diff --git a/configuration.yaml b/configuration.yaml index 403084f..c9fb761 100644 --- a/configuration.yaml +++ b/configuration.yaml @@ -1,5 +1,5 @@ setSocketPath : "/tmp/wizard.sock" -setMapRows : 50 -setMapColumns : 50 +setMapRows : 40 +setMapColumns : 40 setSpawnerProbability : 0.01 setFPS : 5 diff --git a/src-server/Server/Communication.hs b/src-server/Server/Communication.hs index 0a27b70..5968996 100644 --- a/src-server/Server/Communication.hs +++ b/src-server/Server/Communication.hs @@ -221,11 +221,27 @@ sendUpdates = do (\(player@(Player playerId wizard@(Wizard {..}))) -> do 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) + leftLine row = cos leftBound * row + rightLine row = sin rightBound * row + correctionLeft = if wizardRot < pi / 2 || wizardRot > 4 * pi / 2 + then floor + else ceiling + correctionRight = if wizardRot < pi / 2 || wizardRot > 4 * pi / 2 + then ceiling + else floor initViewMatrix = M.fromList 9 9 $ map (\(qr, qc) -> - M.safeGet qr qc tileMap + 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 ) subCoords + -- liftIO $ print $ leftLine . (\x -> x - wr) . fromIntegral .fst <$> subCoords liftIO $ print initViewMatrix ) players diff --git a/src-server/Server/Util.hs b/src-server/Server/Util.hs index cfbd31a..8ebae20 100644 --- a/src-server/Server/Util.hs +++ b/src-server/Server/Util.hs @@ -29,7 +29,7 @@ newWizard newWizard pos = Wizard { wizardWands = [] - , wizardRot = 0 + , wizardRot = 3 , wizardPos = pos , wizardMana = 100 , wizardHealth = 100