Fix no damage to walls bug
This commit is contained in:
+33
-30
@@ -1,58 +1,61 @@
|
||||
module Dodge.Machine.Draw
|
||||
where
|
||||
import Dodge.Item.HeldOffset
|
||||
import Dodge.Item.Draw.SPic
|
||||
import Dodge.Placement.TopDecoration
|
||||
import Shape
|
||||
import Picture
|
||||
import Geometry
|
||||
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 -> drawTurret tu mc
|
||||
McSensor se -> drawSensor se 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
|
||||
DamageSensor{_sensDraw = pcds} -> sensorSPic pcds
|
||||
ProximitySensor{} -> const mempty
|
||||
|
||||
terminalSPic :: Machine -> SPic
|
||||
terminalSPic = noPic . terminalShape
|
||||
|
||||
terminalShape :: Machine -> Shape
|
||||
terminalShape mc = colorSH col (prismPoly
|
||||
[V3 10 10 20, V3 (-10) 10 20, V3 (-10) (-10) 10, V3 10 (-10) 10]
|
||||
[V3 10 10 0, V3 (-10) 10 0, V3 (-10) (-10) 0, V3 10 (-10) 0]
|
||||
)
|
||||
<> colorSH black (prismPoly
|
||||
[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]
|
||||
)
|
||||
terminalShape mc =
|
||||
colorSH
|
||||
col
|
||||
( prismPoly
|
||||
[V3 10 10 20, V3 (-10) 10 20, V3 (-10) (-10) 10, V3 10 (-10) 10]
|
||||
[V3 10 10 0, V3 (-10) 10 0, V3 (-10) (-10) 0, V3 10 (-10) 0]
|
||||
)
|
||||
<> colorSH
|
||||
black
|
||||
( prismPoly
|
||||
[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
|
||||
|
||||
drawTurret :: Turret -> Machine -> SPic
|
||||
drawTurret tu mc =
|
||||
( colorSH (_mcColor mc) $ upperPrismPoly 20 (square w)
|
||||
drawBaseMachine :: Float -> Machine -> SPic
|
||||
drawBaseMachine h mc =
|
||||
( colorSH (_mcColor mc) $ upperPrismPoly h (reverse $ square (_mcWidth mc))
|
||||
, mempty
|
||||
)
|
||||
<> overPosSP (turretItemOffset it tu mc) (itemSPic it)
|
||||
drawTurret :: Turret -> Machine -> SPic
|
||||
drawTurret tu mc = overPosSP (turretItemOffset it tu mc) (itemSPic it)
|
||||
where
|
||||
it = _tuWeapon tu
|
||||
w = _mcWidth mc
|
||||
|
||||
sensorSPic :: (PaletteColor, DecorationShape) -> Machine -> SPic
|
||||
sensorSPic (pc, ds) mc =
|
||||
noPic $
|
||||
colorSH (_mcColor mc) (upperPrismPoly 25 (square w))
|
||||
<> decorationToShape ds w w 25 col col
|
||||
noPic $ decorationToShape ds w w 25 col col
|
||||
where
|
||||
col = paletteToColor pc
|
||||
w = _mcWidth mc
|
||||
|
||||
Reference in New Issue
Block a user