Make hud non-saveable

This commit is contained in:
2022-12-29 01:10:09 +00:00
parent be41d51819
commit 7fc3b788b4
17 changed files with 57 additions and 59 deletions
+1 -1
View File
@@ -198,7 +198,7 @@ rotateCamera cfig w
-- TODO check where/how this is used
notAtTerminal :: World -> Bool
notAtTerminal w = isNothing $ w ^? cWorld . lWorld . hud . hudElement . subInventory . termID
notAtTerminal w = isNothing $ w ^? hud . hudElement . subInventory . termID
--zoomCamBy :: Float -> World -> World
--zoomCamBy x w = w {_cameraZoom = max (_cameraZoom w + x) 0.01}
+9 -9
View File
@@ -88,27 +88,27 @@ pauseGame :: Universe -> Universe
pauseGame u = u & uvScreenLayers .~ [pauseMenu u]
spaceAction :: World -> World
spaceAction w = case w ^?! cWorld . lWorld . hud . hudElement of
DisplayCarte -> w & cWorld . lWorld . hud . carteCenter .~ theLoc
spaceAction w = case w ^?! hud . hudElement of
DisplayCarte -> w & hud . carteCenter .~ theLoc
DisplayInventory NoSubInventory -> case selectedCloseObject w of
Just (_, Left flit) -> pickUpItem 0 flit w
Just (_, Right but) -> doButtonEvent (_btEvent but) but w
_ -> w
DisplayInventory DisplayTerminal{} -> w & cWorld . lWorld . hud . hudElement . subInventory .~ NoSubInventory
_ -> w & cWorld . lWorld . hud . hudElement . subInventory .~ NoSubInventory
DisplayInventory DisplayTerminal{} -> w & hud . hudElement . subInventory .~ NoSubInventory
_ -> w & hud . hudElement . subInventory .~ NoSubInventory
where
--theLoc = doWorldPos (fst (_seenLocations (_cWorld w) IM.! _selLocation (_cWorld w))) w
theLoc = doWorldPos (w ^?! cWorld . lWorld . seenLocations . ix (w ^. cWorld . lWorld . selLocation) . _1) w
toggleMap :: World -> World
toggleMap w = case w ^?! cWorld . lWorld . hud . hudElement of
DisplayCarte -> w & cWorld . lWorld . hud . hudElement .~ DisplayInventory NoSubInventory
_ -> w & cWorld . lWorld . hud . hudElement .~ DisplayCarte
toggleMap w = case w ^?! hud . hudElement of
DisplayCarte -> w & hud . hudElement .~ DisplayInventory NoSubInventory
_ -> w & hud . hudElement .~ DisplayCarte
toggleTweakInv :: World -> World
toggleTweakInv w = case w ^. cWorld . lWorld . hud . hudElement of
toggleTweakInv w = case w ^. hud . hudElement of
DisplayInventory ExamineInventory{} -> w & thepointer .~ NoSubInventory
_ -> w & thepointer .~ ExamineInventory mi
where
thepointer = cWorld . lWorld . hud . hudElement . subInventory
thepointer = hud . hudElement . subInventory
mi = 0 <$ (yourItem w >>= (^? itTweaks . tweakParams . ix 0))
+3 -3
View File
@@ -19,9 +19,9 @@ import LensHelp
import SDL
updateWheelEvent :: Int -> World -> World
updateWheelEvent yi w = case w ^. cWorld . lWorld . hud . hudElement of
updateWheelEvent yi w = case w ^. hud . hudElement of
DisplayCarte
| rbDown -> w & cWorld . lWorld . 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)
DisplayInventory NoSubInventory
-- functions that modify the inventory should be centralised so that
@@ -54,7 +54,7 @@ moveCombineSel yi w = moveSubSel yi (length $ combineItemListYou w) w
moveSubSel :: Int -> Int -> World -> World
moveSubSel yi maxyi =
cWorld . lWorld . hud . hudElement . subInventory . subInvSel . _Just
hud . hudElement . subInventory . subInvSel . _Just
%~ ((`mod` maxyi) . subtract yi)
guardDisconnectedID :: Int -> World -> World -> World
+7 -7
View File
@@ -18,7 +18,7 @@ import ListHelp
import SDL
updateUsingInput :: World -> World
updateUsingInput w = case w ^. cWorld . lWorld . hud . hudElement of
updateUsingInput w = case w ^. hud . hudElement of
DisplayInventory subinv ->
pressedMBEffects subinv (_mouseButtons (_input w)) w
DisplayCarte ->
@@ -47,7 +47,7 @@ pressedMBEffects subinv pkeys w = case subinv of
where
maybeexitcombine
| ButtonRight `M.member` _mouseButtons (_input w) = id
| otherwise = cWorld . lWorld . hud . hudElement . subInventory .~ NoSubInventory
| otherwise = hud . hudElement . subInventory .~ NoSubInventory
pressedMBEffectsNoInventory :: M.Map MouseButton Bool -> World -> World
pressedMBEffectsNoInventory pkeys w
@@ -65,7 +65,7 @@ pressedMBEffectsNoInventory pkeys w
| isDown ButtonLeft = w & input . hammers . ix DoubleMouseHam .~ HammerDown
| otherwise = w
where
inTopInv = case w ^. cWorld . lWorld . hud . hudElement of
inTopInv = case w ^. hud . hudElement of
DisplayInventory NoSubInventory -> True
_ -> False
justPressedDown but = (pkeys ^. at but) == Just False
@@ -91,15 +91,15 @@ updatePressedButtonsCarte pkeys w
| isDown ButtonRight =
w
& input . clickMousePos .~ _mousePos (_input w)
& cWorld . lWorld . hud . carteCenter %~ (-.- trans)
& hud . carteCenter %~ (-.- trans)
| isDown ButtonLeft =
w
& input . clickMousePos .~ _mousePos (_input w)
& cWorld . lWorld . hud . carteRot -~ rot
& cWorld . lWorld . hud . carteZoom *~ czoom
& hud . carteRot -~ rot
& hud . carteZoom *~ czoom
| otherwise = w
where
isDown but = but `M.member` pkeys
rot = angleBetween (_mousePos (_input w)) (_clickMousePos (_input w))
czoom = magV (_mousePos (_input w)) / magV (_clickMousePos (_input w))
trans = rotateV (w ^. cWorld . lWorld . hud . carteRot) $ 1 / (w ^. cWorld . lWorld . hud . carteZoom) *.* (_mousePos (_input w) -.- _clickMousePos (_input w))
trans = rotateV (w ^. hud . carteRot) $ 1 / (w ^. hud . carteZoom) *.* (_mousePos (_input w) -.- _clickMousePos (_input w))