diff --git a/src/Dodge/Combine.hs b/src/Dodge/Combine.hs index 630e2b7e7..2303c97a3 100644 --- a/src/Dodge/Combine.hs +++ b/src/Dodge/Combine.hs @@ -82,15 +82,14 @@ itemsMultisets = map mconcat . mapM itemMultisets -- "individual" items can produce multiple multisets if they are in fact -- a stack of more than one item itemMultisets :: (Int,Item) -> [([Int],M.Map CombineType Int)] -itemMultisets (i,it) = case it ^? itConsumption . itAmount' of +itemMultisets (i,it) = case it ^? itConsumption . itAmount of Nothing -> [ ([i], M.singleton thetype 1 ) ] Just n -> map (\k -> (replicate k i, M.singleton thetype k)) [1..n] where thetype = _itType it - itemTypeAmounts :: Item -> [[CombineType]] -itemTypeAmounts it = case it ^? itConsumption . itAmount' of +itemTypeAmounts it = case it ^? itConsumption . itAmount of Nothing -> [[thetype]] Just i -> map (`replicate` thetype) [1 .. i] where diff --git a/src/Dodge/Creature.hs b/src/Dodge/Creature.hs index ba96579ce..717c68111 100644 --- a/src/Dodge/Creature.hs +++ b/src/Dodge/Creature.hs @@ -13,7 +13,7 @@ module Dodge.Creature where --import Dodge.Creature.Stance.Data import Dodge.Creature.State.Data -import Dodge.Item.Weapon.Grenade +--import Dodge.Item.Weapon.Grenade import Dodge.Item.Weapon.Booster import Dodge.Item.Weapon.Utility import Dodge.Item.Weapon.Drone @@ -197,7 +197,7 @@ stackedInventory = IM.fromList $ zip [0..] ,boosterGun ,remoteLauncher ,flatShield - ,grenade +-- ,grenade ,spawnGun (lamp 5) ,lasGun ,flamer diff --git a/src/Dodge/Creature/HandPos.hs b/src/Dodge/Creature/HandPos.hs new file mode 100644 index 000000000..1d4153ca1 --- /dev/null +++ b/src/Dodge/Creature/HandPos.hs @@ -0,0 +1,6 @@ +module Dodge.Creature.HandPos where +import Dodge.Data +import Geometry + +crHandPos :: Creature -> Point3 +crHandPos cr = V3 0 0 20 diff --git a/src/Dodge/Creature/Picture.hs b/src/Dodge/Creature/Picture.hs index e89a36565..170dba997 100644 --- a/src/Dodge/Creature/Picture.hs +++ b/src/Dodge/Creature/Picture.hs @@ -85,7 +85,6 @@ creatureDisplayText cfig w cr a = argV v - 0.5 * pi (V2 x y) = campos +.+ v +.+ _crRad cr *.* normalizeV v - crDisplayAlert :: Creature -> String crDisplayAlert cr | isSuspicious = "?" diff --git a/src/Dodge/Creature/YourControl.hs b/src/Dodge/Creature/YourControl.hs index ee6458cd7..4f68c0df6 100644 --- a/src/Dodge/Creature/YourControl.hs +++ b/src/Dodge/Creature/YourControl.hs @@ -32,9 +32,22 @@ wasdWithAiming -> Creature -> Creature wasdWithAiming w speed i cr - | isAiming = set crDir mouseDir $ theMovement cr - | otherwise = theMovement $ theTurn cr + | isAiming + = addAnyTwist $ set crDir mouseDir $ theMovement cr + | (isReloading && SDL.ButtonRight `S.member` _mouseButtons w) + = addAnyTwist $ set crDir (mouseDir + anytwist) $ theMovement cr + | otherwise = theMovement $ theTurn $ removeTwist cr where + twistamount = 1.6 + removeTwist cr' = case _crTwist cr' of + t -> cr' & crDir +~ t & crTwist .~ 0 + anytwist = case cr ^? crInv . ix (_crInvSel (_creatures w IM.! i)) . itUse . useAim . aimStance of + Just TwoHandTwist -> twistamount * pi + _ -> 0 + addAnyTwist cr' + = case cr' ^? crInv . ix (_crInvSel (_creatures w IM.! i)) . itUse . useAim . aimStance of + Just TwoHandTwist -> cr' & crTwist .~ twistamount * pi + _ -> cr' theMovement | movDir == V2 0 0 = id | otherwise = crMvAbsolute (speed *.* movAbs) . set crMvDir dir @@ -43,6 +56,7 @@ wasdWithAiming w speed i cr dir = _cameraRot w + argV movDir movAbs = rotateV (_cameraRot w) $ normalizeV movDir isAiming = _posture (_crStance cr) == Aiming + isReloading = _posture (_crStance cr) == Reloading mouseDir = case w ^? creatures . ix i . crInv . ix (_crInvSel (_creatures w IM.! i)) . itAttachment of Just ItScope{_scopePos = p} -> normalizeAngle $ argV diff --git a/src/Dodge/Data.hs b/src/Dodge/Data.hs index 8422ac0ef..bb41ec1ba 100644 --- a/src/Dodge/Data.hs +++ b/src/Dodge/Data.hs @@ -219,6 +219,7 @@ data Creature = Creature , _crDir :: Float , _crOldDir :: Float , _crMvDir :: Float + , _crTwist :: Float , _crID :: Int , _crPict :: Creature -> Configuration -> World -> SPic , _crUpdate :: Creature -> World -> (Endo World, Maybe Creature) @@ -329,7 +330,7 @@ data ItemConsumption , _wpCharge :: Int } | ItemItselfConsumable - { _itAmount' :: Int + { _itAmount :: Int } | NoConsumption data Item @@ -337,7 +338,6 @@ data Item { _itName :: String , _itConsumption :: ItemConsumption , _itUse :: ItemUse - , _itFloorPict :: Item -> SPic , _itEquipPict :: Creature -> Int -> SPic , _itScroll :: Float -> Creature -> Item -> Item , _itType :: CombineType @@ -353,52 +353,57 @@ data Item , _itParams :: ItemParams , _itTweaks :: ItemTweaks } - | Equipment - { _itName :: String - , _itFloorPict :: Item -> SPic - , _itEquipPict :: Creature -> Int -> SPic --- , _itIdentity :: ItemIdentity - , _itEffect :: ItEffect - , _itID :: Maybe Int - , _itType :: CombineType - , _itZoom :: ItZoom - , _itInvSize :: Float - , _itInvDisplay :: Item -> [String] - , _itInvColor :: Color - , _itCurseStatus :: CurseStatus - , _itDimension :: ItemDimension - } - | Throwable - { _itName :: String - , _itMaxStack :: Int --- , _itAmount :: Int - , _itFloorPict :: Item -> SPic - , _twMaxRange :: Float - , _twAccuracy :: Float - , _itUse :: ItemUse --- , _itZoom :: ItZoom - , _itEquipPict :: Creature -> Int -> SPic - --, _itIdentity :: ItemIdentity - , _itID :: Maybe Int - , _itAttachment :: ItAttachment - , _itType :: CombineType - , _itInvSize :: Float - , _itInvDisplay :: Item -> [String] - , _itInvColor :: Color - , _itEffect :: ItEffect - , _itScroll :: Float -> Creature -> Item -> Item - , _itCurseStatus :: CurseStatus - , _itDimension :: ItemDimension - } +-- | Equipment +-- { _itName :: String +-- , _itFloorPict :: Item -> SPic +-- , _itEquipPict :: Creature -> Int -> SPic +---- , _itIdentity :: ItemIdentity +-- , _itEffect :: ItEffect +-- , _itID :: Maybe Int +-- , _itType :: CombineType +-- , _itZoom :: ItZoom +-- , _itInvSize :: Float +-- , _itInvDisplay :: Item -> [String] +-- , _itInvColor :: Color +-- , _itCurseStatus :: CurseStatus +-- , _itDimension :: ItemDimension +-- } +-- | Throwable +-- { _itName :: String +-- , _itMaxStack :: Int +---- , _itAmount :: Int +-- , _itFloorPict :: Item -> SPic +-- , _twMaxRange :: Float +-- , _twAccuracy :: Float +-- , _itUse :: ItemUse +---- , _itZoom :: ItZoom +-- , _itEquipPict :: Creature -> Int -> SPic +-- --, _itIdentity :: ItemIdentity +-- , _itID :: Maybe Int +-- , _itAttachment :: ItAttachment +-- , _itType :: CombineType +-- , _itInvSize :: Float +-- , _itInvDisplay :: Item -> [String] +-- , _itInvColor :: Color +-- , _itEffect :: ItEffect +-- , _itScroll :: Float -> Creature -> Item -> Item +-- , _itCurseStatus :: CurseStatus +-- , _itDimension :: ItemDimension +-- } -- | NoItem data ItemDimension = ItemDimension - { _itDim :: Point3 -- length width height - , _itRad :: Float - , _itHandle :: Point3 - , _itCenter :: Point3 - , _muzzleLength :: Float + { _dimRad :: Float + , _dimCenter :: Point3 + , _dimPortage :: ItemPortage + , _dimSPic :: Item -> SPic } +data ItemPortage + = HeldItem + { _handlePos :: Float + , _muzPos :: Float + } + | WornItem data ReloadType = ActiveClear @@ -913,3 +918,4 @@ makeLenses ''ItemParams makeLenses ''ItemTweaks makeLenses ''Maybe' makeLenses ''InventoryMode +makeLenses ''ItemPortage diff --git a/src/Dodge/Default.hs b/src/Dodge/Default.hs index fc1b62e19..56c4234ef 100644 --- a/src/Dodge/Default.hs +++ b/src/Dodge/Default.hs @@ -28,6 +28,7 @@ defaultCreature = Creature , _crDir = 0 , _crOldDir = 0 , _crMvDir = 0 + , _crTwist = 0 , _crID = 1 , _crPict = \_ _ _ -> (,) mempty blank , _crUpdate = \cr _ -> (Endo id , Just cr) @@ -131,20 +132,25 @@ defaultState = CrSt , _crDropsOnDeath = DropAll } defaultEquipment :: Item -defaultEquipment = Equipment +defaultEquipment = Item { _itCurseStatus = Uncursed , _itType = NOTDEFINED , _itName = "genericEquipment" -- ,_itIdentity = Generic - , _itFloorPict = \_ -> noShape $ setLayer 0 $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)] , _itEquipPict = \_ _ -> (,) emptySH blank , _itEffect = NoItEffect , _itID = Nothing - , _itZoom = defaultItZoom , _itInvColor = yellow , _itInvDisplay = \it -> [_itName it] , _itInvSize = 1 - , _itDimension = defaultItemDimension + , _itDimension = defItDimCol yellow + , _itConsumption = NoConsumption + , _itUse = NoUse + , _itScroll = \ _ _ -> id + , _itAttachment = NoItAttachment + , _itParams = NoParams + , _itTweaks = NoTweaks + , _itTargeting = Nothing } defaultItZoom :: ItZoom defaultItZoom = ItZoom 20 0.2 1 @@ -155,19 +161,18 @@ defaultConsumable = Item , _itInvSize = 1 , _itCurseStatus = Uncursed , _itName = "genericConsumable" - , _itConsumption = ItemItselfConsumable {_itAmount' = 1} - , _itFloorPict = \_ -> noShape $ onLayer FlItLayer $ color blue $ circleSolid 3 + , _itConsumption = ItemItselfConsumable {_itAmount = 1} , _itEquipPict = \_ _ -> mempty , _itID = Nothing , _itInvColor = blue - , _itInvDisplay = \it -> [_itName it ++ " x" ++ show (_itAmount' $ _itConsumption it)] + , _itInvDisplay = \it -> [_itName it ++ " x" ++ show (_itAmount $ _itConsumption it)] , _itEffect = NoItEffect , _itScroll = \_ _ -> id , _itAttachment = NoItAttachment , _itType = NoCombineType , _itTargeting = Nothing , _itParams = NoParams - , _itDimension = defaultItemDimension + , _itDimension = defItDimCol blue , _itTweaks = NoTweaks } defaultApplyDamage :: [DamageType] -> Creature -> (World -> World, Creature) diff --git a/src/Dodge/Default/Weapon.hs b/src/Dodge/Default/Weapon.hs index fc639da0f..1f5c76a19 100644 --- a/src/Dodge/Default/Weapon.hs +++ b/src/Dodge/Default/Weapon.hs @@ -86,14 +86,9 @@ defaultGun = Item { _itName = "default" , _itType = NoCombineType , _itCurseStatus = Uncursed --- , _itIdentity = Pistol , _itConsumption = defaultAmmo , _itUse = defaultrUse - , _itFloorPict = const $ noPic $ colorSH green (prismPoly - (map (addZ 3) $ rectNESW 3 3 (-3) (-3)) - (map (addZ 0) $ rectNESW 5 3 (-5) (-7)) - ) --- , _itZoom = ItZoom 20 0.2 1 + , _itDimension = defItDimCol white , _itEquipPict = pictureWeaponOnAim , _itScroll = \_ _ -> id , _itAttachment = NoItAttachment @@ -104,7 +99,6 @@ defaultGun = Item , _itInvSize = 1 , _itTargeting = Nothing , _itParams = NoParams - , _itDimension = defaultItemDimension , _itTweaks = NoTweaks } defaultCraftable :: Item @@ -115,10 +109,6 @@ defaultCraftable = Item -- , _itIdentity = Generic , _itConsumption = NoConsumption , _itUse = NoUse - , _itFloorPict = const $ noPic $ colorSH green (prismPoly - (map (addZ 3) $ rectNESW 3 3 (-3) (-3)) - (map (addZ 0) $ rectNESW 5 3 (-5) (-7)) - ) -- , _itZoom = ItZoom 20 0.2 1 , _itEquipPict = pictureWeaponOnAim , _itScroll = \_ _ -> id @@ -130,16 +120,28 @@ defaultCraftable = Item , _itInvSize = 1 , _itTargeting = Nothing , _itParams = NoParams - , _itDimension = defaultItemDimension + , _itDimension = defItDimCol green , _itTweaks = NoTweaks } -defaultItemDimension :: ItemDimension -defaultItemDimension = ItemDimension - { _itDim = V3 4 4 4 - , _itRad = 10 - , _itHandle = V3 2 2 2 - , _itCenter = V3 2 2 2 - , _muzzleLength = 5 -- how much the item projects out from the cr radius when aiming +defItDim :: ItemDimension +defItDim = ItemDimension + { _dimRad = 2 + , _dimCenter = V3 0 0 0 + , _dimPortage = HeldItem + { _handlePos = 0 + , _muzPos = 0 + } + , _dimSPic = const $ noPic $ colorSH green $ upperPrismPoly 3 $ square 4 + } +defItDimCol :: Color -> ItemDimension +defItDimCol col = ItemDimension + { _dimRad = 2 + , _dimCenter = V3 0 0 0 + , _dimPortage = HeldItem + { _handlePos = 0 + , _muzPos = 0 + } + , _dimSPic = const $ noPic $ colorSH col $ upperPrismPoly 3 $ square 4 } defaultAutoGun :: Item diff --git a/src/Dodge/FloorItem.hs b/src/Dodge/FloorItem.hs index a67af85ce..c3cde7a50 100644 --- a/src/Dodge/FloorItem.hs +++ b/src/Dodge/FloorItem.hs @@ -21,14 +21,14 @@ copyItemToFloorID pos it w = (,) flid $ w' & floorItems %~ IM.insert flid theflit & updateLocation where - (p',w') = findWallFreeDropPoint (_itRad $ _itDimension it) pos w + (p',w') = findWallFreeDropPoint (_dimRad $ _itDimension it) pos w rot = fst . randomR (-pi,pi) $ _randGen w updateLocation = case it ^? itID of Just (Just i') -> itemPositions . ix i' .~ OnFloor flid _ -> id flid = IM.newKey $ _floorItems w theflit = FlIt - {_flIt = it & itConsumption . itAmount' %~ const 1 + {_flIt = it & itConsumption . itAmount %~ const 1 ,_flItPos = p' ,_flItRot = rot ,_flItID = flid diff --git a/src/Dodge/Inventory.hs b/src/Dodge/Inventory.hs index eaff6ff15..3f9bbc45d 100644 --- a/src/Dodge/Inventory.hs +++ b/src/Dodge/Inventory.hs @@ -46,8 +46,8 @@ import Control.Lens rmInvItem :: Int -- ^ Creature id -> Int -- ^ Inventory position -> World -> World -rmInvItem cid invid w = case w ^? creatures . ix cid . crInv . ix invid . itConsumption . itAmount' of - Just x | x > 1 -> w & creatures . ix cid . crInv . ix invid . itConsumption . itAmount' %~ subtract 1 +rmInvItem cid invid w = case w ^? creatures . ix cid . crInv . ix invid . itConsumption . itAmount of + Just x | x > 1 -> w & creatures . ix cid . crInv . ix invid . itConsumption . itAmount %~ subtract 1 _ -> w & creatures . ix cid . crInv %~ f & creatures . ix cid . crInvSel %~ g & creatures . ix cid . crLeftInvSel . _Just %~ g diff --git a/src/Dodge/Inventory/Add.hs b/src/Dodge/Inventory/Add.hs index c2d731ada..59334da96 100644 --- a/src/Dodge/Inventory/Add.hs +++ b/src/Dodge/Inventory/Add.hs @@ -11,7 +11,7 @@ putItemInInvID cid flid w = fromMaybe w $ tryPutItemInInv cid (_floorItems w IM.! flid) w putItemInInvSlot :: Int -> Item -> IM.IntMap Item -> IM.IntMap Item -putItemInInvSlot = IM.insertWith (const $ itConsumption . itAmount' +~ 1) +putItemInInvSlot = IM.insertWith (const $ itConsumption . itAmount +~ 1) {- | Pick up a specific item. -} tryPutItemInInv :: Int -> FloorItem -> World -> Maybe World diff --git a/src/Dodge/Inventory/ItemSpace.hs b/src/Dodge/Inventory/ItemSpace.hs index 798daef0c..c7035fb30 100644 --- a/src/Dodge/Inventory/ItemSpace.hs +++ b/src/Dodge/Inventory/ItemSpace.hs @@ -4,6 +4,6 @@ import Dodge.Data import Control.Lens itSlotsTaken :: Item -> Int -itSlotsTaken it = case it ^? itConsumption . itAmount' of +itSlotsTaken it = case it ^? itConsumption . itAmount of Nothing -> ceiling (_itInvSize it) Just i -> ceiling (_itInvSize it * fromIntegral i) diff --git a/src/Dodge/Item.hs b/src/Dodge/Item.hs index c6ea91630..3430a724f 100644 --- a/src/Dodge/Item.hs +++ b/src/Dodge/Item.hs @@ -12,8 +12,6 @@ keyToken :: Int -> Item keyToken n = defaultEquipment { _itType = NOTDEFINED , _itName = "KEYTOKEN "++show n - , _itMaxStack = 5 - , _itFloorPict = \_ -> (,) emptySH $ setDepth 0.5 keyPic , _itEquipPict = \_ _ -> (,) emptySH $ setDepth 0 $ translate (-5) (-5) $ rotate (pi/2.5) keyPic , _itEffect = NoItEffect , _itID = Nothing @@ -32,8 +30,6 @@ latchkey :: Int -> Item latchkey n = defaultEquipment { _itType = NOTDEFINED , _itName = "KEY "++show n - , _itMaxStack = 1 - , _itFloorPict = \_ -> (,) emptySH $ setDepth 0.5 latchkeyPic , _itEquipPict = \_ _ -> (,) emptySH $ setDepth 0 $ translate (-5) (-5) $ rotate (pi/2.5) latchkeyPic , _itEffect = NoItEffect , _itID = Nothing diff --git a/src/Dodge/Item/Consumable.hs b/src/Dodge/Item/Consumable.hs index 354d2da15..ae747040f 100644 --- a/src/Dodge/Item/Consumable.hs +++ b/src/Dodge/Item/Consumable.hs @@ -21,7 +21,6 @@ medkit i = defaultConsumable ,_useDelay = NoDelay ,_useHammer = HasHammer HammerUp } - , _itFloorPict = \_ -> (,) emptySH $ setLayer 0 . onLayer FlItLayer . color blue $ circleSolid 3 , _itEquipPict = pictureItem $ (,) emptySH $ color blue $ circleSolid 3 , _itID = Nothing } diff --git a/src/Dodge/Item/Draw.hs b/src/Dodge/Item/Draw.hs index 838b9091c..14e9b9c19 100644 --- a/src/Dodge/Item/Draw.hs +++ b/src/Dodge/Item/Draw.hs @@ -7,14 +7,17 @@ import ShapePicture import qualified Data.IntMap.Strict as IM import Control.Lens +import Data.Maybe pictureWeaponOnAim :: Creature -> Int -- ^ Position of item in inventory -> SPic -pictureWeaponOnAim cr i = pictureWeaponOnAimItem pic cr i +pictureWeaponOnAim cr i = pictureWeaponOnAimItem (itSPic it) cr i where it = _crInv cr IM.! i - pic = _itFloorPict it it + +itSPic :: Item -> SPic +itSPic it = _dimSPic (_itDimension it) it pictureWeaponOnAim' :: (Item -> SPic) @@ -40,7 +43,7 @@ pictureWeaponOnAimItem -> Creature -> Int -- ^ Position of item in inventory -> SPic -pictureWeaponOnAimItem p cr posInInv +pictureWeaponOnAimItem p' cr posInInv | isSelected && _posture (_crStance cr) == Aiming && isTwisting = shoulderD twistWep | isSelected && _posture (_crStance cr) == Aiming && isOneHand @@ -59,15 +62,20 @@ pictureWeaponOnAimItem p cr posInInv handD = translateSPz 15 isSelected = _crInvSel cr == posInInv drawnWep = translateSPf (1.2 * _crRad cr) 0 p - twistWep = translateSPf (0.5 * _crRad cr) 0 p - oneHandWep = translateSPf (1.5 * _crRad cr) 0 p - holsteredWep = translateSPf (_crRad cr) 0 (rotateSP (strideRot cr + 1.2) p) + twistWep = translateSPf (-5) 0 p + oneHandWep = translateSPf 14 0 p + holsteredWep = translateSPf (_crRad cr) 0 + (rotateSP (strideRot cr + 1.2) (translateSPf (-5) 0 twistWep)) holsteredTwoFlat = translateSPf (_crRad cr) 0 (rotateSP (twoFlatHRot cr) p) - holsteredOneHandWep = translateSPf (_crRad cr * 0.7 + handPos) (_crRad cr * negate 0.7) p + holsteredOneHandWep = translateSPf (_crRad cr * 0.7 + handPos) (_crRad cr * negate 0.7) + (translateSPf (-2) 0 p) handPos = case cr^? crStance . carriage of Just (Walking x LeftForward) -> f x * 50 _ -> 0 theIt = _crInv cr IM.! posInInv + p = fromMaybe p' $ do + x <- theIt ^? itDimension . dimPortage . handlePos + return $translateSPf (-x) 0 p' isTwisting = theIt ^? itUseAimStance == Just TwoHandTwist isOneHand = theIt ^? itUseAimStance == Just OneHand isTwoHandFlat = theIt ^? itUseAimStance == Just TwoHandFlat diff --git a/src/Dodge/Item/Equipment.hs b/src/Dodge/Item/Equipment.hs index 5772b01e9..67fc8443a 100644 --- a/src/Dodge/Item/Equipment.hs +++ b/src/Dodge/Item/Equipment.hs @@ -20,7 +20,6 @@ magShield :: Item magShield = defaultEquipment { _itType = MAGSHIELD , _itName = "MAGSHIELD" - , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)] , _itEquipPict = \_ _ -> (,) emptySH blank , _itID = Nothing } @@ -28,7 +27,6 @@ flameShield :: Item flameShield = defaultEquipment { _itType = FLAMESHIELD , _itName = "FLAMESHIELD" - , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)] , _itEquipPict = \cr _ -> (,) emptySH $ onLayer CrLayer $ pictures [color cyan $ circle (_crRad cr+2)] , _itID = Nothing } @@ -37,10 +35,10 @@ frontArmour :: Item frontArmour = defaultEquipment { _itType = FRONTARMOUR , _itName = "FARMOUR" - , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ translate 0 (-5) $ pictures - [color (greyN 0.1) $ thickArc 0 (pi/2) 10 5 - ,color (greyN 0.1) $ thickArc (3*pi/2) (2*pi) 10 5 - ] +-- , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ translate 0 (-5) $ pictures +-- [color (greyN 0.1) $ thickArc 0 (pi/2) 10 5 +-- ,color (greyN 0.1) $ thickArc (3*pi/2) (2*pi) 10 5 +-- ] , _itEquipPict = \_ _ -> (,) emptySH $ onLayer CrLayer $ pictures [color (greyN 0.1) $ thickArc 0 (pi/2) 10 5 ,color (greyN 0.1) $ thickArc (3*pi/2) (2*pi) 10 5 @@ -133,7 +131,6 @@ jetPack :: Item jetPack = defaultEquipment { _itType = JETPACK , _itName = "JETPACK" - , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ color yellow $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)] , _itEquipPict = \_ _ -> (,) emptySH $ onLayer CrLayer $ pictures [color yellow $ polygon $ rectNSEW 5 (-5) (-3) (-11) ] , _itEffect = NoItEffect diff --git a/src/Dodge/Item/Weapon/BatteryGuns.hs b/src/Dodge/Item/Weapon/BatteryGuns.hs index a6c9aac04..b65680b68 100644 --- a/src/Dodge/Item/Weapon/BatteryGuns.hs +++ b/src/Dodge/Item/Weapon/BatteryGuns.hs @@ -37,7 +37,6 @@ teslaGun :: Item teslaGun = defaultGun { _itName = "TESLA" , _itType = TESLAGUN --- , _itIdentity = TeslaGun , _itConsumption = defaultAmmo { _ammoMax = 200 , _ammoLoaded = 200 @@ -51,16 +50,23 @@ teslaGun = defaultGun ] & useAim . aimSpeed .~ 0.4 & useAim . aimStance .~ TwoHandFlat - , _itFloorPict = teslaGunPic + , _itDimension = ItemDimension + { _dimRad = 9 + , _dimCenter = V3 4 0 0 + , _dimPortage = HeldItem + {_handlePos = 4 + ,_muzPos = 4 + } + , _dimSPic = teslaGunPic + } } teslaGunPic :: Item -> SPic teslaGunPic _ = noPic $ colorSH blue $ - upperPrismPoly 5 (rectNESW xb y xa (-y)) - ++ upperPrismPoly 5 (rectNESW (-xa) y (-xb) (-y)) + upperPrismPoly 5 (rectNESW xb 8 xa 0) + ++ upperPrismPoly 5 (rectNESW (-xa) 8 (-xb) 0) where xa = 1 xb = 9 - y = 4 lasGun :: Item lasGun = defaultAutoGun { _itName = "LASGUN ////" @@ -79,13 +85,29 @@ lasGun = defaultAutoGun & useAim . aimSpeed .~ 0.4 & useAim . aimRange .~ 1 & useAim . aimStance .~ TwoHandTwist - , _itFloorPict = lasGunPic , _itParams = Refracting {_phaseV = 1} , _itTweaks = Tweakable { _tweakParams = IM.fromList [(0,lasGunTweak)] , _tweakSel = 0 } + , _itDimension = ItemDimension + { _dimRad = 10 + , _dimCenter = V3 15 0 0 + , _dimPortage = HeldItem 5 30 + , _dimSPic = lasGunPic + } } +lasGunPic :: Item -> SPic +lasGunPic it = + ( colorSH blue $ + upperPrismPoly 4 (rectNESW 3 30 1 0) + <> upperPrismPoly 4 (rectNESW (-1) 30 (-3) 0) + <> upperPrismPoly 1 (rectNESW 3 30 (-3) 0) + , setLayer 1 . color col . setDepth 1.1 . polygon $ rectNESW 1 30 (-1) 0 + ) + where + amFrac = fractionLoadedAmmo it + col = brightX 2 1.5 $ mixColors amFrac (1-amFrac) green red lasGunTweak :: TweakParam lasGunTweak = TweakParam { _doTweak = thetweak @@ -104,21 +126,9 @@ lasGunTweak = TweakParam showPhaseV 2 = "Z" showPhaseV i = "THIS SHOULD NOT BE POSSIBLE" ++ show i -lasGunPic :: Item -> SPic -lasGunPic it = - ( colorSH blue $ - upperPrismPoly 4 (rectNESW 3 15 1 (-15)) - <> upperPrismPoly 4 (rectNESW (-1) 15 (-3) (-15)) - -- <> (upperPrismPoly 4 $ rectNESW (5) l (-5) (l-2)) - <> upperPrismPoly 1 (rectNESW 3 15 (-3) (-15)) - , setLayer 1 . color col . setDepth 1.1 . polygon $ rectNESW 1 15 (-1) (-15) - ) - where - amFrac = fractionLoadedAmmo it - col = brightX 2 1.5 $ mixColors amFrac (1-amFrac) green red tractorGun :: Item -tractorGun = defaultAutoGun +tractorGun = lasGun { _itName = "TRACTORGUN" , _itType = TRACTORGUN , _itConsumption = defaultAmmo @@ -132,11 +142,7 @@ tractorGun = defaultAutoGun & useAim . aimSpeed .~ 0.4 & useAim . aimRange .~ 1 & useAim . aimStance .~ TwoHandTwist - , _itFloorPict = tractorGunSPic } --- TODO own picture for tractor gun -tractorGunSPic :: Item -> SPic -tractorGunSPic = lasGunPic aTeslaArc :: Creature -> World -> World aTeslaArc cr w = set randGen g w diff --git a/src/Dodge/Item/Weapon/Bezier.hs b/src/Dodge/Item/Weapon/Bezier.hs index 40c8dd7d2..48bcdbf32 100644 --- a/src/Dodge/Item/Weapon/Bezier.hs +++ b/src/Dodge/Item/Weapon/Bezier.hs @@ -37,7 +37,7 @@ bezierGun = defaultGun & useAim . aimRange .~ 0 & useAim . aimStance .~ TwoHandTwist -- & useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5} - , _itFloorPict = bezierGunSPic +-- , _itFloorPict = bezierGunSPic , _itAttachment = NoItAttachment , _itScroll = \_ _ -> removeItTarget , _itEffect = rbSetTarget diff --git a/src/Dodge/Item/Weapon/Booster.hs b/src/Dodge/Item/Weapon/Booster.hs index 347615676..3ebda9b48 100644 --- a/src/Dodge/Item/Weapon/Booster.hs +++ b/src/Dodge/Item/Weapon/Booster.hs @@ -119,7 +119,6 @@ boosterGun = defaultGun , _reloadTime = 20 } , _itUse = luseInstantNoH $ boostSelfL 10 - , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-2,-2),(-2,2),(2,2),(2,0),(0,0),(0,-2)] , _itEffect = resetAttachmentID } resetAttachmentID :: ItEffect diff --git a/src/Dodge/Item/Weapon/BulletGuns.hs b/src/Dodge/Item/Weapon/BulletGuns.hs index 4fc479e50..518a3a11b 100644 --- a/src/Dodge/Item/Weapon/BulletGuns.hs +++ b/src/Dodge/Item/Weapon/BulletGuns.hs @@ -89,7 +89,7 @@ autoGun = defaultAutoGun & useAim . aimRange .~ 1 & useAim . aimStance .~ TwoHandTwist & useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5} - , _itFloorPict = autoGunPic +-- , _itFloorPict = autoGunPic -- , _itZoom = defaultItZoom , _itEquipPict = pictureWeaponOnAim , _itAttachment = ItCharMode $ Seq.fromList "MS" @@ -139,9 +139,8 @@ bangStick i = defaultGun , spreadLoaded , withRecoilI 25 ] - , _itFloorPict = pistolPic -- , _itZoom = defaultItZoom - , _itEquipPict = pictureWeaponAim pistolPic +-- , _itEquipPict = pictureWeaponAim pistolPic , _itID = Nothing , _itInvColor = white , _itTargeting = Nothing @@ -157,6 +156,15 @@ bangStick i = defaultGun } , _itTweaks = defaultBulletSelTweak , _itInvSize = fromIntegral i / 3 + , _itDimension = ItemDimension + { _dimRad = 5 + , _dimCenter = V3 5 0 0 + , _dimPortage = HeldItem + {_handlePos = 5 + ,_muzPos = 10 + } + , _dimSPic = const $ noPic $ colorSH green $ upperPrismPoly 3 $ rectXH 10 2 + } } bangCane :: Item bangCane = defaultGun @@ -184,8 +192,16 @@ bangCane = defaultGun , withMuzFlareI , withRecoilI 50 ] - , _itFloorPict = autoGunPic , _itTweaks = defaultBulletSelTweak + , _itDimension = ItemDimension + { _dimRad = 8 + , _dimCenter = V3 5 0 0 + , _dimPortage = HeldItem + {_handlePos = 5 + ,_muzPos = 20 + } + , _dimSPic = const $ noPic $ colorSH red $ upperPrismPoly 3 $ rectXH 15 2 + } } & itUse . useAim . aimSpeed .~ 0.4 & itUse . useAim . aimRange .~ 1 & itUse . useAim . aimStance .~ OneHand @@ -198,16 +214,27 @@ bangCaneX i = bangCane [ ammoHammerCheck , useTimeCheck , withSoundItemChoiceStart bangStickSoundChoice - , useAmmoAmount 1 - , torqueAfterI 0.2 + , useAllAmmo + , torqueAfterI 0.5 , duplicateLoadedBarrels , applyInaccuracy , withMuzFlareI , withRecoilI 50 ] + , _itDimension = ItemDimension + { _dimRad = 8 + , _dimCenter = V3 5 0 0 + , _dimPortage = HeldItem + {_handlePos = 5 + ,_muzPos = 15 + } + , _dimSPic = const $ noPic $ colorSH red $ foldMap + (\y -> upperPrismPoly 3 $ map (+.+ V2 0 y) $ rectXH 15 2) + $ map (\k -> fromIntegral k * 5 - ((fromIntegral i - 1) * 2.5)) [0..i-1] + } } & itUse . useAim . aimSpeed .~ 0.4 & itUse . useAim . aimRange .~ 1 - & itUse . useAim . aimStance .~ TwoHandTwist + & itUse . useAim . aimStance .~ TwoHandFlat & itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5} & itConsumption . ammoMax .~ i & itParams . gunBarrels .~ MultiBarrel @@ -218,6 +245,16 @@ bangCaneX i = bangCane rifle :: Item rifle = bangCane + { _itDimension = ItemDimension + { _dimRad = 8 + , _dimCenter = V3 5 0 0 + , _dimPortage = HeldItem + {_handlePos = 5 + ,_muzPos = 25 + } + , _dimSPic = const $ noPic $ colorSH red $ upperPrismPoly 3 $ rectXH 25 2 + } + } & itUse . useAim . aimStance .~ TwoHandTwist & itName .~ "RIFLE" & itType .~ RIFLE @@ -269,12 +306,20 @@ bangRod = bangCane , withMuzFlareI , withRecoilI 50 ] - , _itFloorPict = longGunSPic + , _itDimension = ItemDimension + { _dimRad = 12 + , _dimCenter = V3 5 0 0 + , _dimPortage = HeldItem + {_handlePos = 5 + ,_muzPos = 30 + } + , _dimSPic = const $ noPic $ colorSH orange $ upperPrismPoly 3 $ rectXH 30 2 + } } & itConsumption . reloadType .~ ActiveClear & itUse . useAim . aimSpeed .~ 0.2 & itUse . useAim . aimRange .~ 1 - & itUse . useAim . aimStance .~ OneHand + & itUse . useAim . aimStance .~ TwoHandTwist & itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5} elephantGun :: Item elephantGun = bangRod @@ -358,7 +403,16 @@ bangCone = defaultGun , _bore = 5 , _gunBarrels = SingleBarrel 0.5 } - , _itFloorPict = spreadGunPic + , _itDimension = ItemDimension + { _dimRad = 8 + , _dimCenter = V3 5 0 0 + , _dimPortage = HeldItem + {_handlePos = 5 + ,_muzPos = 15 + } + , _dimSPic = const $ noPic $ colorSH cyan $ upperPrismPoly 3 (rectXH 5 2) + <> upperPrismPoly 6 (rectNSEW 4 (-4) 15 5) + } , _itTweaks = defaultBulletSelTweak } coneRandItemParams :: State StdGen ItemParams @@ -392,6 +446,16 @@ blunderbuss = bangCone ] & useAim . aimStance .~ TwoHandTwist & useAim . aimSpeed .~ 0.4 + , _itDimension = ItemDimension + { _dimRad = 8 + , _dimCenter = V3 5 0 0 + , _dimPortage = HeldItem + {_handlePos = 5 + ,_muzPos = 30 + } + , _dimSPic = const $ noPic $ colorSH cyan $ upperPrismPoly 3 (rectXH 20 2) + <> upperPrismPoly 6 (rectNSEW 4 (-4) 30 20) + } } grapeShotCannon :: Item @@ -480,9 +544,8 @@ pistol = defaultGun } , _itUse = useAmmoParamsRate 6 upHammer (ammoHammerCheck : pistolAfterHamMods) - , _itFloorPict = pistolPic -- , _itZoom = defaultItZoom - , _itEquipPict = pictureWeaponAim pistolPic +-- , _itEquipPict = pictureWeaponAim pistolPic , _itID = Nothing , _itInvColor = white , _itTargeting = Nothing @@ -494,14 +557,14 @@ pistol = defaultGun } , _itTweaks = defaultBulletSelTweak } -pistolPic :: Item -> SPic -pistolPic it = noPic $ colorSH green (prismPoly - (map (addZ 3) $ rectNESW 3 3 (-3) (-3)) - (map (addZ 0) $ rectNESW 5 3 (-5) (-7)) - ) - <> translateSH (V3 (-4) 5.5 4) (rotateSH pi $ bulletClip am) - where - am = _ammoLoaded $ _itConsumption it +--pistolPic :: Item -> SPic +--pistolPic it = noPic $ colorSH green (prismPoly +-- (map (addZ 3) $ rectNESW 3 3 (-3) (-3)) +-- (map (addZ 0) $ rectNESW 5 3 (-5) (-7)) +-- ) +-- <> translateSH (V3 (-4) 5.5 4) (rotateSH pi $ bulletClip am) +-- where +-- am = _ammoLoaded $ _itConsumption it bulletClip :: Int -> Shape bulletClip x = rotateSHx (negate $ pi/4) . upperPrismPoly 2 $ rectNESW 3 0 (3 - 0.25 * am) (-5) @@ -530,7 +593,7 @@ hvAutoGun = defaultAutoGun & useAim . aimStance .~ TwoHandTwist & useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5} & useDelay .~ VariableRate {_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0} - , _itFloorPict = hvAutoGunPic +-- , _itFloorPict = hvAutoGunPic , _itInvSize = 3 , _itInvDisplay = \it -> head (basicItemDisplay it) : ["* FIRERATE: *" @@ -585,7 +648,7 @@ ltAutoGun = defaultAutoGun , withSidePushI 50 , modClock 2 withMuzFlareI ] - , _itFloorPict = ltAutoGunPic +-- , _itFloorPict = ltAutoGunPic , _itParams = BulletShooter { _muzVel = 1 , _rifling = 0.8 @@ -594,7 +657,6 @@ ltAutoGun = defaultAutoGun } , _itTweaks = defaultBulletSelTweak } - & itDimension . muzzleLength .~ 10 ltAutoGunPic :: Item -> SPic ltAutoGunPic it = ( colorSH green $ prismPoly @@ -652,7 +714,7 @@ miniGun = defaultAutoGun & useAim . aimRange .~ 1 & useAim . aimStance .~ TwoHandTwist & useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5} - , _itFloorPict = miniGunPictItem +-- , _itFloorPict = miniGunPictItem , _itParams = BulletShooter { _muzVel = 1 , _rifling = 0.9 @@ -673,7 +735,7 @@ miniGun = defaultAutoGun -- [" " ++ replicate 8 ch -- ," " ++ replicate 2 ch ++ fromMaybe " " (maybeWarmupStatus it) ++ replicate 2 ch -- ," " ++ replicate 8 ch] - } & itDimension . muzzleLength .~ 15 + } where --ch = '*' recoilAmount = 5 @@ -744,7 +806,7 @@ spreadGun = defaultGun ,_brlInaccuracy = 0 } } - , _itFloorPict = spreadGunPic +-- , _itFloorPict = spreadGunPic , _itTweaks = defaultBulletSelTweak } spreadGunPic :: Item -> SPic @@ -780,7 +842,7 @@ multGun = defaultGun & useAim . aimRange .~ 1 & useAim . aimStance .~ TwoHandTwist & useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5} - , _itFloorPict = multGunSPic +-- , _itFloorPict = multGunSPic , _itParams = BulletShooter { _muzVel = 1 , _rifling = 0.9 @@ -833,7 +895,7 @@ longGun = defaultGun & useAim . aimRange .~ 1 & useAim . aimStance .~ TwoHandTwist & useAim . aimZoom .~ defaultItZoom {_itZoomMax = 0.5, _itZoomMin = 0.5} - , _itFloorPict = longGunSPic +-- , _itFloorPict = longGunSPic -- , _itZoom = defaultItZoom , _itScroll = zoomLongGun , _itAttachment = ItScope (V2 0 0) 0 1 False diff --git a/src/Dodge/Item/Weapon/Drone.hs b/src/Dodge/Item/Weapon/Drone.hs index 987253f83..27c32ab48 100644 --- a/src/Dodge/Item/Weapon/Drone.hs +++ b/src/Dodge/Item/Weapon/Drone.hs @@ -37,7 +37,6 @@ lasDrones = defaultGun & useAim . aimSpeed .~ 0.2 & useAim . aimRange .~ 0.5 & useAim . aimStance .~ TwoHandTwist - , _itFloorPict = lasDronesPic , _itEffect = NoItEffect } diff --git a/src/Dodge/Item/Weapon/Grenade.hs b/src/Dodge/Item/Weapon/Grenade.hs index 7a49bfadc..55b3a18e9 100644 --- a/src/Dodge/Item/Weapon/Grenade.hs +++ b/src/Dodge/Item/Weapon/Grenade.hs @@ -3,16 +3,16 @@ module Dodge.Item.Weapon.Grenade import Dodge.Data import Dodge.Picture.Layer import Dodge.WorldEvent.Explosion -import Dodge.Item.Weapon.TriggerType +--import Dodge.Item.Weapon.TriggerType import Dodge.Item.Weapon.Remote import Dodge.Default -import Dodge.Default.Weapon +--import Dodge.Default.Weapon import Dodge.Base import Dodge.Zone import Dodge.SoundLogic import Dodge.Item.Draw -import Dodge.Item.Weapon.InventoryDisplay -import Dodge.Item.Attachment +--import Dodge.Item.Weapon.InventoryDisplay +--import Dodge.Item.Attachment import Picture import Geometry import ShapePicture @@ -22,33 +22,34 @@ import qualified IntMapHelp as IM import Data.Maybe import Control.Lens -grenade :: Item -grenade = Throwable - { _itName = "GRENADE " ++ show fuseTime - , _itType = GRENADE - , _itInvSize = 1 - , _itDimension = defaultItemDimension - , _itCurseStatus = Uncursed - , _itMaxStack = 8 - , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)] - , _twMaxRange = 150 - , _twAccuracy = 30 - , _itUse = ruseRate 25 (\_ -> throwGrenade makeExplosionAt) upHammer - [ useTimeCheck - ] - & useAim . aimZoom .~ defaultItZoom {_itZoomMax = f fuseTime, _itZoomMin = f fuseTime} --- , _itZoom = defaultItZoom - , _itEquipPict = pictureWeaponOnAim' $ \_ -> grenadePic fuseTime - , _itID = Nothing - , _itAttachment = ItFuse fuseTime - , _itInvColor = white - , _itInvDisplay = basicItemDisplay - , _itEffect = NoItEffect - , _itScroll = changeFuse - } - where - fuseTime = 50 - f x = 50 / fromIntegral x +--grenade :: Item +--grenade = Item +-- { _itName = "GRENADE " ++ show fuseTime +-- , _itType = GRENADE +-- , _itInvSize = 1 +-- , _itDimension = defaultItemDimension +-- , _itCurseStatus = Uncursed +-- , _itConsumption = ItemItselfConsumable 1 +---- , _itMaxStack = 8 +-- , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)] +-- , _twMaxRange = 150 +-- , _twAccuracy = 30 +-- , _itUse = ruseRate 25 (\_ -> throwGrenade makeExplosionAt) upHammer +-- [ useTimeCheck +-- ] +-- & useAim . aimZoom .~ defaultItZoom {_itZoomMax = f fuseTime, _itZoomMin = f fuseTime} +---- , _itZoom = defaultItZoom +-- , _itEquipPict = pictureWeaponOnAim' $ \_ -> grenadePic fuseTime +-- , _itID = Nothing +-- , _itAttachment = ItFuse fuseTime +-- , _itInvColor = white +-- , _itInvDisplay = basicItemDisplay +-- , _itEffect = NoItEffect +-- , _itScroll = changeFuse +-- } +-- where +-- fuseTime = 50 +-- f x = 50 / fromIntegral x moveGrenade :: Prop -> World -> World moveGrenade pj w @@ -207,22 +208,22 @@ setRemoteBombScope itid pj w' = case _itemPositions w' IM.! itid of .~ (defaultItZoom {_itZoomMax = 0.5, _itZoomMin = 0.5}) _ -> w' -defaultThrowable :: Item -defaultThrowable = grenade -remoteBomb :: Item -remoteBomb = defaultThrowable - { _itName = "REMOTEBOMB" - , _itType = REMOTEBOMB - , _itMaxStack = 1 - , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 - [(-3,-3),(-3,3),(3,3),(3,-3)] - , _twMaxRange = 150 - , _twAccuracy = 30 - , _itUse = ruseRate 25 (const throwRemoteBomb) upHammer - [ hammerCheckI ] - , _itAttachment = ItScope (V2 0 0) 0 1 True - , _itEquipPict = pictureWeaponOnAim' $ \_ -> (,) emptySH remoteBombUnarmedPic - } +--defaultThrowable :: Item +--defaultThrowable = grenade +--remoteBomb :: Item +--remoteBomb = defaultThrowable +-- { _itName = "REMOTEBOMB" +-- , _itType = REMOTEBOMB +-- , _itMaxStack = 1 +-- , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 +-- [(-3,-3),(-3,3),(3,3),(3,-3)] +-- , _twMaxRange = 150 +-- , _twAccuracy = 30 +-- , _itUse = ruseRate 25 (const throwRemoteBomb) upHammer +-- [ hammerCheckI ] +-- , _itAttachment = ItScope (V2 0 0) 0 1 True +-- , _itEquipPict = pictureWeaponOnAim' $ \_ -> (,) emptySH remoteBombUnarmedPic +-- } throwRemoteBomb :: Creature -> World -> World @@ -293,7 +294,7 @@ retireRemoteBomb :: Int -> Int -> Int -> World -> World retireRemoteBomb itid 0 pjid w = w & pointToItem (_itemPositions w IM.! itid) %~ ( (itAttachment . scopePos .~ V2 0 0) - . (itZoom .~ defaultItZoom) +-- . (itZoom .~ defaultItZoom) . (itUse . rUse .~ const throwRemoteBomb) ) & props %~ IM.delete pjid diff --git a/src/Dodge/Item/Weapon/InventoryDisplay.hs b/src/Dodge/Item/Weapon/InventoryDisplay.hs index 91a7b6815..136e15f41 100644 --- a/src/Dodge/Item/Weapon/InventoryDisplay.hs +++ b/src/Dodge/Item/Weapon/InventoryDisplay.hs @@ -25,7 +25,7 @@ basicItemDisplay it = Prelude.take (itSlotsTaken it) $ Nothing' -> show (_ammoLoaded am) Just' x -> show x ++ "R" ++ show (_ammoLoaded am) Just am@ChargeableAmmo{} -> show $ _wpCharge am - Just x@ItemItselfConsumable{} -> "x" ++ show (_itAmount' x) + Just x@ItemItselfConsumable{} -> "x" ++ show (_itAmount x) Just NoConsumption -> "NOCONSUMPTION" Nothing -> "" theparam = fromMaybe [] diff --git a/src/Dodge/Item/Weapon/Launcher.hs b/src/Dodge/Item/Weapon/Launcher.hs index 5eb19a9e9..68baa9328 100644 --- a/src/Dodge/Item/Weapon/Launcher.hs +++ b/src/Dodge/Item/Weapon/Launcher.hs @@ -57,7 +57,6 @@ launcher = defaultGun & useAim . aimSpeed .~ 0.2 & useAim . aimRange .~ 0.5 & useAim . aimStance .~ TwoHandTwist - , _itFloorPict = launcherPic , _itEffect = NoItEffect , _itParams = ShellLauncher { _shellSpinDrag = 1 @@ -70,7 +69,23 @@ launcher = defaultGun } , _itInvSize = 3 , _itInvDisplay = basicItemDisplay + , _itDimension = ItemDimension + { _dimRad = 9 + , _dimCenter = V3 10 0 0 + , _dimPortage = HeldItem + {_handlePos = 5 + ,_muzPos = 20 + } + , _dimSPic = launcherPic + } } +launcherPic :: Item -> SPic +launcherPic _ = + ( colorSH cyan $ prismPoly + (map (+.+.+ V3 20 0 5) $ polyCircx 4 5) + (map (+.+.+ V3 0 0 5) $ polyCircx 4 5) + , mempty + ) defaultShellAmmo :: AmmoType defaultShellAmmo = ProjectileAmmo @@ -79,13 +94,6 @@ defaultShellAmmo = ProjectileAmmo , _amPjDraw = const mempty } -launcherPic :: Item -> SPic -launcherPic _ = - ( colorSH cyan $ prismPoly - (map (+.+.+ V3 10 0 4.5) $ polyCircx 4 5) - (map (+.+.+ V3 (-10) 0 4.5) $ polyCircx 4 5) - , mempty - ) basicAmPjMoves :: IM.IntMap TweakParam basicAmPjMoves = IM.fromList . zip [0..] $ @@ -254,7 +262,7 @@ trySpinByCID cid i pj w = w & props . ix pjid . pjSpin .~ newSpin remoteLauncher :: Item -remoteLauncher = defaultGun +remoteLauncher = launcher { _itName = "ROCKO-REM" , _itType = LAUNCHER , _itConsumption = defaultAmmo @@ -274,7 +282,6 @@ remoteLauncher = defaultGun & useAim . aimSpeed .~ 0.2 & useAim . aimRange .~ 0.5 & useAim . aimStance .~ TwoHandTwist - , _itFloorPict = launcherPic , _itAttachment = ItScope (V2 0 0) 0 1 True -- , _itParams = ShellLauncher -- { _tweakSel = 0 diff --git a/src/Dodge/Item/Weapon/Radar.hs b/src/Dodge/Item/Weapon/Radar.hs index 8a8fa575a..ee0385e8a 100644 --- a/src/Dodge/Item/Weapon/Radar.hs +++ b/src/Dodge/Item/Weapon/Radar.hs @@ -31,7 +31,6 @@ radar = defaultGun ] & useAim . aimRange .~ 1 & useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1} - , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ color blue $ polygon $ rectNESW 5 5 (-5) (-5) -- , _itZoom = defaultItZoom { _itZoomMax = 1} , _itEquipPict = pictureWeaponOnAim' $ \_ -> (,) emptySH $ color blue $ polygon $ rectNESW 5 5 (-5) (-5) } @@ -51,8 +50,6 @@ sonar = defaultGun ] & useAim . aimRange .~ 1 & useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1} - , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ color blue $ polygon $ rectNESW 5 5 (-5) (-5) --- , _itZoom = defaultItZoom {_itZoomMax = 1} , _itEquipPict = pictureWeaponOnAim' $ \_ -> (,) emptySH $ color blue $ polygon $ rectNESW 5 5 (-5) (-5) } {- | @@ -61,12 +58,9 @@ autoSonar :: Item autoSonar = defaultEquipment { _itType = RADAR , _itName = "AUTOSONAR" - , _itMaxStack = 1 - , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ color yellow $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)] , _itEquipPict = \_ _ -> (,) emptySH blank , _itEffect = autoSonarEffect , _itID = Nothing --- , _itZoom = defaultItZoom {_itZoomMax = 1} } {- | Automatically sends out pulses that display walls. -} @@ -74,10 +68,7 @@ autoRadar :: Item autoRadar = defaultEquipment { _itType = RADAR , _itName = "AUTORADAR" - , _itMaxStack = 1 - , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ color yellow $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)] , _itEquipPict = \_ _ -> (,) emptySH blank , _itEffect = autoRadarEffect , _itID = Nothing --- , _itZoom = defaultItZoom {_itZoomMax = 1} } diff --git a/src/Dodge/Item/Weapon/SprayGuns.hs b/src/Dodge/Item/Weapon/SprayGuns.hs index 0d9f772f3..68daaa74b 100644 --- a/src/Dodge/Item/Weapon/SprayGuns.hs +++ b/src/Dodge/Item/Weapon/SprayGuns.hs @@ -52,8 +52,21 @@ poisonSprayer = defaultAutoGun { _nozzleSpread = 0.2 , _nozzleNum = 3 } - , _itFloorPict = flamerPic +-- , _itFloorPict = flamerPic } +flamerPic :: Item -> SPic +flamerPic it = + ( colorSH yellow $ + translateSHf tx ty (upperPrismPoly tz $ polyCirc 3 r) + ++ upperPrismPoly 5 (rectNESW 2 9 (-2) (-9)) + , color black $ translate3 (V3 tx ty (tz+0.01)) $ circleSolid (r * am) + ) + where + tx = - 5 + ty = - 6 + tz = 3 + r = 5 + am = fractionLoadedAmmo2 it flamer :: Item flamer = defaultAutoGun { _itName = "FLAMER" @@ -73,7 +86,7 @@ flamer = defaultAutoGun & useAim . aimSpeed .~ 0.5 & useAim . aimZoom .~ defaultItZoom {_itZoomMax = 5, _itZoomMin = 1.5} & useAim . aimStance .~ TwoHandTwist - , _itFloorPict = flamerPic +-- , _itFloorPict = flamerPic -- , _itZoom = defaultItZoom , _itAttachment = NoItAttachment , _itParams = AngleWalk @@ -82,19 +95,6 @@ flamer = defaultAutoGun ,_currentWalkAngle = 0 } } -flamerPic :: Item -> SPic -flamerPic it = - ( colorSH yellow $ - translateSHf tx ty (upperPrismPoly tz $ polyCirc 3 r) - ++ upperPrismPoly 5 (rectNESW 2 9 (-2) (-9)) - , color black $ translate3 (V3 tx ty (tz+0.01)) $ circleSolid (r * am) - ) - where - tx = - 5 - ty = - 6 - tz = 3 - r = 5 - am = fractionLoadedAmmo2 it aGasCloud :: Creature -> World -> World aGasCloud cr w = insertCloud $ set randGen g w where diff --git a/src/Dodge/Item/Weapon/TriggerType.hs b/src/Dodge/Item/Weapon/TriggerType.hs index 439af161f..49aed375d 100644 --- a/src/Dodge/Item/Weapon/TriggerType.hs +++ b/src/Dodge/Item/Weapon/TriggerType.hs @@ -53,6 +53,7 @@ import Dodge.Reloading import Dodge.WorldEvent import Dodge.RandomHelp import Dodge.Inventory.Lock +import Dodge.Creature.HandPos --import Dodge.Default import Sound.Data import Geometry @@ -353,14 +354,13 @@ modClock n chainEff eff it cr w withMuzFlareI :: ChainEffect withMuzFlareI f it cr w = makeTlsTimeRadColPos 3 100 (V3 1 1 0.5) flashPos - . muzFlareAt (V4 5 5 0 2) flarePos dir + . muzFlareAt (V4 5 5 0 2) flarePos cdir $ f it cr w where - --pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr) - flarePos = addZ 20 $ _crPos cr +.+ (_crRad cr + itLength) *.* unitVectorAtAngle dir - flashPos = addZ 35 $ _crPos cr +.+ (2.5 * _crRad cr) *.* unitVectorAtAngle dir - dir = _crDir cr - itLength = _muzzleLength $ _itDimension it + flarePos = addZ 0 (_crPos cr) +.+.+ rotate3z cdir muzzleOffset + flashPos = addZ 0 (_crPos cr) +.+.+ rotate3z cdir (muzzleOffset +.+.+ V3 5 0 5) + muzzleOffset = V3 (_muzPos (_dimPortage (_itDimension it))) 0 0 + cdir = _crDir cr {- | Applies the effect to a randomly rotated creature, - rotation amount given by inaccuracy in itParams -} applyInaccuracy :: ChainEffect diff --git a/src/Dodge/Item/Weapon/Utility.hs b/src/Dodge/Item/Weapon/Utility.hs index ed439c136..429e09146 100644 --- a/src/Dodge/Item/Weapon/Utility.hs +++ b/src/Dodge/Item/Weapon/Utility.hs @@ -63,7 +63,7 @@ shrinkGun = defaultGun } , _itUse = defaultlUse {_lUse = hammerCheckL useShrinkGun} & useHammer .~ upHammer - , _itFloorPict = shrinkGunPic +-- , _itFloorPict = shrinkGunPic , _itAttachment = ItBool True } @@ -94,7 +94,7 @@ blinkGun = defaultGun , _itUse = defaultlUse {_lUse = hammerCheckL $ shootL aSelfL } & useHammer .~ upHammer - , _itFloorPict = const . noPic . colorSH chartreuse $ upperPrismPoly 2 $ square 2 +-- , _itFloorPict = const . noPic . colorSH chartreuse $ upperPrismPoly 2 $ square 2 } @@ -125,7 +125,7 @@ forceFieldGun = defaultGun , _reloadState = Nothing' } , _itUse = undefined - , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-4,-4),(-4,4),(4,4),(4,0),(0,0),(0,-4)] +-- , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-4,-4),(-4,4),(4,4),(4,0),(0,0),(0,-4)] } -- grapGun = defaultGun -- { _itName = "grapGun" diff --git a/src/Dodge/Placement/Instance/Turret.hs b/src/Dodge/Placement/Instance/Turret.hs index 5b88ee9fd..053306489 100644 --- a/src/Dodge/Placement/Instance/Turret.hs +++ b/src/Dodge/Placement/Instance/Turret.hs @@ -9,6 +9,7 @@ import Dodge.WorldEvent.Explosion import Dodge.Item.Weapon.BatteryGuns import Dodge.SoundLogic.LoadSound import Dodge.SoundLogic +import Dodge.Item.Draw import Geometry import ShapePicture import Shape @@ -85,7 +86,7 @@ drawTurret :: Machine -> SPic drawTurret mc = (rotateSH (-_mcDir mc) . colorSH blue $ upperPrismPoly 20 (square wdth) , mempty -- setLayer 5 $ scale 0.5 0.5 $ text $ show $ _mcDir mc ) ) - <> translateSPz 20 (_itFloorPict it it) + <> translateSPz 20 (itSPic it) where it = _tuWeapon $ _mcType mc diff --git a/src/Dodge/Render/ShapePicture.hs b/src/Dodge/Render/ShapePicture.hs index 11648d2e9..85eedfd88 100644 --- a/src/Dodge/Render/ShapePicture.hs +++ b/src/Dodge/Render/ShapePicture.hs @@ -12,6 +12,7 @@ import Dodge.SoundLogic.LoadSound import Dodge.Graph import Dodge.GameRoom import Dodge.Update.Camera +import Dodge.Item.Draw --import Dodge.Zone import Geometry import ShapePicture @@ -62,7 +63,7 @@ ppDraw c = uncurryV translate (_ppPos c) $ rotate (_ppRot c) (_ppPict c) floorItemSPic :: FloorItem -> SPic floorItemSPic flit = uncurryV translateSPf (_flItPos flit) - $ rotateSP (_flItRot flit) (_itFloorPict (_flIt flit) (_flIt flit)) + $ rotateSP (_flItRot flit) (itSPic (_flIt flit)) btSPic :: Button -> SPic btSPic bt = uncurryV translateSPf (_btPos bt)