diff --git a/data/sound/insert.CUHRAM.500.wav b/data/sound/insert.CUHRAM.500.wav deleted file mode 100644 index cc625cf52..000000000 Binary files a/data/sound/insert.CUHRAM.500.wav and /dev/null differ diff --git a/data/sound/prime.CLIKCLIK.500.wav b/data/sound/prime.CLIKCLIK.500.wav deleted file mode 100644 index 8a3ec4324..000000000 Binary files a/data/sound/prime.CLIKCLIK.500.wav and /dev/null differ diff --git a/src/Dodge/Creature/Impulse/UseItem.hs b/src/Dodge/Creature/Impulse/UseItem.hs index 389daeb3c..4584f6a39 100644 --- a/src/Dodge/Creature/Impulse/UseItem.hs +++ b/src/Dodge/Creature/Impulse/UseItem.hs @@ -4,6 +4,7 @@ module Dodge.Creature.Impulse.UseItem ) where import Dodge.Data import Dodge.Inventory +import Dodge.Reloading import qualified Data.IntMap.Strict as IM --import qualified Data.IntSet as IS diff --git a/src/Dodge/Creature/YourControl.hs b/src/Dodge/Creature/YourControl.hs index 6ce9be37d..e09016768 100644 --- a/src/Dodge/Creature/YourControl.hs +++ b/src/Dodge/Creature/YourControl.hs @@ -12,7 +12,8 @@ import Geometry import Control.Lens import qualified SDL -import qualified Data.Set as S +--import qualified Data.Set as S +import qualified Data.Map.Strict as M --import qualified Data.IntMap.Strict as IM --import Data.Maybe {- | The AI equivalent for your control. -} @@ -34,7 +35,7 @@ wasdWithAiming -> Creature wasdWithAiming w speed cr | isAiming = addAnyTwist $ set crDir mouseDir $ theMovement cr - | crIsReloading cr && SDL.ButtonRight `S.member` _mouseButtons w + | crIsReloading cr && SDL.ButtonRight `M.member` _mouseButtons w = addAnyTwist $ set crDir (mouseDir + anytwist) $ theMovement cr | otherwise = theMovement $ theTurn $ removeTwist cr where @@ -70,9 +71,9 @@ wasdDir :: World -> Point2 wasdDir = foldr ((+.+) . wasdM) (V2 0 0) . _keys {- | Set posture according to mouse presses. -} -mouseActionsCr :: S.Set SDL.MouseButton -> Creature -> Creature +mouseActionsCr :: M.Map SDL.MouseButton Bool -> Creature -> Creature mouseActionsCr pkeys cr | rbPressed = cr & crStance . posture .~ Aiming | otherwise = cr & crStance . posture .~ AtEase where - rbPressed = SDL.ButtonRight `S.member` pkeys + rbPressed = SDL.ButtonRight `M.member` pkeys diff --git a/src/Dodge/Data.hs b/src/Dodge/Data.hs index 29c9cffc2..789b7b64c 100644 --- a/src/Dodge/Data.hs +++ b/src/Dodge/Data.hs @@ -88,7 +88,7 @@ data Universe = Universe } data World = World { _keys :: S.Set Scancode - , _mouseButtons :: S.Set MouseButton + , _mouseButtons :: M.Map MouseButton Bool , _mousePos :: Point2 , _cameraCenter :: Point2 , _cameraRot :: Float @@ -487,6 +487,7 @@ data ItemConsumption { _laAmmoType :: AmmoType , _laMax :: Int , _laLoaded :: Int + , _laPrimed :: Bool , _laCycle :: [LoadAction] , _laProgress :: Maybe [LoadAction] } diff --git a/src/Dodge/Default/Weapon.hs b/src/Dodge/Default/Weapon.hs index 4aff687e2..2b685e125 100644 --- a/src/Dodge/Default/Weapon.hs +++ b/src/Dodge/Default/Weapon.hs @@ -20,6 +20,7 @@ defaultLoadable = LoadableAmmo { _laAmmoType = GenericAmmo , _laMax = 15 , _laLoaded = 0 + , _laPrimed = True , _laCycle = [loadEject 10, loadInsert 10, loadPrime 10] , _laProgress = Nothing } diff --git a/src/Dodge/Default/World.hs b/src/Dodge/Default/World.hs index e050327db..146e83891 100644 --- a/src/Dodge/Default/World.hs +++ b/src/Dodge/Default/World.hs @@ -21,7 +21,7 @@ defaultWorld :: World defaultWorld = World { _keys = S.empty , _magnets = IM.empty - , _mouseButtons = S.empty + , _mouseButtons = mempty , _cameraCenter = V2 0 0 , _cameraRot = 0 , _cameraZoom = 1 diff --git a/src/Dodge/Event.hs b/src/Dodge/Event.hs index 5461b7aa5..5ba985f19 100644 --- a/src/Dodge/Event.hs +++ b/src/Dodge/Event.hs @@ -67,10 +67,12 @@ handleMouseMotionEvent mmev u = Just $ u & uvWorld . mousePos .~ V2 handleMouseButtonEvent :: MouseButtonEventData -> World -> World handleMouseButtonEvent mbev = case mouseButtonEventMotion mbev of - Released -> mouseButtons %~ S.delete thebutton - Pressed -> handlePressedMouseButton thebutton . (mouseButtons %~ S.insert thebutton) + Released -> mouseButtons . at thebutton .~ Nothing + Pressed -> handlePressedMouseButton thebutton . (mouseButtons . at thebutton %~ f) where thebutton = mouseButtonEventButton mbev + f Nothing = Just False + f _ = Just True {- | Sets window position in config. -} handleWindowMoveEvent :: WindowMovedEventData -> Universe -> Maybe Universe @@ -106,7 +108,7 @@ handlePressedMouseButton but w = case (_hudElement (_hud w), but) of _ -> w where maybeexitcombine - | ButtonRight `S.member` _mouseButtons w = id + | ButtonRight `M.member` _mouseButtons w = id | otherwise = hud . hudElement .~ DisplayInventory NoSubInventory -- note "sort" on the inventory indices; otherwise @@ -177,8 +179,8 @@ wheelEvent y w = case _hudElement $ _hud w of numcombs = length $ combineItemListYou w yi = round $ signum y numLocs = (fst . IM.findMax $ _seenLocations w) + 1 - rbDown = ButtonRight `S.member` _mouseButtons w - lbDown = ButtonLeft `S.member` _mouseButtons w + rbDown = ButtonRight `M.member` _mouseButtons w + lbDown = ButtonLeft `M.member` _mouseButtons w invKeyDown = ScancodeCapsLock `S.member` _keys w getArguments' :: TerminalCommand -> Terminal -> World -> [String] diff --git a/src/Dodge/Item/Weapon/BulletGun/Cane.hs b/src/Dodge/Item/Weapon/BulletGun/Cane.hs index 355fb0fd5..495b552f6 100644 --- a/src/Dodge/Item/Weapon/BulletGun/Cane.hs +++ b/src/Dodge/Item/Weapon/BulletGun/Cane.hs @@ -149,7 +149,7 @@ repeater :: Item repeater = rifle & itType . iyModules . at ModRifleMag ?~ EMPTYMODULE & itType . iyBase .~ REPEATER - & itConsumption . laCycle .~ [loadEject 20, loadInsert 20 ,loadPrime 20] + & itConsumption . laCycle .~ [loadEject 50, loadInsert 40 ,loadPrime 20] & itConsumption . laMax .~ 15 & itDimension . dimSPic .~ (\it -> noPic $ baseRifleShape <> makeTinClipAt 0 (V3 10 (-2) 0) it diff --git a/src/Dodge/Item/Weapon/ExtraEffect.hs b/src/Dodge/Item/Weapon/ExtraEffect.hs index ae32bd3a1..e1ce36a4c 100644 --- a/src/Dodge/Item/Weapon/ExtraEffect.hs +++ b/src/Dodge/Item/Weapon/ExtraEffect.hs @@ -32,10 +32,11 @@ import qualified FoldlHelp as L import Sound.Data import ShortShow +import qualified Data.Map.Strict as M --import Data.Bifunctor import Data.Maybe --import qualified Control.Foldl as L -import qualified Data.Set as S +--import qualified Data.Set as S import qualified SDL autoEffect :: (Item -> Creature -> World -> World) -> Int -> SoundID -> Item -> Creature -> World -> World autoEffect eff t sid itm cr w @@ -119,7 +120,7 @@ targetRBCreatureUp it cr w t & tgPos .~ Nothing & tgActive .~ False ) - | SDL.ButtonRight `S.member` _mouseButtons w && isJust (t ^? tgID . _Just) + | SDL.ButtonRight `M.member` _mouseButtons w && isJust (t ^? tgID . _Just) && canSeeTarget = (w, t & updatePos & tgActive .~ True ) @@ -171,7 +172,7 @@ targetUpdateWith f it _ w t targetCursorUpdate :: World -> Targeting -> Targeting targetCursorUpdate w t - | SDL.ButtonRight `S.member` _mouseButtons w = t + | SDL.ButtonRight `M.member` _mouseButtons w = t & tgPos . _Just .~ mouseWorldPos w & tgActive .~ True | otherwise = t & tgPos %~ const Nothing @@ -179,7 +180,7 @@ targetCursorUpdate w t targetRBPressUpdate :: World -> Targeting -> Targeting targetRBPressUpdate w t - | SDL.ButtonRight `S.member` _mouseButtons w = t + | SDL.ButtonRight `M.member` _mouseButtons w = t & tgPos %~ maybe (Just $ mouseWorldPos w) Just & tgActive .~ True | otherwise = t & tgPos %~ const Nothing diff --git a/src/Dodge/Item/Weapon/Launcher.hs b/src/Dodge/Item/Weapon/Launcher.hs index c3e18c3f7..54082b8d6 100644 --- a/src/Dodge/Item/Weapon/Launcher.hs +++ b/src/Dodge/Item/Weapon/Launcher.hs @@ -28,7 +28,8 @@ import qualified IntMapHelp as IM import ShapePicture import Shape -import qualified Data.Set as S +--import qualified Data.Set as S +import qualified Data.Map.Strict as M import qualified SDL import Data.Maybe import Control.Lens @@ -320,7 +321,7 @@ moveRemoteShell cid itid pj w vel = _pjVel pj newPos = oldPos +.+ vel newdir - | SDL.ButtonRight `S.member` _mouseButtons w + | SDL.ButtonRight `M.member` _mouseButtons w && w ^? creatures . ix cid . crInvSel . iselPos == w ^? itemPositions . ix itid . ipInvId = _cameraRot w + argV (_mousePos w) | otherwise = _pjDir pj diff --git a/src/Dodge/Item/Weapon/TriggerType.hs b/src/Dodge/Item/Weapon/TriggerType.hs index 11a92c77a..64f674e92 100644 --- a/src/Dodge/Item/Weapon/TriggerType.hs +++ b/src/Dodge/Item/Weapon/TriggerType.hs @@ -133,12 +133,13 @@ ammoCheckI eff item cr w -- hammer is down? ammoHammerCheck :: ChainEffect ammoHammerCheck eff it cr w - | _laLoaded (_itConsumption it) <= 0 = w -- fromMaybe w (startReloadingWeapon cr w) + | _laLoaded ic <= 0 || _laPrimed ic == False = w -- fromMaybe w (startReloadingWeapon cr w) & setHammerDown | otherwise = case it ^? itUse . useHammer . hammerPosition of Just HammerUp -> eff it cr $ setHammerDown w & creatures . ix (_crID cr) %~ crCancelReloading _ -> setHammerDown w where + ic = _itConsumption it cid = _crID cr setHammerDown = creatures . ix cid . crInv . ix (crSel cr) . itUse . useHammer . hammerPosition .~ HammerDown @@ -304,7 +305,7 @@ useTimeCheck f item cr w = case item ^? itUse . useDelay . rateTime of {- | Applies a world effect after a hammer position check. -} hammerCheckI :: ChainEffect hammerCheckI f it cr w = case it ^? itUse . useHammer . hammerPosition of - Just HammerUp -> f it cr $ setHammerDown w + Just HammerUp | _laPrimed (_itConsumption it) -> f it cr $ setHammerDown w _ -> setHammerDown w where cid = _crID cr diff --git a/src/Dodge/Reloading.hs b/src/Dodge/Reloading.hs index f5086dc3d..a134fe820 100644 --- a/src/Dodge/Reloading.hs +++ b/src/Dodge/Reloading.hs @@ -1,7 +1,9 @@ module Dodge.Reloading ( crCancelReloading , crToggleReloading + , crHoldReloading , stepReloading + , tryStartLoading ) where import Dodge.Data import Dodge.Hammer @@ -33,12 +35,15 @@ tryNextLoadAction cr = case cr ^? crInv . ix (crSel cr) . itConsumption . laProg Just la -> cr & crInvSel . iselAction . actionProgress .~ _actionTime la & crInvSel . iselAction . reloadAction .~ la - crToggleReloading :: Creature -> World -> World crToggleReloading cr w = case cr ^?! crInvSel . iselAction of ReloadAction {} -> w & creatures . ix (_crID cr) . crInvSel . iselAction .~ NoInvSelAction _ -> w & creatures . ix (_crID cr) %~ tryStartLoading +crHoldReloading :: Creature -> World -> World +crHoldReloading cr w = w + & creatures . ix (_crID cr) . crInvSel . iselAction . actionHammer .~ HasHammer HammerDown + tryStartLoading :: Creature -> Creature tryStartLoading cr = case ic ^? laProgress . _Just . ix 0 of Just la -> cr & startLoadAction la @@ -63,11 +68,11 @@ rotateActionProgress ic = case ic ^? laProgress . _Just of doLoadAction :: LoadAction -> ItemConsumption -> ItemConsumption doLoadAction la ic = case la of - LoadEject {} -> ic & laLoaded .~ 0 + LoadEject {} -> ic & laLoaded .~ 0 & laPrimed .~ False LoadInsert {} -> ic & laLoaded .~ _laMax ic LoadAdd {_insertMax = x} -> ic & laLoaded +~ min x (_laMax ic - _laLoaded ic) - LoadPrime {} -> ic + LoadPrime {} -> ic & laPrimed .~ True --{- | Start reloading if clip is empty. -} --crAutoReload :: Creature -> Creature diff --git a/src/Dodge/Render/HUD.hs b/src/Dodge/Render/HUD.hs index cf9b4874b..e06f73b0c 100644 --- a/src/Dodge/Render/HUD.hs +++ b/src/Dodge/Render/HUD.hs @@ -23,7 +23,7 @@ import qualified Data.Vector as V import Data.Maybe import qualified Data.IntMap.Strict as IM import qualified Data.Map.Strict as M -import qualified Data.Set as S +--import qualified Data.Set as S --import qualified Data.IntSet as IS import Control.Lens import SDL (MouseButton (..)) @@ -125,7 +125,7 @@ subInventoryDisplay subinv cfig w = case subinv of selcursor' ct = fromMaybe mempty $ ct 0 0 cfig curpos itcol (determineInvSelCursorWidth w) cury <$ it selcursor = selcursor' selcursortype selcursortype - | ButtonRight `S.member` _mouseButtons w = listCursorNESW + | ButtonRight `M.member` _mouseButtons w = listCursorNESW | otherwise = listCursorNSW curpos = invSelPos w cury = fromMaybe 1 $ augmentedInvSizes w IM.!? crSel (you w) @@ -134,7 +134,7 @@ subInventoryDisplay subinv cfig w = case subinv of _ -> mempty equipcursors = IM.foldMapWithKey (f yellow) (_crInvEquipped cr) f col invid epos = listTextPictureAt 144 0 cfig (selNumPos invid w) . color col $ text $ eqPosText epos - rboptions = if ButtonRight `S.member` _mouseButtons w + rboptions = if ButtonRight `M.member` _mouseButtons w then drawRBOptions cfig w (_rbOptions w) else mempty @@ -251,7 +251,7 @@ topCursorTypeWidth ctype width cfig w i determineInvSelCursorWidth :: World -> Int determineInvSelCursorWidth w = case _rbOptions w of NoRightButtonOptions -> topInvW - EquipOptions {} -> if ButtonRight `S.member` _mouseButtons w + EquipOptions {} -> if ButtonRight `M.member` _mouseButtons w then 47 else topInvW diff --git a/src/Dodge/Save.hs b/src/Dodge/Save.hs index b645241f9..a2ccd16a4 100644 --- a/src/Dodge/Save.hs +++ b/src/Dodge/Save.hs @@ -9,7 +9,7 @@ import Dodge.Data import qualified Data.Map.Strict as M --import Data.Maybe import Control.Lens -import qualified Data.Set as S +--import qualified Data.Set as S saveWorldInEmptySlot :: SaveSlot -> Universe -> Universe saveWorldInEmptySlot slot w = case M.lookup slot $ _savedWorlds w of @@ -28,7 +28,7 @@ doQuicksave :: Universe -> Universe doQuicksave = saveWorldInSlot QuicksaveSlot clearKeys :: World -> World -clearKeys = (keys .~ S.empty) . (mouseButtons .~ S.empty) +clearKeys = (keys .~ mempty) . (mouseButtons .~ mempty) saveLevelStartSlot :: World -> World --saveLevelStartSlot = id diff --git a/src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs b/src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs index f7c0fff25..ef2db3196 100644 --- a/src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs +++ b/src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs @@ -1,171 +1,172 @@ --- generated at 2022-06-21 17:36:17.190436966 UTC +-- generated at 2022-06-22 13:32:00.899109782 UTC module Dodge.SoundLogic.ExternallyGeneratedSounds where import Sound.Data soundToVol :: SoundID -> Float soundToVol v = case _getSoundID v of 0 -> 500 1 -> 500 - 2 -> 2000 - 3 -> 500 - 4 -> 1000 - 5 -> 40 - 6 -> 100 - 7 -> 500 + 2 -> 500 + 3 -> 2000 + 4 -> 500 + 5 -> 1000 + 6 -> 40 + 7 -> 100 8 -> 500 - 9 -> 300 - 10 -> 40 - 11 -> 2000 - 12 -> 50 + 9 -> 500 + 10 -> 300 + 11 -> 40 + 12 -> 2000 13 -> 50 - 14 -> 2000 - 15 -> 200 - 16 -> 40 - 17 -> 300 - 18 -> 500 - 19 -> 2000 - 20 -> 500 - 21 -> 100 - 22 -> 1000 - 23 -> 100 - 24 -> 1000 - 25 -> 40 - 26 -> 2000 - 27 -> 50 - 28 -> 2000 - 29 -> 50 - 30 -> 1000 - 31 -> 8000 - 32 -> 2000 + 14 -> 50 + 15 -> 2000 + 16 -> 200 + 17 -> 40 + 18 -> 300 + 19 -> 500 + 20 -> 2000 + 21 -> 500 + 22 -> 100 + 23 -> 1000 + 24 -> 100 + 25 -> 1000 + 26 -> 40 + 27 -> 2000 + 28 -> 50 + 29 -> 2000 + 30 -> 50 + 31 -> 1000 + 32 -> 8000 33 -> 2000 - 34 -> 1000 - 35 -> 2000 - 36 -> 100 - 37 -> 40 + 34 -> 2000 + 35 -> 1000 + 36 -> 2000 + 37 -> 100 38 -> 40 - 39 -> 2000 - 40 -> 100 - 41 -> 40 - 42 -> 300 - 43 -> 300 - 44 -> 2000 - 45 -> 1000 - 46 -> 1000 + 39 -> 40 + 40 -> 2000 + 41 -> 100 + 42 -> 500 + 43 -> 40 + 44 -> 300 + 45 -> 300 + 46 -> 2000 47 -> 1000 - 48 -> 40 - 49 -> 50 - 50 -> 500 - 51 -> 500 - 52 -> 1000 - 53 -> 20 - 54 -> 500 - 55 -> 300 + 48 -> 1000 + 49 -> 1000 + 50 -> 40 + 51 -> 50 + 52 -> 500 + 53 -> 500 + 54 -> 1000 + 55 -> 20 56 -> 500 - 57 -> 500 - 58 -> 1000 - 59 -> 500 - 60 -> 2000 + 57 -> 300 + 58 -> 500 + 59 -> 1000 + 60 -> 500 61 -> 2000 - 62 -> 500 - 63 -> 2000 - 64 -> 100 - 65 -> 300 - 66 -> 1000 - 67 -> 100 - 68 -> 2000 - 69 -> 1000 - 70 -> 200 - 71 -> 500 - 72 -> 100 - 73 -> 2000 + 62 -> 2000 + 63 -> 500 + 64 -> 2000 + 65 -> 100 + 66 -> 300 + 67 -> 1000 + 68 -> 100 + 69 -> 2000 + 70 -> 1000 + 71 -> 200 + 72 -> 500 + 73 -> 100 74 -> 2000 75 -> 2000 - 76 -> 500 + 76 -> 2000 77 -> 100 _ -> 50 soundToOnomato :: SoundID -> String soundToOnomato v = case _getSoundID v of 0 -> "DEDUM" - 1 -> "SCREE" - 2 -> "BRDBRDBRD" - 3 -> "DEDEDA" - 4 -> "CRNK" - 5 -> "CLNK" - 6 -> "WRR" - 7 -> "TINKLE" - 8 -> "TRINKL" - 9 -> "BWAAH" - 10 -> "TIP" - 11 -> "TATATA" - 12 -> "BLIH" - 13 -> "HMM" - 14 -> "PEW" - 15 -> "CRAKLE" - 16 -> "TAP" - 17 -> "DWAAH" - 18 -> "PRUM" - 19 -> "BANGG" - 20 -> "CRTINK" - 21 -> "PHF" - 22 -> "ZHM" - 23 -> "THUD" - 24 -> "CRASH" - 25 -> "TAPTIP" - 26 -> "CHUGUGUG" - 27 -> "HSSS" - 28 -> "BOOM" - 29 -> "HSS" - 30 -> "TAKH" - 31 -> "RINGGG" - 32 -> "CRH" - 33 -> "UGGAUGGA" - 34 -> "CRUMPLE" - 35 -> "CREUH" - 36 -> "SMACK" - 37 -> "CLICK" - 38 -> "TIPTOP" - 39 -> "CRUH" - 40 -> "CHNKCHNKCHUNK" - 41 -> "TIPTAP" - 42 -> "TNKTNKTNK" - 43 -> "CHPCHPCHP" - 44 -> "SCREE" - 45 -> "BRAP" - 46 -> "CRSK" - 47 -> "CRNKL" - 48 -> "TAPP" - 49 -> "SHUHP" - 50 -> "DEDEDUM" - 51 -> "TAK" - 52 -> "CRISH" - 53 -> "SWSH" - 54 -> "BIPBIPBIP" - 55 -> "BEP" - 56 -> "CLIKCLIK" - 57 -> "KRTNKL" - 58 -> "CRSNK" - 59 -> "DUDURAH" - 60 -> "CHUGUGUG" - 61 -> "BANG" - 62 -> "DEDA" - 63 -> "WHSSH" - 64 -> "HNH" - 65 -> "BWAH" - 66 -> "CRUNK" - 67 -> "DRR" - 68 -> "BRAP" - 69 -> "BLPCHCH" - 70 -> "ZMM" - 71 -> "WRRR" - 72 -> "FWUMP" - 73 -> "BRAHCHCH" - 74 -> "BRPBRPBRP" - 75 -> "WE-OH" - 76 -> "CUHRAM" + 1 -> "CUHRUP" + 2 -> "SCREE" + 3 -> "BRDBRDBRD" + 4 -> "DEDEDA" + 5 -> "CRNK" + 6 -> "CLNK" + 7 -> "WRR" + 8 -> "TINKLE" + 9 -> "TRINKL" + 10 -> "BWAAH" + 11 -> "TIP" + 12 -> "TATATA" + 13 -> "BLIH" + 14 -> "HMM" + 15 -> "PEW" + 16 -> "CRAKLE" + 17 -> "TAP" + 18 -> "DWAAH" + 19 -> "PRUM" + 20 -> "BANGG" + 21 -> "CRTINK" + 22 -> "PHF" + 23 -> "ZHM" + 24 -> "THUD" + 25 -> "CRASH" + 26 -> "TAPTIP" + 27 -> "CHUGUGUG" + 28 -> "HSSS" + 29 -> "BOOM" + 30 -> "HSS" + 31 -> "TAKH" + 32 -> "RINGGG" + 33 -> "CRH" + 34 -> "UGGAUGGA" + 35 -> "CRUMPLE" + 36 -> "CREUH" + 37 -> "SMACK" + 38 -> "CLICK" + 39 -> "TIPTOP" + 40 -> "CRUH" + 41 -> "CHNKCHNKCHUNK" + 42 -> "CLKCLK" + 43 -> "TIPTAP" + 44 -> "TNKTNKTNK" + 45 -> "CHPCHPCHP" + 46 -> "SCREE" + 47 -> "BRAP" + 48 -> "CRSK" + 49 -> "CRNKL" + 50 -> "TAPP" + 51 -> "SHUHP" + 52 -> "DEDEDUM" + 53 -> "TAK" + 54 -> "CRISH" + 55 -> "SWSH" + 56 -> "BIPBIPBIP" + 57 -> "BEP" + 58 -> "KRTNKL" + 59 -> "CRSNK" + 60 -> "DUDURAH" + 61 -> "CHUGUGUG" + 62 -> "BANG" + 63 -> "DEDA" + 64 -> "WHSSH" + 65 -> "HNH" + 66 -> "BWAH" + 67 -> "CRUNK" + 68 -> "DRR" + 69 -> "BRAP" + 70 -> "BLPCHCH" + 71 -> "ZMM" + 72 -> "WRRR" + 73 -> "FWUMP" + 74 -> "BRAHCHCH" + 75 -> "BRPBRPBRP" + 76 -> "WE-OH" 77 -> "FHP" _ -> error "unitialised sound" soundPathList :: [String] soundPathList = [ "dedum.DEDUM.500.wav" + , "insert.CUHRUP.500.wav" , "tone440sawtoothquiet.SCREE.500.wav" , "mini1.BRDBRDBRD.2000.wav" , "dededa.DEDEDA.500.wav" @@ -206,6 +207,7 @@ soundPathList = , "twoStepSlow.TIPTOP.40.wav" , "seagullCry.CRUH.2000.wav" , "crankSlow.CHNKCHNKCHUNK.100.wav" + , "prime.CLKCLK.500.wav" , "twoStep.TIPTAP.40.wav" , "reload.TNKTNKTNK.300.wav" , "reload1.CHPCHPCHP.300.wav" @@ -221,7 +223,6 @@ soundPathList = , "knife.SWSH.20.wav" , "computerBeeping.BIPBIPBIP.500.wav" , "tone440.BEP.300.wav" - , "prime.CLIKCLIK.500.wav" , "smallGlass2.KRTNKL.500.wav" , "glassShat1.CRSNK.1000.wav" , "eject.DUDURAH.500.wav" @@ -241,162 +242,161 @@ soundPathList = , "shotgun.BRAHCHCH.2000.wav" , "mini.BRPBRPBRP.2000.wav" , "seagullWhistle.WE-OH.2000.wav" - , "insert.CUHRAM.500.wav" , "whiteNoiseFadeIn.FHP.100.wav" ] dedumS :: SoundID dedumS = SoundID 0 -tone440sawtoothquietS :: SoundID -tone440sawtoothquietS = SoundID 1 -mini1S :: SoundID -mini1S = SoundID 2 -dededaS :: SoundID -dededaS = SoundID 3 -glassShat3S :: SoundID -glassShat3S = SoundID 4 -tapQuietS :: SoundID -tapQuietS = SoundID 5 -fireS :: SoundID -fireS = SoundID 6 -smallGlass4S :: SoundID -smallGlass4S = SoundID 7 -smallGlass1S :: SoundID -smallGlass1S = SoundID 8 -sineRaisePitchTwoSecS :: SoundID -sineRaisePitchTwoSecS = SoundID 9 -foot1S :: SoundID -foot1S = SoundID 10 -autoBS :: SoundID -autoBS = SoundID 11 -healS :: SoundID -healS = SoundID 12 -fridgeHumS :: SoundID -fridgeHumS = SoundID 13 -seagullWhistle1S :: SoundID -seagullWhistle1S = SoundID 14 -elecCrackleS :: SoundID -elecCrackleS = SoundID 15 -foot2S :: SoundID -foot2S = SoundID 16 -skwareFadeTwoSecS :: SoundID -skwareFadeTwoSecS = SoundID 17 -insertOneS :: SoundID -insertOneS = SoundID 18 -bangEchoS :: SoundID -bangEchoS = SoundID 19 -smallGlass3S :: SoundID -smallGlass3S = SoundID 20 -whiteNoiseFadeOutS :: SoundID -whiteNoiseFadeOutS = SoundID 21 -teleS :: SoundID -teleS = SoundID 22 -hitS :: SoundID -hitS = SoundID 23 -stone1S :: SoundID -stone1S = SoundID 24 -twoStep1S :: SoundID -twoStep1S = SoundID 25 -seagullChatterS :: SoundID -seagullChatterS = SoundID 26 -foamSprayLoopS :: SoundID -foamSprayLoopS = SoundID 27 -explosionS :: SoundID -explosionS = SoundID 28 -foamSprayFadeOutS :: SoundID -foamSprayFadeOutS = SoundID 29 -tap2S :: SoundID -tap2S = SoundID 30 -tinitusS :: SoundID -tinitusS = SoundID 31 -seagullCry1S :: SoundID -seagullCry1S = SoundID 32 -seagullBarkS :: SoundID -seagullBarkS = SoundID 33 -stone3S :: SoundID -stone3S = SoundID 34 -seagullCry2S :: SoundID -seagullCry2S = SoundID 35 -hit1S :: SoundID -hit1S = SoundID 36 -click1S :: SoundID -click1S = SoundID 37 -twoStepSlowS :: SoundID -twoStepSlowS = SoundID 38 -seagullCryS :: SoundID -seagullCryS = SoundID 39 -crankSlowS :: SoundID -crankSlowS = SoundID 40 -twoStepS :: SoundID -twoStepS = SoundID 41 -reloadS :: SoundID -reloadS = SoundID 42 -reload1S :: SoundID -reload1S = SoundID 43 -tone440sawtoothS :: SoundID -tone440sawtoothS = SoundID 44 -tap3S :: SoundID -tap3S = SoundID 45 -glassShat4S :: SoundID -glassShat4S = SoundID 46 -glassShat2S :: SoundID -glassShat2S = SoundID 47 -foot3S :: SoundID -foot3S = SoundID 48 -pickUpS :: SoundID -pickUpS = SoundID 49 -dededumS :: SoundID -dededumS = SoundID 50 -tap1S :: SoundID -tap1S = SoundID 51 -metal4S :: SoundID -metal4S = SoundID 52 -knifeS :: SoundID -knifeS = SoundID 53 -computerBeepingS :: SoundID -computerBeepingS = SoundID 54 -tone440S :: SoundID -tone440S = SoundID 55 -primeS :: SoundID -primeS = SoundID 56 -smallGlass2S :: SoundID -smallGlass2S = SoundID 57 -glassShat1S :: SoundID -glassShat1S = SoundID 58 -ejectS :: SoundID -ejectS = SoundID 59 -seagullChatter1S :: SoundID -seagullChatter1S = SoundID 60 -bangS :: SoundID -bangS = SoundID 61 -dedaS :: SoundID -dedaS = SoundID 62 -missileLaunchS :: SoundID -missileLaunchS = SoundID 63 -gruntS :: SoundID -gruntS = SoundID 64 -sineRaisePitchOneSecS :: SoundID -sineRaisePitchOneSecS = SoundID 65 -metal2S :: SoundID -metal2S = SoundID 66 -slideDoorS :: SoundID -slideDoorS = SoundID 67 -autoGunS :: SoundID -autoGunS = SoundID 68 -oldMachineBootS :: SoundID -oldMachineBootS = SoundID 69 -buzzS :: SoundID -buzzS = SoundID 70 -fireLoudS :: SoundID -fireLoudS = SoundID 71 -tap4S :: SoundID -tap4S = SoundID 72 -shotgunS :: SoundID -shotgunS = SoundID 73 -miniS :: SoundID -miniS = SoundID 74 -seagullWhistleS :: SoundID -seagullWhistleS = SoundID 75 insertS :: SoundID -insertS = SoundID 76 +insertS = SoundID 1 +tone440sawtoothquietS :: SoundID +tone440sawtoothquietS = SoundID 2 +mini1S :: SoundID +mini1S = SoundID 3 +dededaS :: SoundID +dededaS = SoundID 4 +glassShat3S :: SoundID +glassShat3S = SoundID 5 +tapQuietS :: SoundID +tapQuietS = SoundID 6 +fireS :: SoundID +fireS = SoundID 7 +smallGlass4S :: SoundID +smallGlass4S = SoundID 8 +smallGlass1S :: SoundID +smallGlass1S = SoundID 9 +sineRaisePitchTwoSecS :: SoundID +sineRaisePitchTwoSecS = SoundID 10 +foot1S :: SoundID +foot1S = SoundID 11 +autoBS :: SoundID +autoBS = SoundID 12 +healS :: SoundID +healS = SoundID 13 +fridgeHumS :: SoundID +fridgeHumS = SoundID 14 +seagullWhistle1S :: SoundID +seagullWhistle1S = SoundID 15 +elecCrackleS :: SoundID +elecCrackleS = SoundID 16 +foot2S :: SoundID +foot2S = SoundID 17 +skwareFadeTwoSecS :: SoundID +skwareFadeTwoSecS = SoundID 18 +insertOneS :: SoundID +insertOneS = SoundID 19 +bangEchoS :: SoundID +bangEchoS = SoundID 20 +smallGlass3S :: SoundID +smallGlass3S = SoundID 21 +whiteNoiseFadeOutS :: SoundID +whiteNoiseFadeOutS = SoundID 22 +teleS :: SoundID +teleS = SoundID 23 +hitS :: SoundID +hitS = SoundID 24 +stone1S :: SoundID +stone1S = SoundID 25 +twoStep1S :: SoundID +twoStep1S = SoundID 26 +seagullChatterS :: SoundID +seagullChatterS = SoundID 27 +foamSprayLoopS :: SoundID +foamSprayLoopS = SoundID 28 +explosionS :: SoundID +explosionS = SoundID 29 +foamSprayFadeOutS :: SoundID +foamSprayFadeOutS = SoundID 30 +tap2S :: SoundID +tap2S = SoundID 31 +tinitusS :: SoundID +tinitusS = SoundID 32 +seagullCry1S :: SoundID +seagullCry1S = SoundID 33 +seagullBarkS :: SoundID +seagullBarkS = SoundID 34 +stone3S :: SoundID +stone3S = SoundID 35 +seagullCry2S :: SoundID +seagullCry2S = SoundID 36 +hit1S :: SoundID +hit1S = SoundID 37 +click1S :: SoundID +click1S = SoundID 38 +twoStepSlowS :: SoundID +twoStepSlowS = SoundID 39 +seagullCryS :: SoundID +seagullCryS = SoundID 40 +crankSlowS :: SoundID +crankSlowS = SoundID 41 +primeS :: SoundID +primeS = SoundID 42 +twoStepS :: SoundID +twoStepS = SoundID 43 +reloadS :: SoundID +reloadS = SoundID 44 +reload1S :: SoundID +reload1S = SoundID 45 +tone440sawtoothS :: SoundID +tone440sawtoothS = SoundID 46 +tap3S :: SoundID +tap3S = SoundID 47 +glassShat4S :: SoundID +glassShat4S = SoundID 48 +glassShat2S :: SoundID +glassShat2S = SoundID 49 +foot3S :: SoundID +foot3S = SoundID 50 +pickUpS :: SoundID +pickUpS = SoundID 51 +dededumS :: SoundID +dededumS = SoundID 52 +tap1S :: SoundID +tap1S = SoundID 53 +metal4S :: SoundID +metal4S = SoundID 54 +knifeS :: SoundID +knifeS = SoundID 55 +computerBeepingS :: SoundID +computerBeepingS = SoundID 56 +tone440S :: SoundID +tone440S = SoundID 57 +smallGlass2S :: SoundID +smallGlass2S = SoundID 58 +glassShat1S :: SoundID +glassShat1S = SoundID 59 +ejectS :: SoundID +ejectS = SoundID 60 +seagullChatter1S :: SoundID +seagullChatter1S = SoundID 61 +bangS :: SoundID +bangS = SoundID 62 +dedaS :: SoundID +dedaS = SoundID 63 +missileLaunchS :: SoundID +missileLaunchS = SoundID 64 +gruntS :: SoundID +gruntS = SoundID 65 +sineRaisePitchOneSecS :: SoundID +sineRaisePitchOneSecS = SoundID 66 +metal2S :: SoundID +metal2S = SoundID 67 +slideDoorS :: SoundID +slideDoorS = SoundID 68 +autoGunS :: SoundID +autoGunS = SoundID 69 +oldMachineBootS :: SoundID +oldMachineBootS = SoundID 70 +buzzS :: SoundID +buzzS = SoundID 71 +fireLoudS :: SoundID +fireLoudS = SoundID 72 +tap4S :: SoundID +tap4S = SoundID 73 +shotgunS :: SoundID +shotgunS = SoundID 74 +miniS :: SoundID +miniS = SoundID 75 +seagullWhistleS :: SoundID +seagullWhistleS = SoundID 76 whiteNoiseFadeInS :: SoundID whiteNoiseFadeInS = SoundID 77 diff --git a/src/Dodge/Update/Camera.hs b/src/Dodge/Update/Camera.hs index 8d7f3c2fc..d472e294f 100644 --- a/src/Dodge/Update/Camera.hs +++ b/src/Dodge/Update/Camera.hs @@ -16,6 +16,7 @@ import Geometry import Dodge.GameRoom import LensHelp +import qualified Data.Map.Strict as M --import qualified Data.List.NonEmpty as NEL --import Control.Applicative import Data.Foldable @@ -48,10 +49,10 @@ moveZoomCamera cfig w = w vfoffset = do iscam <- yourItem w ^? _Just . itScope . scopeIsCamera guard iscam - guard (SDL.ButtonRight `S.member` _mouseButtons w) + guard (SDL.ButtonRight `M.member` _mouseButtons w) yourItem w ^? _Just . itScope . scopePos mscopeoffset = do - guard (SDL.ButtonRight `S.member` _mouseButtons w) + guard (SDL.ButtonRight `M.member` _mouseButtons w) yourItem w ^? _Just . itScope . scopePos newcen = cpos +.+ fromMaybe (V2 0 0) mscopeoffset +.+ offset offset = rotateV (_cameraRot w) $ ((newzoom - newDefaultZoom)/(newDefaultZoom*newzoom)) *.* _mousePos w @@ -80,7 +81,7 @@ moveZoomCamera cfig w = w updateScopeZoom :: World -> World updateScopeZoom w - | SDL.ButtonRight `S.member` _mouseButtons w + | SDL.ButtonRight `M.member` _mouseButtons w = case w ^? creatures . ix 0 . crInv . ix (crSel (_creatures w IM.! 0)) . itScope . scopeZoomChange of Just x @@ -133,7 +134,7 @@ zoomOutLongGun w ifConfigWallRotate :: Configuration -> World -> World ifConfigWallRotate cfig w - | _gameplay_rotate_to_wall cfig && not (SDL.ButtonRight `S.member` _mouseButtons w) + | _gameplay_rotate_to_wall cfig && not (SDL.ButtonRight `M.member` _mouseButtons w) = rotateToOverlappingWall w | otherwise = w diff --git a/src/Dodge/Update/UsingInput.hs b/src/Dodge/Update/UsingInput.hs index e1fd99f7d..192ca72cc 100644 --- a/src/Dodge/Update/UsingInput.hs +++ b/src/Dodge/Update/UsingInput.hs @@ -8,7 +8,8 @@ import Dodge.Creature.Impulse.UseItem import Geometry import SDL -import qualified Data.Set as S +--import qualified Data.Set as S +import qualified Data.Map.Strict as M import Control.Lens updateUsingInput :: World -> World @@ -16,7 +17,7 @@ updateUsingInput w = case _hudElement $ _hud w of DisplayInventory {} -> updatePressedButtons (_mouseButtons w) w DisplayCarte -> updatePressedButtonsCarte (_mouseButtons w) w -updatePressedButtons :: S.Set MouseButton -> World -> World +updatePressedButtons :: M.Map MouseButton Bool -> World -> World updatePressedButtons pkeys w | isDown ButtonLeft && isDown ButtonRight && inTopInv = useItem (you w) w & doubleMouseHammer .~ HammerDown @@ -34,11 +35,10 @@ updatePressedButtons pkeys w inTopInv = case _hudElement (_hud w) of DisplayInventory NoSubInventory -> True _ -> False - isDown but = but `S.member` pkeys + isDown but = but `M.member` pkeys rotation = angleBetween (_mousePos w) (_clickMousePos w) - -updatePressedButtonsCarte :: S.Set MouseButton -> World -> World +updatePressedButtonsCarte :: M.Map MouseButton Bool -> World -> World updatePressedButtonsCarte pkeys w | isDown ButtonRight = w & clickMousePos .~ _mousePos w @@ -49,7 +49,7 @@ updatePressedButtonsCarte pkeys w & hud . carteZoom *~ czoom | otherwise = w where - isDown but = but `S.member` pkeys + isDown but = but `M.member` pkeys rot = angleBetween (_mousePos w) (_clickMousePos w) czoom = magV (_mousePos w) / magV (_clickMousePos w) trans = rotateV (_carteRot (_hud w)) $ 1 / _carteZoom (_hud w) *.* (_mousePos w -.- _clickMousePos w)