diff --git a/ghcidOutput b/ghcidOutput index 438d89661..487d10c83 100644 --- a/ghcidOutput +++ b/ghcidOutput @@ -1 +1 @@ -All good (620 modules, at 16:31:55) +All good (620 modules, at 10:38:24) diff --git a/src/Dodge/Camera.hs b/src/Dodge/Camera.hs index 631a83419..7bd37ba92 100644 --- a/src/Dodge/Camera.hs +++ b/src/Dodge/Camera.hs @@ -4,7 +4,7 @@ import Dodge.Data.Universe import Control.Lens useNormalCamera :: Universe -> Universe -useNormalCamera = (uvWorld . wCam . camControl .~ CamInGame) +useNormalCamera = (uvWorld . wCam . camControl .~ CamInGame{_cigType = CamOnPlayer}) . (uvWorld . timeFlow .~ NormalTimeFlow) pauseAndFloatCam :: Universe -> Universe diff --git a/src/Dodge/Combine.hs b/src/Dodge/Combine.hs index e34702f7d..3adeae205 100644 --- a/src/Dodge/Combine.hs +++ b/src/Dodge/Combine.hs @@ -25,7 +25,7 @@ import SimpleTrie invertInventoryToMap :: IM.IntMap Item -> M.Map ItemBaseType [Int] invertInventoryToMap = IM.foldrWithKey - (\k it -> (M.insertWith (++) (_iyBase $ _itType it) [k])) + (\k it -> M.insertWith (++) (_iyBase $ _itType it) [k]) mempty groupSplitItemAmounts :: M.Map ItemBaseType [Int] -> [((ItAmount, ItemBaseType), [Int])] @@ -39,7 +39,7 @@ flatLookupItems = . invertInventoryToMap combineItemListYouX :: World -> [([Int], Item)] -combineItemListYouX = map (first $ concat) . flatLookupItems . yourInv +combineItemListYouX = map (first concat) . flatLookupItems . yourInv combineList :: World -> [SelectionItem CombinableItem] combineList = map f . combineListInfo diff --git a/src/Dodge/Combine/Module.hs b/src/Dodge/Combine/Module.hs index f8cd38b4b..ac9588430 100644 --- a/src/Dodge/Combine/Module.hs +++ b/src/Dodge/Combine/Module.hs @@ -34,7 +34,7 @@ moduleModification imt = case imt of --LAUNCHHOME -> itUse . heldConsumption . laAmmoType . amPjCreation .~ CreateTrackingShell LAUNCHHOME -> id ATTACHTORCH -> id - where +-- where -- makeDirectedTele it = -- it -- & itUse . heldMods %~ ModWithDirectedTeleport -- .:~ withPosDirWallCheck directedTelPos diff --git a/src/Dodge/Creature.hs b/src/Dodge/Creature.hs index 94bf61238..8d63d0552 100644 --- a/src/Dodge/Creature.hs +++ b/src/Dodge/Creature.hs @@ -299,7 +299,6 @@ stackedInventory = , miniGunX 3 , beltMag , boosterGun - , remoteLauncher , flatShield , spawnGun (lamp 5) , lasGun diff --git a/src/Dodge/Creature/SentinelAI.hs b/src/Dodge/Creature/SentinelAI.hs index 1cacd647a..8e8153a77 100644 --- a/src/Dodge/Creature/SentinelAI.hs +++ b/src/Dodge/Creature/SentinelAI.hs @@ -18,7 +18,8 @@ import Dodge.Data.World import Geometry.Data sentinelAI :: World -> Creature -> Creature -sentinelAI w = +--sentinelAI w = +sentinelAI = sentinelExtraWatchUpdate [ ( crHasTargetLOS @@ -37,7 +38,7 @@ sentinelAI w = ] ) ] - w +-- w where advanceShoot = DoImpulses [UseItem, MoveForward 3] tcid cr = _crID <$> _targetCr (_crIntention cr) diff --git a/src/Dodge/Creature/State.hs b/src/Dodge/Creature/State.hs index 05b0bc827..400cc09ac 100644 --- a/src/Dodge/Creature/State.hs +++ b/src/Dodge/Creature/State.hs @@ -247,11 +247,11 @@ invSideEff cr w = w' & maybe id (\g -> doInvEffect g it cr) (it ^? itEffect . ieInv) itemInvSideEffect :: Creature -> Item -> World -> World -itemInvSideEffect _ _ +itemInvSideEffect _ _ = id --itemInvSideEffect cr it -- | hastorchattach = createAttachLight cr it - | otherwise = id - where +-- | otherwise = id +-- where -- hastorchattach = it ^? itType . iyModules . ix ModHeldAttach == Just ATTACHTORCH && _itIsRoot it --createAttachLight :: Creature -> Item -> World -> World diff --git a/src/Dodge/Data/Camera.hs b/src/Dodge/Data/Camera.hs index c38cbd680..8daf1fc51 100644 --- a/src/Dodge/Data/Camera.hs +++ b/src/Dodge/Data/Camera.hs @@ -9,11 +9,17 @@ import Data.Aeson import Data.Aeson.TH import Geometry.Data -data CamControl - = CamInGame - | CamFloat +data CamInGameType + = CamOnPlayer + | CamOpticScope + | CamRemoteScope deriving (Eq,Show,Read,Enum,Bounded) +data CamControl + = CamInGame { _cigType :: CamInGameType} + | CamFloat + deriving (Eq,Show,Read) + data Camera = Camera { _camCenter :: Point2 , _camRot :: Float @@ -28,8 +34,10 @@ data Camera = Camera } makeLenses ''Camera +makeLenses ''CamInGameType concat <$> mapM (deriveJSON defaultOptions) - [''CamControl + [''CamInGameType + ,''CamControl ,''Camera ] diff --git a/src/Dodge/Data/Item/Combine.hs b/src/Dodge/Data/Item/Combine.hs index 03f51f79c..baf38aa10 100644 --- a/src/Dodge/Data/Item/Combine.hs +++ b/src/Dodge/Data/Item/Combine.hs @@ -191,7 +191,7 @@ data HeldItemType | TRACTORGUN | LAUNCHER | LAUNCHERX {_xNum :: Int} - | REMOTELAUNCHER +-- | REMOTELAUNCHER | POISONSPRAYER | DRONELAUNCHER | SHATTERGUN diff --git a/src/Dodge/Data/Item/HeldUse.hs b/src/Dodge/Data/Item/HeldUse.hs index 8783b504a..fd2f598b0 100644 --- a/src/Dodge/Data/Item/HeldUse.hs +++ b/src/Dodge/Data/Item/HeldUse.hs @@ -14,11 +14,11 @@ import Control.Lens data Huse = HeldDoNothing - | HeldFireRemoteShell +-- | HeldFireRemoteShell | HeldExplodeRemoteShell Int Int | HeldDetectorEffect Detector | HeldForceField - | HeldShatter +-- | HeldShatter deriving (Eq, Ord, Show, Read) --Generic, Flat) data Cuse @@ -58,7 +58,7 @@ data Luse data HeldMod = PistolMod - | FireRemoteShellMod +-- | FireRemoteShellMod | ExplodeRemoteShellMod | DoNothingMod deriving (Eq, Ord, Show, Read) --Generic, Flat) diff --git a/src/Dodge/Data/Item/Use.hs b/src/Dodge/Data/Item/Use.hs index c7b8ed3ef..fa61c6bc4 100644 --- a/src/Dodge/Data/Item/Use.hs +++ b/src/Dodge/Data/Item/Use.hs @@ -112,7 +112,7 @@ data AmmoParams | ProjectileParams { _ampPayload :: Payload , _ampPjDraw :: ProjectileDraw - , _ampPjCreation :: ProjectileCreate +-- , _ampPjCreation :: ProjectileCreate } | GasParams {_ampCreateGas :: GasFuel} deriving (Eq, Show, Read) --Generic, Flat) diff --git a/src/Dodge/Data/Item/Use/Consumption/Ammo.hs b/src/Dodge/Data/Item/Use/Consumption/Ammo.hs index 475ce39e7..ad31f2703 100644 --- a/src/Dodge/Data/Item/Use/Consumption/Ammo.hs +++ b/src/Dodge/Data/Item/Use/Consumption/Ammo.hs @@ -24,14 +24,16 @@ data ProjectileCreate = CreateShell | CreateTrackingShell data ProjectileUpdate = PJThrust {_pjuStart :: Int, _pjuEnd :: Int} | PJSpin {_pjuTime :: Int, _pjuCID :: Int, _pjuSpinAmound :: Int} - | PJTrack {_pjuStart :: Int, _pjuEnd :: Int, _pjuCRID :: Int} +-- | PJTrack {_pjuStart :: Int, _pjuEnd :: Int, _pjuScreenID :: Int} + | PJRemoteSetDirection {_pjuStart :: Int, _pjuEnd :: Int, _pjuScreenID :: Int} | PJReduceSpin {_pjuReduceSpin :: Float} - | PJRemoteDirection {_pjuStart :: Int, _pjuEnd :: Int, _pjuCID :: Int, _pjuITID :: Int} - | PJSetScope {_pjuITID :: Int} - | PJRetireRemote {_pjuITID :: Int, _pjuTimer :: Int, _pjuPJID :: Int} +-- | PJRemoteDirection {_pjuStart :: Int, _pjuEnd :: Int, _pjuCID :: Int, _pjuITID :: Int} +-- | PJSetScope {_pjuITID :: Int} + | PJRetireRemote {_pjuItID :: Int, _pjuTimer :: Int, _pjuPJID :: Int} | PJDecTimMvVel | PJShellCollisionCheck - | PJRemoteShellCollisionCheck + | PJRemoteShellCollisionCheck {_pjuScreenID :: Int} +-- | PJRemoteShellExplosion deriving (Show, Eq, Ord, Read) --Generic, Flat) data AmmoType diff --git a/src/Dodge/Data/Projectile.hs b/src/Dodge/Data/Projectile.hs index 97e287261..311f2bae9 100644 --- a/src/Dodge/Data/Projectile.hs +++ b/src/Dodge/Data/Projectile.hs @@ -25,7 +25,7 @@ data Proj , _prjTimer :: Int , _prjZ :: Float , _prjUpdates :: [ProjectileUpdate] - , _prjMITID :: Maybe Int +-- , _prjMITID :: Maybe Int } deriving (Eq, Ord, Show, Read) --Generic, Flat) diff --git a/src/Dodge/Default/Shell.hs b/src/Dodge/Default/Shell.hs index b5a7f5330..ca6b40b10 100644 --- a/src/Dodge/Default/Shell.hs +++ b/src/Dodge/Default/Shell.hs @@ -19,5 +19,5 @@ defaultShell = , _prjTimer = 0 , _prjPayload = ExplosionPayload , _prjUpdates = [] - , _prjMITID = Nothing +-- , _prjMITID = Nothing } diff --git a/src/Dodge/Default/World.hs b/src/Dodge/Default/World.hs index c5f4a5bab..8b154342f 100644 --- a/src/Dodge/Default/World.hs +++ b/src/Dodge/Default/World.hs @@ -74,7 +74,7 @@ defaultCWCam = , _camItemZoom = 1 , _camBoundBox = square 100 , _camBoundDist = (100, -100, 100, -100) - , _camControl = CamInGame + , _camControl = CamInGame {_cigType = CamOnPlayer} } defaultCWorld :: CWorld diff --git a/src/Dodge/DoubleTree.hs b/src/Dodge/DoubleTree.hs index f7cf8a05f..37429f6ed 100644 --- a/src/Dodge/DoubleTree.hs +++ b/src/Dodge/DoubleTree.hs @@ -120,7 +120,7 @@ headMap _ _ [] = [] lastMap :: (a -> b) -> (a -> b) -> [a] -> [b] lastMap _ _ [] = [] -lastMap f _ (x:[]) = [f x] +lastMap f _ [x] = [f x] lastMap f g (x:xs) = g x : lastMap f g xs prettyDT :: (a -> String) -> DoubleTree a -> [String] diff --git a/src/Dodge/HeldUse.hs b/src/Dodge/HeldUse.hs index 4d196de72..4b87fcf6e 100644 --- a/src/Dodge/HeldUse.hs +++ b/src/Dodge/HeldUse.hs @@ -44,10 +44,9 @@ import Sound.Data heldEffect :: HeldMod -> LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World heldEffect effecttype = case effecttype of PistolMod -> bulGunEffect - FireRemoteShellMod -> undefined +-- FireRemoteShellMod -> undefined ExplodeRemoteShellMod -> undefined DoNothingMod -> const $ const id - where bulGunEffect :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World bulGunEffect = hammerCheck $ useTimeCheck bulGunEffect' @@ -131,7 +130,8 @@ applyTorqueCME itm cr w -- (Muzzle,Int,Int) = (muzzle, amountloaded, id of mag taken from) loadMuzzle :: LabelDoubleTree ComposeLinkType Item - -> Muzzle -> (LabelDoubleTree ComposeLinkType Item,Maybe (Muzzle, Int,LabelDoubleTree ComposeLinkType Item)) + -> Muzzle + -> (LabelDoubleTree ComposeLinkType Item,Maybe (Muzzle, Int,LabelDoubleTree ComposeLinkType Item)) loadMuzzle t@(LDT _ l _) mz = fromMaybe (t,Nothing) $ do let as = _mzAmmoSlot mz amamount = 1 @@ -313,7 +313,7 @@ useHeld hu = case hu of -- HeldOverNozzlesUseGasParams -> overNozzles useGasParams -- HeldPJCreation -> usePjCreation -- HeldPJCreationX _ -> usePjCreationX - HeldFireRemoteShell -> fireRemoteShell +-- HeldFireRemoteShell -> fireRemoteShell HeldDetectorEffect dt -> detectorEffect dt . _ldtValue -- HeldTeslaArc -> shootTeslaArc . _ldtValue -- HeldLaser -> shootLaser . _ldtValue @@ -322,7 +322,7 @@ useHeld hu = case hu of -- HeldTractor -> aTractorBeam . _ldtValue -- HeldSonicWave -> aSonicWave HeldForceField -> useForceFieldGun . _ldtValue - HeldShatter -> shootShatter . _ldtValue +-- HeldShatter -> shootShatter . _ldtValue HeldExplodeRemoteShell itid pjid -> const $ const $ explodeRemoteRocket itid pjid --usePjCreation :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World @@ -402,18 +402,18 @@ useGasParams mmagid mz itm cr w = pos = _crPos cr + rotateV (_crDir cr) (_mzPos mz + aimingWeaponZeroPos cr itm) (a,g') = randomR (-inacc,inacc) g inacc = _mzInaccuracy mz - dir = _crDir cr + _mzRot mz + a + (_nzCurrentWalkAngle $ _mzEffect mz) + dir = _crDir cr + _mzRot mz + a + _nzCurrentWalkAngle (_mzEffect mz) gasCreate :: GasFuel -> GasCreate -> GasCreate -gasCreate = flip const +gasCreate = const id doGenFloat :: RandomGen g => GenFloat -> g -> (Float, g) doGenFloat (ConstFloat x) g = (x,g) doGenFloat (UniRandFloat x y) g = randomR (x,y) g -fireRemoteShell :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World -fireRemoteShell = undefined +--fireRemoteShell :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World +--fireRemoteShell = undefined --fireRemoteShell :: [Item] -> Item -> Creature -> World -> World --fireRemoteShell ams it cr w = -- set @@ -497,24 +497,28 @@ useForceFieldGun itm cr w = fromMaybe w $ do where i = fromMaybe (IM.newKey (_walls (_lWorld (_cWorld w)))) $ itm ^? itParams . paramMID . _Just -createProjectile :: LabelDoubleTree ComposeLinkType Item -> Muzzle -> Item -> Creature -> World -> World -createProjectile mmagtree muz itm cr = fromMaybe failsound $ do - magid <- mmagtree ^? ldtValue . itLocation . ilInvID +createProjectile + :: LabelDoubleTree ComposeLinkType Item + -> Muzzle -> Item -> Creature -> World -> World +createProjectile magtree muz itm cr = fromMaybe failsound $ do + magid <- magtree ^? ldtValue . itLocation . ilInvID ammoitem <- cr ^? crInv . ix magid --- let mremotescreen = magtree ^. + let mscreen = lookup RemoteScreenLink (magtree ^. ldtLeft) -- matype <- ammoitem ^? itUse . amagType -- guard $ matype == ProjectileAmmo j <- ammoitem ^? itLocation . ilInvID - pt <- ammoitem ^? itUse . amagParams . ampPjCreation - return $ case pt of - CreateShell -> fireShell ammoitem muz itm cr . extrafuncs j - CreateTrackingShell -> fireTrackingShell ammoitem muz itm cr . extrafuncs j +-- pt <- ammoitem ^? itUse . amagParams . ampPjCreation + return $ case mscreen of + Nothing -> fireShell ammoitem muz itm cr . extrafuncs j + Just stree -> fireTrackingShell + (stree ^. ldtValue . itID) + (stree ^?! ldtValue . itLocation . ilInvID) ammoitem muz itm cr + . extrafuncs j where --extrafuncs j = cancelanyreloading . startthesound . useammo j extrafuncs j = startthesound . useammo j useammo j = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix j . itUse . amagLoadStatus . iaLoaded -~ 1 - --cancelanyreloading = cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading -- the sound should be moved to the projectile firing startthesound = soundMultiFrom [CrWeaponSound (_crID cr) j | j <- [0..3]] (_crPos cr) tap4S Nothing failsound w' = case w' ^? input . mouseButtons . ix SDL.ButtonLeft of diff --git a/src/Dodge/Inventory.hs b/src/Dodge/Inventory.hs index 27a8e1c7e..24b7a3bfd 100644 --- a/src/Dodge/Inventory.hs +++ b/src/Dodge/Inventory.hs @@ -222,8 +222,8 @@ updateCloseObjects w = changeSwapSel :: Int -> World -> World changeSwapSel yi w | yi == 0 = w - | yi > 0 = (foldr ($) w $ replicate yi (changeSwapWith $ f IM.cycleLT)) - | otherwise = (foldr ($) w $ replicate (negate yi) (changeSwapWith $ f IM.cycleGT)) + | yi > 0 = foldr ($) w $ replicate yi (changeSwapWith $ f IM.cycleLT) + | otherwise = foldr ($) w $ replicate (negate yi) (changeSwapWith $ f IM.cycleGT) where f g i m = fst <$> g i m diff --git a/src/Dodge/Item/Ammo.hs b/src/Dodge/Item/Ammo.hs index 873c160e3..00636dc5c 100644 --- a/src/Dodge/Item/Ammo.hs +++ b/src/Dodge/Item/Ammo.hs @@ -59,7 +59,6 @@ shellMag = { _amagParams = ProjectileParams { _ampPayload = ExplosionPayload , _ampPjDraw = DrawShell - , _ampPjCreation = CreateShell } , _amagLoadStatus = ReloadStatus diff --git a/src/Dodge/Item/Display.hs b/src/Dodge/Item/Display.hs index dda7bd664..bfe9fe5ff 100644 --- a/src/Dodge/Item/Display.hs +++ b/src/Dodge/Item/Display.hs @@ -145,7 +145,7 @@ showEquipmentNumber _ itm = case _eeUse ee of -- <|> Just [x] showLoadedAmount :: Item -> String -showLoadedAmount itm = fromMaybe [] $ fmap show $ itm ^? itUse . amagLoadStatus . iaLoaded +showLoadedAmount itm = maybe [] show $ itm ^? itUse . amagLoadStatus . iaLoaded --showReloadProgress :: Creature -> Item -> String --showReloadProgress _ itm = fromMaybe [] $ do diff --git a/src/Dodge/Item/Draw/SPic.hs b/src/Dodge/Item/Draw/SPic.hs index a5ef3fea6..bf9baa936 100644 --- a/src/Dodge/Item/Draw/SPic.hs +++ b/src/Dodge/Item/Draw/SPic.hs @@ -168,15 +168,15 @@ heldItemSPic ht it = case ht of GRAPECANNON _ -> noPic $ bangConeShape 20 MINIGUNX i -> miniGunXPictItem i it VOLLEYGUN i -> noPic $ volleyGunShape i -- <> addBullets it - RIFLE -> noPic $ baseRifleShape -- <> addBullets it + RIFLE -> noPic baseRifleShape -- <> addBullets it -- REPEATER -> noPic $ baseRifleShape <> addTinClip it AUTORIFLE -> noPic $ baseRifleShape <> addTinClip it BURSTRIFLE -> noPic $ baseRifleShape <> addTinClip it - BANGROD -> noPic $ baseRodShape -- <> addBullets it - ELEPHANTGUN -> noPic $ baseAMRShape -- <> addBullets it + BANGROD -> noPic baseRodShape -- <> addBullets it + ELEPHANTGUN -> noPic baseAMRShape -- <> addBullets it AMR -> noPic $ baseAMRShape <> addTinClip it AUTOAMR -> noPic $ baseAMRShape <> addTinClip it - SNIPERRIFLE -> noPic $ baseAMRShape -- <> addBullets it + SNIPERRIFLE -> noPic baseAMRShape -- <> addBullets it -- MACHINEGUN -> noPic $ baseAMRShape <> addTinClip it FLAMESPITTER -> flamerPic it FLAMETHROWER -> flamerPic it @@ -193,7 +193,7 @@ heldItemSPic ht it = case ht of TRACTORGUN -> tractorGunPic it LAUNCHER -> launcherPic it LAUNCHERX _ -> launcherPic it - REMOTELAUNCHER -> launcherPic it +-- REMOTELAUNCHER -> launcherPic it POISONSPRAYER -> flamerPic it DRONELAUNCHER -> defSPic SHATTERGUN -> shatterGunSPic diff --git a/src/Dodge/Item/Grammar.hs b/src/Dodge/Item/Grammar.hs index fc4fcf426..d593f6502 100644 --- a/src/Dodge/Item/Grammar.hs +++ b/src/Dodge/Item/Grammar.hs @@ -41,14 +41,20 @@ basePartiallyComposedItem itm = case itm ^. itType . iyBase of ATTACH TARGETATTACH{} -> (itm,WeaponTargetingSF, LinkTest (const Nothing) (const Nothing)) ATTACH ZOOMSCOPE -> (itm,WeaponScopeSF, LinkTest (const Nothing) (const Nothing)) ATTACH ROCKETHOMER -> (itm,AmmoModifierSF ProjectileAmmo, LinkTest (const Nothing) (const Nothing)) - ATTACH REMOTESCREEN -> (itm,AmmoModifierSF ProjectileAmmo, LinkTest (const Nothing) (const Nothing)) + ATTACH REMOTESCREEN -> (itm,RemoteScreenSF, LinkTest (const Nothing) (const Nothing)) _ -> (itm,UncomposableIsolateSF, LinkTest (const Nothing) (const Nothing)) - --AMMOMAG _ -> ammoComposedItem' itm ammoComposedItem :: Item -> PartiallyComposedItem ammoComposedItem itm = fromMaybe (error "in ammoComposedItem, wrong item") $ do atype <- itm ^? itUse . amagType - return (itm, AmmoMagSF atype, useBreakListsLinkTest [(AmmoModifierSF atype, AmmoModLink)] []) + return (itm + , AmmoMagSF atype + , useBreakListsLinkTest + [(AmmoModifierSF atype, AmmoModLink) + ,(RemoteScreenSF, RemoteScreenLink) + ] + [] + ) type LDTComb a b = LabelDoubleTree b a -> LabelDoubleTree b a -> Maybe (LabelDoubleTree b a) @@ -84,10 +90,10 @@ joinItemsInList :: (a -> a -> Maybe a) -> [a] -> [a] joinItemsInList f xs = snd $ h (xs, []) where h ([], zs) = ([], zs) - h ((y : ys), []) = h (ys, [y]) - h ((y : ys), (z : zs)) = case f y z of - Nothing -> h (ys, (y : z : zs)) - Just w -> h ((w : ys), zs) + h (y : ys, []) = h (ys, [y]) + h (y : ys, z : zs) = case f y z of + Nothing -> h (ys, y : z : zs) + Just w -> h (w : ys, zs) invLDT :: IM.IntMap Item -> [LabelDoubleTree ComposeLinkType PartiallyComposedItem] invLDT = @@ -135,7 +141,7 @@ invIndentIM = IM.fromAscList . zip [0 ..] . reverse . map (over _1 (^. _1)) . concatMap ldtToIndentList . invLDT invTrees :: IM.IntMap Item -> IM.IntMap (LabelDoubleTree ComposeLinkType Item) -invTrees = IM.unions . map (ldtToIM getindex) . map (fmap (^. _1)) . invLDT +invTrees = IM.unions . map (ldtToIM getindex . fmap (^. _1)) . invLDT where getindex :: Item -> Int getindex i = diff --git a/src/Dodge/Item/Held.hs b/src/Dodge/Item/Held.hs index f6ab7e89c..bb6d4334c 100644 --- a/src/Dodge/Item/Held.hs +++ b/src/Dodge/Item/Held.hs @@ -61,7 +61,7 @@ itemFromHeldType ht = case ht of TRACTORGUN -> tractorGun LAUNCHER -> launcher LAUNCHERX i -> launcherX i - REMOTELAUNCHER -> remoteLauncher +-- REMOTELAUNCHER -> remoteLauncher POISONSPRAYER -> poisonSprayer DRONELAUNCHER -> undefined FORCEFIELDGUN -> forceFieldGun diff --git a/src/Dodge/Item/Held/Launcher.hs b/src/Dodge/Item/Held/Launcher.hs index a801500cb..3d2a0e8be 100644 --- a/src/Dodge/Item/Held/Launcher.hs +++ b/src/Dodge/Item/Held/Launcher.hs @@ -62,14 +62,14 @@ launcherX i = angles = take i [0,2*pi/ fromIntegral i ..] --angles = take i [1,2 ..] -remoteLauncher :: Item -remoteLauncher = - launcher - & itType . iyBase .~ HELD REMOTELAUNCHER --- & itUse . heldUse .~ HeldFireRemoteShell --fireRemoteShell - & itUse . heldMods .~ FireRemoteShellMod - & itScope .~ RemoteScope (V2 0 0) 1 --- & itUse . heldConsumption . laAmmoType . amPjDraw .~ DrawRemoteShell +--remoteLauncher :: Item +--remoteLauncher = +-- launcher +-- & itType . iyBase .~ HELD REMOTELAUNCHER +---- & itUse . heldUse .~ HeldFireRemoteShell --fireRemoteShell +---- & itUse . heldMods .~ FireRemoteShellMod +-- & itScope .~ RemoteScope (V2 0 0) 1 +---- & itUse . heldConsumption . laAmmoType . amPjDraw .~ DrawRemoteShell basicAmPjMoves :: IM.IntMap TweakParam basicAmPjMoves = diff --git a/src/Dodge/Item/Info.hs b/src/Dodge/Item/Info.hs index f0db0a770..0af21b879 100644 --- a/src/Dodge/Item/Info.hs +++ b/src/Dodge/Item/Info.hs @@ -96,7 +96,7 @@ heldInfo hit = case hit of TRACTORGUN -> "An item that produces a beam of gravitons." LAUNCHER -> "A large tube that can launch self propelled projectiles. Moving the tube after launch will cause the projectile to spin." LAUNCHERX i -> over _head toUpper (showInt i) ++ " tubes that can launch self propelled projectiles. Tubes that do not face forward launch their projecitles at an angle." - REMOTELAUNCHER -> "A large tube that can launch self propelled projectiles. Contains a transmitter allowing for remote control of launched projectiles." +-- REMOTELAUNCHER -> "A large tube that can launch self propelled projectiles. Contains a transmitter allowing for remote control of launched projectiles." POISONSPRAYER -> "A weapon that releases noxious gases." DRONELAUNCHER -> "A device for launching drones." SHATTERGUN -> "A seismic device that shatters hard items in its line of fire." diff --git a/src/Dodge/Item/Module.hs b/src/Dodge/Item/Module.hs index 04b543960..0db544866 100644 --- a/src/Dodge/Item/Module.hs +++ b/src/Dodge/Item/Module.hs @@ -60,7 +60,7 @@ heldBounds hit = case hit of TRACTORGUN -> ls LAUNCHER -> launchs LAUNCHERX _ -> launchs - REMOTELAUNCHER -> launchs +-- REMOTELAUNCHER -> launchs POISONSPRAYER -> fs DRONELAUNCHER -> fs SHATTERGUN -> launchs diff --git a/src/Dodge/Item/Weapon.hs b/src/Dodge/Item/Weapon.hs index eac69594d..b92029457 100644 --- a/src/Dodge/Item/Weapon.hs +++ b/src/Dodge/Item/Weapon.hs @@ -2,7 +2,7 @@ module Dodge.Item.Weapon ( module Dodge.Item.Weapon.TriggerType, module Dodge.Item.Weapon.ExtraEffect, - module Dodge.Item.Weapon.Remote, +-- module Dodge.Item.Weapon.Remote, module Dodge.Item.Weapon.Grenade, module Dodge.Item.Weapon.Spawn, module Dodge.Item.Weapon.Radar, @@ -18,7 +18,7 @@ import Dodge.Item.Weapon.ExtraEffect import Dodge.Item.Weapon.Grenade import Dodge.Item.Weapon.Launcher import Dodge.Item.Weapon.Radar -import Dodge.Item.Weapon.Remote +--import Dodge.Item.Weapon.Remote import Dodge.Item.Weapon.Spawn import Dodge.Item.Weapon.TriggerType import Dodge.Item.Weapon.Utility diff --git a/src/Dodge/Item/Weapon/Launcher.hs b/src/Dodge/Item/Weapon/Launcher.hs index 9be682cd3..912e15453 100644 --- a/src/Dodge/Item/Weapon/Launcher.hs +++ b/src/Dodge/Item/Weapon/Launcher.hs @@ -4,7 +4,7 @@ module Dodge.Item.Weapon.Launcher ( import Control.Lens import Dodge.Data.World -import Dodge.Item.Location +--import Dodge.Item.Location import Dodge.Payload explodeRemoteRocket :: @@ -19,8 +19,8 @@ explodeRemoteRocket itid pjid w = & cWorld . lWorld . projectiles . ix pjid . prjUpdates .~ [PJRetireRemote itid 30 pjid] & cWorld . lWorld . projectiles . ix pjid . prjDraw .~ DrawBlankProjectile -- & itPoint . itUse . heldUse .~ HeldDoNothing - & itPoint . itUse . heldMods .~ DoNothingMod +-- & itPoint . itUse . heldMods .~ DoNothingMod & usePayload (_prjPayload thepj) (_prjPos thepj) where - itPoint = pointerToItemLocation $ w ^?! cWorld . lWorld . itemLocations . ix itid-- _itemLocations (_cWorld w) IM.! itid +-- itPoint = pointerToItemLocation $ w ^?! cWorld . lWorld . itemLocations . ix itid-- _itemLocations (_cWorld w) IM.! itid thepj = w ^?! cWorld . lWorld . projectiles . ix pjid diff --git a/src/Dodge/Item/Weapon/Remote.hs b/src/Dodge/Item/Weapon/Remote.hs index 4b5a72b2d..626d83bfa 100644 --- a/src/Dodge/Item/Weapon/Remote.hs +++ b/src/Dodge/Item/Weapon/Remote.hs @@ -1,16 +1,16 @@ module Dodge.Item.Weapon.Remote ( - setRemoteScope, +-- setRemoteScope, ) where -import Control.Lens -import Dodge.Data.World -import Geometry +--import Control.Lens +--import Dodge.Data.World +--import Geometry -setRemoteScope :: Int -> Point2 -> World -> World -setRemoteScope itid pos w = case w ^? cWorld . lWorld . itemLocations . ix itid of - Just (InInv cid' invid _ _ _) -> - w - & cWorld . lWorld . creatures . ix cid' . crInv . ix invid . itScope - . remotePos - .~ (pos -.- (w ^?! cWorld . lWorld . creatures . ix cid' . crPos)) - _ -> w +--setRemoteScope :: Int -> Point2 -> World -> World +--setRemoteScope itid pos w = case w ^? cWorld . lWorld . itemLocations . ix itid of +-- Just (InInv cid' invid _ _ _) -> +-- w +-- & cWorld . lWorld . creatures . ix cid' . crInv . ix invid . itScope +-- . remotePos +-- .~ (pos -.- (w ^?! cWorld . lWorld . creatures . ix cid' . crPos)) +-- _ -> w diff --git a/src/Dodge/Item/Weapon/TriggerType.hs b/src/Dodge/Item/Weapon/TriggerType.hs index da6e384a3..eb3e787f9 100644 --- a/src/Dodge/Item/Weapon/TriggerType.hs +++ b/src/Dodge/Item/Weapon/TriggerType.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE TupleSections #-} +--{-# LANGUAGE TupleSections #-} {- | Weapon effects when pulling the trigger. @@ -29,7 +29,7 @@ module Dodge.Item.Weapon.TriggerType ( hammerCheck, shootL, useTimeCheck, - ammoCheckI, +-- ammoCheckI, modClock, blCheck, repeatTransformed, @@ -115,18 +115,18 @@ withThickSmokeI eff item cr w = -- TODO create a trigger that does different things on first and continued -- fire. -ammoCheckI :: ChainEffect -ammoCheckI eff itm cr w = fromMaybe (failsound w) $ do - atype <- itm ^? ldtValue . itUse . heldAmmoTypes . ix 0 - leftitms <- itm ^? ldtLeft - mag <- lookup (AmmoInLink 0 atype) leftitms - x <- mag ^? ldtValue . itUse . amagLoadStatus . iaLoaded - guard $ x > 0 - return $ eff itm cr $ w -- & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading - where - failsound = case w ^? input . mouseButtons . ix SDL.ButtonLeft of - Just 0 -> soundStart (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing - _ -> soundContinue (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing +--ammoCheckI :: ChainEffect +--ammoCheckI eff itm cr w = fromMaybe (failsound w) $ do +-- atype <- itm ^? ldtValue . itUse . heldAmmoTypes . ix 0 +-- leftitms <- itm ^? ldtLeft +-- mag <- lookup (AmmoInLink 0 atype) leftitms +-- x <- mag ^? ldtValue . itUse . amagLoadStatus . iaLoaded +-- guard $ x > 0 +-- return $ eff itm cr w -- & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading +-- where +-- failsound = case w ^? input . mouseButtons . ix SDL.ButtonLeft of +-- Just 0 -> soundStart (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing +-- _ -> soundContinue (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing itUseCharge :: Int -> Item -> Item itUseCharge x = itUse . leftConsumption . arLoaded %~ (max 0 . subtract x) diff --git a/src/Dodge/Projectile/Create.hs b/src/Dodge/Projectile/Create.hs index fba277784..a3e2d49cb 100644 --- a/src/Dodge/Projectile/Create.hs +++ b/src/Dodge/Projectile/Create.hs @@ -16,9 +16,9 @@ import LensHelp fireShell :: Item -> Muzzle -> Item -> Creature -> World -> World fireShell ammoitem muz it cr = makeShell + Nothing ammoitem muz - it cr [ PJShellCollisionCheck , PJDecTimMvVel @@ -32,8 +32,8 @@ fireShell ammoitem muz it cr = spinamount = _shellSpinAmount params thrustdelay = _shellThrustDelay params -makeShell :: Item -> Muzzle -> Item -> Creature -> [ProjectileUpdate] -> World -> World -makeShell ammoitem muz it cr theupdate w = fromMaybe w $ do +makeShell :: Maybe Int -> Item -> Muzzle -> Creature -> [ProjectileUpdate] -> World -> World +makeShell mscreeninvid ammoitem muz cr theupdate w = fromMaybe w $ do aparams <- ammoitem ^? itUse . amagParams return $ w & cWorld . lWorld . projectiles . at i @@ -50,27 +50,30 @@ makeShell ammoitem muz it cr theupdate w = fromMaybe w $ do , _prjPayload = _ampPayload aparams , _prjTimer = 350 , _prjUpdates = theupdate - , _prjMITID = Just $ _itID it +-- , _prjMITID = Just $ _itID it } + & updatescreen where + updatescreen = fromMaybe id $ do + screeninvid <- mscreeninvid + return $ cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix screeninvid + . itUse . atLinkedProjectile ?~ i i = IM.newKey $ w ^. cWorld . lWorld . projectiles -- _props (_cWorld w) dir = _crDir cr + _mzRot muz pos = _crPos cr +.+ rotateV dir (_mzPos muz) --am = _heldConsumption $ _itUse it -fireTrackingShell :: Item -> Muzzle -> Item -> Creature -> World -> World -fireTrackingShell ammoitem muz it cr = fromMaybe id $ do - return $ - makeShell +fireTrackingShell :: Int -> Int -> Item -> Muzzle -> Item -> Creature -> World -> World +fireTrackingShell screenid screeninvid ammoitem muz it cr = makeShell + (Just screeninvid) ammoitem muz - it cr - [ PJRemoteShellCollisionCheck + [ PJRemoteShellCollisionCheck screenid , PJDecTimMvVel , PJSpin 335 (_crID cr) spinamount - , PJTrack (350 - thrustdelay) 0 (_itID it) + , PJRemoteSetDirection (350 - thrustdelay) 0 screenid , PJThrust (350 - thrustdelay) 0 , PJReduceSpin (1 - fromIntegral spindrag * 2 / 200) ] diff --git a/src/Dodge/Projectile/Update.hs b/src/Dodge/Projectile/Update.hs index 9abd34efb..1d47cfed6 100644 --- a/src/Dodge/Projectile/Update.hs +++ b/src/Dodge/Projectile/Update.hs @@ -39,8 +39,8 @@ shellCollisionCheck doExplode pj w vel = _prjVel pj newPos = oldPos +.+ vel -remoteShellCollisionCheck :: Proj -> World -> World -remoteShellCollisionCheck = shellCollisionCheck $ \pj -> explodeRemoteRocket (fromJust (_prjMITID pj)) (_prjID pj) +remoteShellCollisionCheck :: Int -> Proj -> World -> World +remoteShellCollisionCheck screenid = shellCollisionCheck $ \pj -> explodeRemoteRocket screenid (_prjID pj) plainShellCollisionCheck :: Proj -> World -> World plainShellCollisionCheck = shellCollisionCheck $ \pj -> @@ -53,7 +53,7 @@ upsProjectile pj w' = foldr (`upProjectile` pj) w' (_prjUpdates pj) upProjectile :: ProjectileUpdate -> Proj -> World -> World upProjectile pu pj = case pu of - PJRemoteShellCollisionCheck -> remoteShellCollisionCheck pj + PJRemoteShellCollisionCheck screenid -> remoteShellCollisionCheck screenid pj PJShellCollisionCheck -> plainShellCollisionCheck pj PJDecTimMvVel -> decTimMvVel pj PJThrust st et @@ -62,15 +62,17 @@ upProjectile pu pj = case pu of PJSpin t cid spinamount | ain t -> trySpinByCID cid spinamount pj | otherwise -> id - PJTrack st et crid - | act st et -> pjTrack crid pj + PJRemoteSetDirection st et screenid + | act st et -> pjRemoteSetDirection screenid pj | otherwise -> id PJReduceSpin x -> reduceSpinBy x pj - PJRemoteDirection st et cid itid - | act st et -> setRemoteDir cid itid pj - | otherwise -> id - PJSetScope itid -> setRemoteScope itid (_prjPos pj) +-- PJRemoteDirection st et cid itid +-- | act st et -> setRemoteDir cid itid pj +-- | otherwise -> id +-- PJSetScope itid -> setRemoteScope itid (_prjPos pj) PJRetireRemote itid 0 pjid -> retireRemoteProj itid pjid +-- the following requires that this is at the top of the update list, which is +-- not ideal PJRetireRemote _ _ pjid -> cWorld . lWorld . projectiles . ix pjid . prjUpdates . ix 0 . pjuTimer -~ 1 where time = _prjTimer pj @@ -78,26 +80,38 @@ upProjectile pu pj = case pu of ain t = time == t retireRemoteProj :: Int -> Int -> World -> World -retireRemoteProj itid pjid w = - w - & pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix itid) - %~ ( (itScope . remotePos .~ V2 0 0) --- . (itUse . heldUse .~ HeldFireRemoteShell) - . (itUse . heldMods .~ FireRemoteShellMod) - ) - & cWorld . lWorld . props %~ IM.delete pjid - -setRemoteDir :: Int -> Int -> Proj -> World -> World -setRemoteDir cid itid pj w = w & cWorld . lWorld . projectiles . ix (_prjID pj) . prjAcc .~ turntonewdir +retireRemoteProj itid pjid w = w & cWorld . lWorld . projectiles %~ IM.delete pjid + & removelink where - turntonewdir = magV (_prjAcc pj) *.* unitVectorAtAngle newdir - --i = _prjID pj - newdir - | SDL.ButtonRight `M.member` _mouseButtons (_input w) - && w ^? cWorld . lWorld . creatures . ix cid . crManipulation . manObject . imSelectedItem - == w ^? cWorld . lWorld . itemLocations . ix itid . ilInvID - = (w ^. wCam . camRot) + argV (_mousePos (_input w)) - | otherwise = _prjDir pj + removelink = fromMaybe id $ do + loc <- w ^? cWorld . lWorld . itemLocations . ix itid + itm <- w ^? pointerToItemLocation loc . itUse . atLinkedProjectile . _Just + guard $ itm == pjid + --return $ pointerToItemLocation . itUse . atLinkedProjectile .~ Nothing + return $ pointerToItemLocation loc . itUse . atLinkedProjectile .~ Nothing + + +--retireRemoteProj :: Int -> Int -> World -> World +--retireRemoteProj itid pjid w = +-- w +-- & pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix itid) +-- %~ ( (itScope . remotePos .~ V2 0 0) +-- . (itUse . heldUse .~ HeldFireRemoteShell) +-- . (itUse . heldMods .~ FireRemoteShellMod) +-- ) +-- & cWorld . lWorld . props %~ IM.delete pjid + +--setRemoteDir :: Int -> Int -> Proj -> World -> World +--setRemoteDir cid itid pj w = w & cWorld . lWorld . projectiles . ix (_prjID pj) . prjAcc .~ turntonewdir +-- where +-- turntonewdir = magV (_prjAcc pj) *.* unitVectorAtAngle newdir +-- --i = _prjID pj +-- newdir +-- | SDL.ButtonRight `M.member` _mouseButtons (_input w) +-- && w ^? cWorld . lWorld . creatures . ix cid . crManipulation . manObject . imSelectedItem +-- == w ^? cWorld . lWorld . itemLocations . ix itid . ilInvID +-- = (w ^. wCam . camRot) + argV (_mousePos (_input w)) +-- | otherwise = _prjDir pj doThrust :: Proj -> World -> World doThrust pj w = @@ -137,19 +151,46 @@ trySpinByCID cid i pj w = w & cWorld . lWorld . projectiles . ix pjid . prjSpin _ -> 0 spinFactor = 5 * (6 - fromIntegral i) -pjTrack :: Int -> Proj -> World -> World -pjTrack crid pj w = rotateToTarget pj w +--pjTrack :: Int -> Proj -> World -> World +--pjTrack crid pj w = rotateToTarget pj w +-- where +-- rotateToTarget _ = fromMaybe id $ do +-- tpos <- w ^? cWorld . lWorld . creatures . ix crid . crTargeting . ctPos . _Just +-- return $ +-- cWorld . lWorld . projectiles . ix (_prjID pj) . prjSpin +-- .~ turnToAmount +-- 0.15 +-- (_prjPos pj) +-- tpos +-- (argV $ _prjAcc pj) +-- --itPoint = pointerToItemLocation $ w ^?! cWorld . lWorld . itemLocations . ix itid + +-- note this only allows YOU to remotely track projectiles +pjRemoteSetDirection :: Int -> Proj -> World -> World +pjRemoteSetDirection screenid pj w = w + & cWorld . lWorld . projectiles . ix (_prjID pj) . prjAcc .~ turntonewdir where - rotateToTarget _ = fromMaybe id $ do - tpos <- w ^? cWorld . lWorld . creatures . ix crid . crTargeting . ctPos . _Just - return $ - cWorld . lWorld . projectiles . ix (_prjID pj) . prjSpin - .~ turnToAmount - 0.15 - (_prjPos pj) - tpos - (argV $ _prjAcc pj) - --itPoint = pointerToItemLocation $ w ^?! cWorld . lWorld . itemLocations . ix itid + turntonewdir = magV (_prjAcc pj) *.* unitVectorAtAngle newdir + --i = _prjID pj + newdir + | w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . imSelectedItem + == w ^? cWorld . lWorld . itemLocations . ix screenid . ilInvID + = (w ^. wCam . camRot) + argV (_mousePos (_input w)) + | otherwise = _prjDir pj + +--pjTrack :: Int -> Proj -> World -> World +--pjTrack screenid pj w = w-- rotateToTarget pj w +-- where +-- rotateToTarget _ = fromMaybe id $ do +-- tpos <- w ^? cWorld . lWorld . creatures . ix crid . crTargeting . ctPos . _Just +-- return $ +-- cWorld . lWorld . projectiles . ix (_prjID pj) . prjSpin +-- .~ turnToAmount +-- 0.15 +-- (_prjPos pj) +-- tpos +-- (argV $ _prjAcc pj) +-- --itPoint = pointerToItemLocation $ w ^?! cWorld . lWorld . itemLocations . ix itid reduceSpinBy :: Float -> Proj -> World -> World reduceSpinBy x pj = cWorld . lWorld . projectiles . ix (_prjID pj) . prjSpin *~ x diff --git a/src/Dodge/SelectUse.hs b/src/Dodge/SelectUse.hs index b288be948..d7b036836 100644 --- a/src/Dodge/SelectUse.hs +++ b/src/Dodge/SelectUse.hs @@ -10,14 +10,15 @@ import Control.Lens selectUse :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World selectUse ittree _ w = fromMaybe w $ do + itid <- ittree ^? ldtValue . itID pjid <- ittree ^? ldtValue . itUse . atLinkedProjectile . _Just thepj <- w ^? cWorld . lWorld . projectiles . ix pjid return $ w - & cWorld . lWorld . projectiles . ix pjid . prjUpdates .~ [PJRetireRemote 69 30 pjid] -- 69 is placeholder, should be removed + & cWorld . lWorld . projectiles . ix pjid . prjUpdates .~ [PJRetireRemote itid 30 pjid] -- 69 is placeholder, should be removed & cWorld . lWorld . projectiles . ix pjid . prjDraw .~ DrawBlankProjectile -- & itPoint . itUse . heldUse .~ HeldDoNothing -- & itPoint . itUse . heldMods .~ DoNothingMod & usePayload (_prjPayload thepj) (_prjPos thepj) - where +-- where -- itPoint = pointerToItemLocation $ w ^?! cWorld . lWorld . itemLocations . ix itid-- _itemLocations (_cWorld w) IM.! itid diff --git a/src/Dodge/Update/Camera.hs b/src/Dodge/Update/Camera.hs index 8094e10b4..2ff6feda5 100644 --- a/src/Dodge/Update/Camera.hs +++ b/src/Dodge/Update/Camera.hs @@ -31,7 +31,7 @@ import qualified SDL update where your avatar's view is from. -} updateCamera :: Configuration -> World -> World updateCamera cfig w = case w ^. wCam . camControl of - CamInGame -> updateInGameCamera cfig w + CamInGame {} -> updateInGameCamera cfig w CamFloat -> updateFloatingCamera cfig w updateFloatingCamera :: Configuration -> World -> World @@ -72,16 +72,16 @@ updateInGameCamera :: Configuration -> World -> World updateInGameCamera cfig w = w & updateBounds cfig - & wCam %~ moveZoomCamera cfig (w ^. input) (you w) + & wCam %~ moveZoomCamera cfig (w ^. input) (you w) w & updateScopeZoom & rotateCamera cfig & over wCam (setViewDistance cfig) -- I think this should be updated after the zoom? -moveZoomCamera :: Configuration -> Input -> Creature -> Camera -> Camera -moveZoomCamera cfig theinput cr campos = +moveZoomCamera :: Configuration -> Input -> Creature -> World -> Camera -> Camera +moveZoomCamera cfig theinput cr w campos = campos - & camCenter .~ _crPos cr +.+ offset - & camViewFrom .~ _crPos cr +.+ vfoffset + & camCenter .~ fromMaybe (_crPos cr +.+ offset ) mremotepos + & camViewFrom .~ fromMaybe (_crPos cr +.+ vfoffset) mremotepos & camZoom .~ newzoom & camDefaultZoom .~ newDefaultZoom & camItemZoom .~ newItemZoom @@ -89,22 +89,26 @@ moveZoomCamera cfig theinput cr campos = vfoffset = fromMaybe 0 $ do guard (SDL.ButtonRight `M.member` _mouseButtons theinput) i <- cr ^? crManipulation . manObject . imSelectedItem - (cr ^? crInv . ix i . itScope . remotePos) + cr ^? crInv . ix i . itScope . remotePos + mremotepos = do + i <- cr ^? crManipulation . manObject . imSelectedItem + j <- cr ^? crInv . ix i . itUse . atLinkedProjectile . _Just + w ^? cWorld . lWorld . projectiles . ix j . prjPos docamrot = rotateV (campos ^. camRot) offset = fromMaybe noscopeoffset $ do guard (SDL.ButtonRight `M.member` _mouseButtons theinput) i <- cr ^? crManipulation . manObject . imSelectedItem - (fmap docamrot (cr ^? crInv . ix i . itScope . opticPos)) + fmap docamrot (cr ^? crInv . ix i . itScope . opticPos) <|> (cr ^? crInv . ix i . itScope . remotePos) noscopeoffset = docamrot $ ((newzoom - newDefaultZoom) / (newDefaultZoom * newzoom)) *.* _mousePos theinput newzoom = fromMaybe (newDefaultZoom * newItemZoom) $ do i <- cr ^? crManipulation . manObject . imSelectedItem - (cr ^? crInv . ix i . itScope . opticZoom) + cr ^? crInv . ix i . itScope . opticZoom idealDefaultZoom = clipZoom wallZoom newDefaultZoom = fromMaybe (changeZoom (campos ^. camDefaultZoom) idealDefaultZoom) $ do i <- cr ^? crManipulation . manObject . imSelectedItem - (cr ^? crInv . ix i . itScope . opticZoom) + cr ^? crInv . ix i . itScope . opticZoom idealItemZoom = fromMaybe 1 $ do guard $ crIsAiming cr i <- cr ^? crManipulation . manObject . imSelectedItem diff --git a/src/Dodge/WorldEvent/Flash.hs b/src/Dodge/WorldEvent/Flash.hs index 16870508f..e446b3c2a 100644 --- a/src/Dodge/WorldEvent/Flash.hs +++ b/src/Dodge/WorldEvent/Flash.hs @@ -41,7 +41,7 @@ muzFlareAt col tranv dir w = } where thestate = replicateM 4 $ state $ randomR (2,20) - ((a : b : c : d : _), g) = runState thestate $ _randGen w -- randomRs (2, 20) (_randGen w) + (a : b : c : d : _, g) = runState thestate $ _randGen w -- randomRs (2, 20) (_randGen w) flareCircleAt :: Color -> Float -> Point3 -> World -> World flareCircleAt col alphax tranv =