Move towards incorporating sound into ai

This commit is contained in:
2021-09-08 17:41:13 +01:00
parent 45bbf9b005
commit 643cd5a420
25 changed files with 150 additions and 144 deletions
+33 -1
View File
@@ -8,9 +8,12 @@ module Dodge.Creature.Picture
, picAtCrPosNoRot
) where
import Dodge.Data
--import Dodge.Base
--import Dodge.Creature.Stance.Data
import Dodge.Creature.Perception.Data
import Dodge.Creature.State.Data
import Dodge.Creature.Stance.Data
import Dodge.Creature.Memory.Data
import Dodge.Creature.Test
--import Dodge.Creature.AlertLevel.Data
--import Dodge.Picture.Layer
@@ -27,12 +30,13 @@ basicCrPict
-> Creature
-> World
-> Picture
basicCrPict col cr w = setLayer 0 $ pictures $
basicCrPict col cr w = pictures $
targetingPic ++
[ tr . dm . rotdir $ scalp cr
, tr . dm . rotdir $ upperBody col cr
, tr . dm . rotmdir $ feet cr
, tr . rotdir $ drawEquipment cr
, creatureDisplayText w cr
]
where
dm = damageMod cr
@@ -44,6 +48,34 @@ basicCrPict col cr w = setLayer 0 $ pictures $
. setDepth 1
. color (greyN 0.3)
creatureDisplayText :: World -> Creature -> Picture
creatureDisplayText w cr
= setLayer 4
. setDepth 50
. translate x y
. color white
. rotate a
. scale theScale theScale
$ text $ creatureDisplayString cr
where
campos = _cameraViewFrom w
theScale = 0.2 / _cameraZoom w
cpos = _crPos cr
v = cpos -.- campos
a = argV v - 0.5 * pi
(V2 x y) = campos +.+ v +.+ _crRad cr *.* normalizeV v
creatureDisplayString :: Creature -> String
creatureDisplayString cr = show . _soundsToInvestigate $ _crMemory cr
-- | isAsleep = "Z"
-- | isSuspicious = "?"
-- | otherwise = ""
-- where
-- isAsleep = _crAwakeLevel (_crPerception cr) == Asleep
-- imAwarenesses = _crAwarenessLevel (_crPerception cr)
-- isSuspicious = any f imAwarenesses && not (null imAwarenesses)
-- f (Suspicious _) = True
-- f _ = False
damageMod :: Creature -> Picture -> Picture
damageMod cr pic = piercingMod $ bluntScale pic
where