Correctly display held root item

This commit is contained in:
2024-11-26 17:05:13 +00:00
parent 7d0f44a041
commit e1f5049e0f
9 changed files with 16 additions and 67 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
-1
View File
@@ -134,7 +134,6 @@ data LWorld = LWorld
, _foregroundShapes :: IM.IntMap ForegroundShape
, _corpses :: IM.IntMap Corpse
, _lightSources :: IM.IntMap LightSource
-- , _tempLightSources :: [TempLightSource]
, _lights :: [LSParam]
, _seenLocations :: IM.IntMap (WdP2, String)
, _selLocation :: Int
+1 -1
View File
@@ -17,7 +17,7 @@ import ShapePicture
itemEquipPict :: Creature -> LabelDoubleTree ItemLink ComposedItem -> SPic
itemEquipPict cr itmtree = case itm ^. itUse of
UseHeld{} | itm ^? itLocation . ilIsRoot == Just True
&& itm ^? itLocation . ilIsSelected == Just True
&& itm ^? itLocation . ilInvID == cr ^? crManipulation . manObject . imRootSelectedItem
-> overPosSP (heldItemOffset itm cr) (itemTreeSPic itmtree)
ituse -> fold $ do
attachpos <- ituse ^? uequipEffect . eeAttachPos
+1
View File
@@ -168,6 +168,7 @@ joinItemsInList f xs = snd $ h (xs, [])
Nothing -> h (ys, y : z : zs)
Just w -> h (w : ys, zs)
-- this puts the first elements in the intmap at the end of the list
invLDT :: IM.IntMap Item -> [LabelDoubleTree ItemLink PartiallyComposedItem]
invLDT =
joinItemsInList (leftRightCombine leftIsParentCombine rightIsParentCombine) . IM.elems
+2 -2
View File
@@ -28,7 +28,7 @@ teslaGun =
& itUse . heldDelay .~ NoDelay
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimStance .~ TwoHandFlat
& itUse . heldAim . aimMuzzles . ix 0 . mzPos .~ V2 4 0
& itUse . heldAim . aimMuzzles . ix 0 . mzPos .~ V2 10 0
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0
& itUse . heldAim . aimMuzzles . ix 0 . mzFlareType .~ TeslaGunFlare
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleTesla
@@ -44,7 +44,7 @@ laser =
& itAmmoSlots .~ singleAmmo ElectricalAmmo
& itUse . heldDelay .~ NoDelay
& itUse . heldTriggerType .~ AutoTrigger
& itUse . heldAim . aimMuzzles . ix 0 . mzPos .~ V2 4 0
& itUse . heldAim . aimMuzzles . ix 0 . mzPos .~ V2 6 0
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0
& itUse . heldAim . aimMuzzles . ix 0 . mzFlareType .~ LasGunFlare
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleLaser
+2 -59
View File
@@ -12,33 +12,11 @@ import Dodge.Material.Sound
import Dodge.WorldEvent.Sound
import Geometry.Data
import Geometry.Vector
import Geometry.Vector3D
import LensHelp
lsPosRad :: Point3 -> Float -> LightSource
lsPosRad = lsColPosRad 0.75
--tlsTimeRadFunPos :: Int -> Float -> TLSIntensity -> Point3 -> TempLightSource
--tlsTimeRadFunPos t rmax intensityF p =
-- TLS
-- { _tlsParam =
-- LSParam
-- { _lsPos = p
-- , _lsRad = rmax
-- , _lsCol = 0 -- intensityF t
-- }
-- , _tlsUpdate = IntensityTLS intensityF
-- , _tlsTime = t
-- }
-- where
-- upF tls
-- | _tlsTime tls <= 0 = Nothing
-- | otherwise = Just $ tls
-- & tlsTime -~ 1
-- & tlsParam . lsCol .~ f (intensityF (_tlsTime tls) )
-- f x' = V3 x' x' x'
lsColPosID :: Point3 -> Point3 -> Int -> LightSource
lsColPosID col p i = lsColPos col p & lsID .~ i
@@ -51,33 +29,6 @@ lsPosCol pos col = lsColPos col pos
lsColPosRad :: Point3 -> Point3 -> Float -> LightSource
lsColPosRad col p r = LS 0 $ LSParam p r col
--lsRadCol :: Float -> Point3 -> LightSource
--lsRadCol r col =
-- defaultLS & lsParam . lsRad .~ r
-- & lsParam . lsCol .~ col
--tlsTimeRadColPos ::
-- Int ->
-- -- | maximal radius
-- Float ->
-- Point3 ->
-- Point3 ->
-- TempLightSource
--tlsTimeRadColPos t rmax col (V3 x y z) =
-- TLS
-- { _tlsParam =
-- LSParam
-- { _lsPos = V3 x y z
-- , _lsRad = rmax
-- , _lsCol = col
-- }
-- , _tlsUpdate = TimerTLS
-- , _tlsTime = t
-- }
--
--makeTlsTimeRadColPos :: Int -> Float -> Point3 -> Point3 -> World -> World
--makeTlsTimeRadColPos i rad (V3 r g b) p = cWorld . lWorld . tempLightSources .:~ tlsTimeRadColPos i rad (V3 r g b) p
destroyLS :: Int -> World -> World
destroyLS lsid w =
w
@@ -89,14 +40,6 @@ destroyLS lsid w =
p3 = _lsPos $ _lsParam ls
destroyLSFlashAt :: Point3 -> World -> World
destroyLSFlashAt (V3 x' y' z') =
destroyLSFlashAt x =
cWorld . lWorld . worldEvents .:~ MakeTempLight
(LSParam (addZ z' p) 150 1) 20
-- cWorld . lWorld . tempLightSources
-- .:~ tlsTimeRadFunPos
-- 20
-- 150
-- (TLSFade 1 10)
-- (addZ z' p)
where
p = V2 x' y'
(LSParam x 150 1) 20
-1
View File
@@ -16,7 +16,6 @@ lightsToRender :: Configuration -> Camera -> LWorld -> [(Point3, Float, Point3)]
lightsToRender cfig campos w = take (fromEnum $ cfig ^. graphics_num_shadow_casters) $
sortOn (\(_,x,_) -> negate x) $
mapMaybe getLS (IM.elems $ w ^. lightSources)
-- ++ mapMaybe getTLS (w ^. tempLightSources)
++ mapMaybe getlsparam (w ^. lights)
where
getLS = getlsparam . _lsParam
+8 -1
View File
@@ -24,7 +24,14 @@ import Dodge.Data.Universe
import qualified IntMapHelp as IM
testStringInit :: Universe -> [String]
testStringInit u = [show $ length <$> u ^.. uvWorld . cWorld . lWorld . lights]
testStringInit u = [show $ u ^? uvWorld . cWorld . lWorld . creatures . ix 0 .
crManipulation . manObject . imRootSelectedItem]
-- fromMaybe mempty $ do
-- cr <- u ^? uvWorld . cWorld . lWorld . creatures . ix 0
-- let itms = IM.elems $ cr ^. crInv
-- return $ map (show . (^? itLocation . ilIsSelected)) itms
--return . foldMap (prettyLDT (show . (^. _1 . itType))) . invLDT $ _crInv cr
-- [ show $ u ^? uvWorld . input . mouseContext . mcoSelEnd
-- , show $ u ^? uvWorld . hud . hudElement . diSelection
-- , show $ u ^? uvWorld . input . mouseContext
+1 -1
View File
@@ -162,7 +162,7 @@ updateUniverseMid u = case _uvScreenLayers u of
--updateParticles
(cWorld . lWorld . radarBlips .~ [])
-- . updateIMl _props _pjUpdate
-- . updateLightSources
-- might want to clear temp light sources here?
. (cWorld . lWorld . lights .~ [])
. updateClouds
)