Cleanup
This commit is contained in:
Binary file not shown.
@@ -1,5 +1,4 @@
|
|||||||
--{-# LANGUAGE TupleSections #-}
|
--{-# LANGUAGE TupleSections #-}
|
||||||
|
|
||||||
module Dodge.Inventory (
|
module Dodge.Inventory (
|
||||||
selSecSelPos,
|
selSecSelPos,
|
||||||
checkInvSlotsYou,
|
checkInvSlotsYou,
|
||||||
@@ -89,9 +88,6 @@ rmInvItem cid invid w = case w ^? getcid . crInv . ix invid . itUse . useAmount
|
|||||||
doanyitemeffect = fromMaybe id $ do
|
doanyitemeffect = fromMaybe id $ do
|
||||||
rmf <- itm ^? itEffect . ieOnDrop
|
rmf <- itm ^? itEffect . ieOnDrop
|
||||||
return $ doInvEffect rmf itm cr
|
return $ doInvEffect rmf itm cr
|
||||||
--removeAnySlotEquipment = case w ^? cWorld . lWorld . creatures . ix cid . crInvEquipped . ix invid of
|
|
||||||
-- Just epos -> pointcid . crEquipment . at epos .~ Nothing
|
|
||||||
-- Nothing -> id
|
|
||||||
removeAnySlotEquipment = fromMaybe id $ do
|
removeAnySlotEquipment = fromMaybe id $ do
|
||||||
epos <- w ^? cWorld . lWorld . creatures . ix cid . crInvEquipped . ix invid
|
epos <- w ^? cWorld . lWorld . creatures . ix cid . crInvEquipped . ix invid
|
||||||
return $ pointcid . crEquipment . at epos .~ Nothing
|
return $ pointcid . crEquipment . at epos .~ Nothing
|
||||||
@@ -114,16 +110,6 @@ rmSelectedInvItem cid w = case w ^? cWorld . lWorld . creatures . ix cid . crMan
|
|||||||
Just i -> rmInvItem cid i w
|
Just i -> rmInvItem cid i w
|
||||||
Nothing -> w
|
Nothing -> w
|
||||||
|
|
||||||
--selNumPos :: ManipulatedObject -> World -> Maybe Int
|
|
||||||
--selNumPos mo w =
|
|
||||||
-- w ^? hud . hudElement . diSections
|
|
||||||
-- >>= case mo of
|
|
||||||
-- InInventory SortInventory -> selSecSelPos (-1) 0
|
|
||||||
-- InInventory (SelItem i _) -> selSecSelPos 0 i
|
|
||||||
-- SelNothing -> selSecSelPos 1 0
|
|
||||||
-- InNearby SortNearby -> selSecSelPos 2 0
|
|
||||||
-- InNearby (SelCloseObject i) -> selSecSelPos 3 i
|
|
||||||
|
|
||||||
-- there are still more ListDisplayParams to integrate here
|
-- there are still more ListDisplayParams to integrate here
|
||||||
selNumTextEndPos :: Configuration -> ListDisplayParams -> SelectionSections a -> Int -> Int -> Maybe Point2
|
selNumTextEndPos :: Configuration -> ListDisplayParams -> SelectionSections a -> Int -> Int -> Maybe Point2
|
||||||
selNumTextEndPos cfig ldp sss i j = do
|
selNumTextEndPos cfig ldp sss i j = do
|
||||||
|
|||||||
+2
-2
@@ -293,8 +293,8 @@ advanceScrollAmount u =
|
|||||||
& uvWorld . input . smoothScrollAmount %~ advanceSmoothScroll
|
& uvWorld . input . smoothScrollAmount %~ advanceSmoothScroll
|
||||||
|
|
||||||
updatePastWorlds :: World -> World
|
updatePastWorlds :: World -> World
|
||||||
--updatePastWorlds w = w & pastWorlds %~ (forceFoldable . take 100 . ((w ^. cWorld . lWorld) :))
|
updatePastWorlds w = w & pastWorlds %~ (forceFoldable . take 100 . ((w ^. cWorld . lWorld) :))
|
||||||
updatePastWorlds w = w & pastWorlds %~ (forceFoldable . take 600 . ((w ^. cWorld . lWorld) :))
|
--updatePastWorlds w = w & pastWorlds %~ (forceFoldable . take 600 . ((w ^. cWorld . lWorld) :))
|
||||||
|
|
||||||
doWorldEvents :: World -> World
|
doWorldEvents :: World -> World
|
||||||
doWorldEvents w =
|
doWorldEvents w =
|
||||||
|
|||||||
+17
-17
@@ -2,7 +2,6 @@ module Dodge.Update.Scroll (
|
|||||||
updateWheelEvent,
|
updateWheelEvent,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Dodge.SelectionSections
|
|
||||||
import qualified Data.Map.Strict as M
|
import qualified Data.Map.Strict as M
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
@@ -10,6 +9,7 @@ import Dodge.Data.Universe
|
|||||||
import Dodge.HeldScroll
|
import Dodge.HeldScroll
|
||||||
import Dodge.InputFocus
|
import Dodge.InputFocus
|
||||||
import Dodge.Inventory
|
import Dodge.Inventory
|
||||||
|
import Dodge.SelectionSections
|
||||||
import Dodge.SoundLogic
|
import Dodge.SoundLogic
|
||||||
import Dodge.Terminal
|
import Dodge.Terminal
|
||||||
import Dodge.Tweak
|
import Dodge.Tweak
|
||||||
@@ -22,7 +22,7 @@ updateWheelEvent yi w = case w ^. hud . hudElement of
|
|||||||
DisplayCarte
|
DisplayCarte
|
||||||
| rbDown -> w & hud . carteZoom %~ min 0.75 . max 0.05 . ((1 + y * 0.1) *)
|
| rbDown -> w & hud . carteZoom %~ min 0.75 . max 0.05 . ((1 + y * 0.1) *)
|
||||||
| otherwise -> w & cWorld . lWorld . selLocation %~ (`mod` numLocs) . (+ yi)
|
| otherwise -> w & cWorld . lWorld . selLocation %~ (`mod` numLocs) . (+ yi)
|
||||||
DisplayInventory {_subInventory = NoSubInventory}
|
DisplayInventory{_subInventory = NoSubInventory}
|
||||||
-- functions that modify the inventory should be centralised so that
|
-- functions that modify the inventory should be centralised so that
|
||||||
-- this lock can be sensibly applied, perhaps
|
-- this lock can be sensibly applied, perhaps
|
||||||
| w ^?! cWorld . lWorld . creatures . ix 0 . crInvLock -> w
|
| w ^?! cWorld . lWorld . creatures . ix 0 . crInvLock -> w
|
||||||
@@ -33,13 +33,13 @@ updateWheelEvent yi w = case w ^. hud . hudElement of
|
|||||||
| lbDown -> w & wCam . camZoom +~ y
|
| lbDown -> w & wCam . camZoom +~ y
|
||||||
| invKeyDown -> changeSwapSel yi w
|
| invKeyDown -> changeSwapSel yi w
|
||||||
| otherwise -> stopSoundFrom (CrReloadSound 0) $ scrollAugInvSel yi w
|
| otherwise -> stopSoundFrom (CrReloadSound 0) $ scrollAugInvSel yi w
|
||||||
DisplayInventory {_subInventory = ExamineInventory mi}
|
DisplayInventory{_subInventory = ExamineInventory mi}
|
||||||
| invKeyDown && rbDown -> w & moveTweakSel yi
|
| invKeyDown && rbDown -> w & moveTweakSel yi
|
||||||
| invKeyDown -> stopSoundFrom (CrReloadSound 0) $ scrollAugInvSel yi w
|
| invKeyDown -> stopSoundFrom (CrReloadSound 0) $ scrollAugInvSel yi w
|
||||||
| rbDown -> w & changeTweakParam mi yi
|
| rbDown -> w & changeTweakParam mi yi
|
||||||
| otherwise -> w & moveTweakSel yi
|
| otherwise -> w & moveTweakSel yi
|
||||||
DisplayInventory {_subInventory = CombineInventory {}} -> w & moveCombineSel yi
|
DisplayInventory{_subInventory = CombineInventory{}} -> w & moveCombineSel yi
|
||||||
DisplayInventory {_subInventory = DisplayTerminal tmid} -> terminalWheelEvent yi tmid w
|
DisplayInventory{_subInventory = DisplayTerminal tmid} -> terminalWheelEvent yi tmid w
|
||||||
_ -> w
|
_ -> w
|
||||||
where
|
where
|
||||||
y = fromIntegral yi
|
y = fromIntegral yi
|
||||||
@@ -49,9 +49,11 @@ updateWheelEvent yi w = case w ^. hud . hudElement of
|
|||||||
invKeyDown = ScancodeCapsLock `M.member` _pressedKeys (_input w)
|
invKeyDown = ScancodeCapsLock `M.member` _pressedKeys (_input w)
|
||||||
|
|
||||||
moveCombineSel :: Int -> World -> World
|
moveCombineSel :: Int -> World -> World
|
||||||
moveCombineSel yi = (hud . hudElement . subInventory . ciSections
|
moveCombineSel yi =
|
||||||
%~ scrollSelectionSections yi)
|
( hud . hudElement . subInventory . ciSections
|
||||||
. (worldEventFlags . at CombineInventoryChange ?~ ())
|
%~ scrollSelectionSections yi
|
||||||
|
)
|
||||||
|
. (worldEventFlags . at CombineInventoryChange ?~ ())
|
||||||
|
|
||||||
moveSubSel :: Int -> Int -> World -> World
|
moveSubSel :: Int -> Int -> World -> World
|
||||||
moveSubSel yi maxyi =
|
moveSubSel yi maxyi =
|
||||||
@@ -65,14 +67,14 @@ guardDisconnectedID tmid w w' = case w ^? cWorld . lWorld . terminals . ix tmid
|
|||||||
|
|
||||||
terminalWheelEvent :: Int -> Int -> World -> World
|
terminalWheelEvent :: Int -> Int -> World -> World
|
||||||
terminalWheelEvent yi tmid w
|
terminalWheelEvent yi tmid w
|
||||||
-- | isJust $ w ^? cWorld . lWorld . terminals . ix tmid . tmPartialCommand . _Just = w
|
|
||||||
| rbDown && inTermFocus w =
|
| rbDown && inTermFocus w =
|
||||||
guardDisconnectedID tmid w $
|
guardDisconnectedID tmid w $
|
||||||
w
|
w
|
||||||
& cWorld . lWorld . terminals . ix tmid %~ updatetermsubsel
|
& cWorld . lWorld . terminals . ix tmid %~ updatetermsubsel
|
||||||
| inTermFocus w = guardDisconnectedID tmid w $
|
| inTermFocus w =
|
||||||
w
|
guardDisconnectedID tmid w $
|
||||||
& cWorld . lWorld . terminals . ix tmid %~ updatetermsel
|
w
|
||||||
|
& cWorld . lWorld . terminals . ix tmid %~ updatetermsel
|
||||||
| otherwise = w
|
| otherwise = w
|
||||||
where
|
where
|
||||||
rbDown = ButtonRight `M.member` _mouseButtons (_input w)
|
rbDown = ButtonRight `M.member` _mouseButtons (_input w)
|
||||||
@@ -119,14 +121,12 @@ changeTweakParam mi i w = fromMaybe w $ do
|
|||||||
)
|
)
|
||||||
|
|
||||||
scrollCommands :: Terminal -> [TerminalCommand]
|
scrollCommands :: Terminal -> [TerminalCommand]
|
||||||
scrollCommands tm = (nullCommand :) $ _tmScrollCommands tm
|
scrollCommands = (nullCommand :) . _tmScrollCommands
|
||||||
-- | null $ _tmPartialCommand tm = (nullCommand :) $ _tmScrollCommands tm
|
|
||||||
-- | otherwise = [nullCommand]
|
|
||||||
|
|
||||||
scrollCommandStrings :: World -> Terminal -> [String]
|
scrollCommandStrings :: World -> Terminal -> [String]
|
||||||
scrollCommandStrings w tm = case tm ^? tmPartialCommand . _Just of
|
scrollCommandStrings w tm = case tm ^? tmPartialCommand . _Just of
|
||||||
Nothing -> map _tcString $ scrollCommands tm
|
Nothing -> map _tcString $ scrollCommands tm
|
||||||
Just tc -> "": map tail (getArguments tc tm w)
|
Just tc -> "" : map tail (getArguments tc tm w)
|
||||||
|
|
||||||
getArguments' :: TerminalCommand -> Terminal -> World -> [String]
|
getArguments' :: TerminalCommand -> Terminal -> World -> [String]
|
||||||
getArguments' tc tm = ("" :) . getArguments tc tm
|
getArguments' tc tm = ("" :) . getArguments tc tm
|
||||||
@@ -143,4 +143,4 @@ nullCommand =
|
|||||||
getArguments :: TerminalCommand -> Terminal -> World -> [String]
|
getArguments :: TerminalCommand -> Terminal -> World -> [String]
|
||||||
getArguments tc tm w = case doTerminalCommandEffect (_tcEffect tc) tm w of
|
getArguments tc tm w = case doTerminalCommandEffect (_tcEffect tc) tm w of
|
||||||
NoArguments{} -> []
|
NoArguments{} -> []
|
||||||
OneArgument _ m -> map (' ':) $ M.keys m
|
OneArgument _ m -> map (' ' :) $ M.keys m
|
||||||
|
|||||||
Reference in New Issue
Block a user