69 lines
1.9 KiB
Haskell
69 lines
1.9 KiB
Haskell
module Dodge.Machine.Draw where
|
|
|
|
import Dodge.Data.Machine
|
|
import Dodge.Item.Draw.SPic
|
|
import Dodge.Item.HeldOffset
|
|
import Dodge.Placement.TopDecoration
|
|
import Geometry
|
|
import Picture
|
|
import Shape
|
|
import ShapePicture
|
|
|
|
drawMachine :: Machine -> SPic
|
|
drawMachine mc = case _mcType mc of
|
|
McStatic -> mempty
|
|
McTerminal -> terminalSPic mc
|
|
McTurret tu -> drawBaseMachine 20 mc <> drawTurret tu mc
|
|
McSensor se -> drawBaseMachine 25 mc <> drawSensor se mc
|
|
|
|
drawSensor :: Sensor -> Machine -> SPic
|
|
drawSensor sens = case sens of
|
|
DamageSensor{_sensDraw = pcds} -> sensorSPic pcds
|
|
ProximitySensor{} -> const mempty
|
|
|
|
terminalSPic :: Machine -> SPic
|
|
terminalSPic = noPic . terminalShape
|
|
|
|
terminalShape :: Machine -> Shape
|
|
terminalShape mc =
|
|
colorSH
|
|
col
|
|
( prismBox
|
|
Medium
|
|
Typical
|
|
[V3 10 10 20, V3 (-10) 10 20, V3 (-10) (-10) 10, V3 10 (-10) 10]
|
|
(addZ 0 `map` rectWH 10 10)
|
|
)
|
|
<> colorSH
|
|
black
|
|
( prismBox
|
|
Small
|
|
Superfluous
|
|
[V3 8 8 20, V3 (-8) 8 20, V3 0 (-8) 10]
|
|
[V3 8 8 19, V3 (-8) 8 19, V3 0 (-8) 9]
|
|
--[V3 8 8 20, V3 (-8) 8 20, V3 (-8) (-8) 10, V3 8 (-8) 10]
|
|
--[V3 8 8 19, V3 (-8) 8 19, V3 (-8) (-8) 9, V3 8 (-8) 9]
|
|
)
|
|
where
|
|
col = _mcColor mc
|
|
|
|
drawBaseMachine :: Float -> Machine -> SPic
|
|
drawBaseMachine h mc =
|
|
noPic
|
|
. colorSH (_mcColor mc)
|
|
. upperBox Medium Typical h
|
|
. square
|
|
$ _mcWidth mc
|
|
|
|
drawTurret :: Turret -> Machine -> SPic
|
|
drawTurret tu mc = overPosSP (turretItemOffset it tu mc) (itemSPic it)
|
|
where
|
|
it = _tuWeapon tu
|
|
|
|
sensorSPic :: (PaletteColor, DecorationShape) -> Machine -> SPic
|
|
sensorSPic (pc, ds) mc =
|
|
noPic $ decorationToShape ds w w 25 col col
|
|
where
|
|
col = paletteToColor pc
|
|
w = _mcWidth mc
|