mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
Localised lightmap (reducing memory usage by 64 MB!), smoother and realistic light dimming (looks even more beautiful)
Former-commit-id: c312c73701bb3d2add4d5a5fe4f476ee6ee8be25 Former-commit-id: bc40f0e42025d1a368a22d08447c8ecc956248bb
This commit is contained in:
@@ -52,7 +52,7 @@ constructor() : BasicGameState() {
|
||||
|
||||
var screenZoom = 1.0f
|
||||
val ZOOM_MAX = 2.0f
|
||||
val ZOOM_MIN = 0.25f
|
||||
val ZOOM_MIN = 0.5f
|
||||
|
||||
private lateinit var shader12BitCol: Shader
|
||||
private lateinit var shaderBlurH: Shader
|
||||
|
||||
@@ -16,15 +16,21 @@ import java.util.*
|
||||
*/
|
||||
|
||||
object LightmapRenderer {
|
||||
val overscan_open: Int = (256f / (TilePropCodex.getProp(TileNameCode.AIR).opacity and 0xFF).toFloat()).ceil()
|
||||
val overscan_opaque: Int = (256f / (TilePropCodex.getProp(TileNameCode.STONE).opacity and 0xFF).toFloat()).ceil()
|
||||
|
||||
private val LIGHTMAP_WIDTH = Terrarum.game.ZOOM_MIN.inv().times(Terrarum.WIDTH)
|
||||
.div(MapDrawer.TILE_SIZE).ceil() + overscan_open * 2 + 3
|
||||
private val LIGHTMAP_HEIGHT = Terrarum.game.ZOOM_MIN.inv().times(Terrarum.HEIGHT)
|
||||
.div(MapDrawer.TILE_SIZE).ceil() + overscan_open * 2 + 3
|
||||
|
||||
/**
|
||||
* 8-Bit RGB values
|
||||
*/
|
||||
@Volatile private var lightmap: Array<IntArray> = Array(Terrarum.game.map.height) { IntArray(Terrarum.game.map.width) }
|
||||
private var lightMapInitialised = false
|
||||
|
||||
private val AIR = 0
|
||||
private val SUNSTONE = 41 // TODO add sunstone: emits same light as Map.GL. Goes dark at night
|
||||
//private val lightmap: Array<IntArray> = Array(Terrarum.game.map.height) { IntArray(Terrarum.game.map.width) }
|
||||
private val lightmap: Array<IntArray> = Array(LIGHTMAP_HEIGHT) { IntArray(LIGHTMAP_WIDTH) }
|
||||
|
||||
private val AIR = TileNameCode.AIR
|
||||
|
||||
private val OFFSET_R = 2
|
||||
private val OFFSET_G = 1
|
||||
@@ -39,26 +45,40 @@ object LightmapRenderer {
|
||||
const val CHANNEL_MAX_FLOAT = CHANNEL_MAX.toFloat()
|
||||
const val COLOUR_RANGE_SIZE = MUL * MUL_2
|
||||
|
||||
fun getLight(x: Int, y: Int): Int? =
|
||||
if (x !in 0..Terrarum.game.map.width - 1 || y !in 0..Terrarum.game.map.height - 1)
|
||||
internal var for_x_start: Int = 0
|
||||
internal var for_y_start: Int = 0
|
||||
internal var for_x_end: Int = 0
|
||||
internal var for_y_end: Int = 0
|
||||
|
||||
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 out of range then
|
||||
null
|
||||
else
|
||||
lightmap[y][x]
|
||||
lightmap[y][x]*/
|
||||
try {
|
||||
return lightmap[y - for_y_start + overscan_open][x - for_x_start + overscan_open]
|
||||
}
|
||||
catch (e: ArrayIndexOutOfBoundsException) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
fun setLight(x: Int, y: Int, colour: Int) {
|
||||
lightmap[y][x] = colour
|
||||
//lightmap[y][x] = colour
|
||||
try {
|
||||
lightmap[y - for_y_start + overscan_open][x - for_x_start + overscan_open] = colour
|
||||
}
|
||||
catch (e: ArrayIndexOutOfBoundsException) {
|
||||
}
|
||||
}
|
||||
|
||||
fun renderLightMap() {
|
||||
val for_x_start = MapCamera.cameraX / TSIZE - 1 // fix for premature lightmap rendering
|
||||
val for_y_start = MapCamera.cameraY / TSIZE - 1 // on topmost/leftmost side
|
||||
for_x_start = MapCamera.cameraX / TSIZE - 1 // fix for premature lightmap rendering
|
||||
for_y_start = MapCamera.cameraY / TSIZE - 1 // on topmost/leftmost side
|
||||
|
||||
val for_x_end = for_x_start + MapCamera.getRenderWidth() / TSIZE + 3
|
||||
val for_y_end = for_y_start + MapCamera.getRenderHeight() / TSIZE + 2 // same fix as above
|
||||
|
||||
val overscan_open: Int = (256f / (TilePropCodex.getProp(TileNameCode.AIR).opacity and 0xFF).toFloat()).ceil()
|
||||
val overscan_opaque: Int = (256f / (TilePropCodex.getProp(TileNameCode.STONE).opacity and 0xFF).toFloat()).ceil()
|
||||
for_x_end = for_x_start + MapCamera.getRenderWidth() / TSIZE + 3
|
||||
for_y_end = for_y_start + MapCamera.getRenderHeight() / TSIZE + 2 // same fix as above
|
||||
|
||||
/**
|
||||
* * true: overscanning is limited to 8 tiles in width (overscan_opaque)
|
||||
@@ -80,7 +100,8 @@ object LightmapRenderer {
|
||||
* for all staticLightMap[y][x]
|
||||
*/
|
||||
|
||||
purgePartOfLightmap(for_x_start - overscan_open, for_y_start - overscan_open, for_x_end + overscan_open, for_y_end + overscan_open)
|
||||
//purgePartOfLightmap(for_x_start - overscan_open, for_y_start - overscan_open, for_x_end + overscan_open, for_y_end + overscan_open)
|
||||
purgeLightmap()
|
||||
|
||||
try {
|
||||
// Round 1
|
||||
@@ -145,8 +166,8 @@ object LightmapRenderer {
|
||||
// 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 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 = maximiseRGB(lightLevelThis, actorLuminosity) // maximise to not exceed 1.0 with normal (<= 1.0) light
|
||||
@@ -174,17 +195,13 @@ object LightmapRenderer {
|
||||
*/
|
||||
if (xoff != yoff && -xoff != yoff) {
|
||||
// 'v' tiles
|
||||
if (!outOfMapBounds(x + xoff, y + yoff)) {
|
||||
nearby = getLight(x + xoff, y + yoff) ?: 0
|
||||
}
|
||||
nearby = getLight(x + xoff, y + yoff) ?: 0
|
||||
}
|
||||
else if (xoff != 0 && yoff != 0) {
|
||||
// 'a' tiles
|
||||
if (!outOfMapBounds(x + xoff, y + yoff)) {
|
||||
nearby = darkenUniformInt(getLight(x + xoff, y + yoff) ?: 0, 12) //2 for 40step
|
||||
// mix some to have more 'spreading'
|
||||
// so that light spreads in a shape of an octagon instead of a diamond
|
||||
}
|
||||
nearby = darkenUniformInt(getLight(x + xoff, y + yoff) ?: 0, 12) //2 for 40step
|
||||
// mix some to have more 'spreading'
|
||||
// so that light spreads in a shape of an octagon instead of a diamond
|
||||
}
|
||||
else {
|
||||
nearby = 0 // exclude 'me' tile
|
||||
@@ -206,27 +223,25 @@ object LightmapRenderer {
|
||||
}
|
||||
|
||||
fun draw(g: Graphics) {
|
||||
val for_x_start = MapCamera.cameraX / TSIZE - 1 // fix for premature lightmap rendering
|
||||
val for_y_start = MapCamera.cameraY / TSIZE - 1 // on topmost/leftmost side
|
||||
|
||||
val for_x_end = for_x_start + MapCamera.getRenderWidth() / TSIZE + 3
|
||||
val for_y_end = for_y_start + MapCamera.getRenderHeight() / TSIZE + 2 // same fix as above
|
||||
|
||||
val this_x_start = for_x_start// + overscan_open
|
||||
val this_x_end = for_x_end// + overscan_open
|
||||
val this_y_start = for_y_start// + overscan_open
|
||||
val this_y_end = for_y_end// + overscan_open
|
||||
|
||||
// draw
|
||||
try {
|
||||
// loop for "scanlines"
|
||||
for (y in for_y_start..for_y_end) {
|
||||
for (y in this_y_start..this_y_end) {
|
||||
// loop x
|
||||
var x = for_x_start
|
||||
while (x < for_x_end) {
|
||||
var x = this_x_start
|
||||
while (x < this_x_end) {
|
||||
// smoothing enabled
|
||||
if (Terrarum.game.screenZoom >= 1
|
||||
&& Terrarum.gameConfig.getAsBoolean("smoothlighting") ?: false) {
|
||||
|
||||
val thisLightLevel = getLight(x, y) ?: 0
|
||||
|
||||
if (x < for_x_end && thisLightLevel == 0
|
||||
if (x < this_x_end && thisLightLevel == 0
|
||||
&& getLight(x, y - 1) == 0) {
|
||||
try {
|
||||
// coalesce zero intensity blocks to one
|
||||
@@ -234,7 +249,7 @@ object LightmapRenderer {
|
||||
while (getLight(x + zeroLevelCounter, y) == 0) {
|
||||
zeroLevelCounter += 1
|
||||
|
||||
if (x + zeroLevelCounter >= for_x_end) break
|
||||
if (x + zeroLevelCounter >= this_x_end) break
|
||||
}
|
||||
|
||||
g.color = Color(0)
|
||||
@@ -309,7 +324,7 @@ object LightmapRenderer {
|
||||
while (getLight(x + sameLevelCounter, y) == thisLightLevel) {
|
||||
sameLevelCounter += 1
|
||||
|
||||
if (x + sameLevelCounter >= for_x_end) break
|
||||
if (x + sameLevelCounter >= this_x_end) break
|
||||
}
|
||||
|
||||
g.color = Color((getLight(x, y) ?: 0).rgb30ClampTo24())
|
||||
@@ -469,13 +484,6 @@ object LightmapRenderer {
|
||||
return constructRGBFromInt(r, g, b)
|
||||
}
|
||||
|
||||
private fun outOfBounds(x: Int, y: Int): Boolean =
|
||||
x !in 0..Terrarum.game.map.width - 1 || y !in 0..Terrarum.game.map.height - 1
|
||||
|
||||
private fun outOfMapBounds(x: Int, y: Int): Boolean =
|
||||
//x !in 0..lightMapMSB!![0].size - 1 || y !in 0..lightMapMSB!!.size - 1
|
||||
x !in 0..lightmap[0].size - 1 || y !in 0..lightmap.size - 1
|
||||
|
||||
private fun Int.clampZero() = if (this < 0) 0 else this
|
||||
|
||||
private fun Float.clampZero() = if (this < 0) 0f else this
|
||||
@@ -486,47 +494,12 @@ object LightmapRenderer {
|
||||
|
||||
fun getValueFromMap(x: Int, y: Int): Int? = getLight(x, y)
|
||||
|
||||
private fun purgePartOfLightmap(x1: Int, y1: Int, x2: Int, y2: Int) {
|
||||
try {
|
||||
for (y in y1 - 1..y2 + 1) {
|
||||
for (x in x1 - 1..x2 + 1) {
|
||||
//if (y == y1 - 1 || y == y2 + 1 || x == x1 - 1 || x == x2 + 1) {
|
||||
// fill the rim with (pre) calculation
|
||||
// setLight(x, y, preCalculateUpdateGLOnly(x, y))
|
||||
//}
|
||||
//else {
|
||||
setLight(x, y, 0)
|
||||
//}
|
||||
}
|
||||
private fun purgeLightmap() {
|
||||
for (y in 0..LIGHTMAP_HEIGHT - 1) {
|
||||
for (x in 0..LIGHTMAP_WIDTH - 1) {
|
||||
lightmap[y][x] = 0
|
||||
}
|
||||
}
|
||||
catch (e: ArrayIndexOutOfBoundsException) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun clampWTile(x: Int): Int {
|
||||
if (x < 0) {
|
||||
return 0
|
||||
}
|
||||
else if (x > Terrarum.game.map.width) {
|
||||
return Terrarum.game.map.width
|
||||
}
|
||||
else {
|
||||
return x
|
||||
}
|
||||
}
|
||||
|
||||
private fun clampHTile(x: Int): Int {
|
||||
if (x < 0) {
|
||||
return 0
|
||||
}
|
||||
else if (x > Terrarum.game.map.height) {
|
||||
return Terrarum.game.map.height
|
||||
}
|
||||
else {
|
||||
return x
|
||||
}
|
||||
}
|
||||
|
||||
private fun arithmeticAverage(vararg i: Int): Int {
|
||||
@@ -537,12 +510,6 @@ object LightmapRenderer {
|
||||
return Math.round(sum / i.size.toFloat())
|
||||
}
|
||||
|
||||
internal data class LightmapLantern(
|
||||
var x: Int,
|
||||
var y: Int,
|
||||
var intensity: Int
|
||||
)
|
||||
|
||||
private fun Int.clamp256() = if (this > 255) 255 else this
|
||||
|
||||
fun Int.rgb30ClampTo24(): Int {
|
||||
@@ -556,6 +523,7 @@ object LightmapRenderer {
|
||||
infix fun Float.powerOf(f: Float) = FastMath.pow(this, f)
|
||||
private fun Float.sqr() = this * this
|
||||
private fun Float.sqrt() = FastMath.sqrt(this)
|
||||
private fun Float.inv() = 1f / this
|
||||
fun Float.floor() = FastMath.floor(this)
|
||||
fun Float.round(): Int = Math.round(this)
|
||||
fun Float.ceil() = FastMath.ceil(this)
|
||||
|
||||
@@ -42,7 +42,7 @@ class TilePropCodex {
|
||||
|
||||
private lateinit var tileProps: Array<TileProp>
|
||||
|
||||
val CSV_PATH = "./src/com/torvald/terrarum/tileproperties/tileprop.csv"
|
||||
val CSV_PATH = "./src/net/torvald/terrarum/tileproperties/tileprop.csv"
|
||||
|
||||
fun getProp(index: Int, damage: Int): TileProp {
|
||||
try {
|
||||
|
||||
@@ -35,32 +35,32 @@
|
||||
"9"; "0";"TILE_SNOW" ; "33587232"; "6"; "500"; "0"; "0"; "1"; "1"; "0"; "9"; "0"; "0";"16"
|
||||
"9"; "1";"TILE_ICE_FRAGILE" ; "13644813"; "1"; "930"; "0"; "0"; "1"; "0"; "0"; "9"; "1"; "0";"16"
|
||||
"9"; "2";"TILE_ICE_NATURAL" ; "27289626"; "25"; "930"; "0"; "0"; "1"; "1"; "0"; "9"; "2"; "0"; "8"
|
||||
"9"; "3";"TILE_ICE_CLEAR_MAGICAL" ; "33587232"; "25";"3720"; "0"; "0"; "1"; "1"; "1253434"; "9"; "3"; "0"; "8"
|
||||
"9"; "3";"TILE_ICE_CLEAR_MAGICAL" ; "33587232"; "25";"3720"; "0"; "0"; "1"; "1"; "19955770"; "9"; "3"; "0"; "8"
|
||||
"10"; "0";"TILE_PLATFORM_STONE" ; "8396808"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "0"; "0";"16"
|
||||
"10"; "1";"TILE_PLATFORM_WOODEN" ; "8396808"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "1"; "0";"16"
|
||||
"10"; "2";"TILE_PLATFORM_EBONY" ; "8396808"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "2"; "0";"16"
|
||||
"10"; "3";"TILE_PLATFORM_BIRCH" ; "8396808"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "3"; "0";"16"
|
||||
"10"; "4";"TILE_PLATFORM_BLOODROSE" ; "8396808"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "4"; "0";"16"
|
||||
"11"; "0";"TILE_TORCH" ; "8396808"; "0"; "N/A"; "0"; "0"; "0"; "0"; "15304000"; "11"; "0"; "0";"16"
|
||||
"11"; "1";"TILE_TORCH_FROST" ; "8396808"; "0"; "N/A"; "0"; "0"; "0"; "0"; "5143807"; "11"; "1"; "0";"16"
|
||||
"11"; "0";"TILE_TORCH" ; "8396808"; "0"; "N/A"; "0"; "0"; "0"; "0"; "244454464"; "11"; "0"; "0";"16"
|
||||
"11"; "1";"TILE_TORCH_FROST" ; "8396808"; "0"; "N/A"; "0"; "0"; "0"; "0"; "81916159"; "11"; "1"; "0";"16"
|
||||
"12"; "0";"TILE_TORCH" ; "8396808"; "0"; "N/A"; "0"; "0"; "0"; "0"; "0"; "11"; "0"; "0";"16"
|
||||
"12"; "1";"TILE_TORCH_FROST" ; "8396808"; "0"; "N/A"; "0"; "0"; "0"; "0"; "0"; "11"; "1"; "0";"16"
|
||||
"13"; "0";"TILE_ILLUMINATOR_WHITE" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "15461355"; "13"; "0"; "0";"16"
|
||||
"13"; "1";"TILE_ILLUMINATOR_YELLOW" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "15461120"; "13"; "1"; "0";"16"
|
||||
"13"; "2";"TILE_ILLUMINATOR_ORANGE" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "15447808"; "13"; "2"; "0";"16"
|
||||
"13"; "3";"TILE_ILLUMINATOR_RED" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "15400960"; "13"; "3"; "0";"16"
|
||||
"13"; "4";"TILE_ILLUMINATOR_FUCHSIA" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "15401143"; "13"; "4"; "0";"16"
|
||||
"13"; "5";"TILE_ILLUMINATOR_PURPLE" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "11993323"; "13"; "5"; "0";"16"
|
||||
"13"; "0";"TILE_ILLUMINATOR_WHITE" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "246656235"; "13"; "0"; "0";"16"
|
||||
"13"; "1";"TILE_ILLUMINATOR_YELLOW" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "246656000"; "13"; "1"; "0";"16"
|
||||
"13"; "2";"TILE_ILLUMINATOR_ORANGE" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "246602752"; "13"; "2"; "0";"16"
|
||||
"13"; "3";"TILE_ILLUMINATOR_RED" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "246415360"; "13"; "3"; "0";"16"
|
||||
"13"; "4";"TILE_ILLUMINATOR_FUCHSIA" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "246415543"; "13"; "4"; "0";"16"
|
||||
"13"; "5";"TILE_ILLUMINATOR_PURPLE" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "191889643"; "13"; "5"; "0";"16"
|
||||
"13"; "6";"TILE_ILLUMINATOR_BLUE" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "235"; "13"; "6"; "0";"16"
|
||||
"13"; "7";"TILE_ILLUMINATOR_CYAN" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "51947"; "13"; "7"; "0";"16"
|
||||
"13"; "8";"TILE_ILLUMINATOR_GREEN" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "4311552"; "13"; "8"; "0";"16"
|
||||
"13"; "9";"TILE_ILLUMINATOR_GREEN_DARK";"8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "2123776"; "13"; "9"; "0";"16"
|
||||
"13"; "10";"TILE_ILLUMINATOR_BROWN" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "5578752"; "13"; "10"; "0";"16"
|
||||
"13"; "11";"TILE_ILLUMINATOR_TAN" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "9857076"; "13"; "11"; "0";"16"
|
||||
"13"; "12";"TILE_ILLUMINATOR_GREY_LIGHT";"8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "12434877"; "13"; "12"; "0";"16"
|
||||
"13"; "13";"TILE_ILLUMINATOR_GREY_MED"; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "7697781"; "13"; "13"; "0";"16"
|
||||
"13"; "14";"TILE_ILLUMINATOR_GREY_DARK"; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "4276545"; "13"; "14"; "0";"16"
|
||||
"13"; "15";"TILE_ILLUMINATOR_BLACK" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "7274751"; "13"; "15"; "0";"16"
|
||||
"13"; "7";"TILE_ILLUMINATOR_CYAN" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "207083"; "13"; "7"; "0";"16"
|
||||
"13"; "8";"TILE_ILLUMINATOR_GREEN" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "68364288"; "13"; "8"; "0";"16"
|
||||
"13"; "9";"TILE_ILLUMINATOR_GREEN_DARK";"8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "33660928"; "13"; "9"; "0";"16"
|
||||
"13"; "10";"TILE_ILLUMINATOR_BROWN" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "89161728"; "13"; "10"; "0";"16"
|
||||
"13"; "11";"TILE_ILLUMINATOR_TAN" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "157392948"; "13"; "11"; "0";"16"
|
||||
"13"; "12";"TILE_ILLUMINATOR_GREY_LIGHT";"8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "198374589"; "13"; "12"; "0";"16"
|
||||
"13"; "13";"TILE_ILLUMINATOR_GREY_MED"; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "122803317"; "13"; "13"; "0";"16"
|
||||
"13"; "14";"TILE_ILLUMINATOR_GREY_DARK"; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "68224065"; "13"; "14"; "0";"16"
|
||||
"13"; "15";"TILE_ILLUMINATOR_BLACK" ; "8396808"; "0"; "N/A"; "0"; "0"; "1"; "1"; "116392191"; "13"; "15"; "0";"16"
|
||||
"14"; "0";"TILE_ILLUMINATOR_WHITE" ; "33587232"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "0"; "0";"16"
|
||||
"14"; "1";"TILE_ILLUMINATOR_YELLOW" ; "33587232"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "1"; "0";"16"
|
||||
"14"; "2";"TILE_ILLUMINATOR_ORANGE" ; "33587232"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "2"; "0";"16"
|
||||
@@ -83,7 +83,7 @@
|
||||
"15"; "3";"TILE_SANDSTONE_DESERT" ; "33587232"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "3"; "0";"16"
|
||||
"15"; "4";"TILE_SANDSTONE_BLACK" ; "33587232"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "4"; "0";"16"
|
||||
"15"; "5";"TILE_SANDSTONE_BLACK" ; "33587232"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "5"; "0";"16"
|
||||
"16"; "0";"TILE_LANTERN_IRON_REGULAR"; "8396808"; "0"; "N/A"; "0"; "0"; "0"; "0"; "16769944"; "16"; "0"; "0";"16"
|
||||
"16"; "0";"TILE_LANTERN_IRON_REGULAR"; "8396808"; "0"; "N/A"; "0"; "0"; "0"; "0"; "267619480"; "16"; "0"; "0";"16"
|
||||
"255"; "0";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
||||
"255"; "1";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
||||
"255"; "2";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 1 and column 18.
|
@@ -34,7 +34,7 @@ class BasicDebugInfoWindow : UICanvas {
|
||||
|
||||
override fun update(gc: GameContainer, delta: Int) {
|
||||
val player = Terrarum.game.player
|
||||
val hitbox = player.hitbox!!
|
||||
val hitbox = player.hitbox
|
||||
|
||||
xdelta = hitbox.pointedX - prevPlayerX
|
||||
ydelta = hitbox.pointedY - prevPlayerY
|
||||
@@ -53,8 +53,8 @@ class BasicDebugInfoWindow : UICanvas {
|
||||
val sb = StringBuilder()
|
||||
val formatter = Formatter(sb)
|
||||
|
||||
val mouseTileX = ((MapCamera.cameraX + gc.getInput().mouseX / Terrarum.game.screenZoom) / MapDrawer.TILE_SIZE).toInt()
|
||||
val mouseTileY = ((MapCamera.cameraY + gc.getInput().mouseY / Terrarum.game.screenZoom) / MapDrawer.TILE_SIZE).toInt()
|
||||
val mouseTileX = ((MapCamera.cameraX + gc.input.mouseX / Terrarum.game.screenZoom) / MapDrawer.TILE_SIZE).toInt()
|
||||
val mouseTileY = ((MapCamera.cameraY + gc.input.mouseY / Terrarum.game.screenZoom) / MapDrawer.TILE_SIZE).toInt()
|
||||
|
||||
g.color = Color.white
|
||||
|
||||
@@ -62,7 +62,7 @@ class BasicDebugInfoWindow : UICanvas {
|
||||
val nextHitbox = player.nextHitbox
|
||||
|
||||
printLine(g, 1, "posX: "
|
||||
+ "${hitbox!!.pointedX.toString()}"
|
||||
+ "${hitbox.pointedX.toString()}"
|
||||
+ " ("
|
||||
+ "${(hitbox.pointedX / MapDrawer.TILE_SIZE).toInt().toString()}"
|
||||
+ ")")
|
||||
|
||||
Reference in New Issue
Block a user