Conditional overscanning for lightmap, actor/uiContainers are now LinkedList, added methods to retrieve/delete actors
Former-commit-id: 866789452965a62871e87713fa6c450e16f99895 Former-commit-id: b7a9b20d2a648ca0f10d4cf2f0ffdf449c38c1ae
6
.idea/libraries/lib.xml
generated
@@ -20,14 +20,10 @@
|
|||||||
<root url="http://slick.ninjacave.com/javadoc/" />
|
<root url="http://slick.ninjacave.com/javadoc/" />
|
||||||
<root url="file://$PROJECT_DIR$/lib/javadoc" />
|
<root url="file://$PROJECT_DIR$/lib/javadoc" />
|
||||||
<root url="file://$PROJECT_DIR$/lib/apidocs" />
|
<root url="file://$PROJECT_DIR$/lib/apidocs" />
|
||||||
<root url="jar://$PROJECT_DIR$/lib/commons-codec-1.10-javadoc.jar!/" />
|
|
||||||
<root url="https://commons.apache.org/proper/commons-csv/archives/1.1/apidocs/index.html" />
|
<root url="https://commons.apache.org/proper/commons-csv/archives/1.1/apidocs/index.html" />
|
||||||
</JAVADOC>
|
</JAVADOC>
|
||||||
<NATIVE>
|
<NATIVE>
|
||||||
<root url="file://$PROJECT_DIR$/lib/native" />
|
<root url="file://$PROJECT_DIR$/lib/natives" />
|
||||||
<root url="jar://$PROJECT_DIR$/lib/natives-linux.jar!/" />
|
|
||||||
<root url="jar://$PROJECT_DIR$/lib/natives-mac.jar!/" />
|
|
||||||
<root url="jar://$PROJECT_DIR$/lib/natives-windows.jar!/" />
|
|
||||||
</NATIVE>
|
</NATIVE>
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="file://$USER_HOME$/Downloads/slick/src" />
|
<root url="file://$USER_HOME$/Downloads/slick/src" />
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 237 B After Width: | Height: | Size: 249 B |
|
Before Width: | Height: | Size: 272 B |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 342 B After Width: | Height: | Size: 476 B |
|
Before Width: | Height: | Size: 364 B |
|
Before Width: | Height: | Size: 620 B After Width: | Height: | Size: 638 B |
|
Before Width: | Height: | Size: 158 B After Width: | Height: | Size: 157 B |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 738 B After Width: | Height: | Size: 744 B |
|
Before Width: | Height: | Size: 630 B After Width: | Height: | Size: 663 B |
|
Before Width: | Height: | Size: 664 B |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 483 KiB After Width: | Height: | Size: 1022 KiB |
|
Before Width: | Height: | Size: 479 KiB After Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 347 KiB After Width: | Height: | Size: 347 KiB |
@@ -55,6 +55,8 @@ class Col216 : LimitedColours {
|
|||||||
raw = (MUL_2 * r + MUL * g + b).toByte()
|
raw = (MUL_2 * r + MUL * g + b).toByte()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun toSlickColour(): Color = createSlickColor(raw.toUint())
|
||||||
|
|
||||||
private fun assertRaw(i: Int) {
|
private fun assertRaw(i: Int) {
|
||||||
if (i >= COLOUR_RANGE_SIZE || i < 0) {
|
if (i >= COLOUR_RANGE_SIZE || i < 0) {
|
||||||
println("i: " + i.toString())
|
println("i: " + i.toString())
|
||||||
@@ -71,6 +73,8 @@ class Col216 : LimitedColours {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun Byte.toUint() = this.toInt() and 0xFF
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@Transient private val LOOKUP = intArrayOf(0x00, 0x33, 0x66, 0x99, 0xCC, 0xFF)
|
@Transient private val LOOKUP = intArrayOf(0x00, 0x33, 0x66, 0x99, 0xCC, 0xFF)
|
||||||
|
|
||||||
|
|||||||
@@ -57,22 +57,22 @@ class Col4096 : LimitedColours {
|
|||||||
a = raw and 0xF000 shr 12
|
a = raw and 0xF000 shr 12
|
||||||
|
|
||||||
return Color(
|
return Color(
|
||||||
r shl 4 or r, g shl 4 or g, b shl 4 or b, a shl 4 or a)
|
r.shl(4) or r, g.shl(4) or g, b.shl(4) or b, a.shl(4) or a)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return Color(
|
return Color(
|
||||||
r shl 4 or r, g shl 4 or g, b shl 4 or b)
|
r.shl(4) or r, g.shl(4) or g, b.shl(4) or b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createSlickColor(r: Int, g: Int, b: Int): Color {
|
override fun createSlickColor(r: Int, g: Int, b: Int): Color {
|
||||||
assertARGB(0, r, g, b)
|
assertARGB(0, r, g, b)
|
||||||
return createSlickColor(r shl 8 or g shl 4 or b)
|
return createSlickColor(r.shl(8) or g.shl(4) or b)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createSlickColor(a: Int, r: Int, g: Int, b: Int): Color {
|
fun createSlickColor(a: Int, r: Int, g: Int, b: Int): Color {
|
||||||
assertARGB(a, r, g, b)
|
assertARGB(a, r, g, b)
|
||||||
return createSlickColor(a shl 12 or r shl 8 or g shl 4 or b)
|
return createSlickColor(a.shl(12) or r.shl(8) or g.shl(4) or b)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun create(raw: Int) {
|
override fun create(raw: Int) {
|
||||||
@@ -82,12 +82,12 @@ class Col4096 : LimitedColours {
|
|||||||
|
|
||||||
override fun create(r: Int, g: Int, b: Int) {
|
override fun create(r: Int, g: Int, b: Int) {
|
||||||
assertARGB(0, r, g, b)
|
assertARGB(0, r, g, b)
|
||||||
raw = (r shl 8 or g shl 4 or b).toShort()
|
raw = (r.shl(8) or g.shl(4) or b).toShort()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun create(a: Int, r: Int, g: Int, b: Int) {
|
fun create(a: Int, r: Int, g: Int, b: Int) {
|
||||||
assertARGB(a, r, g, b)
|
assertARGB(a, r, g, b)
|
||||||
raw = (a shl 12 or r shl 8 or g shl 4 or b).toShort()
|
raw = (a.shl(12) or r.shl(8) or g.shl(4) or b).toShort()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,13 +100,15 @@ class Col4096 : LimitedColours {
|
|||||||
val g = (raw.toInt() and 0x0F0) shr 4
|
val g = (raw.toInt() and 0x0F0) shr 4
|
||||||
val b = (raw.toInt() and 0x00F)
|
val b = (raw.toInt() and 0x00F)
|
||||||
|
|
||||||
ret[0] = (r shl 4 or r).toByte()
|
ret[0] = (r.shl(4) or r).toByte()
|
||||||
ret[1] = (g shl 4 or g).toByte()
|
ret[1] = (g.shl(4) or g).toByte()
|
||||||
ret[2] = (b shl 4 or b).toByte()
|
ret[2] = (b.shl(4) or b).toByte()
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun toSlickColour(): Color = createSlickColor(raw.toUint())
|
||||||
|
|
||||||
private fun assertRaw(i: Int) {
|
private fun assertRaw(i: Int) {
|
||||||
if (i > 0xFFFF || i < 0) {
|
if (i > 0xFFFF || i < 0) {
|
||||||
println("i: " + i.toString())
|
println("i: " + i.toString())
|
||||||
@@ -124,4 +126,5 @@ class Col4096 : LimitedColours {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun Short.toUint(): Int = this.toInt() and 0xFFFF
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,4 +13,5 @@ interface LimitedColours {
|
|||||||
fun create(raw: Int)
|
fun create(raw: Int)
|
||||||
fun create(r: Int, g: Int, b: Int)
|
fun create(r: Int, g: Int, b: Int)
|
||||||
|
|
||||||
|
fun toSlickColour(): Color
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ object WriteMeta {
|
|||||||
|
|
||||||
val BYTE_NULL: Byte = 0
|
val BYTE_NULL: Byte = 0
|
||||||
|
|
||||||
val terraseed: Long = MapGenerator.getGeneratorSeed()
|
val terraseed: Long = MapGenerator.SEED
|
||||||
val rogueseed: Long = RoguelikeRandomiser.getGeneratorSeed()
|
val rogueseed: Long = RoguelikeRandomiser.seed
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write save meta to specified directory. Returns false if something went wrong.
|
* Write save meta to specified directory. Returns false if something went wrong.
|
||||||
@@ -88,14 +88,14 @@ object WriteMeta {
|
|||||||
|
|
||||||
fun toByteArray(long: Long): ByteArray {
|
fun toByteArray(long: Long): ByteArray {
|
||||||
return byteArrayOf(
|
return byteArrayOf(
|
||||||
((long ushr 0x38) and 0xFF).toByte(),
|
(long.ushr(0x38) and 0xFF).toByte(),
|
||||||
((long ushr 0x30) and 0xFF).toByte(),
|
(long.ushr(0x30) and 0xFF).toByte(),
|
||||||
((long ushr 0x28) and 0xFF).toByte(),
|
(long.ushr(0x28) and 0xFF).toByte(),
|
||||||
((long ushr 0x20) and 0xFF).toByte(),
|
(long.ushr(0x20) and 0xFF).toByte(),
|
||||||
((long ushr 0x18) and 0xFF).toByte(),
|
(long.ushr(0x18) and 0xFF).toByte(),
|
||||||
((long ushr 0x10) and 0xFF).toByte(),
|
(long.ushr(0x10) and 0xFF).toByte(),
|
||||||
((long ushr 0x08) and 0xFF).toByte(),
|
(long.ushr(0x08) and 0xFF).toByte(),
|
||||||
((long ) and 0xFF).toByte()
|
(long and 0xFF).toByte()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -38,8 +38,8 @@ constructor() : BasicGameState() {
|
|||||||
|
|
||||||
lateinit var map: GameMap
|
lateinit var map: GameMap
|
||||||
|
|
||||||
var actorContainer = HashSet<Actor>()
|
val actorContainer = LinkedList<Actor>()
|
||||||
var uiContainer = HashSet<UIHandler>()
|
val uiContainer = LinkedList<UIHandler>()
|
||||||
|
|
||||||
lateinit var consoleHandler: UIHandler
|
lateinit var consoleHandler: UIHandler
|
||||||
lateinit var debugWindow: UIHandler
|
lateinit var debugWindow: UIHandler
|
||||||
@@ -54,19 +54,14 @@ constructor() : BasicGameState() {
|
|||||||
val ZOOM_MAX = 2.0f
|
val ZOOM_MAX = 2.0f
|
||||||
val ZOOM_MIN = 0.25f
|
val ZOOM_MIN = 0.25f
|
||||||
|
|
||||||
private var shader12BitCol: Shader? = null
|
private lateinit var shader12BitCol: Shader
|
||||||
private var shaderBlurH: Shader? = null
|
private lateinit var shaderBlurH: Shader
|
||||||
private var shaderBlurV: Shader? = null
|
private lateinit var shaderBlurV: Shader
|
||||||
|
|
||||||
|
|
||||||
private val useShader: Boolean = false
|
private val useShader: Boolean = false
|
||||||
private val shaderProgram = 0
|
private val shaderProgram = 0
|
||||||
|
|
||||||
|
|
||||||
private val ENV_COLTEMP_SUNRISE = 2500
|
|
||||||
private val ENV_SUNLIGHT_DELTA = MapDrawer.ENV_COLTEMP_NOON - ENV_COLTEMP_SUNRISE
|
|
||||||
|
|
||||||
|
|
||||||
val memInUse: Long
|
val memInUse: Long
|
||||||
get() = ManagementFactory.getMemoryMXBean().heapMemoryUsage.used shr 20
|
get() = ManagementFactory.getMemoryMXBean().heapMemoryUsage.used shr 20
|
||||||
val totalVMMem: Long
|
val totalVMMem: Long
|
||||||
@@ -98,11 +93,11 @@ constructor() : BasicGameState() {
|
|||||||
map.gravitation = 9.8f
|
map.gravitation = 9.8f
|
||||||
|
|
||||||
MapGenerator.attachMap(map)
|
MapGenerator.attachMap(map)
|
||||||
MapGenerator.setSeed(0x51621D2)
|
MapGenerator.SEED = 0x51621D2
|
||||||
//mapgenerator.setSeed(new HQRNG().nextLong());
|
//mapgenerator.setSeed(new HQRNG().nextLong());
|
||||||
MapGenerator.generateMap()
|
MapGenerator.generateMap()
|
||||||
|
|
||||||
RoguelikeRandomiser.setSeed(0x540198)
|
RoguelikeRandomiser.seed = 0x540198
|
||||||
//RoguelikeRandomiser.setSeed(new HQRNG().nextLong());
|
//RoguelikeRandomiser.setSeed(new HQRNG().nextLong());
|
||||||
|
|
||||||
|
|
||||||
@@ -110,7 +105,7 @@ constructor() : BasicGameState() {
|
|||||||
player = PFSigrid.create()
|
player = PFSigrid.create()
|
||||||
//player = PFCynthia.create()
|
//player = PFCynthia.create()
|
||||||
//player.setNoClip(true);
|
//player.setNoClip(true);
|
||||||
actorContainer.add(player)
|
addActor(player)
|
||||||
|
|
||||||
consoleHandler = UIHandler(ConsoleWindow())
|
consoleHandler = UIHandler(ConsoleWindow())
|
||||||
consoleHandler.setPosition(0, 0)
|
consoleHandler.setPosition(0, 0)
|
||||||
@@ -189,45 +184,32 @@ constructor() : BasicGameState() {
|
|||||||
|
|
||||||
MapCamera.renderBehind(gc, g)
|
MapCamera.renderBehind(gc, g)
|
||||||
|
|
||||||
actorContainer.forEach { actor ->
|
actorContainer.forEach { actor -> if (actor is Visible) actor.drawBody(gc, g) }
|
||||||
if (actor is Visible) actor.drawBody(gc, g)
|
|
||||||
if (actor is Glowing) actor.drawGlow(gc, g)
|
|
||||||
}
|
|
||||||
|
|
||||||
player.drawBody(gc, g)
|
player.drawBody(gc, g)
|
||||||
player.drawGlow(gc, g)
|
|
||||||
|
|
||||||
LightmapRenderer.renderLightMap()
|
LightmapRenderer.renderLightMap()
|
||||||
|
|
||||||
MapCamera.renderFront(gc, g)
|
MapCamera.renderFront(gc, g)
|
||||||
MapDrawer.render(gc, g)
|
MapDrawer.render(gc, g)
|
||||||
|
|
||||||
|
|
||||||
setBlendMul()
|
setBlendMul()
|
||||||
|
|
||||||
MapDrawer.drawEnvOverlay(g)
|
MapDrawer.drawEnvOverlay(g)
|
||||||
|
|
||||||
if (!KeyToggler.isOn(KEY_LIGHTMAP_RENDER)) setBlendMul()
|
if (!KeyToggler.isOn(KEY_LIGHTMAP_RENDER)) setBlendMul() else setBlendNormal()
|
||||||
else setBlendNormal()
|
LightmapRenderer.draw(g)
|
||||||
|
|
||||||
LightmapRenderer.draw(g)
|
|
||||||
|
|
||||||
setBlendNormal()
|
setBlendNormal()
|
||||||
|
|
||||||
|
actorContainer.forEach { actor -> if (actor is Glowing) actor.drawGlow(gc, g) }
|
||||||
|
player.drawGlow(gc, g)
|
||||||
|
|
||||||
uiContainer.forEach { ui -> ui.render(gc, g) }
|
uiContainer.forEach { ui -> ui.render(gc, g) }
|
||||||
debugWindow.render(gc, g)
|
debugWindow.render(gc, g)
|
||||||
consoleHandler.render(gc, g)
|
consoleHandler.render(gc, g)
|
||||||
notifinator.render(gc, g)
|
notifinator.render(gc, g)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addActor(e: Actor): Boolean {
|
|
||||||
return actorContainer.add(e)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun removeActor(e: Actor): Boolean {
|
|
||||||
return actorContainer.remove(e)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getGradientColour(row: Int): Color {
|
private fun getGradientColour(row: Int): Color {
|
||||||
val gradMapWidth = GRADIENT_IMAGE!!.width
|
val gradMapWidth = GRADIENT_IMAGE!!.width
|
||||||
val phase = Math.round(
|
val phase = Math.round(
|
||||||
@@ -298,4 +280,41 @@ constructor() : BasicGameState() {
|
|||||||
* extension function for org.newdawn.slick.Color
|
* extension function for org.newdawn.slick.Color
|
||||||
*/
|
*/
|
||||||
fun Color.getRGB24(): Int = (this.redByte shl 16) or (this.greenByte shl 8) or (this.blueByte)
|
fun Color.getRGB24(): Int = (this.redByte shl 16) or (this.greenByte shl 8) or (this.blueByte)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* actorContainer extensions
|
||||||
|
*/
|
||||||
|
fun hasActor(ID: Long): Boolean {
|
||||||
|
for (actor in actorContainer) {
|
||||||
|
if (actor.referenceID == ID) return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
fun removeActor(ID: Long) {
|
||||||
|
for (actor in actorContainer) {
|
||||||
|
if (actor.referenceID == ID)
|
||||||
|
actorContainer.remove(actor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun addActor(other: Actor): Boolean {
|
||||||
|
if (hasActor(other.referenceID)) return false
|
||||||
|
actorContainer.add(other)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getActor(ID: Long): Actor {
|
||||||
|
for (actor in actorContainer) {
|
||||||
|
if (actor.referenceID == ID)
|
||||||
|
return actor
|
||||||
|
}
|
||||||
|
throw NullPointerException("Actor with ID $ID does not exist.")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun addUI(other: UIHandler): Boolean {
|
||||||
|
if (uiContainer.contains(other)) return false
|
||||||
|
uiContainer.add(other)
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,9 @@ constructor(//properties
|
|||||||
|
|
||||||
//public World physWorld = new World( new Vec2(0, -TerrarumMain.game.gravitationalAccel) );
|
//public World physWorld = new World( new Vec2(0, -TerrarumMain.game.gravitationalAccel) );
|
||||||
//physics
|
//physics
|
||||||
var gravitation: Float = 0.toFloat()
|
/** \[m / s^2\] */
|
||||||
|
var gravitation: Float = 9.8.toFloat()
|
||||||
|
/** RGB in Integer */
|
||||||
var globalLight: Int = 0
|
var globalLight: Int = 0
|
||||||
val worldTime: WorldTime
|
val worldTime: WorldTime
|
||||||
|
|
||||||
@@ -193,9 +195,8 @@ constructor(//properties
|
|||||||
|
|
||||||
private var iteratorCount = 0
|
private var iteratorCount = 0
|
||||||
|
|
||||||
override fun hasNext(): Boolean {
|
override fun hasNext(): Boolean =
|
||||||
return iteratorCount < width * height
|
iteratorCount < width * height
|
||||||
}
|
|
||||||
|
|
||||||
override fun next(): Int {
|
override fun next(): Int {
|
||||||
val y = iteratorCount / width
|
val y = iteratorCount / width
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ object ItemPropCodex {
|
|||||||
val CSV_PATH = "./src/com/torvald/terrarum/itemproperties/itemprop.csv"
|
val CSV_PATH = "./src/com/torvald/terrarum/itemproperties/itemprop.csv"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <ItemID or RefID for Actor, TheItem>
|
* <ItemID or RefID for Actor, TheItem>
|
||||||
* Will return corresponding Actor if ID >= 32768
|
* Will return corresponding Actor if ID >= 32768
|
||||||
*/
|
*/
|
||||||
private lateinit var itemCodex: Array<InventoryItem>
|
private lateinit var itemCodex: Array<InventoryItem>
|
||||||
@@ -34,7 +34,7 @@ object ItemPropCodex {
|
|||||||
return itemCodex[(code and 0xFFFFFFFF).toInt()]
|
return itemCodex[(code and 0xFFFFFFFF).toInt()]
|
||||||
else {
|
else {
|
||||||
for (actor in Terrarum.game.actorContainer) {
|
for (actor in Terrarum.game.actorContainer) {
|
||||||
if (actor is CanBeAnItem && actor.referenceID.equals(code))
|
if (actor is CanBeAnItem && actor.referenceID == code)
|
||||||
return actor.itemData
|
return actor.itemData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.torvald.terrarum.gamemap.WorldTime
|
|||||||
import com.torvald.terrarum.Terrarum
|
import com.torvald.terrarum.Terrarum
|
||||||
import com.torvald.terrarum.tileproperties.TilePropCodex
|
import com.torvald.terrarum.tileproperties.TilePropCodex
|
||||||
import com.jme3.math.FastMath
|
import com.jme3.math.FastMath
|
||||||
|
import com.torvald.terrarum.tileproperties.TileNameCode
|
||||||
import org.newdawn.slick.Color
|
import org.newdawn.slick.Color
|
||||||
import org.newdawn.slick.Graphics
|
import org.newdawn.slick.Graphics
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -22,10 +23,8 @@ object LightmapRenderer {
|
|||||||
@Volatile private var lightMapLSB: Array<ByteArray>? = null // modify this to CharArray to implement 30-bit RGB
|
@Volatile private var lightMapLSB: Array<ByteArray>? = null // modify this to CharArray to implement 30-bit RGB
|
||||||
private var lightMapInitialised = false
|
private var lightMapInitialised = false
|
||||||
|
|
||||||
/**
|
// TODO dynamic lightmap with overscanning, HDR (use 30-bit to store 0-1023, 255 = 1.0, 1024 = 4.0)
|
||||||
* For entities that emits light (e.g. Player with shine potion)
|
// redefine ONLY IF camera zoom has been changed!
|
||||||
*/
|
|
||||||
private val lanterns = ArrayList<LightmapLantern>()
|
|
||||||
|
|
||||||
private val AIR = 0
|
private val AIR = 0
|
||||||
private val SUNSTONE = 41 // TODO add sunstone: emits same light as Map.GL. Goes dark at night
|
private val SUNSTONE = 41 // TODO add sunstone: emits same light as Map.GL. Goes dark at night
|
||||||
@@ -44,37 +43,6 @@ object LightmapRenderer {
|
|||||||
const val CHANNEL_MAX_FLOAT = CHANNEL_MAX.toFloat()
|
const val CHANNEL_MAX_FLOAT = CHANNEL_MAX.toFloat()
|
||||||
const val COLOUR_RANGE_SIZE = MUL * MUL_2
|
const val COLOUR_RANGE_SIZE = MUL * MUL_2
|
||||||
|
|
||||||
private const val deprecatedFeatureDebatable = "The usage of this feature is debatable. Do not use it yet."
|
|
||||||
|
|
||||||
|
|
||||||
@Deprecated(deprecatedFeatureDebatable)
|
|
||||||
fun addLantern(x: Int, y: Int, intensity: Int) {
|
|
||||||
val thisLantern = LightmapLantern(x, y, intensity)
|
|
||||||
|
|
||||||
for (i in lanterns.indices.reversed()) {
|
|
||||||
val lanternInList = lanterns[i]
|
|
||||||
// found duplicates
|
|
||||||
if (lanternInList.x == x && lanternInList.y == y) {
|
|
||||||
// add colour
|
|
||||||
val addedL = addRaw(intensity, lanternInList.intensity)
|
|
||||||
lanternInList.intensity = addedL
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//else
|
|
||||||
lanterns.add(thisLantern)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated(deprecatedFeatureDebatable)
|
|
||||||
fun removeLantern(x: Int, y: Int) {
|
|
||||||
for (i in lanterns.indices.reversed()) {
|
|
||||||
val lantern = lanterns[i]
|
|
||||||
if (lantern.x == x && lantern.y == y) {
|
|
||||||
lanterns.removeAt(i)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getLight(x: Int, y: Int): Int? =
|
fun getLight(x: Int, y: Int): Int? =
|
||||||
if (x !in 0..Terrarum.game.map.width - 1 || y !in 0..Terrarum.game.map.height - 1)
|
if (x !in 0..Terrarum.game.map.width - 1 || y !in 0..Terrarum.game.map.height - 1)
|
||||||
// if out of range then
|
// if out of range then
|
||||||
@@ -94,7 +62,7 @@ object LightmapRenderer {
|
|||||||
lightMapLSB = Array(Terrarum.game.map.height) { ByteArray(Terrarum.game.map.width) }
|
lightMapLSB = Array(Terrarum.game.map.height) { ByteArray(Terrarum.game.map.width) }
|
||||||
|
|
||||||
if (lightMapInitialised) {
|
if (lightMapInitialised) {
|
||||||
throw RuntimeException("Attempting to re-initialise 'staticLightMap'")
|
throw RuntimeException("Tried to re-initialise lightmap.")
|
||||||
}
|
}
|
||||||
|
|
||||||
lightMapInitialised = true
|
lightMapInitialised = true
|
||||||
@@ -104,180 +72,56 @@ object LightmapRenderer {
|
|||||||
val for_x_start = div16(MapCamera.cameraX) - 1 // fix for premature lightmap rendering
|
val for_x_start = div16(MapCamera.cameraX) - 1 // fix for premature lightmap rendering
|
||||||
val for_y_start = div16(MapCamera.cameraY) - 1 // on topmost/leftmost side
|
val for_y_start = div16(MapCamera.cameraY) - 1 // on topmost/leftmost side
|
||||||
|
|
||||||
val for_x_end = clampWTile(for_x_start + div16(MapCamera.getRenderWidth()) + 2) + 1
|
val for_x_end = for_x_start + div16(MapCamera.getRenderWidth()) + 3
|
||||||
val for_y_end = clampHTile(for_y_start + div16(MapCamera.getRenderHeight()) + 2) + 1 // same fix as above
|
val for_y_end = for_y_start + div16(MapCamera.getRenderHeight()) + 2 // same fix as above
|
||||||
|
|
||||||
|
val overscan: Int = FastMath.ceil(256f / (TilePropCodex.getProp(TileNameCode.AIR).opacity and 0xFF).toFloat())
|
||||||
|
val overscan_opaque: Int = FastMath.ceil(256f / (TilePropCodex.getProp(TileNameCode.STONE).opacity and 0xFF).toFloat())
|
||||||
|
|
||||||
|
val noop_mask = BitSet(2 * (for_x_end - for_x_start + 1) +
|
||||||
|
2 * (for_y_end - for_y_start - 1))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updating order:
|
* Updating order:
|
||||||
* +-----+ +-----+ +-----+ +-----+
|
* +--------+ +--+-----+ +-----+--+ +--------+ -
|
||||||
* |1 | | 1| |3 | | 3|
|
* | ↘ | | | 3| |3 | | | ↙ | ↕︎ overscan
|
||||||
* | 2 | > | 2 | > | 2 | > | 2 |
|
* | +-----+ | | 2 | | 2 | | +-----+ | -
|
||||||
* | 3| |3 | | 1| |1 |
|
* | |1 | → | |1 | → | 1| | → | 1| |
|
||||||
* +-----+ +-----+ +-----+ +-----+
|
* | | 2 | | +-----+ +-----+ | | 2 | |
|
||||||
* round: 1 2 3 4
|
* | | 3| | ↗ | | ↖ | |3 | |
|
||||||
|
* +--+-----+ +--------+ +--------+ +-----+--+
|
||||||
|
* round: 1 2 3 4
|
||||||
* for all staticLightMap[y][x]
|
* for all staticLightMap[y][x]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
purgePartOfLightmap(for_x_start, for_y_start, for_x_end, for_y_end)
|
purgePartOfLightmap(for_x_start - overscan, for_y_start - overscan, for_x_end + overscan, for_y_end + overscan)
|
||||||
// if wider purge were not applied, GL changing (sunset, sunrise) will behave incorrectly
|
|
||||||
// ("leakage" of not updated sunlight)
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Round 1
|
// Round 1
|
||||||
for (y in for_y_start..for_y_end - 1) {
|
for (y in for_y_start - overscan..for_y_end) {
|
||||||
for (x in for_x_start..for_x_end - 1) {
|
for (x in for_x_start - overscan..for_x_end) {
|
||||||
setLight(x, y, calculate(x, y))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Round 4
|
|
||||||
for (y in for_y_end - 1 downTo for_y_start + 1) {
|
|
||||||
for (x in for_x_start..for_x_end - 1) {
|
|
||||||
setLight(x, y, calculate(x, y))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Round 3
|
|
||||||
for (y in for_y_end - 1 downTo for_y_start + 1) {
|
|
||||||
for (x in for_x_end - 1 downTo for_x_start) {
|
|
||||||
setLight(x, y, calculate(x, y))
|
setLight(x, y, calculate(x, y))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Round 2
|
// Round 2
|
||||||
for (y in for_y_start..for_y_end - 1) {
|
for (y in for_y_end + overscan downTo for_y_start) {
|
||||||
for (x in for_x_end - 1 downTo for_x_start) {
|
for (x in for_x_start - overscan..for_x_end) {
|
||||||
setLight(x, y, calculate(x, y))
|
setLight(x, y, calculate(x, y))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (e: ArrayIndexOutOfBoundsException) {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
// Round 3
|
||||||
|
for (y in for_y_end + overscan downTo for_y_start) {
|
||||||
|
for (x in for_x_end + overscan downTo for_x_start) {
|
||||||
|
setLight(x, y, calculate(x, y))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun draw(g: Graphics) {
|
// Round 4
|
||||||
val for_x_start = MapCamera.getRenderStartX() - 1
|
for (y in for_y_start - overscan..for_y_end) {
|
||||||
val for_y_start = MapCamera.getRenderStartY() - 1
|
for (x in for_x_end + overscan downTo for_x_start) {
|
||||||
val for_x_end = MapCamera.getRenderEndX()
|
setLight(x, y, calculate(x, y))
|
||||||
val for_y_end = MapCamera.getRenderEndY()
|
|
||||||
|
|
||||||
// draw
|
|
||||||
try {
|
|
||||||
for (y in for_y_start..for_y_end - 1) {
|
|
||||||
var x = for_x_start
|
|
||||||
while (x < for_x_end) {
|
|
||||||
// smooth
|
|
||||||
if (Terrarum.game.screenZoom >= 1 && Terrarum.gameConfig.getAsBoolean("smoothlighting") ?: false) {
|
|
||||||
val thisLightLevel = getLight(x, y) ?: 0
|
|
||||||
if (y > 0 && x < for_x_end && thisLightLevel == 0
|
|
||||||
&& getLight(x, y - 1) == 0) {
|
|
||||||
try {
|
|
||||||
// coalesce zero intensity blocks to one
|
|
||||||
var zeroLevelCounter = 1
|
|
||||||
while (getLight(x + zeroLevelCounter, y) == 0
|
|
||||||
&& getLight(x + zeroLevelCounter, y - 1) == 0) {
|
|
||||||
zeroLevelCounter += 1
|
|
||||||
|
|
||||||
if (x + zeroLevelCounter >= for_x_end) break
|
|
||||||
}
|
|
||||||
|
|
||||||
g.color = Color(0)
|
|
||||||
g.fillRect(
|
|
||||||
Math.round(x.toFloat() * TSIZE.toFloat() * Terrarum.game.screenZoom).toFloat(), Math.round(y.toFloat() * TSIZE.toFloat() * Terrarum.game.screenZoom).toFloat(), (FastMath.ceil(
|
|
||||||
TSIZE * Terrarum.game.screenZoom) * zeroLevelCounter).toFloat(), FastMath.ceil(TSIZE * Terrarum.game.screenZoom).toFloat())
|
|
||||||
|
|
||||||
x += zeroLevelCounter - 1
|
|
||||||
}
|
|
||||||
catch (e: ArrayIndexOutOfBoundsException) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/** a
|
|
||||||
* +-+-+
|
|
||||||
* |i|j|
|
|
||||||
* b +-+-+ c
|
|
||||||
* |k|l|
|
|
||||||
* +-+-+
|
|
||||||
* d
|
|
||||||
*/
|
|
||||||
val a = if (y == 0)
|
|
||||||
thisLightLevel
|
|
||||||
else if (y == Terrarum.game.map.height - 1)
|
|
||||||
thisLightLevel
|
|
||||||
else
|
|
||||||
maximiseRGB(
|
|
||||||
getLight(x, y) ?: 0,
|
|
||||||
getLight(x, y - 1) ?: 0)
|
|
||||||
val d = if (y == 0)
|
|
||||||
thisLightLevel
|
|
||||||
else if (y == Terrarum.game.map.height - 1)
|
|
||||||
thisLightLevel
|
|
||||||
else
|
|
||||||
maximiseRGB(
|
|
||||||
getLight(x, y) ?: 0,
|
|
||||||
getLight(x, y + 1) ?: 0)
|
|
||||||
val b = if (x == 0)
|
|
||||||
thisLightLevel
|
|
||||||
else if (x == Terrarum.game.map.width - 1)
|
|
||||||
thisLightLevel
|
|
||||||
else
|
|
||||||
maximiseRGB(
|
|
||||||
getLight(x, y) ?: 0,
|
|
||||||
getLight(x - 1, y) ?: 0)
|
|
||||||
val c = if (x == 0)
|
|
||||||
thisLightLevel
|
|
||||||
else if (x == Terrarum.game.map.width - 1)
|
|
||||||
thisLightLevel
|
|
||||||
else
|
|
||||||
maximiseRGB(
|
|
||||||
getLight(x, y) ?: 0,
|
|
||||||
getLight(x + 1, y) ?: 0)
|
|
||||||
val colourMapItoL = IntArray(4)
|
|
||||||
colourMapItoL[0] = colourLinearMix(a, b)
|
|
||||||
colourMapItoL[1] = colourLinearMix(a, c)
|
|
||||||
colourMapItoL[2] = colourLinearMix(b, d)
|
|
||||||
colourMapItoL[3] = colourLinearMix(c, d)
|
|
||||||
|
|
||||||
for (iy in 0..1) {
|
|
||||||
for (ix in 0..1) {
|
|
||||||
g.color = Color(colourMapItoL[iy * 2 + ix])
|
|
||||||
|
|
||||||
g.fillRect(
|
|
||||||
Math.round(
|
|
||||||
x.toFloat() * TSIZE.toFloat() * Terrarum.game.screenZoom) + ix * TSIZE / 2 * Terrarum.game.screenZoom, Math.round(
|
|
||||||
y.toFloat() * TSIZE.toFloat() * Terrarum.game.screenZoom) + iy * TSIZE / 2 * Terrarum.game.screenZoom, FastMath.ceil(TSIZE * Terrarum.game.screenZoom / 2).toFloat(), FastMath.ceil(TSIZE * Terrarum.game.screenZoom / 2).toFloat())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
try {
|
|
||||||
val thisLightLevel = getLight(x, y)
|
|
||||||
|
|
||||||
// coalesce identical intensity blocks to one
|
|
||||||
var sameLevelCounter = 1
|
|
||||||
while (getLight(x + sameLevelCounter, y) == thisLightLevel) {
|
|
||||||
sameLevelCounter += 1
|
|
||||||
|
|
||||||
if (x + sameLevelCounter >= for_x_end) break
|
|
||||||
}
|
|
||||||
|
|
||||||
g.color = Color(getLight(x, y) ?: 0)
|
|
||||||
g.fillRect(
|
|
||||||
Math.round(x.toFloat() * TSIZE.toFloat() * Terrarum.game.screenZoom).toFloat(), Math.round(y.toFloat() * TSIZE.toFloat() * Terrarum.game.screenZoom).toFloat(), (FastMath.ceil(
|
|
||||||
TSIZE * Terrarum.game.screenZoom) * sameLevelCounter).toFloat(), FastMath.ceil(TSIZE * Terrarum.game.screenZoom).toFloat())
|
|
||||||
|
|
||||||
x += sameLevelCounter - 1
|
|
||||||
}
|
|
||||||
catch (e: ArrayIndexOutOfBoundsException) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
}// Retro
|
|
||||||
x++
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -304,7 +148,7 @@ object LightmapRenderer {
|
|||||||
// luminous tile on top of air
|
// luminous tile on top of air
|
||||||
else if (thisWall == AIR && thisTileLuminosity.toInt() > 0) {
|
else if (thisWall == AIR && thisTileLuminosity.toInt() > 0) {
|
||||||
val darkenSunlight = darkenColoured(sunLight, thisTileOpacity)
|
val darkenSunlight = darkenColoured(sunLight, thisTileOpacity)
|
||||||
lightLevelThis = maximiseRGB(darkenSunlight, thisTileLuminosity)
|
lightLevelThis = screenBlend(darkenSunlight, thisTileLuminosity)
|
||||||
}
|
}
|
||||||
// opaque wall and luminous tile
|
// opaque wall and luminous tile
|
||||||
else if (thisWall != AIR && thisTileLuminosity.toInt() > 0) {
|
else if (thisWall != AIR && thisTileLuminosity.toInt() > 0) {
|
||||||
@@ -312,14 +156,6 @@ object LightmapRenderer {
|
|||||||
}
|
}
|
||||||
// END MIX TILE
|
// END MIX TILE
|
||||||
|
|
||||||
// mix lantern
|
|
||||||
for (lantern in lanterns) {
|
|
||||||
if (lantern.x == x && lantern.y == y) {
|
|
||||||
lightLevelThis = screenBlend(lightLevelThis, lantern.intensity)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// mix luminous actor
|
// mix luminous actor
|
||||||
for (actor in Terrarum.game.actorContainer) {
|
for (actor in Terrarum.game.actorContainer) {
|
||||||
if (actor is Luminous && actor is ActorWithBody) {
|
if (actor is Luminous && actor is ActorWithBody) {
|
||||||
@@ -328,6 +164,7 @@ object LightmapRenderer {
|
|||||||
val actorLuminosity = actor.luminosity
|
val actorLuminosity = actor.luminosity
|
||||||
if (x == tileX && y == tileY) {
|
if (x == tileX && y == tileY) {
|
||||||
lightLevelThis = screenBlend(lightLevelThis, actorLuminosity)
|
lightLevelThis = screenBlend(lightLevelThis, actorLuminosity)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -382,6 +219,122 @@ object LightmapRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun draw(g: Graphics) {
|
||||||
|
val for_x_start = div16(MapCamera.cameraX) - 1 // fix for premature lightmap rendering
|
||||||
|
val for_y_start = div16(MapCamera.cameraY) - 1 // on topmost/leftmost side
|
||||||
|
|
||||||
|
val for_x_end = for_x_start + div16(MapCamera.getRenderWidth()) + 3
|
||||||
|
val for_y_end = for_y_start + div16(MapCamera.getRenderHeight()) + 2 // same fix as above
|
||||||
|
|
||||||
|
|
||||||
|
// draw
|
||||||
|
try {
|
||||||
|
for (y in for_y_start..for_y_end) {
|
||||||
|
var x = for_x_start
|
||||||
|
while (x < for_x_end) {
|
||||||
|
// smooth
|
||||||
|
if (Terrarum.game.screenZoom >= 1 && Terrarum.gameConfig.getAsBoolean("smoothlighting") ?: false) {
|
||||||
|
val thisLightLevel = getLight(x, y) ?: 0
|
||||||
|
if (y > 0 && x < for_x_end && thisLightLevel == 0
|
||||||
|
&& getLight(x, y - 1) == 0) {
|
||||||
|
try {
|
||||||
|
// coalesce zero intensity blocks to one
|
||||||
|
var zeroLevelCounter = 1
|
||||||
|
while (getLight(x + zeroLevelCounter, y) == 0
|
||||||
|
&& getLight(x + zeroLevelCounter, y - 1) == 0) {
|
||||||
|
zeroLevelCounter += 1
|
||||||
|
|
||||||
|
if (x + zeroLevelCounter >= for_x_end) break
|
||||||
|
}
|
||||||
|
|
||||||
|
g.color = Color(0)
|
||||||
|
g.fillRect(
|
||||||
|
Math.round(x.toFloat() * TSIZE.toFloat() * Terrarum.game.screenZoom).toFloat(), Math.round(y.toFloat() * TSIZE.toFloat() * Terrarum.game.screenZoom).toFloat(), (FastMath.ceil(
|
||||||
|
TSIZE * Terrarum.game.screenZoom) * zeroLevelCounter).toFloat(), FastMath.ceil(TSIZE * Terrarum.game.screenZoom).toFloat())
|
||||||
|
|
||||||
|
x += zeroLevelCounter - 1
|
||||||
|
}
|
||||||
|
catch (e: ArrayIndexOutOfBoundsException) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/** a
|
||||||
|
* +-+-+
|
||||||
|
* |i|j|
|
||||||
|
* b +-+-+ c
|
||||||
|
* |k|l|
|
||||||
|
* +-+-+
|
||||||
|
* d
|
||||||
|
*/
|
||||||
|
val a = maximiseRGB(
|
||||||
|
thisLightLevel,
|
||||||
|
getLight(x, y - 1) ?: thisLightLevel
|
||||||
|
)
|
||||||
|
val d = maximiseRGB(
|
||||||
|
thisLightLevel,
|
||||||
|
getLight(x, y + 1) ?: thisLightLevel
|
||||||
|
)
|
||||||
|
val b = maximiseRGB(
|
||||||
|
thisLightLevel,
|
||||||
|
getLight(x - 1, y) ?: thisLightLevel
|
||||||
|
)
|
||||||
|
val c = maximiseRGB(
|
||||||
|
thisLightLevel,
|
||||||
|
getLight(x + 1, y) ?: thisLightLevel
|
||||||
|
)
|
||||||
|
val colourMapItoL = IntArray(4)
|
||||||
|
colourMapItoL[0] = colourLinearMix(a, b)
|
||||||
|
colourMapItoL[1] = colourLinearMix(a, c)
|
||||||
|
colourMapItoL[2] = colourLinearMix(b, d)
|
||||||
|
colourMapItoL[3] = colourLinearMix(c, d)
|
||||||
|
|
||||||
|
for (iy in 0..1) {
|
||||||
|
for (ix in 0..1) {
|
||||||
|
g.color = Color(colourMapItoL[iy * 2 + ix])
|
||||||
|
|
||||||
|
g.fillRect(
|
||||||
|
Math.round(
|
||||||
|
x.toFloat() * TSIZE.toFloat() * Terrarum.game.screenZoom) + ix * TSIZE / 2 * Terrarum.game.screenZoom, Math.round(
|
||||||
|
y.toFloat() * TSIZE.toFloat() * Terrarum.game.screenZoom) + iy * TSIZE / 2 * Terrarum.game.screenZoom, FastMath.ceil(TSIZE * Terrarum.game.screenZoom / 2).toFloat(), FastMath.ceil(TSIZE * Terrarum.game.screenZoom / 2).toFloat())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
val thisLightLevel = getLight(x, y)
|
||||||
|
|
||||||
|
// coalesce identical intensity blocks to one
|
||||||
|
var sameLevelCounter = 1
|
||||||
|
while (getLight(x + sameLevelCounter, y) == thisLightLevel) {
|
||||||
|
sameLevelCounter += 1
|
||||||
|
|
||||||
|
if (x + sameLevelCounter >= for_x_end) break
|
||||||
|
}
|
||||||
|
|
||||||
|
g.color = Color(getLight(x, y) ?: 0)
|
||||||
|
g.fillRect(
|
||||||
|
Math.round(x.toFloat() * TSIZE.toFloat() * Terrarum.game.screenZoom).toFloat(), Math.round(y.toFloat() * TSIZE.toFloat() * Terrarum.game.screenZoom).toFloat(), (FastMath.ceil(
|
||||||
|
TSIZE * Terrarum.game.screenZoom) * sameLevelCounter).toFloat(), FastMath.ceil(TSIZE * Terrarum.game.screenZoom).toFloat())
|
||||||
|
|
||||||
|
x += sameLevelCounter - 1
|
||||||
|
}
|
||||||
|
catch (e: ArrayIndexOutOfBoundsException) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
}// Retro
|
||||||
|
x++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e: ArrayIndexOutOfBoundsException) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subtract each channel's RGB value.
|
* Subtract each channel's RGB value.
|
||||||
*
|
*
|
||||||
@@ -492,6 +445,20 @@ object LightmapRenderer {
|
|||||||
return constructRGBFromInt(newR, newG, newB)
|
return constructRGBFromInt(newR, newG, newB)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun minimiseRGB(rgb: Int, rgb2: Int): Int {
|
||||||
|
val r1 = getRawR(rgb)
|
||||||
|
val r2 = getRawR(rgb2)
|
||||||
|
val newR = if (r1 < r2) r1 else r2
|
||||||
|
val g1 = getRawG(rgb)
|
||||||
|
val g2 = getRawG(rgb2)
|
||||||
|
val newG = if (g1 < g2) g1 else g2
|
||||||
|
val b1 = getRawB(rgb)
|
||||||
|
val b2 = getRawB(rgb2)
|
||||||
|
val newB = if (b1 < b2) b1 else b2
|
||||||
|
|
||||||
|
return constructRGBFromInt(newR, newG, newB)
|
||||||
|
}
|
||||||
|
|
||||||
private fun screenBlend(rgb: Int, rgb2: Int): Int {
|
private fun screenBlend(rgb: Int, rgb2: Int): Int {
|
||||||
val r1 = getR(rgb)
|
val r1 = getR(rgb)
|
||||||
val r2 = getR(rgb2)
|
val r2 = getR(rgb2)
|
||||||
@@ -624,13 +591,13 @@ object LightmapRenderer {
|
|||||||
try {
|
try {
|
||||||
for (y in y1 - 1..y2 + 1) {
|
for (y in y1 - 1..y2 + 1) {
|
||||||
for (x in x1 - 1..x2 + 1) {
|
for (x in x1 - 1..x2 + 1) {
|
||||||
if (y == y1 - 1 || y == y2 + 1 || x == x1 - 1 || x == x2 + 1) {
|
//if (y == y1 - 1 || y == y2 + 1 || x == x1 - 1 || x == x2 + 1) {
|
||||||
// fill the rim with (pre) calculation
|
// fill the rim with (pre) calculation
|
||||||
setLight(x, y, preCalculateUpdateGLOnly(x, y))
|
// setLight(x, y, preCalculateUpdateGLOnly(x, y))
|
||||||
}
|
//}
|
||||||
else {
|
//else {
|
||||||
setLight(x, y, 0)
|
setLight(x, y, 0)
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -639,53 +606,6 @@ object LightmapRenderer {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun preCalculateUpdateGLOnly(x: Int, y: Int): Int {
|
|
||||||
var lightLevelThis: Int = 0
|
|
||||||
val thisTerrain = Terrarum.game.map.getTileFromTerrain(x, y)
|
|
||||||
val thisWall = Terrarum.game.map.getTileFromWall(x, y)
|
|
||||||
val thisTileLuminosity = TilePropCodex.getProp(thisTerrain).luminosity
|
|
||||||
val thisTileOpacity = TilePropCodex.getProp(thisTerrain).opacity
|
|
||||||
val sunLight = Terrarum.game.map.globalLight
|
|
||||||
|
|
||||||
// MIX TILE
|
|
||||||
// open air
|
|
||||||
if (thisTerrain == AIR && thisWall == AIR) {
|
|
||||||
lightLevelThis = sunLight
|
|
||||||
}
|
|
||||||
// luminous tile on top of air
|
|
||||||
else if (thisWall == AIR && thisTileLuminosity.toInt() > 0) {
|
|
||||||
val darkenSunlight = darkenColoured(sunLight, thisTileOpacity)
|
|
||||||
lightLevelThis = maximiseRGB(darkenSunlight, thisTileLuminosity)
|
|
||||||
}
|
|
||||||
// opaque wall and luminous tile
|
|
||||||
else if (thisWall != AIR && thisTileLuminosity.toInt() > 0) {
|
|
||||||
lightLevelThis = thisTileLuminosity
|
|
||||||
}
|
|
||||||
// END MIX TILE
|
|
||||||
|
|
||||||
// mix lantern
|
|
||||||
for (lantern in lanterns) {
|
|
||||||
if (lantern.x == x && lantern.y == y) {
|
|
||||||
lightLevelThis = screenBlend(lightLevelThis, lantern.intensity)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// mix luminous actor
|
|
||||||
for (actor in Terrarum.game.actorContainer) {
|
|
||||||
if (actor is Luminous && actor is ActorWithBody) {
|
|
||||||
val tileX = Math.round(actor.hitbox!!.pointedX / TSIZE)
|
|
||||||
val tileY = Math.round(actor.hitbox!!.pointedY / TSIZE) - 1
|
|
||||||
val actorLuminosity = actor.luminosity
|
|
||||||
if (x == tileX && y == tileY) {
|
|
||||||
lightLevelThis = screenBlend(lightLevelThis, actorLuminosity)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return lightLevelThis
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun clampWTile(x: Int): Int {
|
private fun clampWTile(x: Int): Int {
|
||||||
if (x < 0) {
|
if (x < 0) {
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -184,10 +184,39 @@ object MapCamera {
|
|||||||
*/
|
*/
|
||||||
private val TILES_BLEND_MUL = arrayOf(
|
private val TILES_BLEND_MUL = arrayOf(
|
||||||
TileNameCode.WATER
|
TileNameCode.WATER
|
||||||
|
, TileNameCode.WATER_1
|
||||||
|
, TileNameCode.WATER_2
|
||||||
|
, TileNameCode.WATER_3
|
||||||
|
, TileNameCode.WATER_4
|
||||||
|
, TileNameCode.WATER_5
|
||||||
|
, TileNameCode.WATER_6
|
||||||
|
, TileNameCode.WATER_7
|
||||||
|
, TileNameCode.WATER_8
|
||||||
|
, TileNameCode.WATER_9
|
||||||
|
, TileNameCode.WATER_10
|
||||||
|
, TileNameCode.WATER_11
|
||||||
|
, TileNameCode.WATER_12
|
||||||
|
, TileNameCode.WATER_13
|
||||||
|
, TileNameCode.WATER_14
|
||||||
|
, TileNameCode.WATER_15
|
||||||
, TileNameCode.LAVA
|
, TileNameCode.LAVA
|
||||||
|
, TileNameCode.LAVA_1
|
||||||
|
, TileNameCode.LAVA_2
|
||||||
|
, TileNameCode.LAVA_3
|
||||||
|
, TileNameCode.LAVA_4
|
||||||
|
, TileNameCode.LAVA_5
|
||||||
|
, TileNameCode.LAVA_6
|
||||||
|
, TileNameCode.LAVA_7
|
||||||
|
, TileNameCode.LAVA_8
|
||||||
|
, TileNameCode.LAVA_9
|
||||||
|
, TileNameCode.LAVA_10
|
||||||
|
, TileNameCode.LAVA_11
|
||||||
|
, TileNameCode.LAVA_12
|
||||||
|
, TileNameCode.LAVA_13
|
||||||
|
, TileNameCode.LAVA_14
|
||||||
|
, TileNameCode.LAVA_15
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun update(gc: GameContainer, delta_t: Int) {
|
fun update(gc: GameContainer, delta_t: Int) {
|
||||||
val player = Terrarum.game.player
|
val player = Terrarum.game.player
|
||||||
|
|
||||||
@@ -201,7 +230,6 @@ object MapCamera {
|
|||||||
player.hitbox!!.centeredY - renderHeight / 2, TSIZE.toFloat(), map.height * TSIZE - renderHeight - TSIZE.toFloat()))
|
player.hitbox!!.centeredY - renderHeight / 2, TSIZE.toFloat(), map.height * TSIZE - renderHeight - TSIZE.toFloat()))
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun renderBehind(gc: GameContainer, g: Graphics) {
|
fun renderBehind(gc: GameContainer, g: Graphics) {
|
||||||
/**
|
/**
|
||||||
* render to camera
|
* render to camera
|
||||||
@@ -211,7 +239,6 @@ object MapCamera {
|
|||||||
drawTiles(TERRAIN, false)
|
drawTiles(TERRAIN, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun renderFront(gc: GameContainer, g: Graphics) {
|
fun renderFront(gc: GameContainer, g: Graphics) {
|
||||||
setBlendMul()
|
setBlendMul()
|
||||||
drawTiles(TERRAIN, true)
|
drawTiles(TERRAIN, true)
|
||||||
@@ -252,12 +279,17 @@ object MapCamera {
|
|||||||
|
|
||||||
&& (thisTile ?: 0) > 0
|
&& (thisTile ?: 0) > 0
|
||||||
&&
|
&&
|
||||||
// check if light level of upper tile is zero and
|
// check if light level of nearby or this tile is illuminated
|
||||||
// that of this tile is also zero
|
( LightmapRenderer.getValueFromMap(x, y) ?: 0 > 0
|
||||||
(y > 0 && !(LightmapRenderer.getValueFromMap(x, y) ?: 0.toInt() == 0
|
|| LightmapRenderer.getValueFromMap(x - 1, y) ?: 0 > 0
|
||||||
&& LightmapRenderer.getValueFromMap(x, y - 1) ?: 0.toInt() == 0)
|
|| LightmapRenderer.getValueFromMap(x + 1, y) ?: 0 > 0
|
||||||
// check if light level of this tile is zero, for y = 0
|
|| LightmapRenderer.getValueFromMap(x, y - 1) ?: 0 > 0
|
||||||
|| y == 0 && LightmapRenderer.getValueFromMap(x, y) ?: 0.toInt() > 0)) {
|
|| LightmapRenderer.getValueFromMap(x, y + 1) ?: 0 > 0
|
||||||
|
|| LightmapRenderer.getValueFromMap(x - 1, y - 1) ?: 0 > 0
|
||||||
|
|| LightmapRenderer.getValueFromMap(x + 1, y + 1) ?: 0 > 0
|
||||||
|
|| LightmapRenderer.getValueFromMap(x + 1, y - 1) ?: 0 > 0
|
||||||
|
|| LightmapRenderer.getValueFromMap(x - 1, y + 1) ?: 0 > 0)
|
||||||
|
) {
|
||||||
|
|
||||||
val nearbyTilesInfo: Int
|
val nearbyTilesInfo: Int
|
||||||
if (isWallSticker(thisTile)) {
|
if (isWallSticker(thisTile)) {
|
||||||
@@ -284,13 +316,9 @@ object MapCamera {
|
|||||||
drawTile(mode, x, y, thisTileX, thisTileY)
|
drawTile(mode, x, y, thisTileX, thisTileY)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// currently it draws all the transparent tile and colour mixes
|
// do NOT add "if (!isBlendMul(thisTile))"!
|
||||||
// on top of the previously drawn tile
|
// or else they will not look like they should be when backed with wall
|
||||||
// TODO check wether it works as intended when skybox is dark
|
drawTile(mode, x, y, thisTileX, thisTileY)
|
||||||
// add instruction "if (!isBlendMul((byte) thisTile))"
|
|
||||||
if (!isBlendMul(thisTile)) {
|
|
||||||
drawTile(mode, x, y, thisTileX, thisTileY)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: NullPointerException) {
|
} catch (e: NullPointerException) {
|
||||||
@@ -345,7 +373,7 @@ object MapCamera {
|
|||||||
for (i in 0..3) {
|
for (i in 0..3) {
|
||||||
try {
|
try {
|
||||||
if (!TilePropCodex.getProp(nearbyTiles[i]).isSolid) {
|
if (!TilePropCodex.getProp(nearbyTiles[i]).isSolid) {
|
||||||
ret += 1 shl i // add 1, 2, 4, 8 for i = 0, 1, 2, 3
|
ret += (1 shl i) // add 1, 2, 4, 8 for i = 0, 1, 2, 3
|
||||||
}
|
}
|
||||||
} catch (e: ArrayIndexOutOfBoundsException) {
|
} catch (e: ArrayIndexOutOfBoundsException) {
|
||||||
}
|
}
|
||||||
@@ -364,7 +392,8 @@ object MapCamera {
|
|||||||
nearbyTiles[NEARBY_TILE_KEY_BACK] = map.getTileFrom(WALL, x, y) ?: 4096
|
nearbyTiles[NEARBY_TILE_KEY_BACK] = map.getTileFrom(WALL, x, y) ?: 4096
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (TilePropCodex.getProp(nearbyTiles[NEARBY_TILE_KEY_RIGHT]).isSolid && TilePropCodex.getProp(nearbyTiles[NEARBY_TILE_KEY_LEFT]).isSolid) {
|
if (TilePropCodex.getProp(nearbyTiles[NEARBY_TILE_KEY_RIGHT]).isSolid
|
||||||
|
&& TilePropCodex.getProp(nearbyTiles[NEARBY_TILE_KEY_LEFT]).isSolid) {
|
||||||
if (TilePropCodex.getProp(nearbyTiles[NEARBY_TILE_KEY_BACK]).isSolid)
|
if (TilePropCodex.getProp(nearbyTiles[NEARBY_TILE_KEY_BACK]).isSolid)
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ object MapGenerator {
|
|||||||
private lateinit var map: GameMap
|
private lateinit var map: GameMap
|
||||||
private lateinit var random: Random
|
private lateinit var random: Random
|
||||||
//private static float[] noiseArray;
|
//private static float[] noiseArray;
|
||||||
private var SEED: Long = 0
|
var SEED: Long = 0
|
||||||
var WIDTH: Int = 0
|
var WIDTH: Int = 0
|
||||||
var HEIGHT: Int = 0
|
var HEIGHT: Int = 0
|
||||||
|
|
||||||
@@ -74,10 +74,6 @@ object MapGenerator {
|
|||||||
GLACIER_MOUNTAIN_WIDTH = Math.round(GLACIER_MOUNTAIN_WIDTH * widthMulFactor)
|
GLACIER_MOUNTAIN_WIDTH = Math.round(GLACIER_MOUNTAIN_WIDTH * widthMulFactor)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setSeed(seed: Long) {
|
|
||||||
this.SEED = seed
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate terrain and override attached map
|
* Generate terrain and override attached map
|
||||||
*/
|
*/
|
||||||
@@ -905,10 +901,6 @@ object MapGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun getGeneratorSeed(): Long {
|
|
||||||
return SEED
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Utility */
|
/* Utility */
|
||||||
|
|
||||||
private fun clampN(clampNumber: Int, num: Int): Int {
|
private fun clampN(clampNumber: Int, num: Int): Int {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.torvald.terrarum.mapgenerator
|
|||||||
|
|
||||||
import com.torvald.colourutil.Col4096
|
import com.torvald.colourutil.Col4096
|
||||||
import com.torvald.random.HQRNG
|
import com.torvald.random.HQRNG
|
||||||
|
import org.newdawn.slick.Color
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -9,14 +10,14 @@ import java.util.*
|
|||||||
*/
|
*/
|
||||||
object RoguelikeRandomiser {
|
object RoguelikeRandomiser {
|
||||||
|
|
||||||
private val POTION_PRIMARY_COLSET = intArrayOf(15, 15, 7, 7, 0, 0)
|
val POTION_PRIMARY_COLSET = intArrayOf(15, 15, 7, 7, 0, 0)
|
||||||
|
|
||||||
private var potionColours: HashMap<Int, Col4096> = HashMap()
|
var potionColours: HashMap<Int, Col4096> = HashMap()
|
||||||
private var coloursDiscovered: HashMap<Col4096, Boolean> = HashMap()
|
var coloursDiscovered: HashMap<Col4096, Boolean> = HashMap()
|
||||||
|
|
||||||
val coloursTaken: ArrayList<Col4096> = ArrayList()
|
val coloursTaken: ArrayList<Col4096> = ArrayList()
|
||||||
|
|
||||||
private var seed: Long? = null
|
var seed: Long = 0
|
||||||
private val random: Random = HQRNG()
|
private val random: Random = HQRNG()
|
||||||
|
|
||||||
private val POTION_HEAL_TIER1 = 0x00
|
private val POTION_HEAL_TIER1 = 0x00
|
||||||
@@ -27,18 +28,134 @@ object RoguelikeRandomiser {
|
|||||||
private val POTION_BERSERK_TIER1 = 0x20
|
private val POTION_BERSERK_TIER1 = 0x20
|
||||||
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun setSeed(seed: Long) {
|
|
||||||
this.seed = seed
|
|
||||||
}
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun setupColours() {
|
fun setupColours() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For external classes/objects, does not touch COLOUR SET
|
||||||
|
* @param arr Array of Int(0-15)
|
||||||
|
*/
|
||||||
|
fun composeColourFrom(arr: IntArray): Color {
|
||||||
|
val colourElements = arr.copyOf()
|
||||||
|
shuffleArrayInt(colourElements, HQRNG())
|
||||||
|
|
||||||
fun getGeneratorSeed(): Long {
|
val colourStack = IntArrayStack(colourElements)
|
||||||
return seed!!
|
|
||||||
|
return Col4096(colourStack.pop(),
|
||||||
|
colourStack.pop(),
|
||||||
|
colourStack.pop())
|
||||||
|
.toSlickColour()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fun shuffleArrayInt(ar: IntArray, rnd: Random) {
|
||||||
|
for (i in ar.size - 1 downTo 0) {
|
||||||
|
val index = rnd.nextInt(i + 1);
|
||||||
|
// Simple swap
|
||||||
|
val a = ar[index];
|
||||||
|
ar[index] = ar[i];
|
||||||
|
ar[i] = a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class IntArrayStack {
|
||||||
|
/**
|
||||||
|
* Number of elements in the stack
|
||||||
|
*/
|
||||||
|
var depth: Int = 0
|
||||||
|
private set
|
||||||
|
|
||||||
|
var size: Int
|
||||||
|
get() = data.size
|
||||||
|
set(newSize) {
|
||||||
|
if (newSize > depth) inflate(newSize - data.size)
|
||||||
|
else deflate(data.size - newSize)
|
||||||
|
}
|
||||||
|
|
||||||
|
private lateinit var data: IntArray
|
||||||
|
|
||||||
|
constructor(stackSize: Int) {
|
||||||
|
data = IntArray(stackSize)
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(arr: IntArray) {
|
||||||
|
data = arr.copyOf()
|
||||||
|
depth = size
|
||||||
|
}
|
||||||
|
|
||||||
|
fun push(v: Int) {
|
||||||
|
if (depth >= data.size) throw StackOverflowError()
|
||||||
|
data[depth++] = v
|
||||||
|
}
|
||||||
|
|
||||||
|
fun pop(): Int {
|
||||||
|
if (depth == 0) throw EmptyStackException()
|
||||||
|
return data[--depth]
|
||||||
|
}
|
||||||
|
|
||||||
|
fun peek(): Int? {
|
||||||
|
if (depth == 0) return null
|
||||||
|
return data[depth - 1]
|
||||||
|
}
|
||||||
|
|
||||||
|
fun dup() {
|
||||||
|
if (depth == 0) throw EmptyStackException()
|
||||||
|
if (depth == data.size) throw StackOverflowError()
|
||||||
|
push(peek()!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun swap() {
|
||||||
|
if (depth < 2) throw UnsupportedOperationException("Stack is empty or has only one element.")
|
||||||
|
val up = pop()
|
||||||
|
val dn = pop()
|
||||||
|
push(up)
|
||||||
|
push(dn)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun drop() {
|
||||||
|
if (depth == 0) throw EmptyStackException()
|
||||||
|
--depth
|
||||||
|
}
|
||||||
|
|
||||||
|
fun defineFromArray(arr: IntArray) { data = arr.copyOf() }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Increase the stack size by a factor.
|
||||||
|
*/
|
||||||
|
fun inflate(sizeToAdd: Int) {
|
||||||
|
if (sizeToAdd < 0) throw UnsupportedOperationException("$sizeToAdd: Cannot deflate the stack with this function. Use deflate(int) instead.")
|
||||||
|
size += sizeToAdd
|
||||||
|
val oldStack = this.asArray()
|
||||||
|
data = IntArray(size, { if (it < oldStack.size) oldStack[it] else 0 })
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decrease the stack size by a factor. Overflowing data will be removed.
|
||||||
|
*/
|
||||||
|
fun deflate(sizeToTake: Int) {
|
||||||
|
if (size - sizeToTake < 1) throw UnsupportedOperationException("$sizeToTake: Cannot deflate the stack to the size of zero or negative.")
|
||||||
|
size -= sizeToTake
|
||||||
|
val oldStack = this.asArray()
|
||||||
|
data = IntArray(size, { oldStack[it] })
|
||||||
|
if (depth > data.size) depth = data.size
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert stack as array. Index zero is the bottommost element.
|
||||||
|
* @return array of data, with array size equivalent to the stack depth.
|
||||||
|
*/
|
||||||
|
fun asArray() = data.copyOfRange(0, depth - 1)
|
||||||
|
|
||||||
|
fun equalTo(other: IntArrayStack) = (this.asArray() == other.asArray())
|
||||||
|
|
||||||
|
fun plus() { data[depth - 2] += pop() }
|
||||||
|
fun minus() { data[depth - 2] -= pop() }
|
||||||
|
fun times() { data[depth - 2] *= pop() }
|
||||||
|
fun div() { data[depth - 2] /= pop() }
|
||||||
|
fun mod() { data[depth - 2] %= pop() }
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -90,10 +90,15 @@ constructor(gamename: String) : StateBasedGame(gamename) {
|
|||||||
lateinit var gameConfig: GameConfig
|
lateinit var gameConfig: GameConfig
|
||||||
|
|
||||||
lateinit var OSName: String
|
lateinit var OSName: String
|
||||||
|
private set
|
||||||
lateinit var OSVersion: String
|
lateinit var OSVersion: String
|
||||||
|
private set
|
||||||
lateinit var OperationSystem: String
|
lateinit var OperationSystem: String
|
||||||
|
private set
|
||||||
lateinit var defaultDir: String
|
lateinit var defaultDir: String
|
||||||
|
private set
|
||||||
lateinit var defaultSaveDir: String
|
lateinit var defaultSaveDir: String
|
||||||
|
private set
|
||||||
|
|
||||||
var gameLocale = "" // locale override
|
var gameLocale = "" // locale override
|
||||||
|
|
||||||
|
|||||||
@@ -9,136 +9,137 @@ object TileNameCode {
|
|||||||
|
|
||||||
val AIR = 0
|
val AIR = 0
|
||||||
|
|
||||||
val STONE = TilePropCodex.indexDamageToArrayAddr(1, 0)
|
val STONE = TilePropCodex.idDamageToIndex(1, 0)
|
||||||
val STONE_QUARRIED = TilePropCodex.indexDamageToArrayAddr(1, 1)
|
val STONE_QUARRIED = TilePropCodex.idDamageToIndex(1, 1)
|
||||||
|
|
||||||
val DIRT = TilePropCodex.indexDamageToArrayAddr(2, 0)
|
val DIRT = TilePropCodex.idDamageToIndex(2, 0)
|
||||||
val GRASS = TilePropCodex.indexDamageToArrayAddr(2, 1)
|
val GRASS = TilePropCodex.idDamageToIndex(2, 1)
|
||||||
|
|
||||||
val PLANK_NORMAL = TilePropCodex.indexDamageToArrayAddr(3, 0)
|
val PLANK_NORMAL = TilePropCodex.idDamageToIndex(3, 0)
|
||||||
val PLANK_EBONY = TilePropCodex.indexDamageToArrayAddr(3, 1)
|
val PLANK_EBONY = TilePropCodex.idDamageToIndex(3, 1)
|
||||||
val PLANK_BIRCH = TilePropCodex.indexDamageToArrayAddr(3, 2)
|
val PLANK_BIRCH = TilePropCodex.idDamageToIndex(3, 2)
|
||||||
val PLANK_BLOODROSE = TilePropCodex.indexDamageToArrayAddr(3, 3)
|
val PLANK_BLOODROSE = TilePropCodex.idDamageToIndex(3, 3)
|
||||||
|
|
||||||
val TRUNK_NORMAL = TilePropCodex.indexDamageToArrayAddr(4, 0)
|
val TRUNK_NORMAL = TilePropCodex.idDamageToIndex(4, 0)
|
||||||
val TRUNK_EBONY = TilePropCodex.indexDamageToArrayAddr(4, 1)
|
val TRUNK_EBONY = TilePropCodex.idDamageToIndex(4, 1)
|
||||||
val TRUNK_BIRCH = TilePropCodex.indexDamageToArrayAddr(4, 2)
|
val TRUNK_BIRCH = TilePropCodex.idDamageToIndex(4, 2)
|
||||||
val TRUNK_BLOODROSE = TilePropCodex.indexDamageToArrayAddr(4, 3)
|
val TRUNK_BLOODROSE = TilePropCodex.idDamageToIndex(4, 3)
|
||||||
|
|
||||||
val SAND = TilePropCodex.indexDamageToArrayAddr(5, 0)
|
val SAND = TilePropCodex.idDamageToIndex(5, 0)
|
||||||
val SAND_WHITE = TilePropCodex.indexDamageToArrayAddr(5, 1)
|
val SAND_WHITE = TilePropCodex.idDamageToIndex(5, 1)
|
||||||
val SAND_RED = TilePropCodex.indexDamageToArrayAddr(5, 2)
|
val SAND_RED = TilePropCodex.idDamageToIndex(5, 2)
|
||||||
val SAND_DESERT = TilePropCodex.indexDamageToArrayAddr(5, 3)
|
val SAND_DESERT = TilePropCodex.idDamageToIndex(5, 3)
|
||||||
val SAND_BLACK = TilePropCodex.indexDamageToArrayAddr(5, 4)
|
val SAND_BLACK = TilePropCodex.idDamageToIndex(5, 4)
|
||||||
val SAND_GREEN = TilePropCodex.indexDamageToArrayAddr(5, 5)
|
val SAND_GREEN = TilePropCodex.idDamageToIndex(5, 5)
|
||||||
|
|
||||||
val GRAVEL = TilePropCodex.indexDamageToArrayAddr(6, 0)
|
val GRAVEL = TilePropCodex.idDamageToIndex(6, 0)
|
||||||
val GRAVEL_GREY = TilePropCodex.indexDamageToArrayAddr(6, 1)
|
val GRAVEL_GREY = TilePropCodex.idDamageToIndex(6, 1)
|
||||||
|
|
||||||
val ORE_COPPER = TilePropCodex.indexDamageToArrayAddr(7, 0)
|
val ORE_COPPER = TilePropCodex.idDamageToIndex(7, 0)
|
||||||
val ORE_IRON = TilePropCodex.indexDamageToArrayAddr(7, 1)
|
val ORE_IRON = TilePropCodex.idDamageToIndex(7, 1)
|
||||||
val ORE_GOLD = TilePropCodex.indexDamageToArrayAddr(7, 2)
|
val ORE_GOLD = TilePropCodex.idDamageToIndex(7, 2)
|
||||||
val ORE_SILVER = TilePropCodex.indexDamageToArrayAddr(7, 3)
|
val ORE_SILVER = TilePropCodex.idDamageToIndex(7, 3)
|
||||||
val ORE_ILMENITE = TilePropCodex.indexDamageToArrayAddr(7, 4)
|
val ORE_ILMENITE = TilePropCodex.idDamageToIndex(7, 4)
|
||||||
val ORE_AURICHALCUM = TilePropCodex.indexDamageToArrayAddr(7, 5)
|
val ORE_AURICHALCUM = TilePropCodex.idDamageToIndex(7, 5)
|
||||||
|
|
||||||
val RAW_RUBY = TilePropCodex.indexDamageToArrayAddr(8, 0)
|
val RAW_RUBY = TilePropCodex.idDamageToIndex(8, 0)
|
||||||
val RAW_EMERALD = TilePropCodex.indexDamageToArrayAddr(8, 1)
|
val RAW_EMERALD = TilePropCodex.idDamageToIndex(8, 1)
|
||||||
val RAW_SAPPHIRE = TilePropCodex.indexDamageToArrayAddr(8, 2)
|
val RAW_SAPPHIRE = TilePropCodex.idDamageToIndex(8, 2)
|
||||||
val RAW_TOPAZ = TilePropCodex.indexDamageToArrayAddr(8, 3)
|
val RAW_TOPAZ = TilePropCodex.idDamageToIndex(8, 3)
|
||||||
val RAW_DIAMOND = TilePropCodex.indexDamageToArrayAddr(8, 4)
|
val RAW_DIAMOND = TilePropCodex.idDamageToIndex(8, 4)
|
||||||
val RAW_AMETHYST = TilePropCodex.indexDamageToArrayAddr(8, 5)
|
val RAW_AMETHYST = TilePropCodex.idDamageToIndex(8, 5)
|
||||||
|
|
||||||
val SNOW = TilePropCodex.indexDamageToArrayAddr(9, 0)
|
val SNOW = TilePropCodex.idDamageToIndex(9, 0)
|
||||||
val ICE_FRAGILE = TilePropCodex.indexDamageToArrayAddr(9, 1)
|
val ICE_FRAGILE = TilePropCodex.idDamageToIndex(9, 1)
|
||||||
val ICE_NATURAL = TilePropCodex.indexDamageToArrayAddr(9, 2)
|
val ICE_NATURAL = TilePropCodex.idDamageToIndex(9, 2)
|
||||||
val ICE_MAGICAL = TilePropCodex.indexDamageToArrayAddr(9, 3)
|
val ICE_MAGICAL = TilePropCodex.idDamageToIndex(9, 3)
|
||||||
|
|
||||||
val PLATFORM_STONE = TilePropCodex.indexDamageToArrayAddr(10, 0)
|
val PLATFORM_STONE = TilePropCodex.idDamageToIndex(10, 0)
|
||||||
val PLATFORM_WOODEN = TilePropCodex.indexDamageToArrayAddr(10, 1)
|
val PLATFORM_WOODEN = TilePropCodex.idDamageToIndex(10, 1)
|
||||||
val PLATFORM_EBONY = TilePropCodex.indexDamageToArrayAddr(10, 2)
|
val PLATFORM_EBONY = TilePropCodex.idDamageToIndex(10, 2)
|
||||||
val PLATFORM_BIRCH = TilePropCodex.indexDamageToArrayAddr(10, 3)
|
val PLATFORM_BIRCH = TilePropCodex.idDamageToIndex(10, 3)
|
||||||
val PLATFORM_BLOODROSE = TilePropCodex.indexDamageToArrayAddr(10, 4)
|
val PLATFORM_BLOODROSE = TilePropCodex.idDamageToIndex(10, 4)
|
||||||
|
|
||||||
val TORCH = TilePropCodex.indexDamageToArrayAddr(11, 0)
|
val TORCH = TilePropCodex.idDamageToIndex(11, 0)
|
||||||
val TORCH_FROST = TilePropCodex.indexDamageToArrayAddr(11, 1)
|
val TORCH_FROST = TilePropCodex.idDamageToIndex(11, 1)
|
||||||
|
|
||||||
val TORCH_OFF = TilePropCodex.indexDamageToArrayAddr(12, 0)
|
val TORCH_OFF = TilePropCodex.idDamageToIndex(12, 0)
|
||||||
val TORCH_FROST_OFF = TilePropCodex.indexDamageToArrayAddr(12, 1)
|
val TORCH_FROST_OFF = TilePropCodex.idDamageToIndex(12, 1)
|
||||||
|
|
||||||
val ILLUMINATOR_WHITE = TilePropCodex.indexDamageToArrayAddr(13, 0)
|
val ILLUMINATOR_WHITE = TilePropCodex.idDamageToIndex(13, 0)
|
||||||
val ILLUMINATOR_YELLOW = TilePropCodex.indexDamageToArrayAddr(13, 1)
|
val ILLUMINATOR_YELLOW = TilePropCodex.idDamageToIndex(13, 1)
|
||||||
val ILLUMINATOR_ORANGE = TilePropCodex.indexDamageToArrayAddr(13, 2)
|
val ILLUMINATOR_ORANGE = TilePropCodex.idDamageToIndex(13, 2)
|
||||||
val ILLUMINATOR_RED = TilePropCodex.indexDamageToArrayAddr(13, 3)
|
val ILLUMINATOR_RED = TilePropCodex.idDamageToIndex(13, 3)
|
||||||
val ILLUMINATOR_FUCHSIA = TilePropCodex.indexDamageToArrayAddr(13, 4)
|
val ILLUMINATOR_FUCHSIA = TilePropCodex.idDamageToIndex(13, 4)
|
||||||
val ILLUMINATOR_PURPLE = TilePropCodex.indexDamageToArrayAddr(13, 5)
|
val ILLUMINATOR_PURPLE = TilePropCodex.idDamageToIndex(13, 5)
|
||||||
val ILLUMINATOR_BLUE = TilePropCodex.indexDamageToArrayAddr(13, 6)
|
val ILLUMINATOR_BLUE = TilePropCodex.idDamageToIndex(13, 6)
|
||||||
val ILLUMINATOR_CYAN = TilePropCodex.indexDamageToArrayAddr(13, 7)
|
val ILLUMINATOR_CYAN = TilePropCodex.idDamageToIndex(13, 7)
|
||||||
val ILLUMINATOR_GREEN = TilePropCodex.indexDamageToArrayAddr(13, 8)
|
val ILLUMINATOR_GREEN = TilePropCodex.idDamageToIndex(13, 8)
|
||||||
val ILLUMINATOR_GREEN_DARK = TilePropCodex.indexDamageToArrayAddr(13, 9)
|
val ILLUMINATOR_GREEN_DARK = TilePropCodex.idDamageToIndex(13, 9)
|
||||||
val ILLUMINATOR_BROWN = TilePropCodex.indexDamageToArrayAddr(13, 10)
|
val ILLUMINATOR_BROWN = TilePropCodex.idDamageToIndex(13, 10)
|
||||||
val ILLUMINATOR_TAN = TilePropCodex.indexDamageToArrayAddr(13, 11)
|
val ILLUMINATOR_TAN = TilePropCodex.idDamageToIndex(13, 11)
|
||||||
val ILLUMINATOR_GREY_LIGHT = TilePropCodex.indexDamageToArrayAddr(13, 12)
|
val ILLUMINATOR_GREY_LIGHT = TilePropCodex.idDamageToIndex(13, 12)
|
||||||
val ILLUMINATOR_GREY_MED = TilePropCodex.indexDamageToArrayAddr(13, 13)
|
val ILLUMINATOR_GREY_MED = TilePropCodex.idDamageToIndex(13, 13)
|
||||||
val ILLUMINATOR_GREY_DARK = TilePropCodex.indexDamageToArrayAddr(13, 14)
|
val ILLUMINATOR_GREY_DARK = TilePropCodex.idDamageToIndex(13, 14)
|
||||||
val ILLUMINATOR_BLACK = TilePropCodex.indexDamageToArrayAddr(13, 15)
|
val ILLUMINATOR_BLACK = TilePropCodex.idDamageToIndex(13, 15)
|
||||||
|
|
||||||
val ILLUMINATOR_WHITE_OFF = TilePropCodex.indexDamageToArrayAddr(14, 0)
|
val ILLUMINATOR_WHITE_OFF = TilePropCodex.idDamageToIndex(14, 0)
|
||||||
val ILLUMINATOR_YELLOW_OFF = TilePropCodex.indexDamageToArrayAddr(14, 1)
|
val ILLUMINATOR_YELLOW_OFF = TilePropCodex.idDamageToIndex(14, 1)
|
||||||
val ILLUMINATOR_ORANGE_OFF = TilePropCodex.indexDamageToArrayAddr(14, 2)
|
val ILLUMINATOR_ORANGE_OFF = TilePropCodex.idDamageToIndex(14, 2)
|
||||||
val ILLUMINATOR_RED_OFF = TilePropCodex.indexDamageToArrayAddr(14, 3)
|
val ILLUMINATOR_RED_OFF = TilePropCodex.idDamageToIndex(14, 3)
|
||||||
val ILLUMINATOR_FUCHSIA_OFF = TilePropCodex.indexDamageToArrayAddr(14, 4)
|
val ILLUMINATOR_FUCHSIA_OFF = TilePropCodex.idDamageToIndex(14, 4)
|
||||||
val ILLUMINATOR_PURPLE_OFF = TilePropCodex.indexDamageToArrayAddr(14, 5)
|
val ILLUMINATOR_PURPLE_OFF = TilePropCodex.idDamageToIndex(14, 5)
|
||||||
val ILLUMINATOR_BLUE_OFF = TilePropCodex.indexDamageToArrayAddr(14, 6)
|
val ILLUMINATOR_BLUE_OFF = TilePropCodex.idDamageToIndex(14, 6)
|
||||||
val ILLUMINATOR_CYAN_OFF = TilePropCodex.indexDamageToArrayAddr(14, 7)
|
val ILLUMINATOR_CYAN_OFF = TilePropCodex.idDamageToIndex(14, 7)
|
||||||
val ILLUMINATOR_GREEN_OFF = TilePropCodex.indexDamageToArrayAddr(14, 8)
|
val ILLUMINATOR_GREEN_OFF = TilePropCodex.idDamageToIndex(14, 8)
|
||||||
val ILLUMINATOR_GREEN_DARK_OFF = TilePropCodex.indexDamageToArrayAddr(14, 9)
|
val ILLUMINATOR_GREEN_DARK_OFF = TilePropCodex.idDamageToIndex(14, 9)
|
||||||
val ILLUMINATOR_BROWN_OFF = TilePropCodex.indexDamageToArrayAddr(14, 10)
|
val ILLUMINATOR_BROWN_OFF = TilePropCodex.idDamageToIndex(14, 10)
|
||||||
val ILLUMINATOR_TAN_OFF = TilePropCodex.indexDamageToArrayAddr(14, 11)
|
val ILLUMINATOR_TAN_OFF = TilePropCodex.idDamageToIndex(14, 11)
|
||||||
val ILLUMINATOR_GREY_LIGHT_OFF = TilePropCodex.indexDamageToArrayAddr(14, 12)
|
val ILLUMINATOR_GREY_LIGHT_OFF = TilePropCodex.idDamageToIndex(14, 12)
|
||||||
val ILLUMINATOR_GREY_MED_OFF = TilePropCodex.indexDamageToArrayAddr(14, 13)
|
val ILLUMINATOR_GREY_MED_OFF = TilePropCodex.idDamageToIndex(14, 13)
|
||||||
val ILLUMINATOR_GREY_DARK_OFF = TilePropCodex.indexDamageToArrayAddr(14, 14)
|
val ILLUMINATOR_GREY_DARK_OFF = TilePropCodex.idDamageToIndex(14, 14)
|
||||||
val ILLUMINATOR_BLACK_OFF = TilePropCodex.indexDamageToArrayAddr(14, 15)
|
val ILLUMINATOR_BLACK_OFF = TilePropCodex.idDamageToIndex(14, 15)
|
||||||
|
|
||||||
val SANDSTONE = TilePropCodex.indexDamageToArrayAddr(15, 0)
|
val SANDSTONE = TilePropCodex.idDamageToIndex(15, 0)
|
||||||
val SANDSTONE_WHITE = TilePropCodex.indexDamageToArrayAddr(15, 1)
|
val SANDSTONE_WHITE = TilePropCodex.idDamageToIndex(15, 1)
|
||||||
val SANDSTONE_RED = TilePropCodex.indexDamageToArrayAddr(15, 2)
|
val SANDSTONE_RED = TilePropCodex.idDamageToIndex(15, 2)
|
||||||
val SANDSTONE_DESERT = TilePropCodex.indexDamageToArrayAddr(15, 3)
|
val SANDSTONE_DESERT = TilePropCodex.idDamageToIndex(15, 3)
|
||||||
val SANDSTONE_BLACK = TilePropCodex.indexDamageToArrayAddr(15, 4)
|
val SANDSTONE_BLACK = TilePropCodex.idDamageToIndex(15, 4)
|
||||||
val SANDSTONE_GREEN = TilePropCodex.indexDamageToArrayAddr(15, 5)
|
val SANDSTONE_GREEN = TilePropCodex.idDamageToIndex(15, 5)
|
||||||
|
|
||||||
val WATER_1 = TilePropCodex.indexDamageToArrayAddr(254, 0)
|
val WATER_1 = TilePropCodex.idDamageToIndex(255, 0)
|
||||||
val WATER_2 = TilePropCodex.indexDamageToArrayAddr(254, 1)
|
val WATER_2 = TilePropCodex.idDamageToIndex(255, 1)
|
||||||
val WATER_3 = TilePropCodex.indexDamageToArrayAddr(254, 2)
|
val WATER_3 = TilePropCodex.idDamageToIndex(255, 2)
|
||||||
val WATER_4 = TilePropCodex.indexDamageToArrayAddr(254, 3)
|
val WATER_4 = TilePropCodex.idDamageToIndex(255, 3)
|
||||||
val WATER_5 = TilePropCodex.indexDamageToArrayAddr(254, 4)
|
val WATER_5 = TilePropCodex.idDamageToIndex(255, 4)
|
||||||
val WATER_6 = TilePropCodex.indexDamageToArrayAddr(254, 5)
|
val WATER_6 = TilePropCodex.idDamageToIndex(255, 5)
|
||||||
val WATER_7 = TilePropCodex.indexDamageToArrayAddr(254, 6)
|
val WATER_7 = TilePropCodex.idDamageToIndex(255, 6)
|
||||||
val WATER_8 = TilePropCodex.indexDamageToArrayAddr(254, 7)
|
val WATER_8 = TilePropCodex.idDamageToIndex(255, 7)
|
||||||
val WATER_9 = TilePropCodex.indexDamageToArrayAddr(254, 8)
|
val WATER_9 = TilePropCodex.idDamageToIndex(255, 8)
|
||||||
val WATER_10 = TilePropCodex.indexDamageToArrayAddr(254, 9)
|
val WATER_10 = TilePropCodex.idDamageToIndex(255, 9)
|
||||||
val WATER_11 = TilePropCodex.indexDamageToArrayAddr(254, 10)
|
val WATER_11 = TilePropCodex.idDamageToIndex(255, 10)
|
||||||
val WATER_12 = TilePropCodex.indexDamageToArrayAddr(254, 11)
|
val WATER_12 = TilePropCodex.idDamageToIndex(255, 11)
|
||||||
val WATER_13 = TilePropCodex.indexDamageToArrayAddr(254, 12)
|
val WATER_13 = TilePropCodex.idDamageToIndex(255, 12)
|
||||||
val WATER_14 = TilePropCodex.indexDamageToArrayAddr(254, 13)
|
val WATER_14 = TilePropCodex.idDamageToIndex(255, 13)
|
||||||
val WATER_15 = TilePropCodex.indexDamageToArrayAddr(254, 14)
|
val WATER_15 = TilePropCodex.idDamageToIndex(255, 14)
|
||||||
val WATER = TilePropCodex.indexDamageToArrayAddr(254, 15)
|
val WATER = TilePropCodex.idDamageToIndex(255, 15)
|
||||||
|
|
||||||
val LAVA_1 = TilePropCodex.indexDamageToArrayAddr(255, 0)
|
val LAVA_1 = TilePropCodex.idDamageToIndex(254, 0)
|
||||||
val LAVA_2 = TilePropCodex.indexDamageToArrayAddr(255, 1)
|
val LAVA_2 = TilePropCodex.idDamageToIndex(254, 1)
|
||||||
val LAVA_3 = TilePropCodex.indexDamageToArrayAddr(255, 2)
|
val LAVA_3 = TilePropCodex.idDamageToIndex(254, 2)
|
||||||
val LAVA_4 = TilePropCodex.indexDamageToArrayAddr(255, 3)
|
val LAVA_4 = TilePropCodex.idDamageToIndex(254, 3)
|
||||||
val LAVA_5 = TilePropCodex.indexDamageToArrayAddr(255, 4)
|
val LAVA_5 = TilePropCodex.idDamageToIndex(254, 4)
|
||||||
val LAVA_6 = TilePropCodex.indexDamageToArrayAddr(255, 5)
|
val LAVA_6 = TilePropCodex.idDamageToIndex(254, 5)
|
||||||
val LAVA_7 = TilePropCodex.indexDamageToArrayAddr(255, 6)
|
val LAVA_7 = TilePropCodex.idDamageToIndex(254, 6)
|
||||||
val LAVA_8 = TilePropCodex.indexDamageToArrayAddr(255, 7)
|
val LAVA_8 = TilePropCodex.idDamageToIndex(254, 7)
|
||||||
val LAVA_9 = TilePropCodex.indexDamageToArrayAddr(255, 8)
|
val LAVA_9 = TilePropCodex.idDamageToIndex(254, 8)
|
||||||
val LAVA_10 = TilePropCodex.indexDamageToArrayAddr(255, 9)
|
val LAVA_10 = TilePropCodex.idDamageToIndex(254, 9)
|
||||||
val LAVA_11 = TilePropCodex.indexDamageToArrayAddr(255, 10)
|
val LAVA_11 = TilePropCodex.idDamageToIndex(254, 10)
|
||||||
val LAVA_12 = TilePropCodex.indexDamageToArrayAddr(255, 11)
|
val LAVA_12 = TilePropCodex.idDamageToIndex(254, 11)
|
||||||
val LAVA_13 = TilePropCodex.indexDamageToArrayAddr(255, 12)
|
val LAVA_13 = TilePropCodex.idDamageToIndex(254, 12)
|
||||||
val LAVA_14 = TilePropCodex.indexDamageToArrayAddr(255, 13)
|
val LAVA_14 = TilePropCodex.idDamageToIndex(254, 13)
|
||||||
val LAVA_15 = TilePropCodex.indexDamageToArrayAddr(255, 14)
|
val LAVA_15 = TilePropCodex.idDamageToIndex(254, 14)
|
||||||
val LAVA = TilePropCodex.indexDamageToArrayAddr(255, 15)
|
val LAVA = TilePropCodex.idDamageToIndex(254, 15)
|
||||||
|
|
||||||
|
val NULL = 4096
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import java.io.IOException
|
|||||||
class TilePropCodex {
|
class TilePropCodex {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
tileProps = Array<TileProp>(MapLayer.RANGE * PairedMapLayer.RANGE,
|
tileProps = Array<TileProp>(MapLayer.RANGE * PairedMapLayer.RANGE + 1,
|
||||||
{i -> TileProp() }
|
{i -> TileProp() }
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ class TilePropCodex {
|
|||||||
println("[TilePropCodex] Building tile properties table")
|
println("[TilePropCodex] Building tile properties table")
|
||||||
|
|
||||||
records.forEach { record -> setProp(
|
records.forEach { record -> setProp(
|
||||||
tileProps[indexDamageToArrayAddr(intVal(record, "id"), intVal(record, "dmg"))]
|
tileProps[idDamageToIndex(intVal(record, "id"), intVal(record, "dmg"))]
|
||||||
, record)
|
, record)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -46,24 +46,24 @@ class TilePropCodex {
|
|||||||
|
|
||||||
fun getProp(index: Int, damage: Int): TileProp {
|
fun getProp(index: Int, damage: Int): TileProp {
|
||||||
try {
|
try {
|
||||||
tileProps[indexDamageToArrayAddr(index, damage)].id
|
tileProps[idDamageToIndex(index, damage)].id
|
||||||
}
|
}
|
||||||
catch (e: NullPointerException) {
|
catch (e: NullPointerException) {
|
||||||
throw NullPointerException("Tile prop with id $index and damage $damage does not exist.")
|
throw NullPointerException("Tile prop with id $index and damage $damage does not exist.")
|
||||||
}
|
}
|
||||||
|
|
||||||
return tileProps[indexDamageToArrayAddr(index, damage)]
|
return tileProps[idDamageToIndex(index, damage)]
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getProp(rawIndex: Int?): TileProp {
|
fun getProp(rawIndex: Int?): TileProp {
|
||||||
try {
|
try {
|
||||||
tileProps[rawIndex ?: TileNameCode.STONE].id
|
tileProps[rawIndex ?: TileNameCode.NULL].id
|
||||||
}
|
}
|
||||||
catch (e: NullPointerException) {
|
catch (e: NullPointerException) {
|
||||||
throw NullPointerException("Tile prop with raw id $rawIndex does not exist.")
|
throw NullPointerException("Tile prop with raw id $rawIndex does not exist.")
|
||||||
}
|
}
|
||||||
|
|
||||||
return tileProps[rawIndex ?: TileNameCode.STONE]
|
return tileProps[rawIndex ?: TileNameCode.NULL]
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setProp(prop: TileProp, record: CSVRecord) {
|
private fun setProp(prop: TileProp, record: CSVRecord) {
|
||||||
@@ -102,13 +102,9 @@ class TilePropCodex {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun boolVal(rec: CSVRecord, s: String): Boolean {
|
private fun boolVal(rec: CSVRecord, s: String) = intVal(rec, s) != 0
|
||||||
return intVal(rec, s) != 0
|
|
||||||
}
|
|
||||||
|
|
||||||
fun indexDamageToArrayAddr(index: Int, damage: Int): Int {
|
fun idDamageToIndex(index: Int, damage: Int) = index * PairedMapLayer.RANGE + damage
|
||||||
return index * PairedMapLayer.RANGE + damage
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun formatNum3(i: Int): String {
|
private fun formatNum3(i: Int): String {
|
||||||
if (i < 10)
|
if (i < 10)
|
||||||
@@ -119,11 +115,6 @@ class TilePropCodex {
|
|||||||
return i.toString()
|
return i.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun formatNum2(i: Int): String {
|
private fun formatNum2(i: Int) = if (i < 10) "0" + i else i.toString()
|
||||||
if (i < 10)
|
|
||||||
return "0" + i
|
|
||||||
else
|
|
||||||
return i.toString()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
"id";"dmg";"name" ;"opacity";"strength";"dsty";"fluid";"movr";"solid";"wall";"lumcolor";"drop";"ddmg";"fall";"friction"
|
"id";"dmg";"name" ;"opacity";"strength";"dsty";"fluid";"movr";"solid";"wall";"lumcolor";"drop";"ddmg";"fall";"friction"
|
||||||
"0"; "0";"TILE_AIR" ; "394758"; "0"; "1"; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "0";"16"
|
"0"; "0";"TILE_AIR" ; "526344"; "0"; "1"; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "0";"16"
|
||||||
"1"; "0";"TILE_STONE" ;"2105376"; "25";"2400"; "0"; "0"; "1"; "1"; "0"; "1"; "0"; "0";"16"
|
"1"; "0";"TILE_STONE" ;"2105376"; "25";"2400"; "0"; "0"; "1"; "1"; "0"; "1"; "0"; "0";"16"
|
||||||
"1"; "1";"TILE_STONE_QUARRIED" ;"2105376"; "25";"2400"; "0"; "0"; "1"; "1"; "0"; "1"; "1"; "0";"16"
|
"1"; "1";"TILE_STONE_QUARRIED" ;"2105376"; "25";"2400"; "0"; "0"; "1"; "1"; "0"; "1"; "1"; "0";"16"
|
||||||
"2"; "0";"TILE_DIRT" ;"2105376"; "6";"1400"; "0"; "0"; "1"; "1"; "0"; "2"; "0"; "0";"16"
|
"2"; "0";"TILE_DIRT" ;"2105376"; "6";"1400"; "0"; "0"; "1"; "1"; "0"; "2"; "0"; "0";"16"
|
||||||
@@ -36,86 +36,87 @@
|
|||||||
"9"; "1";"TILE_ICE_FRAGILE" ; "855309"; "1"; "930"; "0"; "0"; "1"; "0"; "0"; "9"; "1"; "0";"16"
|
"9"; "1";"TILE_ICE_FRAGILE" ; "855309"; "1"; "930"; "0"; "0"; "1"; "0"; "0"; "9"; "1"; "0";"16"
|
||||||
"9"; "2";"TILE_ICE_NATURAL" ;"1710618"; "25"; "930"; "0"; "0"; "1"; "1"; "0"; "9"; "2"; "0"; "8"
|
"9"; "2";"TILE_ICE_NATURAL" ;"1710618"; "25"; "930"; "0"; "0"; "1"; "1"; "0"; "9"; "2"; "0"; "8"
|
||||||
"9"; "3";"TILE_ICE_CLEAR_MAGICAL" ;"2105376"; "25";"3720"; "0"; "0"; "1"; "1"; "1253434"; "9"; "3"; "0"; "8"
|
"9"; "3";"TILE_ICE_CLEAR_MAGICAL" ;"2105376"; "25";"3720"; "0"; "0"; "1"; "1"; "1253434"; "9"; "3"; "0"; "8"
|
||||||
"10"; "0";"TILE_PLATFORM_STONE" ; "394758"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "0"; "0";"16"
|
"10"; "0";"TILE_PLATFORM_STONE" ; "526344"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "0"; "0";"16"
|
||||||
"10"; "1";"TILE_PLATFORM_WOODEN" ; "394758"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "1"; "0";"16"
|
"10"; "1";"TILE_PLATFORM_WOODEN" ; "526344"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "1"; "0";"16"
|
||||||
"10"; "2";"TILE_PLATFORM_EBONY" ; "394758"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "2"; "0";"16"
|
"10"; "2";"TILE_PLATFORM_EBONY" ; "526344"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "2"; "0";"16"
|
||||||
"10"; "3";"TILE_PLATFORM_BIRCH" ; "394758"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "3"; "0";"16"
|
"10"; "3";"TILE_PLATFORM_BIRCH" ; "526344"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "3"; "0";"16"
|
||||||
"10"; "4";"TILE_PLATFORM_BLOODROSE" ; "394758"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "4"; "0";"16"
|
"10"; "4";"TILE_PLATFORM_BLOODROSE" ; "526344"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "4"; "0";"16"
|
||||||
"11"; "0";"TILE_TORCH" ; "0"; "0"; "N/A"; "0"; "0"; "0"; "0";"15304000"; "11"; "0"; "0";"16"
|
"11"; "0";"TILE_TORCH" ; "526344"; "0"; "N/A"; "0"; "0"; "0"; "0";"15304000"; "11"; "0"; "0";"16"
|
||||||
"11"; "1";"TILE_TORCH_FROST" ; "0"; "0"; "N/A"; "0"; "0"; "0"; "0"; "5143807"; "11"; "1"; "0";"16"
|
"11"; "1";"TILE_TORCH_FROST" ; "526344"; "0"; "N/A"; "0"; "0"; "0"; "0"; "5143807"; "11"; "1"; "0";"16"
|
||||||
"12"; "0";"TILE_TORCH" ; "394758"; "0"; "N/A"; "0"; "0"; "0"; "0"; "0"; "11"; "0"; "0";"16"
|
"12"; "0";"TILE_TORCH" ; "526344"; "0"; "N/A"; "0"; "0"; "0"; "0"; "0"; "11"; "0"; "0";"16"
|
||||||
"12"; "1";"TILE_TORCH_FROST" ; "394758"; "0"; "N/A"; "0"; "0"; "0"; "0"; "0"; "11"; "1"; "0";"16"
|
"12"; "1";"TILE_TORCH_FROST" ; "526344"; "0"; "N/A"; "0"; "0"; "0"; "0"; "0"; "11"; "1"; "0";"16"
|
||||||
"13"; "0";"TILE_ILLUMINATOR_WHITE" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1";"15461355"; "13"; "0"; "0";"16"
|
"13"; "0";"TILE_ILLUMINATOR_WHITE" ; "526344"; "0"; "N/A"; "0"; "0"; "1"; "1";"15461355"; "13"; "0"; "0";"16"
|
||||||
"13"; "1";"TILE_ILLUMINATOR_YELLOW" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1";"15461120"; "13"; "1"; "0";"16"
|
"13"; "1";"TILE_ILLUMINATOR_YELLOW" ; "526344"; "0"; "N/A"; "0"; "0"; "1"; "1";"15461120"; "13"; "1"; "0";"16"
|
||||||
"13"; "2";"TILE_ILLUMINATOR_ORANGE" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1";"15447808"; "13"; "2"; "0";"16"
|
"13"; "2";"TILE_ILLUMINATOR_ORANGE" ; "526344"; "0"; "N/A"; "0"; "0"; "1"; "1";"15447808"; "13"; "2"; "0";"16"
|
||||||
"13"; "3";"TILE_ILLUMINATOR_RED" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1";"15400960"; "13"; "3"; "0";"16"
|
"13"; "3";"TILE_ILLUMINATOR_RED" ; "526344"; "0"; "N/A"; "0"; "0"; "1"; "1";"15400960"; "13"; "3"; "0";"16"
|
||||||
"13"; "4";"TILE_ILLUMINATOR_FUCHSIA" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1";"15401143"; "13"; "4"; "0";"16"
|
"13"; "4";"TILE_ILLUMINATOR_FUCHSIA" ; "526344"; "0"; "N/A"; "0"; "0"; "1"; "1";"15401143"; "13"; "4"; "0";"16"
|
||||||
"13"; "5";"TILE_ILLUMINATOR_PURPLE" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1";"11993323"; "13"; "5"; "0";"16"
|
"13"; "5";"TILE_ILLUMINATOR_PURPLE" ; "526344"; "0"; "N/A"; "0"; "0"; "1"; "1";"11993323"; "13"; "5"; "0";"16"
|
||||||
"13"; "6";"TILE_ILLUMINATOR_BLUE" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "235"; "13"; "6"; "0";"16"
|
"13"; "6";"TILE_ILLUMINATOR_BLUE" ; "526344"; "0"; "N/A"; "0"; "0"; "1"; "1"; "235"; "13"; "6"; "0";"16"
|
||||||
"13"; "7";"TILE_ILLUMINATOR_CYAN" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "51947"; "13"; "7"; "0";"16"
|
"13"; "7";"TILE_ILLUMINATOR_CYAN" ; "526344"; "0"; "N/A"; "0"; "0"; "1"; "1"; "51947"; "13"; "7"; "0";"16"
|
||||||
"13"; "8";"TILE_ILLUMINATOR_GREEN" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "4311552"; "13"; "8"; "0";"16"
|
"13"; "8";"TILE_ILLUMINATOR_GREEN" ; "526344"; "0"; "N/A"; "0"; "0"; "1"; "1"; "4311552"; "13"; "8"; "0";"16"
|
||||||
"13"; "9";"TILE_ILLUMINATOR_GREEN_DARK"; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "2123776"; "13"; "9"; "0";"16"
|
"13"; "9";"TILE_ILLUMINATOR_GREEN_DARK";"526344"; "0"; "N/A"; "0"; "0"; "1"; "1"; "2123776"; "13"; "9"; "0";"16"
|
||||||
"13"; "10";"TILE_ILLUMINATOR_BROWN" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "5578752"; "13"; "10"; "0";"16"
|
"13"; "10";"TILE_ILLUMINATOR_BROWN" ; "526344"; "0"; "N/A"; "0"; "0"; "1"; "1"; "5578752"; "13"; "10"; "0";"16"
|
||||||
"13"; "11";"TILE_ILLUMINATOR_TAN" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "9857076"; "13"; "11"; "0";"16"
|
"13"; "11";"TILE_ILLUMINATOR_TAN" ; "526344"; "0"; "N/A"; "0"; "0"; "1"; "1"; "9857076"; "13"; "11"; "0";"16"
|
||||||
"13"; "12";"TILE_ILLUMINATOR_GREY_LIGHT"; "0"; "0"; "N/A"; "0"; "0"; "1"; "1";"12434877"; "13"; "12"; "0";"16"
|
"13"; "12";"TILE_ILLUMINATOR_GREY_LIGHT";"526344"; "0"; "N/A"; "0"; "0"; "1"; "1";"12434877"; "13"; "12"; "0";"16"
|
||||||
"13"; "13";"TILE_ILLUMINATOR_GREY_MED"; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "7697781"; "13"; "13"; "0";"16"
|
"13"; "13";"TILE_ILLUMINATOR_GREY_MED"; "526344"; "0"; "N/A"; "0"; "0"; "1"; "1"; "7697781"; "13"; "13"; "0";"16"
|
||||||
"13"; "14";"TILE_ILLUMINATOR_GREY_DARK"; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "4276545"; "13"; "14"; "0";"16"
|
"13"; "14";"TILE_ILLUMINATOR_GREY_DARK";"526344"; "0"; "N/A"; "0"; "0"; "1"; "1"; "4276545"; "13"; "14"; "0";"16"
|
||||||
"13"; "15";"TILE_ILLUMINATOR_BLACK" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "7274751"; "13"; "15"; "0";"16"
|
"13"; "15";"TILE_ILLUMINATOR_BLACK" ; "526344"; "0"; "N/A"; "0"; "0"; "1"; "1"; "7274751"; "13"; "15"; "0";"16"
|
||||||
"14"; "0";"TILE_ILLUMINATOR_WHITE" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "0"; "0";"16"
|
"14"; "0";"TILE_ILLUMINATOR_WHITE" ;"2105376"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "0"; "0";"16"
|
||||||
"14"; "1";"TILE_ILLUMINATOR_YELLOW" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "1"; "0";"16"
|
"14"; "1";"TILE_ILLUMINATOR_YELLOW" ;"2105376"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "1"; "0";"16"
|
||||||
"14"; "2";"TILE_ILLUMINATOR_ORANGE" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "2"; "0";"16"
|
"14"; "2";"TILE_ILLUMINATOR_ORANGE" ;"2105376"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "2"; "0";"16"
|
||||||
"14"; "3";"TILE_ILLUMINATOR_RED" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "3"; "0";"16"
|
"14"; "3";"TILE_ILLUMINATOR_RED" ;"2105376"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "3"; "0";"16"
|
||||||
"14"; "4";"TILE_ILLUMINATOR_FUCHSIA" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "4"; "0";"16"
|
"14"; "4";"TILE_ILLUMINATOR_FUCHSIA" ;"2105376"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "4"; "0";"16"
|
||||||
"14"; "5";"TILE_ILLUMINATOR_PURPLE" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "5"; "0";"16"
|
"14"; "5";"TILE_ILLUMINATOR_PURPLE" ;"2105376"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "5"; "0";"16"
|
||||||
"14"; "6";"TILE_ILLUMINATOR_BLUE" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "6"; "0";"16"
|
"14"; "6";"TILE_ILLUMINATOR_BLUE" ;"2105376"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "6"; "0";"16"
|
||||||
"14"; "7";"TILE_ILLUMINATOR_CYAN" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "7"; "0";"16"
|
"14"; "7";"TILE_ILLUMINATOR_CYAN" ;"2105376"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "7"; "0";"16"
|
||||||
"14"; "8";"TILE_ILLUMINATOR_GREEN" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "8"; "0";"16"
|
"14"; "8";"TILE_ILLUMINATOR_GREEN" ;"2105376"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "8"; "0";"16"
|
||||||
"14"; "9";"TILE_ILLUMINATOR_GREEN_DARK"; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "9"; "0";"16"
|
"14"; "9";"TILE_ILLUMINATOR_GREEN_DARK";"2105376"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "9"; "0";"16"
|
||||||
"14"; "10";"TILE_ILLUMINATOR_BROWN" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "10"; "0";"16"
|
"14"; "10";"TILE_ILLUMINATOR_BROWN" ;"2105376"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "10"; "0";"16"
|
||||||
"14"; "11";"TILE_ILLUMINATOR_TAN" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "11"; "0";"16"
|
"14"; "11";"TILE_ILLUMINATOR_TAN" ;"2105376"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "11"; "0";"16"
|
||||||
"14"; "12";"TILE_ILLUMINATOR_GREY_LIGHT"; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "12"; "0";"16"
|
"14"; "12";"TILE_ILLUMINATOR_GREY_LIGHT";"2105376"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "12"; "0";"16"
|
||||||
"14"; "13";"TILE_ILLUMINATOR_GREY_MED"; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "13"; "0";"16"
|
"14"; "13";"TILE_ILLUMINATOR_GREY_MED";"2105376"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "13"; "0";"16"
|
||||||
"14"; "14";"TILE_ILLUMINATOR_GREY_DARK"; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "14"; "0";"16"
|
"14"; "14";"TILE_ILLUMINATOR_GREY_DARK";"2105376"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "14"; "0";"16"
|
||||||
"14"; "15";"TILE_ILLUMINATOR_BLACK" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "15"; "0";"16"
|
"14"; "15";"TILE_ILLUMINATOR_BLACK" ;"2105376"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "15"; "0";"16"
|
||||||
"15"; "0";"TILE_SANDSTONE" ;"2105376"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "0"; "0";"16"
|
"15"; "0";"TILE_SANDSTONE" ;"2105376"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "0"; "0";"16"
|
||||||
"15"; "1";"TILE_SANDSTONE_WHITE" ;"2105376"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "1"; "0";"16"
|
"15"; "1";"TILE_SANDSTONE_WHITE" ;"2105376"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "1"; "0";"16"
|
||||||
"15"; "2";"TILE_SANDSTONE_RED" ;"2105376"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "2"; "0";"16"
|
"15"; "2";"TILE_SANDSTONE_RED" ;"2105376"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "2"; "0";"16"
|
||||||
"15"; "3";"TILE_SANDSTONE_DESERT" ;"2105376"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "3"; "0";"16"
|
"15"; "3";"TILE_SANDSTONE_DESERT" ;"2105376"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "3"; "0";"16"
|
||||||
"15"; "4";"TILE_SANDSTONE_BLACK" ;"2105376"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "4"; "0";"16"
|
"15"; "4";"TILE_SANDSTONE_BLACK" ;"2105376"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "4"; "0";"16"
|
||||||
"15"; "5";"TILE_SANDSTONE_BLACK" ;"2105376"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "5"; "0";"16"
|
"15"; "5";"TILE_SANDSTONE_BLACK" ;"2105376"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "5"; "0";"16"
|
||||||
"16"; "0";"TILE_LANTERN_IRON_REGULAR"; "0"; "0"; "N/A"; "0"; "0"; "0"; "0";"16769944"; "16"; "0"; "0";"16"
|
"16"; "0";"TILE_LANTERN_IRON_REGULAR"; "526344"; "0"; "N/A"; "0"; "0"; "0"; "0";"16769944"; "16"; "0"; "0";"16"
|
||||||
"254"; "0";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
"255"; "0";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
||||||
"254"; "1";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
"255"; "1";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
||||||
"254"; "2";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
"255"; "2";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
||||||
"254"; "3";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
"255"; "3";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
||||||
"254"; "4";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
"255"; "4";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
||||||
"254"; "5";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
"255"; "5";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
||||||
"254"; "6";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
"255"; "6";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
||||||
"254"; "7";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
"255"; "7";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
||||||
"254"; "8";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
"255"; "8";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
||||||
"254"; "9";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
"255"; "9";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
||||||
"254"; "10";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
"255"; "10";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
||||||
"254"; "11";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
"255"; "11";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
||||||
"254"; "12";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
"255"; "12";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
||||||
"254"; "13";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
"255"; "13";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
||||||
"254"; "14";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
"255"; "14";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
||||||
"254"; "15";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
"255"; "15";"TILE_WATER" ;"1708813"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
||||||
"255"; "0";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
"254"; "0";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
||||||
"255"; "1";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
"254"; "1";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
||||||
"255"; "2";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
"254"; "2";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
||||||
"255"; "3";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
"254"; "3";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
||||||
"255"; "4";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
"254"; "4";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
||||||
"255"; "5";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
"254"; "5";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
||||||
"255"; "6";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
"254"; "6";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
||||||
"255"; "7";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
"254"; "7";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
||||||
"255"; "8";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
"254"; "8";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
||||||
"255"; "9";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
"254"; "9";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
||||||
"255"; "10";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
"254"; "10";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
||||||
"255"; "11";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
"254"; "11";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
||||||
"255"; "12";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
"254"; "12";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
||||||
"255"; "13";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
"254"; "13";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
||||||
"255"; "14";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
"254"; "14";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
||||||
"255"; "15";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
"254"; "15";"TILE_LAVA" ;"16316664"; "100";"2600"; "1"; "48"; "0"; "0";"12858368"; "N/A"; "N/A"; "0";"16"
|
||||||
|
"256"; "0";"TILE_NULL" ; "0"; "-1";"2600"; "0"; "0"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
||||||
# Friction: 0: frictionless, <16: slippery, 16: regular, >16: sticky
|
# Friction: 0: frictionless, <16: slippery, 16: regular, >16: sticky
|
||||||
# Opacity/Lumcolor: 40-step RGB
|
# Opacity/Lumcolor: 40-step RGB
|
||||||
# Solid: whether the tile has full collision
|
# Solid: whether the tile has full collision
|
||||||
|
|||||||
|
Can't render this file because it contains an unexpected character in line 1 and column 18.
|
@@ -12,6 +12,8 @@ import org.newdawn.slick.GameContainer
|
|||||||
import org.newdawn.slick.Graphics
|
import org.newdawn.slick.Graphics
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Base class for every actor that has physical (or visible) body. This includes furnishings, paintings, gadgets, etc.
|
||||||
|
*
|
||||||
* Created by minjaesong on 16-03-14.
|
* Created by minjaesong on 16-03-14.
|
||||||
*/
|
*/
|
||||||
open class ActorWithBody constructor() : Actor, Visible, Glowing {
|
open class ActorWithBody constructor() : Actor, Visible, Glowing {
|
||||||
@@ -51,7 +53,7 @@ open class ActorWithBody constructor() : Actor, Visible, Glowing {
|
|||||||
internal var baseSpriteWidth: Int = 0
|
internal var baseSpriteWidth: Int = 0
|
||||||
internal var baseSpriteHeight: Int = 0
|
internal var baseSpriteHeight: Int = 0
|
||||||
|
|
||||||
override var referenceID: Long = HQRNG().nextLong()
|
override var referenceID: Long = 0L
|
||||||
/**
|
/**
|
||||||
* Positions: top-left point
|
* Positions: top-left point
|
||||||
*/
|
*/
|
||||||
@@ -136,7 +138,10 @@ open class ActorWithBody constructor() : Actor, Visible, Glowing {
|
|||||||
@Transient private val MASS_DEFAULT = 60f
|
@Transient private val MASS_DEFAULT = 60f
|
||||||
|
|
||||||
init {
|
init {
|
||||||
// referenceID = HQRNG().nextLong() // renew ID just in case
|
do {
|
||||||
|
referenceID = HQRNG().nextLong() // set new ID
|
||||||
|
} while (Terrarum.game.hasActor(referenceID)) // check for collision
|
||||||
|
|
||||||
map = Terrarum.game.map
|
map = Terrarum.game.map
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.torvald.terrarum.gameactors
|
package com.torvald.terrarum.gameactors
|
||||||
|
|
||||||
|
import com.torvald.terrarum.mapgenerator.RoguelikeRandomiser
|
||||||
import org.newdawn.slick.Color
|
import org.newdawn.slick.Color
|
||||||
import org.newdawn.slick.GameContainer
|
import org.newdawn.slick.GameContainer
|
||||||
import org.newdawn.slick.Graphics
|
import org.newdawn.slick.Graphics
|
||||||
@@ -8,14 +9,19 @@ import org.newdawn.slick.Graphics
|
|||||||
* Created by minjaesong on 16-03-14.
|
* Created by minjaesong on 16-03-14.
|
||||||
*/
|
*/
|
||||||
class PhysTestBall : ActorWithBody {
|
class PhysTestBall : ActorWithBody {
|
||||||
|
|
||||||
|
private var color = Color.orange
|
||||||
|
|
||||||
constructor(): super() {
|
constructor(): super() {
|
||||||
setHitboxDimension(16, 16, 0, 0)
|
setHitboxDimension(16, 16, 0, 0)
|
||||||
isVisible = true
|
isVisible = true
|
||||||
mass = 10f
|
mass = 10f
|
||||||
|
|
||||||
|
color = RoguelikeRandomiser.composeColourFrom(RoguelikeRandomiser.POTION_PRIMARY_COLSET)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun drawBody(gc: GameContainer, g: Graphics) {
|
override fun drawBody(gc: GameContainer, g: Graphics) {
|
||||||
g.color = Color.orange
|
g.color = color
|
||||||
g.fillOval(
|
g.fillOval(
|
||||||
hitbox!!.posX,
|
hitbox!!.posX,
|
||||||
hitbox!!.posY,
|
hitbox!!.posY,
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import com.torvald.terrarum.langpack.Lang
|
|||||||
import com.torvald.terrarum.Terrarum
|
import com.torvald.terrarum.Terrarum
|
||||||
import com.torvald.terrarum.console.CommandInterpreter
|
import com.torvald.terrarum.console.CommandInterpreter
|
||||||
import com.torvald.terrarum.gamecontroller.Key
|
import com.torvald.terrarum.gamecontroller.Key
|
||||||
import com.jme3.math.FastMath
|
|
||||||
import org.newdawn.slick.Color
|
import org.newdawn.slick.Color
|
||||||
import org.newdawn.slick.GameContainer
|
import org.newdawn.slick.GameContainer
|
||||||
import org.newdawn.slick.Graphics
|
import org.newdawn.slick.Graphics
|
||||||
@@ -17,7 +16,7 @@ class ConsoleWindow : UICanvas, UITypable {
|
|||||||
|
|
||||||
internal var UIColour = Color(0xCC000000.toInt())
|
internal var UIColour = Color(0xCC000000.toInt())
|
||||||
|
|
||||||
private var commandInputPool: StringBuffer? = null
|
private var commandInputPool: StringBuilder? = null
|
||||||
private var prevCommand: String? = null
|
private var prevCommand: String? = null
|
||||||
|
|
||||||
private var inputCursorPos: Int = 0
|
private var inputCursorPos: Int = 0
|
||||||
@@ -75,7 +74,7 @@ class ConsoleWindow : UICanvas, UITypable {
|
|||||||
if (key == Key.RET && commandInputPool!!.length > 0) {
|
if (key == Key.RET && commandInputPool!!.length > 0) {
|
||||||
prevCommand = commandInputPool!!.toString()
|
prevCommand = commandInputPool!!.toString()
|
||||||
executeCommand()
|
executeCommand()
|
||||||
commandInputPool = StringBuffer()
|
commandInputPool = StringBuilder()
|
||||||
}
|
}
|
||||||
else if (key == Key.BKSP && commandInputPool!!.length > 0) {
|
else if (key == Key.BKSP && commandInputPool!!.length > 0) {
|
||||||
commandInputPool!!.deleteCharAt(commandInputPool!!.length - 1)
|
commandInputPool!!.deleteCharAt(commandInputPool!!.length - 1)
|
||||||
@@ -89,7 +88,7 @@ class ConsoleWindow : UICanvas, UITypable {
|
|||||||
inputCursorPos += 1
|
inputCursorPos += 1
|
||||||
}
|
}
|
||||||
else if (key == Key.UP) {
|
else if (key == Key.UP) {
|
||||||
commandInputPool = StringBuffer()
|
commandInputPool = StringBuilder()
|
||||||
commandInputPool!!.append(prevCommand)
|
commandInputPool!!.append(prevCommand)
|
||||||
}
|
}
|
||||||
else if (key == Key.PGUP) {
|
else if (key == Key.PGUP) {
|
||||||
@@ -151,7 +150,7 @@ class ConsoleWindow : UICanvas, UITypable {
|
|||||||
messagesCount = 0
|
messagesCount = 0
|
||||||
inputCursorPos = 0
|
inputCursorPos = 0
|
||||||
prevCommand = ""
|
prevCommand = ""
|
||||||
commandInputPool = StringBuffer()
|
commandInputPool = StringBuilder()
|
||||||
|
|
||||||
if (Terrarum.game.auth.b()) sendMessage(Lang.get("DEV_MESSAGE_CONSOLE_CODEX"))
|
if (Terrarum.game.auth.b()) sendMessage(Lang.get("DEV_MESSAGE_CONSOLE_CODEX"))
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
work_files/graphics/fonts/cjkpunct.png
Normal file
|
After Width: | Height: | Size: 638 B |
BIN
work_files/graphics/fonts/futhark.png
Normal file
|
After Width: | Height: | Size: 663 B |
BIN
work_files/graphics/fonts/wenquanyi_11pt_part1.png
Normal file
|
After Width: | Height: | Size: 1022 KiB |
BIN
work_files/graphics/fonts/wenquanyi_11pt_part2.png
Normal file
|
After Width: | Height: | Size: 1.0 MiB |