2014-02-09 20:18:03 +01:00
|
|
|
module Map.StaticMaps
|
|
|
|
where
|
|
|
|
|
|
|
|
import Map.Types
|
|
|
|
import Data.Array
|
2014-04-24 02:45:55 +02:00
|
|
|
import Map.Creation
|
2014-02-11 12:56:24 +01:00
|
|
|
|
|
|
|
-- entirely empty map, only uses the minimal constructor
|
|
|
|
mapEmpty :: PlayMap
|
2014-04-25 15:58:25 +02:00
|
|
|
mapEmpty = array ((0,0), (199,199)) [((a,b), Minimal (a,b)) | a <- [0..199], b <- [0..199]]
|
2014-02-11 12:56:24 +01:00
|
|
|
|
|
|
|
mapCenterMountain :: PlayMap
|
2014-04-22 03:00:39 +02:00
|
|
|
mapCenterMountain = array ((0,0),(199,199)) nodes
|
2014-02-11 12:56:24 +01:00
|
|
|
where
|
|
|
|
nodes = water ++ beach ++ grass ++ hill ++ mountain
|
2014-04-25 15:58:25 +02:00
|
|
|
water = [((a,b), Full (a,b) 0.0 Ocean BNothing NoPlayer NoPath Plain []) | a <- [0..199], b <- [0..199], m2d (a,b) > 95]
|
|
|
|
beach = [((a,b), Full (a,b) (g2d a b) Beach BNothing NoPlayer NoPath Plain []) | a <- [0..199], b <- [0..199], m2d (a,b) <= 95, m2d (a,b) > 75]
|
|
|
|
grass = [((a,b), Full (a,b) (g2d a b) Grass BNothing NoPlayer NoPath Plain []) | a <- [0..199], b <- [0..199], m2d (a,b) <= 75, m2d (a,b) > 25]
|
|
|
|
hill = [((a,b), Full (a,b) (g2d a b) Hill BNothing NoPlayer NoPath Plain []) | a <- [0..199], b <- [0..199], m2d (a,b) <= 25, m2d (a,b) > 10]
|
|
|
|
mountain = [((a,b), Full (a,b) (g2d a b) Mountain BNothing NoPlayer NoPath Plain []) | a <- [0..199], b <- [0..199], m2d (a,b) <= 10]
|
2014-04-22 11:27:07 +02:00
|
|
|
|
2014-02-11 12:56:24 +01:00
|
|
|
g2d :: Int -> Int -> Float
|
2014-04-22 03:00:39 +02:00
|
|
|
g2d x y = gauss3D (fromIntegral x) (fromIntegral y)
|
2014-02-11 12:56:24 +01:00
|
|
|
|
|
|
|
m2d :: (Int,Int) -> Int
|
|
|
|
m2d (x,y) = mnh2D (x,y) (100,100)
|
2014-04-22 11:27:07 +02:00
|
|
|
|
|
|
|
-- small helper for some hills. Should be replaced by multi-layer perlin-noise
|
|
|
|
-- TODO: Replace as given in comment.
|
|
|
|
_noisyMap :: (Floating q) => q -> q -> q
|
2014-04-25 15:58:25 +02:00
|
|
|
_noisyMap x y = gauss3Dgeneral 15 100.0 100.0 15.0 15.0 x y
|
2014-04-22 11:27:07 +02:00
|
|
|
+ gauss3Dgeneral 5 10.0 10.0 10.0 10.0 x y
|
|
|
|
+ gauss3Dgeneral 5 150.0 120.0 10.0 10.0 x y
|
|
|
|
+ gauss3Dgeneral 5 50.0 75.0 10.0 10.0 x y
|
|
|
|
|
|
|
|
-- generates a noisy map
|
|
|
|
-- TODO: add real noise to a simple pattern
|
|
|
|
mapNoise :: PlayMap
|
|
|
|
mapNoise = array ((0,0),(199,199)) nodes
|
|
|
|
where
|
2014-04-25 15:58:25 +02:00
|
|
|
nodes = [((a,b), Full (a,b)
|
|
|
|
(height a b)
|
|
|
|
(heightToTerrain GrassIslandMap $ height a b)
|
|
|
|
BNothing
|
|
|
|
NoPlayer
|
|
|
|
NoPath
|
|
|
|
Plain
|
|
|
|
[]) | a <- [0..199], b <- [0..199]]
|
2014-04-22 11:27:07 +02:00
|
|
|
where
|
2014-04-25 15:58:25 +02:00
|
|
|
height a b = _noisyMap (fromIntegral a) (fromIntegral b)
|