diff --git a/src/Dodge/Creature.hs b/src/Dodge/Creature.hs index 6d03b3eee..6686f6bcb 100644 --- a/src/Dodge/Creature.hs +++ b/src/Dodge/Creature.hs @@ -167,7 +167,7 @@ startCr = defaultCreature {- | Items you start with. -} startInvList :: [Item] startInvList = - [shrinkGun + [ ] startInventory :: IM.IntMap Item startInventory = IM.fromList $ zip [0..defaultInvSize -1] $ startInvList ++ repeat NoItem diff --git a/src/Dodge/Creature/Action.hs b/src/Dodge/Creature/Action.hs index 98944e422..1dfba881e 100644 --- a/src/Dodge/Creature/Action.hs +++ b/src/Dodge/Creature/Action.hs @@ -225,20 +225,12 @@ youDropItem w = case yourItem w ^? itCurseStatus of where cr = you w {- | Copy an inventory item to the floor. -} -copyInvItemToFloor - :: Creature - -> Int -- ^ Inventory position - -> World - -> World +copyInvItemToFloor :: Creature -> Int -> World -> World copyInvItemToFloor cr i w = case _crInv cr IM.! i of NoItem -> w it -> copyItemToFloor (_crPos cr) it w {- | Copy an item to the floor. -} -copyItemToFloor - :: Point2 - -> Item - -> World - -> World +copyItemToFloor :: Point2 -> Item -> World -> World copyItemToFloor pos it w = w' & floorItems %~ IM.insert flid theflit & updateLocation diff --git a/src/Dodge/Default/Weapon.hs b/src/Dodge/Default/Weapon.hs index 33aee4869..984c949a2 100644 --- a/src/Dodge/Default/Weapon.hs +++ b/src/Dodge/Default/Weapon.hs @@ -3,8 +3,12 @@ module Dodge.Default.Weapon import Dodge.Data import Dodge.Item.Weapon.ExtraEffect import Dodge.Item.Weapon.InventoryDisplay +import Dodge.Item.Draw import Picture import ShapePicture +import Shape +import Geometry.Vector3D +import Geometry import Linear.V3 defaultGun :: Item @@ -30,12 +34,15 @@ defaultGun = Weapon , _wpSpread = 0.02 , _wpRange = 20 , _itHammer = HammerUp - , _itFloorPict = const emptyBlank + , _itFloorPict = const $ noPic $ colorSH green (prismPoly + (map (addZ 3) $ rectNESW 3 3 (-3) (-3)) + (map (addZ 0) $ rectNESW 5 3 (-5) (-7)) + ) , _itAimingSpeed = 1 , _itAimingRange = 0 , _itZoom = ItZoom 20 0.2 1 , _itAimZoom = ItZoom 20 0.2 1 - , _itEquipPict = \_ _ -> emptyBlank + , _itEquipPict = pictureWeaponOnAim , _itScroll = \_ _ -> id , _itAttachment = NoItAttachment , _itID = Nothing diff --git a/src/Dodge/Item/Draw.hs b/src/Dodge/Item/Draw.hs index ddedbb708..77613033c 100644 --- a/src/Dodge/Item/Draw.hs +++ b/src/Dodge/Item/Draw.hs @@ -8,11 +8,20 @@ import ShapePicture import qualified Data.IntMap.Strict as IM import Control.Lens pictureWeaponOnAim + :: Creature + -> Int -- ^ Position of item in inventory + -> SPic +pictureWeaponOnAim cr i = pictureWeaponOnAimItem pic cr i + where + it = _crInv cr IM.! i + pic = _itFloorPict it it + +pictureWeaponOnAim' :: (Item -> SPic) -> Creature -> Int -- ^ Position of item in inventory -> SPic -pictureWeaponOnAim f cr i = pictureWeaponOnAimItem pic cr i +pictureWeaponOnAim' f cr i = pictureWeaponOnAimItem pic cr i where pic = f (_crInv cr IM.! i) diff --git a/src/Dodge/Item/Equipment.hs b/src/Dodge/Item/Equipment.hs index d31ab70f4..cbddf029f 100644 --- a/src/Dodge/Item/Equipment.hs +++ b/src/Dodge/Item/Equipment.hs @@ -50,7 +50,7 @@ frontArmour = defaultEquipment } flatShield :: Item flatShield = defaultEquipment - { _itEquipPict = pictureWeaponOnAim flatShieldEquipSPic + { _itEquipPict = pictureWeaponOnAim' flatShieldEquipSPic , _itAimStance = TwoHandFlat , _itEffect = effectOnOffEquip createShieldWall removeShieldWall , _itName = "SHIELD" diff --git a/src/Dodge/Item/Weapon.hs b/src/Dodge/Item/Weapon.hs index c13e41d8b..02ae41a88 100644 --- a/src/Dodge/Item/Weapon.hs +++ b/src/Dodge/Item/Weapon.hs @@ -164,7 +164,7 @@ remoteBomb = defaultThrowable [ hammerCheckI ] , _itAttachment = ItScope (V2 0 0) 0 1 True - , _itEquipPict = pictureWeaponOnAim $ \_ -> (,) emptySH remoteBombUnarmedPic + , _itEquipPict = pictureWeaponOnAim' $ \_ -> (,) emptySH remoteBombUnarmedPic } @@ -219,7 +219,7 @@ explodeRemoteBomb itid pjid cr w cid = _crID cr resetName = set (creatures . ix cid . crInv . ix j . itName) "REMOTEBOMB" resetPict = set (creatures . ix cid . crInv . ix j . itEquipPict ) - (pictureWeaponOnAim $ \_ -> (,) emptySH remoteBombUnarmedPic) + (pictureWeaponOnAim' $ \_ -> (,) emptySH remoteBombUnarmedPic) -- resetScope = creatures . ix cid . crInv . ix j . itScope . _Just . scopePos .~ (0,0) j = _crInvSel $ _creatures w IM.! cid remoteBombPic @@ -269,7 +269,7 @@ radar = defaultGun , _itAimingRange = 1 , _itZoom = defaultItZoom { _itZoomMax = 1} , _itAimZoom = defaultItZoom { _itZoomMax = 1} - , _itEquipPict = pictureWeaponOnAim $ \_ -> (,) emptySH $ color blue $ polygon $ rectNESW 5 5 (-5) (-5) + , _itEquipPict = pictureWeaponOnAim' $ \_ -> (,) emptySH $ color blue $ polygon $ rectNESW 5 5 (-5) (-5) } {- | Sends out pulses that display creatures. -} @@ -293,7 +293,7 @@ sonar = defaultGun , _itAimingRange = 1 , _itZoom = defaultItZoom {_itZoomMax = 1} , _itAimZoom = defaultItZoom {_itZoomMax = 1} - , _itEquipPict = pictureWeaponOnAim $ \_ -> (,) emptySH $ color blue $ polygon $ rectNESW 5 5 (-5) (-5) + , _itEquipPict = pictureWeaponOnAim' $ \_ -> (,) emptySH $ color blue $ polygon $ rectNESW 5 5 (-5) (-5) } {- | Automatically sends out pulses that display creatures. -} diff --git a/src/Dodge/Item/Weapon/BatteryGuns.hs b/src/Dodge/Item/Weapon/BatteryGuns.hs index f48051cc6..2038aa326 100644 --- a/src/Dodge/Item/Weapon/BatteryGuns.hs +++ b/src/Dodge/Item/Weapon/BatteryGuns.hs @@ -59,7 +59,6 @@ teslaGun = defaultGun , _itAimingSpeed = 0.4 , _itZoom = defaultItZoom , _itAimingRange = 0 - , _itEquipPict = pictureWeaponOnAim teslaGunPic } teslaGunPic :: Item -> SPic teslaGunPic _ = @@ -95,7 +94,6 @@ lasGun = defaultAutoGun , _itFloorPict = lasGunPic , _itAimingSpeed = 0.4 , _itAimingRange = 1 - , _itEquipPict = pictureWeaponOnAim lasGunPic , _itAttachment = ItCharMode $ Seq.fromList "/VZ" , _itScroll = scrollCharMode , _itInvDisplay = basicWeaponDisplay @@ -132,7 +130,6 @@ tractorGun = defaultAutoGun , _itFloorPict = tractorGunSPic , _itAimingSpeed = 0.4 , _itAimingRange = 0.5 - , _itEquipPict = pictureWeaponOnAim tractorGunSPic } -- TODO own picture for tractor gun tractorGunSPic :: Item -> SPic diff --git a/src/Dodge/Item/Weapon/Bezier.hs b/src/Dodge/Item/Weapon/Bezier.hs index 97bf04ed9..ec96d1273 100644 --- a/src/Dodge/Item/Weapon/Bezier.hs +++ b/src/Dodge/Item/Weapon/Bezier.hs @@ -35,7 +35,6 @@ bezierGun = defaultGun . torqueBefore 0.05 ] , _itFloorPict = bezierGunSPic - , _itEquipPict = pictureWeaponOnAim bezierGunSPic , _itAttachment = NoItAttachment , _itScroll = \_ _ -> removeItTarget , _itHammer = HammerUp diff --git a/src/Dodge/Item/Weapon/BulletGuns.hs b/src/Dodge/Item/Weapon/BulletGuns.hs index a6a781673..d8776c12f 100644 --- a/src/Dodge/Item/Weapon/BulletGuns.hs +++ b/src/Dodge/Item/Weapon/BulletGuns.hs @@ -66,7 +66,7 @@ autoGun = defaultAutoGun , _itAimingRange = 1 , _itZoom = defaultItZoom , _itAimZoom = defaultItZoom {_itZoomFac = 1.5} - , _itEquipPict = pictureWeaponOnAim autoGunPic + , _itEquipPict = pictureWeaponOnAim , _itAttachment = ItCharMode $ Seq.fromList "MS" , _itScroll = scrollCharMode , _itInvDisplay = basicWeaponDisplay @@ -118,14 +118,11 @@ pistol = defaultGun , _wpAmmo = basicBullet } pistolPic :: Item -> SPic -pistolPic it = - ( colorSH green (prismPoly +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) - , mempty - ) where am = loadedAmmo it @@ -156,7 +153,6 @@ hvAutoGun = defaultAutoGun , _itFloorPict = hvAutoGunPic , _itAimingSpeed = 0.2 , _itAimingRange = 1 - , _itEquipPict = pictureWeaponOnAim hvAutoGunPic , _wpAmmo = hvBullet } hvAutoGunPic :: Item -> SPic @@ -197,7 +193,6 @@ ltAutoGun = defaultAutoGun , _itAimingSpeed = 1 , _itAimingRange = 0 , _itZoom = defaultItZoom - , _itEquipPict = pictureWeaponOnAim ltAutoGunPic , _itAimStance = OneHand , _wpAmmo = ltBullet } @@ -330,7 +325,6 @@ spreadGun = defaultGun , _itFloorPict = spreadGunPic , _itAimingSpeed = 1 , _itAimingRange = 0 - , _itEquipPict = pictureWeaponOnAim spreadGunPic , _wpAmmo = basicBullet , _wpNumBarrels = 50 } @@ -370,7 +364,6 @@ multGun = defaultGun , _itAimingRange = 1 , _itZoom = defaultItZoom , _itAimZoom = defaultItZoom {_itZoomFac = 1.5} - , _itEquipPict = pictureWeaponOnAim multGunSPic , _itAimStance = TwoHandTwist , _wpAmmo = basicBullet , _wpNumBarrels = 5 @@ -418,7 +411,6 @@ longGun = defaultGun , _itAimingRange = 1 , _itZoom = defaultItZoom , _itAimZoom = defaultItZoom {_itZoomMax = 0.5, _itZoomMin = 0.5} - , _itEquipPict = pictureWeaponOnAim longGunSPic , _itScroll = zoomLongGun , _itAttachment = ItScope (V2 0 0) 0 1 False , _itEffect = itemLaserScopeEffect diff --git a/src/Dodge/Item/Weapon/Grenade.hs b/src/Dodge/Item/Weapon/Grenade.hs index 7bc846ac9..a544ed928 100644 --- a/src/Dodge/Item/Weapon/Grenade.hs +++ b/src/Dodge/Item/Weapon/Grenade.hs @@ -39,7 +39,7 @@ grenade = Throwable , _itAimingRange = 0 , _itZoom = defaultItZoom , _itAimZoom = defaultItZoom {_itZoomMax = f fuseTime, _itZoomMin = f fuseTime} - , _itEquipPict = pictureWeaponOnAim $ \_ -> grenadePic fuseTime + , _itEquipPict = pictureWeaponOnAim' $ \_ -> grenadePic fuseTime , _itID = Nothing , _itUseRate = 25 , _itUseTime = 0 @@ -131,7 +131,7 @@ throwArmReset x = ItInvEffect {_itInvEffect = f ,_itEffectCounter = x } counterDown it | _itEffectCounter (_itEffect it) == 0 = it & itHammer .~ HammerUp - & itEquipPict .~ pictureWeaponOnAim (\_ -> grenadePic 50) + & itEquipPict .~ pictureWeaponOnAim' (\_ -> grenadePic 50) | otherwise = it & itEffect . itEffectCounter -~ 1 --flameGrenade :: Item diff --git a/src/Dodge/Item/Weapon/Launcher.hs b/src/Dodge/Item/Weapon/Launcher.hs index 30d7c8318..a6861127e 100644 --- a/src/Dodge/Item/Weapon/Launcher.hs +++ b/src/Dodge/Item/Weapon/Launcher.hs @@ -56,7 +56,6 @@ launcher = defaultGun , _itFloorPict = launcherPic , _itAimingSpeed = 0.2 , _itAimingRange = 0.5 - , _itEquipPict = pictureWeaponOnAim launcherPic , _itHammer = NoHammer , _itEffect = NoItEffect , _wpAmmo = defaultShellAmmo @@ -256,7 +255,6 @@ remoteLauncher = defaultGun , _itFloorPict = launcherPic , _itAimingSpeed = 0.2 , _itAimingRange = 0.5 - , _itEquipPict = pictureWeaponOnAim launcherPic , _itAttachment = ItScope (V2 0 0) 0 1 True , _itAimStance = TwoHandTwist } diff --git a/src/Dodge/Item/Weapon/SprayGuns.hs b/src/Dodge/Item/Weapon/SprayGuns.hs index fece80a07..90580d617 100644 --- a/src/Dodge/Item/Weapon/SprayGuns.hs +++ b/src/Dodge/Item/Weapon/SprayGuns.hs @@ -54,7 +54,6 @@ poisonSprayer = defaultAutoGun , _itAimingSpeed = 0.2 , _itAimingRange = 0 , _itZoom = defaultItZoom - , _itEquipPict = pictureWeaponOnAim flamerPic , _wpSpread = 0.1 , _wpNumBarrels = 3 } @@ -82,7 +81,6 @@ flamer = defaultAutoGun , _itAimingRange = 0 , _itZoom = defaultItZoom , _itAimZoom = defaultItZoom {_itZoomMax = 5, _itZoomMin = 1.5} - , _itEquipPict = pictureWeaponOnAim flamerPic , _itAttachment = NoItAttachment } flamerPic :: Item -> SPic diff --git a/src/Dodge/Room/Corridor.hs b/src/Dodge/Room/Corridor.hs index ba2fa7a07..98c4cb211 100644 --- a/src/Dodge/Room/Corridor.hs +++ b/src/Dodge/Room/Corridor.hs @@ -37,8 +37,8 @@ keyholeCorridor = corridor , midWall $ rectNSEW top bot 25 40] } where - top = 55 - bot = 25 + top = 65 + bot = 15 corridorN :: Room corridorN = defaultRoom