mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 02:24:05 +09:00
Rudimentary load screen works (only with Ingame screen)
This commit is contained in:
@@ -59,4 +59,8 @@ class HistoryArray<T>(val size: Int) {
|
|||||||
val oldest: T?
|
val oldest: T?
|
||||||
get() = this[history.size - 1]
|
get() = this[history.size - 1]
|
||||||
|
|
||||||
|
fun clear() {
|
||||||
|
history.clear()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -144,8 +144,9 @@ class Ingame(val batch: SpriteBatch) : Screen {
|
|||||||
//private val ingameDrawThread: ThreadIngameDraw // draw must be on the main thread
|
//private val ingameDrawThread: ThreadIngameDraw // draw must be on the main thread
|
||||||
|
|
||||||
|
|
||||||
private var gameFullyLoaded = false
|
var gameFullyLoaded = false
|
||||||
|
private set
|
||||||
|
private var postInitDone = false
|
||||||
|
|
||||||
|
|
||||||
//////////////
|
//////////////
|
||||||
@@ -196,7 +197,7 @@ class Ingame(val batch: SpriteBatch) : Screen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun show() {
|
override fun show() {
|
||||||
initViewPort(Terrarum.WIDTH, Terrarum.HEIGHT)
|
//initViewPort(Terrarum.WIDTH, Terrarum.HEIGHT)
|
||||||
|
|
||||||
|
|
||||||
// gameLoadMode and gameLoadInfoPayload must be set beforehand!!
|
// gameLoadMode and gameLoadInfoPayload must be set beforehand!!
|
||||||
@@ -225,54 +226,65 @@ class Ingame(val batch: SpriteBatch) : Screen {
|
|||||||
*/
|
*/
|
||||||
private fun enter(gameSaveData: GameSaveData) {
|
private fun enter(gameSaveData: GameSaveData) {
|
||||||
if (gameFullyLoaded) {
|
if (gameFullyLoaded) {
|
||||||
Error("You are doing horribly wrong, fucknugget.")
|
println("[Ingame] loaded successfully.")
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
LoadScreen.addMessage("Loading world from save")
|
||||||
|
|
||||||
world = gameSaveData.world
|
|
||||||
historicalFigureIDBucket = gameSaveData.historicalFigureIDBucket
|
world = gameSaveData.world
|
||||||
playableActorDelegate = PlayableActorDelegate(gameSaveData.realGamePlayer)
|
historicalFigureIDBucket = gameSaveData.historicalFigureIDBucket
|
||||||
addNewActor(player!!)
|
playableActorDelegate = PlayableActorDelegate(gameSaveData.realGamePlayer)
|
||||||
|
addNewActor(player!!)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
initGame()
|
//initGame()
|
||||||
|
|
||||||
gameFullyLoaded = true
|
gameFullyLoaded = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init instance by creating new world
|
* Init instance by creating new world
|
||||||
*/
|
*/
|
||||||
private fun enter(worldParams: NewWorldParameters) {
|
private fun enter(worldParams: NewWorldParameters) {
|
||||||
|
if (gameFullyLoaded) {
|
||||||
// init map as chosen size
|
println("[Ingame] loaded successfully.")
|
||||||
world = GameWorld(worldParams.width, worldParams.height)
|
}
|
||||||
|
else {
|
||||||
// generate terrain for the map
|
LoadScreen.addMessage("Creating new world")
|
||||||
WorldGenerator.attachMap(world)
|
|
||||||
WorldGenerator.SEED = worldParams.worldGenSeed
|
|
||||||
WorldGenerator.generateMap()
|
|
||||||
|
|
||||||
|
|
||||||
historicalFigureIDBucket = ArrayList<Int>()
|
// init map as chosen size
|
||||||
|
world = GameWorld(worldParams.width, worldParams.height)
|
||||||
|
|
||||||
|
// generate terrain for the map
|
||||||
|
WorldGenerator.attachMap(world)
|
||||||
|
WorldGenerator.SEED = worldParams.worldGenSeed
|
||||||
|
WorldGenerator.generateMap()
|
||||||
|
|
||||||
|
|
||||||
RoguelikeRandomiser.seed = HQRNG().nextLong()
|
historicalFigureIDBucket = ArrayList<Int>()
|
||||||
|
|
||||||
|
|
||||||
// add new player and put it to actorContainer
|
RoguelikeRandomiser.seed = HQRNG().nextLong()
|
||||||
playableActorDelegate = PlayableActorDelegate(PlayerBuilderSigrid())
|
|
||||||
//playableActorDelegate = PlayableActorDelegate(PlayerBuilderTestSubject1())
|
|
||||||
addNewActor(player!!)
|
|
||||||
|
|
||||||
|
|
||||||
// test actor
|
// add new player and put it to actorContainer
|
||||||
//addNewActor(PlayerBuilderCynthia())
|
//playableActorDelegate = PlayableActorDelegate(PlayerBuilderSigrid())
|
||||||
|
//playableActorDelegate = PlayableActorDelegate(PlayerBuilderTestSubject1())
|
||||||
|
//addNewActor(player!!)
|
||||||
|
|
||||||
|
|
||||||
|
// test actor
|
||||||
|
//addNewActor(PlayerBuilderCynthia())
|
||||||
|
|
||||||
initGame()
|
|
||||||
|
//initGame()
|
||||||
|
|
||||||
|
gameFullyLoaded = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun initGame() {
|
fun initGame() {
|
||||||
@@ -394,6 +406,23 @@ class Ingame(val batch: SpriteBatch) : Screen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun render(delta: Float) {
|
override fun render(delta: Float) {
|
||||||
|
if (!postInitDone) { // Q&D solution for LoadScreen and Ingame, where while LoadScreen is working, Ingame now no longer has GL Context
|
||||||
|
|
||||||
|
if (gameLoadMode == GameLoadMode.CREATE_NEW) {
|
||||||
|
playableActorDelegate = PlayableActorDelegate(PlayerBuilderSigrid())
|
||||||
|
addNewActor(player!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
initGame()
|
||||||
|
|
||||||
|
|
||||||
|
postInitDone = true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Gdx.graphics.setTitle(GAME_NAME +
|
Gdx.graphics.setTitle(GAME_NAME +
|
||||||
" — F: ${Gdx.graphics.framesPerSecond} (${Terrarum.TARGET_INTERNAL_FPS})" +
|
" — F: ${Gdx.graphics.framesPerSecond} (${Terrarum.TARGET_INTERNAL_FPS})" +
|
||||||
" — M: ${Terrarum.memInUse}M / ${Terrarum.memTotal}M / ${Terrarum.memXmx}M"
|
" — M: ${Terrarum.memInUse}M / ${Terrarum.memTotal}M / ${Terrarum.memXmx}M"
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ import net.torvald.terrarum.langpack.Lang
|
|||||||
*/
|
*/
|
||||||
object LoadScreen : ScreenAdapter() {
|
object LoadScreen : ScreenAdapter() {
|
||||||
|
|
||||||
private lateinit var actualSceneToBeLoaded: Screen
|
var screenToLoad: Ingame? = null
|
||||||
private lateinit var sceneLoadingThread: Thread
|
private lateinit var screenLoadingThread: Thread
|
||||||
|
|
||||||
|
|
||||||
private val messages = HistoryArray<String>(20)
|
private val messages = HistoryArray<String>(20)
|
||||||
@@ -49,9 +49,6 @@ object LoadScreen : ScreenAdapter() {
|
|||||||
var camera = OrthographicCamera(Terrarum.WIDTH.toFloat(), Terrarum.HEIGHT.toFloat())
|
var camera = OrthographicCamera(Terrarum.WIDTH.toFloat(), Terrarum.HEIGHT.toFloat())
|
||||||
|
|
||||||
fun initViewPort(width: Int, height: Int) {
|
fun initViewPort(width: Int, height: Int) {
|
||||||
//val width = if (width % 1 == 1) width + 1 else width
|
|
||||||
//val height = if (height % 1 == 1) height + 1 else width
|
|
||||||
|
|
||||||
// Set Y to point downwards
|
// Set Y to point downwards
|
||||||
camera.setToOrtho(true, width.toFloat(), height.toFloat())
|
camera.setToOrtho(true, width.toFloat(), height.toFloat())
|
||||||
|
|
||||||
@@ -65,6 +62,24 @@ object LoadScreen : ScreenAdapter() {
|
|||||||
|
|
||||||
|
|
||||||
override fun show() {
|
override fun show() {
|
||||||
|
messages.clear()
|
||||||
|
|
||||||
|
|
||||||
|
if (screenToLoad == null) {
|
||||||
|
println("[LoadScreen] Screen to load is not set. Are you testing the UI?")
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
val runnable = object : Runnable {
|
||||||
|
override fun run() {
|
||||||
|
screenToLoad!!.show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
screenLoadingThread = Thread(runnable, "LoadScreen GameLoader")
|
||||||
|
|
||||||
|
screenLoadingThread.start()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
initViewPort(Terrarum.WIDTH, Terrarum.HEIGHT)
|
initViewPort(Terrarum.WIDTH, Terrarum.HEIGHT)
|
||||||
|
|
||||||
textFbo = FrameBuffer(
|
textFbo = FrameBuffer(
|
||||||
@@ -78,10 +93,6 @@ object LoadScreen : ScreenAdapter() {
|
|||||||
arrowObjGlideOffsetX = -arrowObjTex.width.toFloat()
|
arrowObjGlideOffsetX = -arrowObjTex.width.toFloat()
|
||||||
|
|
||||||
textOverlayTex = Texture(Gdx.files.internal("assets/graphics/test_loading_text_tint.tga"))
|
textOverlayTex = Texture(Gdx.files.internal("assets/graphics/test_loading_text_tint.tga"))
|
||||||
|
|
||||||
|
|
||||||
addMessage("**** This is a test ****")
|
|
||||||
addMessage("Segmentation fault")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -90,97 +101,101 @@ object LoadScreen : ScreenAdapter() {
|
|||||||
private var genuineSonic = false // the "NOW LOADING..." won't appear unless the arrow first run passes it (it's totally not a GenuineIntel tho)
|
private var genuineSonic = false // the "NOW LOADING..." won't appear unless the arrow first run passes it (it's totally not a GenuineIntel tho)
|
||||||
|
|
||||||
override fun render(delta: Float) {
|
override fun render(delta: Float) {
|
||||||
glideDispY = Terrarum.HEIGHT - 100f - Terrarum.fontGame.lineHeight
|
// if loading is done, escape and set screen of the Game to the target
|
||||||
arrowObjGlideSize = arrowObjTex.width + 2f * Terrarum.WIDTH
|
if (screenToLoad?.gameFullyLoaded ?: false) {
|
||||||
|
Terrarum.changeScreen(screenToLoad!!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
glideDispY = Terrarum.HEIGHT - 100f - Terrarum.fontGame.lineHeight
|
||||||
|
arrowObjGlideSize = arrowObjTex.width + 2f * Terrarum.WIDTH
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Gdx.gl.glClearColor(.157f, .157f, .157f, 0f)
|
Gdx.gl.glClearColor(.157f, .157f, .157f, 0f)
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
|
||||||
|
|
||||||
textFbo.inAction(null, null) {
|
|
||||||
Gdx.gl.glClearColor(0f, 0f, 0f, 0f)
|
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
||||||
}
|
|
||||||
|
|
||||||
glideTimer += delta
|
textFbo.inAction(null, null) {
|
||||||
if (glideTimer >= arrowObjGlideSize / arrowGlideSpeed) {
|
Gdx.gl.glClearColor(0f, 0f, 0f, 0f)
|
||||||
glideTimer -= arrowObjGlideSize / arrowGlideSpeed
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
||||||
}
|
}
|
||||||
arrowObjPos = glideTimer * arrowGlideSpeed
|
|
||||||
|
glideTimer += delta
|
||||||
|
if (glideTimer >= arrowObjGlideSize / arrowGlideSpeed) {
|
||||||
|
glideTimer -= arrowObjGlideSize / arrowGlideSpeed
|
||||||
|
}
|
||||||
|
arrowObjPos = glideTimer * arrowGlideSpeed
|
||||||
|
|
||||||
|
|
||||||
|
// draw text to FBO
|
||||||
|
textFbo.inAction(camera, Terrarum.batch) {
|
||||||
|
Terrarum.batch.inUse {
|
||||||
|
blendNormal()
|
||||||
|
Terrarum.fontGame
|
||||||
|
it.color = Color.WHITE
|
||||||
|
Terrarum.fontGame.draw(it, Lang["MENU_IO_LOADING"], 0.33f, 0f) // x 0.5? I dunno but it breaks w/o it
|
||||||
|
|
||||||
|
|
||||||
|
blendMul()
|
||||||
|
// draw flipped
|
||||||
|
it.draw(textOverlayTex,
|
||||||
|
0f,
|
||||||
|
Terrarum.fontGame.lineHeight,
|
||||||
|
textOverlayTex.width.toFloat(),
|
||||||
|
-Terrarum.fontGame.lineHeight
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// draw text to FBO
|
|
||||||
textFbo.inAction(camera, Terrarum.batch) {
|
|
||||||
Terrarum.batch.inUse {
|
Terrarum.batch.inUse {
|
||||||
|
initViewPort(Terrarum.WIDTH, Terrarum.HEIGHT) // dunno, no render without this
|
||||||
|
it.projectionMatrix = camera.combined
|
||||||
blendNormal()
|
blendNormal()
|
||||||
Terrarum.fontGame
|
|
||||||
it.color = Color.WHITE
|
|
||||||
Terrarum.fontGame.draw(it, Lang["MENU_IO_LOADING"], 0.5f, 0f) // x 0.5? I dunno but it breaks w/o it
|
|
||||||
|
|
||||||
|
// draw text FBO to screen
|
||||||
|
val textTex = textFbo.colorBufferTexture
|
||||||
|
textTex.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear)
|
||||||
|
|
||||||
blendMul()
|
// --> original text
|
||||||
// draw flipped
|
if (genuineSonic) {
|
||||||
it.draw(textOverlayTex,
|
it.color = Color.WHITE
|
||||||
0f,
|
it.draw(textTex, textX, glideDispY - 2f)
|
||||||
Terrarum.fontGame.lineHeight,
|
}
|
||||||
textOverlayTex.width.toFloat(),
|
|
||||||
-Terrarum.fontGame.lineHeight
|
// --> ghost
|
||||||
|
it.color = getPulseEffCol()
|
||||||
|
|
||||||
|
if (it.color.a != 0f) genuineSonic = true
|
||||||
|
|
||||||
|
val drawWidth = getPulseEffWidthMul() * textTex.width
|
||||||
|
val drawHeight = getPulseEffWidthMul() * textTex.height
|
||||||
|
it.draw(textTex,
|
||||||
|
textX - (drawWidth - textTex.width) / 2f,
|
||||||
|
glideDispY - 2f - (drawHeight - textTex.height) / 2f,
|
||||||
|
drawWidth,
|
||||||
|
drawHeight
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
// draw coloured arrows
|
||||||
|
arrowColours.forEachIndexed { index, color ->
|
||||||
|
it.color = color
|
||||||
|
it.draw(arrowObjTex, arrowObjPos + arrowObjGlideOffsetX + arrowObjTex.width * index, glideDispY)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// log messages
|
||||||
|
it.color = Color.LIGHT_GRAY
|
||||||
|
for (i in 0 until messages.elemCount) {
|
||||||
|
Terrarum.fontGame.draw(it,
|
||||||
|
messages[i] ?: "",
|
||||||
|
40f,
|
||||||
|
80f + (messages.size - i - 1) * Terrarum.fontGame.lineHeight
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Terrarum.batch.inUse {
|
|
||||||
initViewPort(Terrarum.WIDTH, Terrarum.HEIGHT) // dunno, no render without this
|
|
||||||
it.projectionMatrix = camera.combined
|
|
||||||
blendNormal()
|
|
||||||
|
|
||||||
// draw text FBO to screen
|
|
||||||
val textTex = textFbo.colorBufferTexture
|
|
||||||
textTex.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear)
|
|
||||||
|
|
||||||
// --> original text
|
|
||||||
if (genuineSonic) {
|
|
||||||
it.color = Color.WHITE
|
|
||||||
it.draw(textTex, textX, glideDispY - 2f)
|
|
||||||
}
|
|
||||||
|
|
||||||
// --> ghost
|
|
||||||
it.color = getPulseEffCol()
|
|
||||||
|
|
||||||
if (it.color.a != 0f) genuineSonic = true
|
|
||||||
|
|
||||||
val drawWidth = getPulseEffWidthMul() * textTex.width
|
|
||||||
val drawHeight = getPulseEffWidthMul() * textTex.height
|
|
||||||
it.draw(textTex,
|
|
||||||
textX - (drawWidth - textTex.width) / 2f,
|
|
||||||
glideDispY - 2f - (drawHeight - textTex.height) / 2f,
|
|
||||||
drawWidth,
|
|
||||||
drawHeight
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// draw coloured arrows
|
|
||||||
arrowColours.forEachIndexed { index, color ->
|
|
||||||
it.color = color
|
|
||||||
it.draw(arrowObjTex, arrowObjPos + arrowObjGlideOffsetX + arrowObjTex.width * index, glideDispY)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// log messages
|
|
||||||
it.color = Color.LIGHT_GRAY
|
|
||||||
for (i in 0 until messages.elemCount) {
|
|
||||||
Terrarum.fontGame.draw(it,
|
|
||||||
messages[i] ?: "",
|
|
||||||
40f,
|
|
||||||
80f + (messages.size - i - 1) * Terrarum.fontGame.lineHeight
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getPulseEffCol(): Color {
|
private fun getPulseEffCol(): Color {
|
||||||
|
|||||||
@@ -355,8 +355,15 @@ object Terrarum : Game() {
|
|||||||
ingame!!.gameLoadInfoPayload = Ingame.NewWorldParameters(8192, 2048, HQRNG().nextLong())
|
ingame!!.gameLoadInfoPayload = Ingame.NewWorldParameters(8192, 2048, HQRNG().nextLong())
|
||||||
ingame!!.gameLoadMode = Ingame.GameLoadMode.CREATE_NEW
|
ingame!!.gameLoadMode = Ingame.GameLoadMode.CREATE_NEW
|
||||||
|
|
||||||
//super.setScreen(ingame)
|
|
||||||
|
LoadScreen.screenToLoad = ingame!!
|
||||||
super.setScreen(LoadScreen)
|
super.setScreen(LoadScreen)
|
||||||
|
|
||||||
|
//super.setScreen(ingame)
|
||||||
|
}
|
||||||
|
|
||||||
|
internal fun changeScreen(screen: Screen) {
|
||||||
|
super.setScreen(screen)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render() {
|
override fun render() {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package net.torvald.terrarum.worldgenerator
|
package net.torvald.terrarum.worldgenerator
|
||||||
|
|
||||||
|
import net.torvald.terrarum.LoadScreen
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by minjaesong on 16-06-13.
|
* Created by minjaesong on 16-06-13.
|
||||||
*/
|
*/
|
||||||
@@ -10,6 +12,8 @@ class ThreadProcessNoiseLayers(val startIndex: Int, val endIndex: Int,
|
|||||||
override fun run() {
|
override fun run() {
|
||||||
for (record in noiseRecords) {
|
for (record in noiseRecords) {
|
||||||
println("[mapgenerator] ${record.message}...")
|
println("[mapgenerator] ${record.message}...")
|
||||||
|
LoadScreen.addMessage("${record.message}...")
|
||||||
|
|
||||||
for (y in startIndex..endIndex) {
|
for (y in startIndex..endIndex) {
|
||||||
for (x in 0..WorldGenerator.WIDTH - 1) {
|
for (x in 0..WorldGenerator.WIDTH - 1) {
|
||||||
// straight-line sampling
|
// straight-line sampling
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import net.torvald.terrarum.blockproperties.Block
|
|||||||
import com.jme3.math.FastMath
|
import com.jme3.math.FastMath
|
||||||
import com.sudoplay.joise.Joise
|
import com.sudoplay.joise.Joise
|
||||||
import com.sudoplay.joise.module.*
|
import com.sudoplay.joise.module.*
|
||||||
|
import net.torvald.terrarum.LoadScreen
|
||||||
import net.torvald.terrarum.Terrarum
|
import net.torvald.terrarum.Terrarum
|
||||||
import net.torvald.terrarum.concurrent.ThreadParallel
|
import net.torvald.terrarum.concurrent.ThreadParallel
|
||||||
import net.torvald.terrarum.gameactors.roundInt
|
import net.torvald.terrarum.gameactors.roundInt
|
||||||
@@ -465,6 +466,7 @@ object WorldGenerator {
|
|||||||
|
|
||||||
// fill the area as Joise map
|
// fill the area as Joise map
|
||||||
println("[mapgenerator] Raising and eroding terrain...")
|
println("[mapgenerator] Raising and eroding terrain...")
|
||||||
|
LoadScreen.addMessage("Raising and eroding terrain...")
|
||||||
for (y in 0..(TERRAIN_UNDULATION - 1)) {
|
for (y in 0..(TERRAIN_UNDULATION - 1)) {
|
||||||
for (x in 0..WIDTH) {
|
for (x in 0..WIDTH) {
|
||||||
// straight-line sampling
|
// straight-line sampling
|
||||||
@@ -576,6 +578,7 @@ object WorldGenerator {
|
|||||||
|
|
||||||
private fun fillMapByNoiseMap() {
|
private fun fillMapByNoiseMap() {
|
||||||
println("[mapgenerator] Shaping world...")
|
println("[mapgenerator] Shaping world...")
|
||||||
|
LoadScreen.addMessage("Shaping world...")
|
||||||
// generate dirt-stone transition line
|
// generate dirt-stone transition line
|
||||||
// use catmull spline
|
// use catmull spline
|
||||||
val dirtStoneLine = IntArray(WIDTH)
|
val dirtStoneLine = IntArray(WIDTH)
|
||||||
@@ -750,7 +753,7 @@ object WorldGenerator {
|
|||||||
private fun processNoiseLayers(noiseRecords: Array<TaggedJoise>) {
|
private fun processNoiseLayers(noiseRecords: Array<TaggedJoise>) {
|
||||||
if (Terrarum.MULTITHREAD) {
|
if (Terrarum.MULTITHREAD) {
|
||||||
// set up indices
|
// set up indices
|
||||||
for (i in 0..Terrarum.THREADS - 1) {
|
for (i in 0 until Terrarum.THREADS) {
|
||||||
ThreadParallel.map(
|
ThreadParallel.map(
|
||||||
i,
|
i,
|
||||||
ThreadProcessNoiseLayers(
|
ThreadProcessNoiseLayers(
|
||||||
@@ -773,6 +776,7 @@ object WorldGenerator {
|
|||||||
|
|
||||||
private fun generateFloatingIslands() {
|
private fun generateFloatingIslands() {
|
||||||
println("[mapgenerator] Placing floating islands...")
|
println("[mapgenerator] Placing floating islands...")
|
||||||
|
LoadScreen.addMessage("Placing floating islands...")
|
||||||
|
|
||||||
val nIslandsMax = Math.round(world.width * 6f / 8192f)
|
val nIslandsMax = Math.round(world.width * 6f / 8192f)
|
||||||
val nIslandsMin = Math.max(2, Math.round(world.width * 4f / 8192f))
|
val nIslandsMin = Math.max(2, Math.round(world.width * 4f / 8192f))
|
||||||
@@ -804,7 +808,8 @@ object WorldGenerator {
|
|||||||
/* Flood */
|
/* Flood */
|
||||||
|
|
||||||
private fun floodBottomLava() {
|
private fun floodBottomLava() {
|
||||||
println("[mapgenerator] Flooding bottom lava...")
|
println("[mapgenerator] Flooding with lava...")
|
||||||
|
LoadScreen.addMessage("Flooding with lava...")
|
||||||
for (i in HEIGHT * 14 / 15..HEIGHT - 1) {
|
for (i in HEIGHT * 14 / 15..HEIGHT - 1) {
|
||||||
for (j in 0..WIDTH - 1) {
|
for (j in 0..WIDTH - 1) {
|
||||||
if (world.terrainArray[i][j].toInt() == 0) {
|
if (world.terrainArray[i][j].toInt() == 0) {
|
||||||
@@ -818,6 +823,7 @@ object WorldGenerator {
|
|||||||
|
|
||||||
private fun plantGrass() {
|
private fun plantGrass() {
|
||||||
println("[mapgenerator] Planting grass...")
|
println("[mapgenerator] Planting grass...")
|
||||||
|
LoadScreen.addMessage("Planting grass...")
|
||||||
|
|
||||||
/* TODO composing dirt and stone
|
/* TODO composing dirt and stone
|
||||||
* over certain level, use background dirt with stone 'peckles'
|
* over certain level, use background dirt with stone 'peckles'
|
||||||
|
|||||||
Reference in New Issue
Block a user