Add in "linear" lWorld to separate time reversable worlds
This commit is contained in:
@@ -18,7 +18,7 @@ import ListHelp
|
||||
import SDL
|
||||
|
||||
updateUsingInput :: World -> World
|
||||
updateUsingInput w = case _hudElement $ _hud (_cWorld w) of
|
||||
updateUsingInput w = case w ^. cWorld . lWorld . hud . hudElement of
|
||||
DisplayInventory subinv ->
|
||||
pressedMBEffects subinv (_mouseButtons w) w
|
||||
DisplayCarte ->
|
||||
@@ -35,10 +35,10 @@ pressedMBEffects subinv pkeys w = case subinv of
|
||||
maybeexitcombine (maybe id doCombine mi w) & hammers . ix SubInvHam .~ HammerDown
|
||||
DisplayTerminal tmid
|
||||
| pkeys ^? ix ButtonLeft == Just False && inTermFocus w ->
|
||||
doTerminalEffectLB (w ^?! cWorld . terminals . ix tmid) w
|
||||
doTerminalEffectLB (w ^?! cWorld . lWorld . terminals . ix tmid) w
|
||||
& hammers . ix SubInvHam .~ HammerDown
|
||||
| pkeys ^? ix ButtonLeft == Just False ->
|
||||
w & cWorld . terminals . ix tmid . tmInput . tiFocus %~ const True
|
||||
w & cWorld . lWorld . terminals . ix tmid . tmInput . tiFocus %~ const True
|
||||
& hammers . ix SubInvHam .~ HammerDown
|
||||
_
|
||||
| ButtonLeft `M.member` pkeys ->
|
||||
@@ -47,7 +47,7 @@ pressedMBEffects subinv pkeys w = case subinv of
|
||||
where
|
||||
maybeexitcombine
|
||||
| ButtonRight `M.member` _mouseButtons w = id
|
||||
| otherwise = cWorld . hud . hudElement .~ DisplayInventory NoSubInventory
|
||||
| otherwise = cWorld . lWorld . hud . hudElement .~ DisplayInventory NoSubInventory
|
||||
|
||||
pressedMBEffectsNoInventory :: M.Map MouseButton Bool -> World -> World
|
||||
pressedMBEffectsNoInventory pkeys w
|
||||
@@ -55,17 +55,17 @@ pressedMBEffectsNoInventory pkeys w
|
||||
useItem (you w) w & hammers . ix DoubleMouseHam .~ HammerDown
|
||||
| justPressedDown ButtonLeft && inTopInv
|
||||
&& w ^?! hammers . ix DoubleMouseHam == HammerUp =
|
||||
useLeftItem (_yourID (_cWorld w)) w
|
||||
useLeftItem (w ^. cWorld . lWorld . yourID) w
|
||||
| isDown ButtonLeft && inTopInv =
|
||||
w & hammers . ix DoubleMouseHam .~ HammerDown
|
||||
| isDown ButtonRight && inTopInv = w
|
||||
| isDown ButtonMiddle =
|
||||
w & cWorld . cwCam . cwcRot -~ rotation
|
||||
w & cWorld . lWorld . cwCam . cwcRot -~ rotation
|
||||
& clickMousePos .~ _mousePos w
|
||||
| isDown ButtonLeft = w & hammers . ix DoubleMouseHam .~ HammerDown
|
||||
| otherwise = w
|
||||
where
|
||||
inTopInv = case _hudElement (_hud (_cWorld w)) of
|
||||
inTopInv = case w ^. cWorld . lWorld . hud . hudElement of
|
||||
DisplayInventory NoSubInventory -> True
|
||||
_ -> False
|
||||
justPressedDown but = (pkeys ^. at but) == Just False
|
||||
@@ -83,8 +83,8 @@ doCombine i w = case combineItemListYou w ^? ix i of
|
||||
. createPutItem it
|
||||
$ foldr (rmInvItem yid) w (sort is)
|
||||
where
|
||||
yid = _yourID (_cWorld w)
|
||||
selectinv (Just i', w') = w' & cWorld . creatures . ix yid . crInvSel .~ InvSel i' NoInvSelAction
|
||||
yid = w ^. cWorld . lWorld . yourID
|
||||
selectinv (Just i', w') = w' & cWorld . lWorld . creatures . ix yid . crInvSel .~ InvSel i' NoInvSelAction
|
||||
selectinv (Nothing, w') = w'
|
||||
|
||||
updatePressedButtonsCarte :: M.Map MouseButton Bool -> World -> World
|
||||
@@ -92,15 +92,15 @@ updatePressedButtonsCarte pkeys w
|
||||
| isDown ButtonRight =
|
||||
w
|
||||
& clickMousePos .~ _mousePos w
|
||||
& cWorld . hud . carteCenter %~ (-.- trans)
|
||||
& cWorld . lWorld . hud . carteCenter %~ (-.- trans)
|
||||
| isDown ButtonLeft =
|
||||
w
|
||||
& clickMousePos .~ _mousePos w
|
||||
& cWorld . hud . carteRot -~ rot
|
||||
& cWorld . hud . carteZoom *~ czoom
|
||||
& cWorld . lWorld . hud . carteRot -~ rot
|
||||
& cWorld . lWorld . hud . carteZoom *~ czoom
|
||||
| otherwise = w
|
||||
where
|
||||
isDown but = but `M.member` pkeys
|
||||
rot = angleBetween (_mousePos w) (_clickMousePos w)
|
||||
czoom = magV (_mousePos w) / magV (_clickMousePos w)
|
||||
trans = rotateV (_carteRot (_hud (_cWorld w))) $ 1 / _carteZoom (_hud (_cWorld w)) *.* (_mousePos w -.- _clickMousePos w)
|
||||
trans = rotateV (w ^. cWorld . lWorld . hud . carteRot) $ 1 / (w ^. cWorld . lWorld . hud . carteZoom) *.* (_mousePos w -.- _clickMousePos w)
|
||||
|
||||
Reference in New Issue
Block a user