Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2014
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 2.04 KB | None | 0 0
  1.   def getLoaders(screenCols:Int, screenRows:Int, tooltipId:WindowId):Coroutine[WorldPanel] = {
  2.     val seed = 0//System.nanoTime
  3.     val worldSize = 256
  4.     val cols = worldSize
  5.     val rows = worldSize
  6.  
  7.     val minimapSize = WorldPanel.minimapSize
  8.     val bgColor = Color.Blue
  9.     println("Seed: " + seed + "L")
  10.     val date = DateConstants(framesPerDay = 60*60*24*60)
  11.     val perlin = PerlinParams(worldSize/4, 8, worldSize, seed)
  12.     val worldParams = WorldParams(minimapSize, perlin, date)
  13.  
  14.     import loading._
  15.     Yield(0, "Loading region data", () => {
  16.     val (altRegions, latRegions, surfaceRegions) = Loads.loadRegionMaps.get
  17.     val latMap = new LatitudeMap(cols, rows, latRegions)
  18.     Yield(12, "Loading biome data", () => {
  19.     val biomes = Loads.loadBiomes(latRegions, altRegions, surfaceRegions).get
  20.     Yield(25, "Generating noise", () => {
  21.     val noise = new PerlinNoise(worldParams.perlin).render
  22.     Yield(34, "Generating surface features", () => {
  23.     val surface = new SurfaceMap(noise, worldParams.perlin, surfaceRegions)
  24.     Yield(50, "Generating wind currents", () => {
  25.     val windMap = new StaticWindMap(surface.heightMap, 10000, 1, seed)
  26.     Yield(62, "Plotting average rainfall", () => {
  27.     val moistureMap = new MoistureMap(surface, latMap.latitude, windMap.arrows, 0.5, cols/2, seed)
  28.     Yield(75, "Choosing biomes", () => {
  29.     val biomeMap = new BiomeMap(moistureMap, surface, latMap, altRegions, biomes)
  30.     Yield(88, "Constructing ecosphere", () => {
  31.     val eco = Ecosphere.buildEcosphere(worldParams, latMap, noise, surface, windMap, moistureMap, biomeMap, surfaceRegions, latRegions, altRegions, Vector())
  32.     val world = World.create(worldParams, eco)
  33.     val mapWidth = WorldPanel.computeMapWidth(screenCols)
  34.     val sideWidth = WorldPanel.computeSideWidth(screenCols)
  35.     val mapRect = Recti(sideWidth + 2, 1, mapWidth - 3, screenRows - 2)
  36.  
  37.     val worldPanel = WorldPanel.create(mapRect, minimapSize, worldSize, world, worldParams, tooltipId)
  38.     Return(() => {
  39.       worldPanel
  40.     })
  41.     })
  42.     })
  43.     })
  44.     })
  45.     })
  46.     })
  47.     })
  48.     })
  49.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement