diff --git a/src-client/Client/Graphics.hs b/src-client/Client/Graphics.hs index 76b6940..69904f9 100644 --- a/src-client/Client/Graphics.hs +++ b/src-client/Client/Graphics.hs @@ -84,9 +84,9 @@ castRay -> (Float, Float) -- screen dimensions -> Float -- Ray length castRay wizard (row, col) (x, y) (width, height) = - let direction = angle (wizardRot wizard - hFOV / 2 + x * hFOV / width) + let direction = angle (wizardRot wizard - pi / 2 - hFOV / 2 + x * hFOV / width) invdir@(V2 invDirCol invDirRow) = (1 /) <$> direction - wStep@(V2 wStepCol wStepRow) = wizardPos wizard - (fromIntegral . floor <$> wizardPos wizard) + wStep@(V2 wStepRow wStepCol) = wizardPos wizard - (fromIntegral . floor <$> wizardPos wizard) ulCol = col - 1 ulRow = row - 1 brCol = col diff --git a/src-server/Server/Communication/Handler.hs b/src-server/Server/Communication/Handler.hs index 15917a6..6215253 100644 --- a/src-server/Server/Communication/Handler.hs +++ b/src-server/Server/Communication/Handler.hs @@ -149,10 +149,10 @@ handleMessage stateContainer readerContainer msg = do _ -> 0 newPos = wizardPos wiz + ((0.25 *) <$> case act of - StepForward -> -(angle newRot) - StepBackward -> angle newRot - StrifeRight -> perp (angle newRot) - StrifeLeft -> -(perp (angle newRot)) + StepForward -> -(angle (-newRot)) + StepBackward -> angle (-newRot) + StrifeRight -> perp (angle (-newRot)) + StrifeLeft -> -(perp (angle (-newRot))) _ -> 0 ) newWiz = wiz diff --git a/src-server/Server/Communication/Send.hs b/src-server/Server/Communication/Send.hs index 261aca7..b986307 100644 --- a/src-server/Server/Communication/Send.hs +++ b/src-server/Server/Communication/Send.hs @@ -180,8 +180,8 @@ sendUpdate curLevel stateContainer tileMap player = do buildSlice (Player _ (Wizard {..}) _ _) = let V2 wr wc = wizardPos subCoords = (,) <$> [floor wr - 4 .. floor wr + 4] <*> [floor wc - 4 .. floor wc + 4] - leftBound = wizardRot + (pi / 4) - rightBound = wizardRot - (pi / 4) + leftBound = wizardRot - (pi / 4) + rightBound = wizardRot + (pi / 4) leftLine row = cos leftBound * row rightLine row = sin rightBound * row correctionLeft = if wizardRot < pi / 2 || wizardRot >= 2 * pi @@ -192,12 +192,13 @@ sendUpdate curLevel stateContainer tileMap player = do else floor initViewMatrix = M.fromList 9 9 $ map (\(qr, qc) -> - if qc - floor wc <= correctionLeft (leftLine (wr - fromIntegral qr)) - && qc - floor wc >= correctionRight (rightLine (wr - fromIntegral qr)) - then - M.safeGet qr qc tileMap - else - Nothing + -- if qc - floor wc >= correctionLeft (leftLine (wr - fromIntegral qr)) + -- && qc - floor wc <= correctionRight (rightLine (wr - fromIntegral qr)) + -- then + -- M.safeGet qr qc tileMap + -- else + -- Nothing + M.safeGet qr qc tileMap ) subCoords in