Add Read/Show instance for Creature
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
module Dodge.Corpse.Draw where
|
||||
import Dodge.Data.Corpse
|
||||
import ShapePicture
|
||||
|
||||
-- not currently used, too simple
|
||||
drawCorpse :: Corpse -> SPic
|
||||
drawCorpse cp = _cpSPic cp
|
||||
@@ -0,0 +1,36 @@
|
||||
module Dodge.Corpse.Make where
|
||||
import Dodge.Creature.Picture
|
||||
import Dodge.Data.Creature
|
||||
import Dodge.Data.Corpse
|
||||
import Control.Lens
|
||||
import ShapePicture
|
||||
import Shape
|
||||
import Geometry
|
||||
|
||||
makeCorpse :: CreatureCorpse -> Creature -> Corpse
|
||||
makeCorpse cc = case cc of
|
||||
MakeDefaultCorpse -> makeDefaultCorpse
|
||||
|
||||
makeDefaultCorpse :: Creature -> Corpse
|
||||
makeDefaultCorpse cr = defaultCorpse
|
||||
& cpPos .~ _crPos cr
|
||||
& cpDir .~ _crDir cr
|
||||
& cpSPic .~ noPic (scaleSH (V3 crsize crsize crsize) $ mconcat
|
||||
[ colorSH (_skinHead cskin) $ deadScalp cr
|
||||
, colorSH (_skinUpper cskin) $ deadUpperBody cr
|
||||
, rotmdir $ colorSH (_skinLower cskin) $ deadFeet cr
|
||||
]
|
||||
)
|
||||
where
|
||||
cskin = _crType cr -- this should be fixed
|
||||
crsize = 0.1 * _crRad cr
|
||||
rotmdir = rotateSH (_crMvDir cr - _crDir cr)
|
||||
|
||||
defaultCorpse :: Corpse
|
||||
defaultCorpse = Corpse
|
||||
{ _cpID = 0
|
||||
, _cpPos = 0
|
||||
, _cpDir = 0
|
||||
, _cpSPic = mempty
|
||||
, _cpRes = NoResurrection
|
||||
}
|
||||
Reference in New Issue
Block a user