diff --git a/package.yaml b/package.yaml index fb5095b4a..44ba3ef19 100644 --- a/package.yaml +++ b/package.yaml @@ -24,6 +24,7 @@ dependencies: - containers - unordered-containers - bitwise-enum +- graphviz #- heap - sdl2 - sdl2-mixer diff --git a/src/Dodge/Combine.hs b/src/Dodge/Combine.hs index 5b1ef7f76..6885b63ff 100644 --- a/src/Dodge/Combine.hs +++ b/src/Dodge/Combine.hs @@ -7,7 +7,7 @@ module Dodge.Combine , toggleCombineInv , enterCombineInv ) where -import Dodge.Combine.Combinations +import Dodge.Combine.Trie import Dodge.Base.You import Dodge.Data import Dodge.Item.Amount @@ -27,13 +27,7 @@ import qualified Data.IntMap.Strict as IM import qualified Data.Map.Strict as M --import Data.Map.Merge.Strict import Data.Maybe -import Data.List (scanl',sortOn,sort) - -combinationsTrie :: Trie (IcAmount,ItemBaseType) Item -combinationsTrie = foldr - (uncurry insertInTrie . first sort) - emptyTrie - itemCombinations +import Data.List (scanl',sortOn) invertInventory :: IM.IntMap Item -> [(ItemBaseType,IcAmount,Int)] invertInventory = IM.foldrWithKey diff --git a/src/Dodge/Combine/Combinations.hs b/src/Dodge/Combine/Combinations.hs index 4be87fad0..8a1cbc57a 100644 --- a/src/Dodge/Combine/Combinations.hs +++ b/src/Dodge/Combine/Combinations.hs @@ -32,9 +32,9 @@ itemCombinations = -- , po [BANGCONE,PUMP,HARDWARE] $ grenadeLauncher 1 -- , po [GRENADELAUNCHER 1,MOTOR,DRUM] $ grenadeLauncher 2 - , p [p 2 $ cr PIPE,o $ cr HARDWARE] bangCane - , p [p 2 $ cr PIPE,o BANGCANE] (bangCaneX 2) - , po [BANGCANE,cr TIN] rifle + , p [p 2 $ cr PIPE,o $ cr HARDWARE] (bangCaneX 1) + , p [p 2 $ cr PIPE,o $ BANGCANEX 1] (bangCaneX 2) + , po [BANGCANEX 1,cr TIN] rifle , po [RIFLE,cr PLANK] repeater , po [REPEATER,cr SPRING,cr HARDWARE] autoRifle , po [REPEATER,cr SPRING,cr CAN] burstRifle @@ -91,7 +91,7 @@ itemCombinations = ++ map (\i -> po [cr PIPE,BANGSTICK i] $ bangStick (i+1)) [1..8] ++ map (\i -> po [REVOLVERX i,cr CAN] $ revolverX (i+1)) [1..5] ++ map (\i -> p [o (BANGCANEX i),p 2 $ cr PIPE] $ bangCaneX (i+1)) [1..5] - ++ map (\i -> po [MINIGUNX i,BANGCANE] $ miniGunX (i+1)) [3..15] + ++ map (\i -> po [MINIGUNX i,BANGCANEX 1] $ miniGunX (i+1)) [3..15] ++ [ po (_iyBase (_itType it):mtype) $ it & itType . iyModules . ix modtype .~ m | (modtype,is,ms) <- moduleCombinations diff --git a/src/Dodge/Item/Draw.hs b/src/Dodge/Item/Draw.hs index 5a7666045..250e943c4 100644 --- a/src/Dodge/Item/Draw.hs +++ b/src/Dodge/Item/Draw.hs @@ -48,7 +48,7 @@ pictureWeaponOnAimItem p' cr posInInv = handD holsteredOneHandWep | isSelected = handD holsteredWep - | otherwise = emptyBlank + | otherwise = mempty where shoulderD = translateSPz 18 handD = translateSPz 15 diff --git a/src/Dodge/Item/Weapon/BulletGun/Cane.hs b/src/Dodge/Item/Weapon/BulletGun/Cane.hs index d74d60afe..51c235b51 100644 --- a/src/Dodge/Item/Weapon/BulletGun/Cane.hs +++ b/src/Dodge/Item/Weapon/BulletGun/Cane.hs @@ -76,8 +76,8 @@ bangCane = defaultBulletWeapon & itConsumption . laMax .~ 1 & itConsumption . laCycle .~ [loadPartialInsert 10 1] bangCaneX :: Int -> Item -bangCaneX i = bangCane - { _itUse = ruseAmmoParamsRate 6 upHammer +bangCaneX i = defaultBulletWeapon + & itUse .~ ruseAmmoParamsRate 6 upHammer [ ammoHammerCheck , useTimeCheck , withSoundItemChoiceStart caneStickSoundChoice @@ -88,7 +88,7 @@ bangCaneX i = bangCane , withMuzFlareI , withRecoil ] - , _itDimension = ItemDimension + & itDimension .~ ItemDimension { _dimRad = 8 , _dimCenter = V3 5 0 0 , _dimPortage = HeldItem @@ -101,11 +101,22 @@ bangCaneX i = bangCane . (\k -> fromIntegral k * 5 - ((fromIntegral i - 1) * 2.5))) [0..i-1] ) <> caneClipX i it } - } & itUse . useAim . aimWeight .~ 6 - & itUse . useAim . aimRange .~ 1 - & itUse . useAim . aimStance .~ TwoHandFlat - & itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5} + & itUse . useAim . aimWeight .~ 6 + & itUse . useAim . aimRange .~ 1 + & itUse . useAim . aimStance .~ TwoHandFlat + & itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5} & itConsumption . laMax .~ i + & itParams .~ BulletShooter + { _muzVel = 0.8 + , _rifling = 0.9 + , _bore = 2 + , _gunBarrels = SingleBarrel + { _brlInaccuracy = 0.01 + } + , _recoil = 50 + , _torqueAfter = 0.1 + , _randomOffset = 0 + } & itParams . gunBarrels .~ MultiBarrel {_brlSpread = AlignedBarrels ,_brlNum = i diff --git a/src/Dodge/Item/Weapon/Grenade.hs b/src/Dodge/Item/Weapon/Grenade.hs index e2e0fff5d..4b90930ec 100644 --- a/src/Dodge/Item/Weapon/Grenade.hs +++ b/src/Dodge/Item/Weapon/Grenade.hs @@ -239,7 +239,7 @@ throwRemoteBomb cr w = setLocation | otherwise = v' j = crSel cr -- resetName = set (creatures . ix cid . crInv . ix j . itName) "REMOTE" - removePict = set (creatures . ix cid . crInv . ix j . itEquipPict) $ \ _ _ -> emptyBlank + removePict = set (creatures . ix cid . crInv . ix j . itEquipPict) $ \ _ _ -> mempty resetFire = set (creatures . ix cid . crInv . ix j . itUse . rUse) $ \_ -> explodeRemoteBomb itid i p' = _crPos cr +.+ rotateV (_crDir cr) (V2 (_crRad cr) 0) diff --git a/src/Dodge/LevelGen.hs b/src/Dodge/LevelGen.hs index 1025dd26b..fd1e3e591 100644 --- a/src/Dodge/LevelGen.hs +++ b/src/Dodge/LevelGen.hs @@ -10,6 +10,7 @@ import Dodge.Initialisation --import Dodge.LevelGen.Data import Dodge.Tree import Geometry.ConvexPoly +import Dodge.Combine.Graph --import Dodge.LevelGen.LevelStructure import Data.Foldable @@ -18,6 +19,7 @@ import System.Random import Control.Lens import Control.Monad.State import qualified Data.IntMap.Strict as IM +import qualified Data.Text.IO as TIO generateWorldFromSeed :: Int -> IO World generateWorldFromSeed i = do @@ -25,6 +27,7 @@ generateWorldFromSeed i = do writeFile "log/attemptedSeeds" "" writeFile "log/treeCluster" "" writeFile "log/aGeneratedRoomLayout" "" + TIO.writeFile "log/itemCombinations.gv" combinationsDotGraph (roomList,bounds) <- layoutLevelFromSeed 0 i return $ saveLevelStartSlot $ postGenerationProcessing diff --git a/src/ShapePicture.hs b/src/ShapePicture.hs index b48d94953..c81265ac8 100644 --- a/src/ShapePicture.hs +++ b/src/ShapePicture.hs @@ -1,15 +1,15 @@ {-# LANGUAGE TupleSections #-} module ShapePicture - ( emptyBlank - , translateSP + ( --emptyBlank + translateSP , translateSPf , translateSPz , rotateSP , SPic , noPic , noShape - , _spShape - , _spPicture +-- , _spShape +-- , _spPicture , mirrorSPyz , mirrorSPxz ) where @@ -25,37 +25,45 @@ type SPic = (Shape, Picture) -- should all this be inlined/inlinable? noPic :: Shape -> SPic +{-# INLINE noPic #-} noPic = (,mempty) noShape :: Picture -> SPic +{-# INLINE noShape #-} noShape = (mempty,) -_spShape :: SPic -> Shape -_spShape = fst -_spPicture :: SPic -> Picture -_spPicture = snd +--_spShape :: SPic -> Shape +--_spShape = fst +--_spPicture :: SPic -> Picture +--_spPicture = snd -emptyBlank :: SPic -emptyBlank = mempty +--emptyBlank :: SPic +--emptyBlank = mempty translateSPf :: Float -> Float -> SPic -> SPic +{-# INLINE translateSPf #-} translateSPf x y = bimap (translateSH (V3 x y 0)) (translate x y) translateSPz :: Float -> SPic -> SPic +{-# INLINE translateSPz #-} translateSPz z = bimap (translateSH (V3 0 0 z)) (translate3 (V3 0 0 z)) translateSP :: Point3 -> SPic -> SPic +{-# INLINE translateSP #-} translateSP v = bimap (translateSH v) (translate3 v) rotateSP :: Float -> SPic -> SPic +{-# INLINE rotateSP #-} rotateSP a = bimap (rotateSH a) (rotate a) mirrorSPxz :: SPic -> SPic +{-# INLINE mirrorSPxz #-} mirrorSPxz = bimap (S.map (over shVs reverse) . overPosSH flipy) mirrorxz where flipy (V3 x y z) = V3 x (negate y) z mirrorSPyz :: SPic -> SPic +{-# INLINE mirrorSPyz #-} mirrorSPyz = bimap (S.map (over shVs reverse) . overPosSH flipx) mirroryz where flipx (V3 x y z) = V3 (negate x) y z