Cleanup
This commit is contained in:
+59
-66
@@ -1,70 +1,63 @@
|
||||
module Dodge.Beam where
|
||||
module Dodge.Beam
|
||||
() where
|
||||
|
||||
import Data.Maybe
|
||||
import Dodge.Data.World
|
||||
import Dodge.Flame
|
||||
import Dodge.Item.Location
|
||||
import Dodge.Tesla.Arc
|
||||
import Geometry
|
||||
import LensHelp
|
||||
import Picture
|
||||
--import Data.Maybe
|
||||
--import Dodge.Data.World
|
||||
--import Dodge.Flame
|
||||
--import Dodge.Item.Location
|
||||
--import Dodge.Tesla.Arc
|
||||
--import Geometry
|
||||
--import LensHelp
|
||||
--import Picture
|
||||
|
||||
doBeamCombine ::
|
||||
BeamCombineType ->
|
||||
(Point2, (Point2, Point2, Beam), (Point2, Point2, Beam)) ->
|
||||
World ->
|
||||
World
|
||||
doBeamCombine bct = case bct of
|
||||
FlameBeamCombine -> flameBeamCombine
|
||||
LasBeamCombine -> lasBeamCombine
|
||||
TeslaBeamCombine -> teslaBeamCombine
|
||||
SplitBeamCombine -> splitBeamCombine
|
||||
NoBeamCombine -> const id
|
||||
|
||||
flameBeamCombine ::
|
||||
(Point2, (Point2, Point2, Beam), (Point2, Point2, Beam)) ->
|
||||
World ->
|
||||
World
|
||||
flameBeamCombine (p, (a, b, _), (x, y, _)) =
|
||||
makeFlame p (2 *.* normalizeV (normalizeV (b -.- a) +.+ normalizeV (y -.- x)))
|
||||
--doBeamCombine ::
|
||||
-- BeamCombineType ->
|
||||
-- (Point2, (Point2, Point2, Beam), (Point2, Point2, Beam)) ->
|
||||
-- World ->
|
||||
-- World
|
||||
--doBeamCombine bct = case bct of
|
||||
-- FlameBeamCombine -> flameBeamCombine
|
||||
-- LasBeamCombine -> lasBeamCombine
|
||||
-- TeslaBeamCombine -> teslaBeamCombine
|
||||
-- SplitBeamCombine -> splitBeamCombine
|
||||
-- NoBeamCombine -> const id
|
||||
--
|
||||
--flameBeamCombine ::
|
||||
-- (Point2, (Point2, Point2, Beam), (Point2, Point2, Beam)) ->
|
||||
-- World ->
|
||||
-- World
|
||||
--flameBeamCombine (p, (a, b, _), (x, y, _)) =
|
||||
-- makeFlame p (2 *.* normalizeV (normalizeV (b -.- a) +.+ normalizeV (y -.- x)))
|
||||
--
|
||||
--lasBeamCombine ::
|
||||
-- (Point2, (Point2, Point2, Beam), (Point2, Point2, Beam)) ->
|
||||
-- World ->
|
||||
-- World
|
||||
--lasBeamCombine (p, (a, b, _), (x, y, _)) =
|
||||
-- cWorld . lWorld . lasers .:~ lasRayAt yellow 11 1 p (argV (normalizeV (b -.- a) +.+ normalizeV (y -.- x)))
|
||||
--
|
||||
--splitBeamCombine ::
|
||||
-- (Point2, (Point2, Point2, Beam), (Point2, Point2, Beam)) ->
|
||||
-- World ->
|
||||
-- World
|
||||
--splitBeamCombine (p, (a, b, _), (x, y, _)) =
|
||||
-- (cWorld . lWorld . lasers .:~ lasRayAt yellow 11 1 p (dir + 0.5 * pi))
|
||||
-- . (cWorld . lWorld . lasers .:~ lasRayAt yellow 11 1 p (dir -0.5 * pi))
|
||||
-- where
|
||||
-- dir = argV (normalizeV (b -.- a) +.+ normalizeV (y -.- x))
|
||||
--
|
||||
--teslaBeamCombine ::
|
||||
-- (Point2, (Point2, Point2, Beam), (Point2, Point2, Beam)) ->
|
||||
-- World ->
|
||||
-- World
|
||||
--teslaBeamCombine (p, (a, b, bm), (x, y, _)) w =
|
||||
-- w' & pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix itid) . itParams . subParams ?~ ip
|
||||
-- where
|
||||
-- itid = fromJust $ _bmOrigin bm
|
||||
-- dir = argV (normalizeV (b -.- a) +.+ normalizeV (y -.- x))
|
||||
-- (w', ip) = makeTeslaArc (fromJust . _subParams $ _itParams it) p dir w
|
||||
-- it = case getItem itid w of
|
||||
-- Nothing -> error "tried to get item use teslaBeamCombine that doesn't exist"
|
||||
-- Just itm -> itm
|
||||
|
||||
lasBeamCombine ::
|
||||
(Point2, (Point2, Point2, Beam), (Point2, Point2, Beam)) ->
|
||||
World ->
|
||||
World
|
||||
lasBeamCombine (p, (a, b, _), (x, y, _)) =
|
||||
cWorld . lWorld . lasers .:~ lasRayAt yellow 11 1 p (argV (normalizeV (b -.- a) +.+ normalizeV (y -.- x)))
|
||||
|
||||
splitBeamCombine ::
|
||||
(Point2, (Point2, Point2, Beam), (Point2, Point2, Beam)) ->
|
||||
World ->
|
||||
World
|
||||
splitBeamCombine (p, (a, b, _), (x, y, _)) =
|
||||
(cWorld . lWorld . lasers .:~ lasRayAt yellow 11 1 p (dir + 0.5 * pi))
|
||||
. (cWorld . lWorld . lasers .:~ lasRayAt yellow 11 1 p (dir -0.5 * pi))
|
||||
where
|
||||
dir = argV (normalizeV (b -.- a) +.+ normalizeV (y -.- x))
|
||||
|
||||
teslaBeamCombine ::
|
||||
(Point2, (Point2, Point2, Beam), (Point2, Point2, Beam)) ->
|
||||
World ->
|
||||
World
|
||||
teslaBeamCombine (p, (a, b, bm), (x, y, _)) w =
|
||||
w' & pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix itid) . itParams . subParams ?~ ip
|
||||
where
|
||||
itid = fromJust $ _bmOrigin bm
|
||||
dir = argV (normalizeV (b -.- a) +.+ normalizeV (y -.- x))
|
||||
(w', ip) = makeTeslaArc (fromJust . _subParams $ _itParams it) p dir w
|
||||
it = case getItem itid w of
|
||||
Nothing -> error "tried to get item use teslaBeamCombine that doesn't exist"
|
||||
Just itm -> itm
|
||||
|
||||
lasRayAt :: Color -> Int -> Float -> Point2 -> Float -> LaserStart
|
||||
lasRayAt col dam phasev pos dir =
|
||||
LaserStart
|
||||
{ _lpType = DamageLaser dam
|
||||
, _lpPhaseV = phasev
|
||||
, _lpPos = pos
|
||||
, _lpDir = dir
|
||||
, _lpColor = col
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user