Various tweaks

This commit is contained in:
jgk
2021-08-18 20:38:55 +02:00
parent 61adae1e40
commit b9f73d255f
8 changed files with 35 additions and 43 deletions
+9 -10
View File
@@ -8,6 +8,7 @@ module Dodge.Update.Camera
where
import Dodge.Data
import Dodge.Base
import Dodge.Base.Zone
import Dodge.Base.Window
import Dodge.Base.Collide
import Dodge.Config.KeyConfig
@@ -166,18 +167,16 @@ farWallDist cpos w = getMin . uncurry (<>) $ bimap (toScale hw) (toScale hh) $ s
distsMaybeTo x = (valueAtWidth x,valueAtHeight x)
valueAtHeight h = cpiv (cpos +.+ x) <> cpiv (cpos -.- x)
where
x = viewDistAtHeight h
x = rotateV camRot $ V2 maxViewDistance h
cpiv p = Ap $ Max . horSize <$> collidePointIndirect cpos p wos
horSize = abs . dotV rv . (-.- cpos)
rv = rotateV camRot (V2 1 0)
valueAtWidth h = cpih (cpos +.+ x) <> cpih (cpos -.- x)
where
x = viewDistAtWidth h
cpiv p = Ap $ Max . horSize <$> collidePointIndirect cpos p wos
cpih p = Ap $ Max . verSize <$> collidePointIndirect cpos p wos
horSize = abs . dotV rv . (-.- cpos)
verSize = abs . dotV rh . (-.- cpos)
rv = rotateV camRot (V2 1 0)
rh = rotateV camRot (V2 0 1)
viewDistAtHeight = rotateV camRot . V2 maxViewDistance
viewDistAtWidth x = rotateV camRot $ V2 x maxViewDistance
x = rotateV camRot $ V2 h maxViewDistance
cpih p = Ap $ Max . verSize <$> collidePointIndirect cpos p wos
verSize = abs . dotV rh . (-.- cpos)
rh = rotateV camRot (V2 0 1)
wos = wallsOnScreen w
camRot = _cameraRot w
hw = halfWidth w