Add concept of GameRoom, check viewing distance based on rooms

This commit is contained in:
2021-09-02 23:24:29 +01:00
parent 9d2f42dbc9
commit c69af7a5f4
30 changed files with 295 additions and 151 deletions
-10
View File
@@ -5,22 +5,12 @@ import Polyhedra
import Geometry
import qualified Data.IntMap as IM
crToBox :: Creature -> [[Point3]]
crToBox cr = map (map f . polyToTris) $ boxXYZ 8 8 15
where
f = (+ V3 (x-4) (y-4) 1)
V2 x y = _crPos cr
youBox' :: World -> [[Point3]]
youBox' w = crToBox' $ _creatures w IM.! 0
youBox :: World -> [Point3]
youBox = concat . youBox'
crToBox' :: Creature -> [[Point3]]
crToBox' cr = map (map f . polyToTris) $ boxXYZ 12 12 15
where
f = (+ V3 (x-6) (y-6) 0)
V2 x y = _crPos cr
youSil :: World -> [Point3]
youSil = constructEdgesList . youBox'
+2 -7
View File
@@ -14,13 +14,8 @@ creatureSilhouettes w = concatMap f . IM.elems $ _creatures w
where
f cr = _crSilhouette cr cr
crBox :: [Point3]
crBox = constructEdgesList . map (map f . polyToTris) $ boxXYZ 12 12 15
where
f = (+ V3 (-6) (-6) 0)
basicCrSilhouette :: Creature -> [Point3]
basicCrSilhouette cr = map theTrans crBox
basicCrSilhouette cr = constructEdgesList . map (map f . polyToTris) $ boxXYZ 12 12 15
where
theTrans = (+ V3 x y 0)
f = (+ V3 (x-6) (y-6) 0)
V2 x y = _crPos cr
+1 -1
View File
@@ -50,7 +50,7 @@ wasdWithAiming w speed i cr
isAiming = _posture (_crStance cr) == Aiming
mouseDir = case w ^? creatures . ix i . crInv . ix (_crInvSel (_creatures w IM.! i))
. itAttachment of
Just (Just ItScope{_scopePos = p}) -> normalizeAngle $ argV
Just ItScope{_scopePos = p} -> normalizeAngle $ argV
$ p +.+ 2 / _cameraZoom w
*.* rotateV (_cameraRot w) (_mousePos w)
_ -> normalizeAngle $ argV (_mousePos w) + _cameraRot w