Add in "linear" lWorld to separate time reversable worlds
This commit is contained in:
+25
-66
@@ -1,79 +1,37 @@
|
||||
module Dodge.Update.Scroll where
|
||||
|
||||
import qualified Data.Map.Strict as M
|
||||
import Data.Maybe
|
||||
import qualified Data.Set as S
|
||||
import qualified Data.Text as T
|
||||
import Dodge.Base
|
||||
import Dodge.Combine
|
||||
import Dodge.Data.Universe
|
||||
import Dodge.Event.Keyboard
|
||||
import Dodge.HeldScroll
|
||||
import Dodge.InputFocus
|
||||
import Dodge.Inventory
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.Terminal
|
||||
import Dodge.Tweak
|
||||
import Dodge.Combine
|
||||
import Dodge.Event.Keyboard
|
||||
import Control.Applicative
|
||||
import Data.List
|
||||
import qualified Data.Map.Strict as M
|
||||
import qualified Data.Set as S
|
||||
import Data.Maybe
|
||||
import Dodge.Base
|
||||
import Dodge.Beam
|
||||
import Dodge.InputFocus
|
||||
import Dodge.Bullet
|
||||
import Dodge.HeldScroll
|
||||
import Dodge.CrGroupUpdate
|
||||
import Dodge.Creature.Update
|
||||
import Dodge.CullBox
|
||||
import Dodge.Data.Universe
|
||||
import Dodge.Distortion
|
||||
import Dodge.DrWdWd
|
||||
import Dodge.EnergyBall
|
||||
import Dodge.Flame
|
||||
import Dodge.Flare
|
||||
import Dodge.Hammer
|
||||
import Dodge.Inventory
|
||||
import Dodge.Item.Location
|
||||
import Dodge.Laser.Update
|
||||
import Dodge.LightSource.Update
|
||||
import Dodge.LinearShockwave.Update
|
||||
import Dodge.Machine.Update
|
||||
import Dodge.Magnet.Update
|
||||
import Dodge.Menu
|
||||
import Dodge.ModificationEffect
|
||||
import Dodge.PosEvent
|
||||
import Dodge.PressPlate
|
||||
import Dodge.Projectile.Update
|
||||
import Dodge.Prop.Update
|
||||
import Dodge.RadarBlip
|
||||
import Dodge.RadarSweep
|
||||
import Dodge.Shockwave.Update
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.Spark
|
||||
import Dodge.Tesla.Arc
|
||||
import Dodge.TmTm
|
||||
import Dodge.TractorBeam.Update
|
||||
import Dodge.Update.Camera
|
||||
import Dodge.Update.Cloud
|
||||
import Dodge.Update.WallDamage
|
||||
import Dodge.WallCreatureCollisions
|
||||
import Dodge.WorldEffect
|
||||
import Dodge.Zoning.Cloud
|
||||
import Dodge.Zoning.Creature
|
||||
import Geometry
|
||||
import qualified IntMapHelp as IM
|
||||
import LensHelp
|
||||
--import MaybeHelp
|
||||
import SDL
|
||||
import Sound.Data
|
||||
import StrictHelp
|
||||
import qualified Data.Text as T
|
||||
|
||||
updateWheelEvent :: Int -> World -> World
|
||||
updateWheelEvent yi w = case w ^. cWorld . hud . hudElement of
|
||||
updateWheelEvent yi w = case w ^. cWorld . lWorld . hud . hudElement of
|
||||
DisplayCarte
|
||||
| rbDown -> w & cWorld . hud . carteZoom %~ min 0.75 . max 0.05 . ((1 + y * 0.1) *)
|
||||
| otherwise -> w & cWorld . selLocation %~ (`mod` numLocs) . (+ yi)
|
||||
| rbDown -> w & cWorld . lWorld . 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
|
||||
-- this lock can be sensibly applied, perhaps
|
||||
| _crInvLock (_creatures (_cWorld w) IM.! _yourID (_cWorld w)) -> w
|
||||
| w ^?! cWorld . lWorld . creatures . ix (w ^. cWorld . lWorld . yourID) . crInvLock -> w
|
||||
| rbDown -> case (yourItem w ^? _Just . itUse . heldScroll, _rbOptions w) of
|
||||
(_, EquipOptions{}) -> scrollRBOption y w
|
||||
(Nothing, _) -> closeObjScrollDir y w
|
||||
(Just f, _) -> doHeldScroll f y (you w) w
|
||||
| lbDown -> w & cWorld . cwCam . cwcZoom +~ y
|
||||
| lbDown -> w & cWorld . lWorld . cwCam . cwcZoom +~ y
|
||||
| invKeyDown -> changeSwapInvSel yi w
|
||||
| otherwise -> stopSoundFrom (CrReloadSound 0) $ changeAugInvSel yi w
|
||||
DisplayInventory (TweakInventory mi)
|
||||
@@ -83,15 +41,15 @@ updateWheelEvent yi w = case w ^. cWorld . hud . hudElement of
|
||||
| otherwise -> w & moveTweakSel yi
|
||||
DisplayInventory CombineInventory{} ->
|
||||
w
|
||||
& cWorld . hud . hudElement . subInventory . combineInvSel . _Just %~ ((`mod` numcombs) . subtract yi)
|
||||
& cWorld . lWorld . hud . hudElement . subInventory . combineInvSel . _Just %~ ((`mod` numcombs) . subtract yi)
|
||||
DisplayInventory (DisplayTerminal tmid)
|
||||
| rbDown && inTermFocus w ->
|
||||
guardDisconnectedID tmid w $
|
||||
w
|
||||
& cWorld . terminals . ix tmid %~ updatetermsubsel
|
||||
& cWorld . lWorld . terminals . ix tmid %~ updatetermsubsel
|
||||
| inTermFocus w ->
|
||||
w
|
||||
& cWorld . terminals . ix tmid %~ updatetermsel
|
||||
& cWorld . lWorld . terminals . ix tmid %~ updatetermsel
|
||||
_ -> w
|
||||
where
|
||||
updatetermsel tm = case tm ^? tmInput . tiSel of
|
||||
@@ -113,7 +71,7 @@ updateWheelEvent yi w = case w ^. cWorld . hud . hudElement of
|
||||
arg = getArguments' tc tm w' !! j
|
||||
numcombs = length $ combineItemListYou w
|
||||
y = fromIntegral yi
|
||||
numLocs = (fst . IM.findMax $ _seenLocations (_cWorld w)) + 1
|
||||
numLocs = (fst . IM.findMax $ (w ^. cWorld . lWorld . seenLocations)) + 1
|
||||
rbDown = ButtonRight `M.member` _mouseButtons w
|
||||
lbDown = ButtonLeft `M.member` _mouseButtons w
|
||||
invKeyDown = ScancodeCapsLock `S.member` _keys w
|
||||
@@ -126,7 +84,7 @@ scrollRBOption y w
|
||||
|
||||
moveTweakSel :: Int -> World -> World
|
||||
moveTweakSel i w = case yourItem w ^? _Just . itTweaks . tweakParams of
|
||||
Just l -> w & cWorld . hud . hudElement . subInventory . tweakInvSel . _Just %~ (`mod` length l) . subtract i
|
||||
Just l -> w & cWorld . lWorld . hud . hudElement . subInventory . tweakInvSel . _Just %~ (`mod` length l) . subtract i
|
||||
_ -> w
|
||||
|
||||
changeTweakParam :: Maybe Int -> Int -> World -> World
|
||||
@@ -135,10 +93,11 @@ changeTweakParam mi i w = fromMaybe w $ do
|
||||
params <- yourItem w ^? _Just . itTweaks . tweakParams . ix paramid
|
||||
let x = (_tweakVal params + i) `mod` _tweakMax params
|
||||
return $
|
||||
w & cWorld . creatures . ix (_yourID (_cWorld w)) . crInv . ix (crSel (you w))
|
||||
w & cWorld . lWorld . creatures . ix (w ^. cWorld . lWorld . yourID) . crInv . ix (crSel (you w))
|
||||
%~ ( (itTweaks . tweakParams . ix paramid . tweakVal .~ x)
|
||||
. doTweak (_tweakType params) x
|
||||
)
|
||||
|
||||
scrollCommands :: Terminal -> [TerminalCommand]
|
||||
scrollCommands = (nullCommand :) . _tmScrollCommands
|
||||
|
||||
|
||||
Reference in New Issue
Block a user