dump (another useless message)

This commit is contained in:
minjaesong
2018-08-05 21:57:18 +09:00
parent 0d05a40f8f
commit 6ed012f0c1
130 changed files with 1350 additions and 563 deletions

View File

@@ -4,14 +4,12 @@ package net.torvald.terrarum.gameworld
import com.badlogic.gdx.graphics.Color
import net.torvald.terrarum.realestate.LandUtil
import net.torvald.terrarum.blockproperties.BlockCodex
import net.torvald.terrarum.modulebasegame.gameworld.GameEconomy
import net.torvald.terrarum.modulebasegame.gameworld.WorldTime
import org.dyn4j.geometry.Vector2
typealias BlockAddress = Long
typealias BlockDamage = Float
class GameWorld(val width: Int, val height: Int) {
open class GameWorld(val width: Int, val height: Int) {
//layers
@@ -22,7 +20,8 @@ class GameWorld(val width: Int, val height: Int) {
val layerWallLowBits: PairedMapLayer
val layerTerrainLowBits: PairedMapLayer
val layerThermal: MapLayerFloat // in Kelvins
val layerThermal: MapLayerHalfFloat // in Kelvins
val layerAirPressure: MapLayerHalfFloat // (milibar - 1000)
/** Tilewise spawn point */
var spawnX: Int
@@ -42,10 +41,6 @@ class GameWorld(val width: Int, val height: Int) {
val time: WorldTime
val economy = GameEconomy()
var generatorSeed: Long = 0
@@ -61,14 +56,11 @@ class GameWorld(val width: Int, val height: Int) {
layerTerrainLowBits = PairedMapLayer(width, height)
layerWallLowBits = PairedMapLayer(width, height)
layerThermal = MapLayerFloat(width / 2, height / 2, averageTemperature)
// temperature layer: 2x2 is one cell
layerThermal = MapLayerHalfFloat(width / 2, height / 2, averageTemperature)
time = WorldTime(
71 * WorldTime.DAY_LENGTH +
7 * WorldTime.HOUR_SEC +
30L * WorldTime.MINUTE_SEC
)
// air pressure layer: 4 * 8 is one cell
layerAirPressure = MapLayerHalfFloat(width / 4, height / 8, 13f) // 1013 mBar
}
/**
@@ -187,10 +179,6 @@ class GameWorld(val width: Int, val height: Int) {
throw IllegalArgumentException("illegal mode input: " + mode.toString())
}
fun updateWorldTime(delta: Float) {
time.update(delta)
}
fun terrainIterator(): Iterator<Int> {
return object : Iterator<Int> {
@@ -297,6 +285,11 @@ class GameWorld(val width: Int, val height: Int) {
return layerThermal.getValue((worldTileX fmod width) / 2, worldTileY / 2)
}
fun getAirPressure(worldTileX: Int, worldTileY: Int): Float? {
return layerAirPressure.getValue((worldTileX fmod width) / 4, worldTileY / 8)
}
companion object {

View File

@@ -1,11 +1,9 @@
package net.torvald.terrarum.gameworld
import net.torvald.terrarum.modulecomputers.virtualcomputer.tvd.ByteArray64
/**
* Created by minjaesong on 2016-01-17.
*/
class MapLayer(val width: Int, val height: Int) : Iterable<Byte> {
open class MapLayer(val width: Int, val height: Int) : Iterable<Byte> {
internal @Volatile var data: ByteArray // in parallel programming: do not trust your register; always read freshly from RAM!

View File

@@ -8,7 +8,7 @@ import net.torvald.dataclass.Float16Bits
*
* Created by minjaesong on 2017-04-21.
*/
class MapLayerFloat(val width: Int, val height: Int) : Iterable<Float16Bits> {
open class MapLayerHalfFloat(val width: Int, val height: Int) : Iterable<Float16Bits> {
constructor(width: Int, height: Int, init: Float) : this(width, height) {
data = Array(height) { Array(width, { Float16.fromFloat(init) }) }

View File

@@ -1,6 +1,6 @@
package net.torvald.terrarum.gameworld
import net.torvald.point.Point2d
import net.torvald.terrarum.Point2d
class MapPoint {

View File

@@ -3,7 +3,7 @@ package net.torvald.terrarum.gameworld
/**
* Created by minjaesong on 2016-02-15.
*/
class PairedMapLayer(width: Int, val height: Int) : Iterable<Byte> {
open class PairedMapLayer(width: Int, val height: Int) : Iterable<Byte> {
/**
* 0b_xxxx_yyyy, x for lower index, y for higher index