Refactor, try to limit dependencies
This commit is contained in:
@@ -1,27 +1,33 @@
|
||||
module Dodge.Placement.Shift
|
||||
( shiftPlacement
|
||||
, shiftPSBy
|
||||
, shiftRelativeToPS
|
||||
) where
|
||||
--import Dodge.LevelGen.Data
|
||||
import Dodge.Data
|
||||
module Dodge.Placement.Shift (
|
||||
shiftPlacement,
|
||||
shiftPSBy,
|
||||
shiftRelativeToPS,
|
||||
) where
|
||||
|
||||
import Dodge.Data.GenWorld
|
||||
import Dodge.ShiftPoint
|
||||
import Geometry
|
||||
import LensHelp
|
||||
|
||||
import Geometry
|
||||
shiftPSBy :: (Point2,Float) -> PlacementSpot -> PlacementSpot
|
||||
shiftPSBy (pos,rot) ps = ps
|
||||
& psPos %~ shiftPointBy (pos,rot)
|
||||
& psRot +~ rot
|
||||
shiftPSBy :: (Point2, Float) -> PlacementSpot -> PlacementSpot
|
||||
shiftPSBy (pos, rot) ps =
|
||||
ps
|
||||
& psPos %~ shiftPointBy (pos, rot)
|
||||
& psRot +~ rot
|
||||
|
||||
shiftRelativeToPS :: Point2 -> PlacementSpot -> PlacementSpot
|
||||
shiftRelativeToPS p ps = ps & psPos .+.+~ rotateV (_psRot ps) p
|
||||
shiftPlacement :: (Point2,Float) -> Placement -> Placement
|
||||
|
||||
shiftPlacement :: (Point2, Float) -> Placement -> Placement
|
||||
shiftPlacement shift plmnt = case plmnt of
|
||||
-- slightly messy NoShiftCont, necessary to stop interference with ps0jPushPS
|
||||
Placement {_plSpot = PSNoShiftCont {}} -> plmnt & plSpot %~ shiftPSBy shift
|
||||
Placement {} -> plmnt & plSpot %~ shiftPSBy shift
|
||||
& plIDCont %~ fmap (fmap (fmap $ shiftPlacement shift))
|
||||
PlacementUsingPos p f -> PlacementUsingPos (shiftPoint3By shift p)
|
||||
(fmap (shiftPlacement shift) f)
|
||||
-- slightly messy NoShiftCont, necessary to stop interference with ps0jPushPS
|
||||
Placement{_plSpot = PSNoShiftCont{}} -> plmnt & plSpot %~ shiftPSBy shift
|
||||
Placement{} ->
|
||||
plmnt & plSpot %~ shiftPSBy shift
|
||||
& plIDCont %~ fmap (fmap (fmap $ shiftPlacement shift))
|
||||
PlacementUsingPos p f ->
|
||||
PlacementUsingPos
|
||||
(shiftPoint3By shift p)
|
||||
(fmap (shiftPlacement shift) f)
|
||||
RandomPlacement rpl -> RandomPlacement $ fmap (shiftPlacement shift) rpl
|
||||
PickOnePlacement i pl -> PickOnePlacement i (shiftPlacement shift pl)
|
||||
|
||||
Reference in New Issue
Block a user