Add laser central room, using new placement/roompos functionality

This commit is contained in:
2021-11-21 17:44:32 +00:00
parent 48cd59069c
commit 2f3896345d
12 changed files with 127 additions and 76 deletions
+1 -26
View File
@@ -17,11 +17,9 @@ import Sound.Data
import Geometry
import Geometry.Vector3D
import SDL (MouseButton (..))
import Data.List
import Data.Maybe
import Data.Function
import qualified Data.Set as S
import qualified Data.IntMap.Strict as IM
import qualified Data.Map.Strict as M
import Control.Lens
@@ -50,7 +48,7 @@ functionalUpdate w = case _menuLayers w of
. ppEvents
. updateCamera
. colCrsWalls
. ifConfigWallRotate
-- . ifConfigWallRotate
. simpleCrSprings
. zoneCreatures
. updateDoors
@@ -253,29 +251,6 @@ crCrSpring c1 c2 w
overlap2 = ((comRad - diff) * _crMass c1 * 0.5 / massT) *.* errorNormalizeV 56 vec
massT = _crMass c1 + _crMass c2
ifConfigWallRotate :: World -> World
ifConfigWallRotate w
| _rotate_to_wall (_config w) && not (ButtonRight `S.member` _mouseButtons w)
= rotateToOverlappingWall w
| otherwise = w
rotateToOverlappingWall :: World -> World
rotateToOverlappingWall w = case theWall of
Nothing -> w
Just wl -> rotateUsing ( (argV . uncurry (-.-) $ _wlLine wl) - camrot)
where
camrot = _cameraRot w
rotateUsing a
| b - b' > 0.01 = w & cameraRot +~ 0.01
| b - b' < negate 0.01 = w & cameraRot -~ 0.01
| otherwise = w
where
b = a * (2 / pi)
b' = fromIntegral (round b :: Int)
cr = you w
p = _crPos cr
theWall = overlapCircWallsReturnWall p (_crRad cr + 5) (IM.filter _wlRotateTo $ wallsNearPoint p w)
{- Finds the visible walls from a point to another point. -}
visibleWalls :: Point2 -> Point2 -> IM.IntMap Wall -> [Wall]
visibleWalls p1 p2 ws