diff --git a/Known problems.md b/Known problems.md new file mode 100644 index 000000000..ad1708001 --- /dev/null +++ b/Known problems.md @@ -0,0 +1,16 @@ +## From playtests ## + +### Character ### + +* Cannot fit into single-tile width pit + Cause: Player/NPC looks slim enough to fit, but don't fit in the game + Solution: Draw them wider, allow them to fit into the pit (Phys resolver will glitch?) + + +## Internal ## + +### Phys ### + +* Actor stick to wall and not get off + +* Actor with mass <2 behaves erratically \ No newline at end of file diff --git a/res/graphics/gui/message_twoline_black_body.png b/res/graphics/gui/message_twoline_black_body.png index 76ddb9d6a..7c05b5ae0 100644 Binary files a/res/graphics/gui/message_twoline_black_body.png and b/res/graphics/gui/message_twoline_black_body.png differ diff --git a/res/graphics/gui/message_twoline_black_left.png b/res/graphics/gui/message_twoline_black_left.png index 3a4e0d802..2546135ba 100644 Binary files a/res/graphics/gui/message_twoline_black_left.png and b/res/graphics/gui/message_twoline_black_left.png differ diff --git a/res/graphics/gui/message_twoline_black_right.png b/res/graphics/gui/message_twoline_black_right.png index 860d8fa42..08ddd8a2a 100644 Binary files a/res/graphics/gui/message_twoline_black_right.png and b/res/graphics/gui/message_twoline_black_right.png differ diff --git a/res/graphics/sky_colour.png b/res/graphics/sky_colour.png index ebacbd067..9c5574f32 100644 Binary files a/res/graphics/sky_colour.png and b/res/graphics/sky_colour.png differ diff --git a/res/graphics/sprites/test_player.png b/res/graphics/sprites/test_player.png index 91a3a2905..99a21e8e1 100644 Binary files a/res/graphics/sprites/test_player.png and b/res/graphics/sprites/test_player.png differ diff --git a/src/com/Torvald/ColourUtil/Col40.kt b/src/com/Torvald/ColourUtil/Col40 similarity index 100% rename from src/com/Torvald/ColourUtil/Col40.kt rename to src/com/Torvald/ColourUtil/Col40 diff --git a/src/com/Torvald/Terrarum/Actors/Luminous.kt b/src/com/Torvald/Terrarum/Actors/Luminous.kt index 6fc62470e..714a4587f 100644 --- a/src/com/Torvald/Terrarum/Actors/Luminous.kt +++ b/src/com/Torvald/Terrarum/Actors/Luminous.kt @@ -19,6 +19,6 @@ interface Luminous { actorValue.set("luminosity", value) } */ - var luminosity: Char + var luminosity: Int } \ No newline at end of file diff --git a/src/com/Torvald/Terrarum/Actors/PFSigrid.kt b/src/com/Torvald/Terrarum/Actors/PFSigrid.kt index 15dc20294..5c363f051 100644 --- a/src/com/Torvald/Terrarum/Actors/PFSigrid.kt +++ b/src/com/Torvald/Terrarum/Actors/PFSigrid.kt @@ -59,7 +59,7 @@ object PFSigrid { p.actorValue.set("intelligent", true) - p.actorValue.set("luminosity", 22819) + p.actorValue.set("luminosity", 5980540) p.actorValue.set("selectedtile", 16) diff --git a/src/com/Torvald/Terrarum/Actors/Player.kt b/src/com/Torvald/Terrarum/Actors/Player.kt index 3b6312f04..018990630 100644 --- a/src/com/Torvald/Terrarum/Actors/Player.kt +++ b/src/com/Torvald/Terrarum/Actors/Player.kt @@ -68,13 +68,8 @@ class Player : ActorWithBody, Controllable, Pocketed, Factionable, Luminous, Lan override var houseDesignation: ArrayList? = null - override var luminosity: Char - get() { - if (actorValue.get("luminosity") != null) - return actorValue.getAsInt("luminosity")!!.toChar() - else - return 0.toChar() - } + override var luminosity: Int + get() = actorValue.getAsInt("luminosity") ?: 0 set(value) { actorValue.set("luminosity", value) } diff --git a/src/com/Torvald/Terrarum/ConsoleCommand/Gettime.kt b/src/com/Torvald/Terrarum/ConsoleCommand/Gettime.kt index 52e0c22ac..e17206607 100644 --- a/src/com/Torvald/Terrarum/ConsoleCommand/Gettime.kt +++ b/src/com/Torvald/Terrarum/ConsoleCommand/Gettime.kt @@ -8,9 +8,10 @@ import com.Torvald.Terrarum.Terrarum class GetTime : ConsoleCommand { override fun execute(args: Array) { val echo = Echo() - echo.execute("Day ${Terrarum.game.map.worldTime.days}, " + - "${Terrarum.game.map.worldTime.getFormattedTime()} " + - "(${Terrarum.game.map.worldTime.elapsedSeconds()} s)" + val worldTime = Terrarum.game.map.worldTime + echo.execute("Year ${worldTime.years}, Month ${worldTime.months}, " + + "Day ${worldTime.days} (${worldTime.getDayNameShort()}), " + + "${worldTime.getFormattedTime()}" ) } diff --git a/src/com/Torvald/Terrarum/ConsoleCommand/SetGlobalLightLevel.kt b/src/com/Torvald/Terrarum/ConsoleCommand/SetGlobalLightLevel.kt index 0dc65825f..4fa9a4903 100644 --- a/src/com/Torvald/Terrarum/ConsoleCommand/SetGlobalLightLevel.kt +++ b/src/com/Torvald/Terrarum/ConsoleCommand/SetGlobalLightLevel.kt @@ -27,7 +27,7 @@ class SetGlobalLightLevel : ConsoleCommand { } else if (args.size == 2) { try { - val GL = Integer(args[1]).toInt().toChar() + val GL = args[1].toInt() if (GL.toInt() < 0 || GL.toInt() >= LightmapRenderer.COLOUR_DOMAIN_SIZE) { Echo().execute("Range: 0-" + (LightmapRenderer.COLOUR_DOMAIN_SIZE - 1)) diff --git a/src/com/Torvald/Terrarum/Game.kt b/src/com/Torvald/Terrarum/Game.kt index c03429853..2466e9246 100644 --- a/src/com/Torvald/Terrarum/Game.kt +++ b/src/com/Torvald/Terrarum/Game.kt @@ -1,9 +1,7 @@ package com.Torvald.Terrarum -import com.Torvald.ColourUtil.Col40 import com.Torvald.Terrarum.Actors.* import com.Torvald.Terrarum.ConsoleCommand.Authenticator -import com.Torvald.Terrarum.ConsoleCommand.CommandDict import com.Torvald.Terrarum.GameControl.GameController import com.Torvald.Terrarum.GameControl.Key import com.Torvald.Terrarum.GameControl.KeyMap @@ -139,7 +137,7 @@ constructor() : BasicGameState() { // GL at after_sunrise-noon_before_sunset map.updateWorldTime(delta) - map.setGlobalLight(globalLightByTime); + map.globalLight = globalLightByTime GameController.processInput(gc.input) @@ -194,6 +192,9 @@ constructor() : BasicGameState() { actorContainer.forEach { actor -> if (actor is Visible) actor.drawBody(gc, g) } actorContainer.forEach { actor -> if (actor is Glowing) actor.drawGlow(gc, g) } + player.drawBody(gc, g) + player.drawGlow(gc, g) + LightmapRenderer.renderLightMap() MapCamera.renderFront(gc, g) @@ -225,17 +226,14 @@ constructor() : BasicGameState() { return actorContainer.remove(e) } - private fun getGradientColour(): Array { + private fun getGradientColour(row: Int): Color { val gradMapWidth = GRADIENT_IMAGE!!.width val phase = Math.round( map.worldTime.elapsedSeconds().toFloat() / WorldTime.DAY_LENGTH.toFloat() * gradMapWidth ) //update in every INTERNAL_FRAME frames - return arrayOf( - GRADIENT_IMAGE!!.getColor(phase, 0), - GRADIENT_IMAGE!!.getColor(phase, GRADIENT_IMAGE!!.height - 1) - ) + return GRADIENT_IMAGE!!.getColor(phase, row) } override fun keyPressed(key: Int, c: Char) { @@ -279,10 +277,9 @@ constructor() : BasicGameState() { } private fun drawSkybox(g: Graphics) { - val colourTable = getGradientColour() val skyColourFill = GradientFill( - 0f, 0f, colourTable[0], - 0f, Terrarum.HEIGHT.toFloat(), colourTable[1] + 0f, 0f, getGradientColour(0), + 0f, Terrarum.HEIGHT.toFloat(), getGradientColour(1) ) g.fill(skyBox, skyColourFill) } @@ -302,56 +299,13 @@ constructor() : BasicGameState() { notifinator.setAsOpening() } - private val globalLightByTime: Char - get() { - /** - * y = -DELTA(x-1)^RAYLEIGH + MAX - * See documentation 'sky colour' - */ - val INTENSITY_MIN = 9 - val INTENSITY_MAX = 39 + private val globalLightByTime: Int + get() = getGradientColour(2).getRGB24() - val COLTEMP_MIN = 2500 - val COLTEMP_MAX = MapDrawer.ENV_COLTEMP_NOON - val COLTEMP_DELTA = COLTEMP_MAX - COLTEMP_MIN - val RAYLEIGH_INDEX = 3.3f - - /** - * get colour temperature - */ - val dusk_len_colouring = 0.5f - val daytime_len = 10 - var secs_offset: Int = Math.round(WorldTime.HOUR_SEC * dusk_len_colouring) // 1h as Seconds - var time_domain_x_in_sec = (daytime_len + 2*dusk_len_colouring) * WorldTime.HOUR_SEC // 11h as Seconds - - var today_secs: Float = map.worldTime.elapsedSeconds().toFloat() + secs_offset - if (today_secs > time_domain_x_in_sec - secs_offset) today_secs - WorldTime.DAY_LENGTH // 79000 -> -200 - - var func_x: Float = (today_secs / time_domain_x_in_sec) * 2f // 0-46800 -> 0-2.0 - if (func_x < 1) func_x = 2f - func_x // mirror graph - if (func_x > 2) func_x = 2f // clamp - - // println("x: $func_x") - - val sunAltColouring: Int = FastMath.ceil( - -COLTEMP_DELTA * FastMath.pow(func_x - 1, RAYLEIGH_INDEX) + COLTEMP_MAX - ) - val sunColour: Col40 = Col40(MapDrawer.getColourFromMap(sunAltColouring)) - - /** - * get intensity - */ - val dusk_len = 1.5f - val intensity: Int = 39 - secs_offset = Math.round(WorldTime.HOUR_SEC * dusk_len) // 1h30 as Seconds - time_domain_x_in_sec = (daytime_len + 2*dusk_len) * WorldTime.HOUR_SEC // 13h as Seconds - - today_secs = map.worldTime.elapsedSeconds().toFloat() + secs_offset - if (today_secs > time_domain_x_in_sec - secs_offset) today_secs - WorldTime.DAY_LENGTH // 79000 -> -200 - - - - - return LightmapRenderer.darkenUniformInt(sunColour.raw, INTENSITY_MAX - intensity) - } + /** + * extension function for org.newdawn.slick.Color + */ + fun Color.getRGB24(): Int = (this.redByte shl 16) or + (this.greenByte shl 8) or + (this.blueByte) } diff --git a/src/com/Torvald/Terrarum/GameControl/KeyToggler.kt b/src/com/Torvald/Terrarum/GameControl/KeyToggler.kt index 5eef3b513..8875e0f82 100644 --- a/src/com/Torvald/Terrarum/GameControl/KeyToggler.kt +++ b/src/com/Torvald/Terrarum/GameControl/KeyToggler.kt @@ -2,12 +2,13 @@ package com.Torvald.Terrarum.GameControl import org.newdawn.slick.GameContainer import org.newdawn.slick.Input +import java.util.* object KeyToggler { - private val currentState = BooleanArray(256) - private val isPressed = BooleanArray(256) - private val isToggled = BooleanArray(256) + private val currentState = BitSet(256) + private val isPressed = BitSet(256) + private val isToggled = BitSet(256) fun isOn(key: Int): Boolean { return currentState[key] diff --git a/src/com/Torvald/Terrarum/GameMap/GameMap.java b/src/com/Torvald/Terrarum/GameMap/GameMap.java index 29a4f0802..7125ff7ce 100644 --- a/src/com/Torvald/Terrarum/GameMap/GameMap.java +++ b/src/com/Torvald/Terrarum/GameMap/GameMap.java @@ -33,7 +33,7 @@ public class GameMap { //public World physWorld = new World( new Vec2(0, -TerrarumMain.game.gravitationalAccel) ); //physics private float gravitation; - private char globalLight; + private int globalLight; private WorldTime worldTime; public static transient final int TILES_SUPPORTED = MapLayer.RANGE * PairedMapLayer.RANGE; @@ -57,7 +57,7 @@ public class GameMap { terrainDamage = new PairedMapLayer(width, height); wallDamage = new PairedMapLayer(width, height); - globalLight = (char) 63999; + globalLight = (char) 0; worldTime = new WorldTime(); } @@ -213,11 +213,11 @@ public class GameMap { return gravitation; } - public char getGlobalLight() { + public int getGlobalLight() { return globalLight; } - public void setGlobalLight(char globalLight) { + public void setGlobalLight(int globalLight) { this.globalLight = globalLight; } diff --git a/src/com/Torvald/Terrarum/GameMap/WorldTime.kt b/src/com/Torvald/Terrarum/GameMap/WorldTime.kt index d2629dc2c..d1404edf8 100644 --- a/src/com/Torvald/Terrarum/GameMap/WorldTime.kt +++ b/src/com/Torvald/Terrarum/GameMap/WorldTime.kt @@ -8,7 +8,7 @@ class WorldTime { internal var minutes: Int internal var hours: Int - internal var daysCount: Int //NOT a calendar day + internal var yearlyDays: Int //NOT a calendar day internal var days: Int internal var months: Int @@ -20,23 +20,23 @@ class WorldTime { @Transient private var realMillisec: Int - val DAYNAMES = arrayOf(//daynames are taken from Nynorsk (å -> o) + val DAY_NAMES = arrayOf(//daynames are taken from Nynorsk (å -> o) "Mondag", "Tysdag", "Midtedag" //From Islenska Miðvikudagur , "Torsdag", "Fredag", "Laurdag", "Sundag", "Verdag" //From Norsk word 'verd' ) - val DAYNAMES_SHORT = arrayOf("Mon", "Tys", "Mid", "Tor", "Fre", "Lau", "Sun", "Ver") + val DAY_NAMES_SHORT = arrayOf("Mon", "Tys", "Mid", "Tor", "Fre", "Lau", "Sun", "Ver") @Transient val REAL_SEC_IN_MILLI = 1000 init { seconds = 0 - minutes = 0 - hours = 0 - daysCount = 0 - days = 1 - months = 1 - years = 1 + minutes = 30 + hours = 8 + yearlyDays = 1 + days = 12 + months = 3 + years = 125 dayOfWeek = 0 realMillisec = 0 } @@ -80,7 +80,7 @@ class WorldTime { } val dayName: String - get() = DAYNAMES[dayOfWeek] + get() = DAY_NAMES[dayOfWeek] private fun kickVariables() { if (seconds >= MINUTE_SEC) { @@ -96,7 +96,7 @@ class WorldTime { if (hours >= DAY_LENGTH / HOUR_SEC) { hours = 0 days += 1 - daysCount += 1 + yearlyDays += 1 dayOfWeek += 1 } @@ -114,11 +114,11 @@ class WorldTime { years++ } else if ((months == 1 || months == 4 || months == 7 || months == 10) && days > 31) { - days = 0 + days = 1 months++ } else if (days > 30) { - days = 0 + days = 1 months++ } @@ -136,6 +136,9 @@ class WorldTime { return "${hours}h${formatMin(minutes)}" } + fun getDayNameFull(): String = DAY_NAMES[dayOfWeek] + fun getDayNameShort(): String = DAY_NAMES_SHORT[dayOfWeek] + companion object { /** * 22h diff --git a/src/com/Torvald/Terrarum/MapDrawer/LightmapLantern.kt b/src/com/Torvald/Terrarum/MapDrawer/LightmapLantern.kt deleted file mode 100644 index bfeed9f52..000000000 --- a/src/com/Torvald/Terrarum/MapDrawer/LightmapLantern.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.Torvald.Terrarum.MapDrawer - -/** - * Created by minjaesong on 16-03-15. - */ -internal data class LightmapLantern( - var x: Int, - var y: Int, - var intensity: Char -) \ No newline at end of file diff --git a/src/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.kt b/src/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.kt index 156ca9b69..01c1771b3 100644 --- a/src/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.kt +++ b/src/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.kt @@ -1,6 +1,5 @@ package com.Torvald.Terrarum.MapDrawer -import com.Torvald.ColourUtil.Col40 import com.Torvald.Terrarum.Actors.ActorWithBody import com.Torvald.Terrarum.Actors.Luminous import com.Torvald.Terrarum.GameMap.WorldTime @@ -19,7 +18,8 @@ object LightmapRenderer { /** * 8-Bit RGB values */ - @Volatile private var staticLightMap: Array? = null + @Volatile private var lightMapMSB: Array? = null + @Volatile private var lightMapLSB: Array? = null private var lightMapInitialised = false /** @@ -38,17 +38,17 @@ object LightmapRenderer { private val TSIZE = MapDrawer.TILE_SIZE // color model related vars - const val MUL = Col40.MUL - const val MUL_2 = Col40.MUL_2 - const val CHANNEL_MAX = Col40.MAX_STEP - const val CHANNEL_MAX_FLOAT = CHANNEL_MAX.toFloat() - const val COLOUR_DOMAIN_SIZE = Col40.COLOUR_DOMAIN_SIZE + const val MUL = 256 + const val MUL_2 = 256 * 256 + const val CHANNEL_MAX = 255 + const val CHANNEL_MAX_FLOAT = 255f + const val COLOUR_DOMAIN_SIZE = 256 * 256 * 256 private const val deprecatedFeatureDebatable = "This feature is debatable. Do not use it yet." @Deprecated(deprecatedFeatureDebatable) - fun addLantern(x: Int, y: Int, intensity: Char) { + fun addLantern(x: Int, y: Int, intensity: Int) { val thisLantern = LightmapLantern(x, y, intensity) for (i in lanterns.indices.reversed()) { @@ -75,9 +75,18 @@ object LightmapRenderer { } } + fun getLight(x: Int, y: Int): Int = + java.lang.Byte.toUnsignedInt(lightMapLSB!![y][x]) or (lightMapMSB!![y][x].toInt() shl 8) + + fun setLight(x: Int, y: Int, colour: Int) { + lightMapLSB!![y][x] = (colour and 0xFF).toByte() + lightMapMSB!![y][x] = (colour ushr 8).toChar() + } + fun renderLightMap() { - if (staticLightMap == null) { - staticLightMap = Array(Terrarum.game.map.height) { CharArray(Terrarum.game.map.width) } + if (lightMapMSB == null && lightMapLSB == null) { + lightMapMSB = Array(Terrarum.game.map.height) { CharArray(Terrarum.game.map.width) } + lightMapLSB = Array(Terrarum.game.map.height) { ByteArray(Terrarum.game.map.width) } if (lightMapInitialised) { throw RuntimeException("Attempting to re-initialise 'staticLightMap'") @@ -112,28 +121,28 @@ object LightmapRenderer { // Round 1 for (y in for_y_start..for_y_end - 1) { for (x in for_x_start..for_x_end - 1) { - staticLightMap!![y][x] = calculate(x, y) + 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) { - staticLightMap!![y][x] = calculate(x, y) + 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) { - staticLightMap!![y][x] = calculate(x, y) + setLight(x, y, calculate(x, y)) } } // Round 2 for (y in for_y_start..for_y_end - 1) { for (x in for_x_end - 1 downTo for_x_start) { - staticLightMap!![y][x] = calculate(x, y) + setLight(x, y, calculate(x, y)) } } } @@ -155,12 +164,14 @@ object LightmapRenderer { while (x < for_x_end) { // smooth if (Terrarum.game.screenZoom >= 1 && Terrarum.gameConfig.getAsBoolean("smoothlighting") ?: false) { - val thisLightLevel = staticLightMap!![y][x] - if (y > 0 && x < for_x_end && thisLightLevel.toInt() == 0 && staticLightMap!![y - 1][x].toInt() == 0) { + val thisLightLevel = getLight(x, y) + 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 (staticLightMap!![y][x + zeroLevelCounter].toInt() == 0 && staticLightMap!![y - 1][x + zeroLevelCounter].toInt() == 0) { + while (getLight(x + zeroLevelCounter, y) == 0 + && getLight(x + zeroLevelCounter, y - 1) == 0) { zeroLevelCounter += 1 if (x + zeroLevelCounter >= for_x_end) break @@ -193,33 +204,33 @@ object LightmapRenderer { thisLightLevel else maximiseRGB( - staticLightMap!![y][x], - staticLightMap!![y - 1][x]) + getLight(x, y), + getLight(x, y - 1)) val d = if (y == 0) thisLightLevel else if (y == Terrarum.game.map.height - 1) thisLightLevel else maximiseRGB( - staticLightMap!![y][x], - staticLightMap!![y + 1][x]) + getLight(x, y), + getLight(x, y + 1)) val b = if (x == 0) thisLightLevel else if (x == Terrarum.game.map.width - 1) thisLightLevel else maximiseRGB( - staticLightMap!![y][x], - staticLightMap!![y][x - 1]) + getLight(x, y), + getLight(x - 1, y)) val c = if (x == 0) thisLightLevel else if (x == Terrarum.game.map.width - 1) thisLightLevel else maximiseRGB( - staticLightMap!![y][x], - staticLightMap!![y][x + 1]) - val colourMapItoL = CharArray(4) + getLight(x, y), + getLight(x + 1, y)) + val colourMapItoL = IntArray(4) colourMapItoL[0] = colourLinearMix(a, b) colourMapItoL[1] = colourLinearMix(a, c) colourMapItoL[2] = colourLinearMix(b, d) @@ -227,7 +238,7 @@ object LightmapRenderer { for (iy in 0..1) { for (ix in 0..1) { - g.color = toTargetColour(colourMapItoL[iy * 2 + ix]) + g.color = Color(colourMapItoL[iy * 2 + ix]) g.fillRect( Math.round( @@ -239,17 +250,17 @@ object LightmapRenderer { } else { try { - val thisLightLevel = staticLightMap!![y][x].toInt() + val thisLightLevel = getLight(x, y) // coalesce identical intensity blocks to one var sameLevelCounter = 1 - while (staticLightMap!![y][x + sameLevelCounter].toInt() == thisLightLevel) { + while (getLight(x + sameLevelCounter, y) == thisLightLevel) { sameLevelCounter += 1 if (x + sameLevelCounter >= for_x_end) break } - g.color = toTargetColour(staticLightMap!![y][x]) + g.color = Color(getLight(x, y)) 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()) @@ -270,10 +281,10 @@ object LightmapRenderer { } - private fun calculate(x: Int, y: Int): Char = calculate(x, y, false) + private fun calculate(x: Int, y: Int): Int = calculate(x, y, false) - private fun calculate(x: Int, y: Int, doNotCalculateAmbient: Boolean): Char { - var lightLevelThis: Char = 0.toChar() + private fun calculate(x: Int, y: Int, doNotCalculateAmbient: Boolean): 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 @@ -319,8 +330,8 @@ object LightmapRenderer { if (!doNotCalculateAmbient) { // calculate ambient - var ambient: Char = 0.toChar() - var nearby: Char = 0.toChar() + var ambient: Int = 0 + var nearby: Int = 0 findNearbyBrightest@ for (yoff in -1..1) { for (xoff in -1..1) { /** @@ -336,19 +347,19 @@ object LightmapRenderer { if (xoff != yoff && -xoff != yoff) { // 'v' tiles if (!outOfMapBounds(x + xoff, y + yoff)) { - nearby = staticLightMap!![y + yoff][x + xoff] + nearby = getLight(x + xoff, y + yoff) } } else if (xoff != 0 && yoff != 0) { // 'a' tiles if (!outOfMapBounds(x + xoff, y + yoff)) { - nearby = darkenUniformInt(staticLightMap!![y + yoff][x + xoff], 2) //2 + nearby = darkenUniformInt(getLight(x + xoff, y + yoff), 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.toChar() // exclude 'me' tile + nearby = 0 // exclude 'me' tile } ambient = maximiseRGB(ambient, nearby) // keep base value as brightest nearby @@ -377,7 +388,7 @@ object LightmapRenderer { * @param darken (0-39) per channel * @return darkened data (0-39) per channel */ - fun darkenColoured(data: Char, darken: Char): Char { + fun darkenColoured(data: Int, darken: Int): Int { if (darken.toInt() < 0 || darken.toInt() >= COLOUR_DOMAIN_SIZE) { throw IllegalArgumentException("darken: out of " + "range") } @@ -400,7 +411,7 @@ object LightmapRenderer { * @param darken (0-1) * @return */ - fun darkenUniformFloat(data: Char, darken: Float): Char { + fun darkenUniformFloat(data: Int, darken: Float): Int { if (darken < 0 || darken > 1f) { throw IllegalArgumentException("darken: out of " + "range") } @@ -422,7 +433,7 @@ object LightmapRenderer { * @param darken (0-39) * @return */ - fun darkenUniformInt(data: Char, darken: Int): Char { + fun darkenUniformInt(data: Int, darken: Int): Int { if (darken < 0 || darken > CHANNEL_MAX) { throw IllegalArgumentException("darken: out of " + "range") } @@ -447,7 +458,7 @@ object LightmapRenderer { * * * @return brightened data [0-39] per channel */ - private fun brightenColoured(data: Char, brighten: Char): Char { + private fun brightenColoured(data: Int, brighten: Int): Int { if (brighten.toInt() < 0 || brighten.toInt() >= COLOUR_DOMAIN_SIZE) { throw IllegalArgumentException("brighten: out of " + "range") } @@ -466,7 +477,7 @@ object LightmapRenderer { * * * @return */ - private fun maximiseRGB(rgb: Char, rgb2: Char): Char { + private fun maximiseRGB(rgb: Int, rgb2: Int): Int { val r1 = getRawR(rgb) val r2 = getRawR(rgb2) val newR = if (r1 > r2) r1 else r2 @@ -480,7 +491,7 @@ object LightmapRenderer { return constructRGBFromInt(newR, newG, newB) } - private fun screenBlend(rgb: Char, rgb2: Char): Char { + private fun screenBlend(rgb: Int, rgb2: Int): Int { val r1 = getR(rgb) val r2 = getR(rgb2) val newR = 1 - (1 - r1) * (1 - r2) @@ -494,15 +505,15 @@ object LightmapRenderer { return constructRGBFromFloat(newR, newG, newB) } - fun getRawR(RGB: Char): Int { + fun getRawR(RGB: Int): Int { return RGB.toInt() / MUL_2 } - fun getRawG(RGB: Char): Int { + fun getRawG(RGB: Int): Int { return RGB.toInt() % MUL_2 / MUL } - fun getRawB(RGB: Char): Int { + fun getRawB(RGB: Int): Int { return RGB.toInt() % MUL } @@ -514,7 +525,7 @@ object LightmapRenderer { * * * @return */ - fun getRaw(RGB: Char, offset: Int): Int { + fun getRaw(RGB: Int, offset: Int): Int { if (offset == OFFSET_R) return getRawR(RGB) if (offset == OFFSET_G) return getRawG(RGB) if (offset == OFFSET_B) @@ -523,19 +534,19 @@ object LightmapRenderer { throw IllegalArgumentException("Channel offset out of range") } - private fun getR(rgb: Char): Float { + private fun getR(rgb: Int): Float { return getRawR(rgb) / CHANNEL_MAX_FLOAT } - private fun getG(rgb: Char): Float { + private fun getG(rgb: Int): Float { return getRawG(rgb) / CHANNEL_MAX_FLOAT } - private fun getB(rgb: Char): Float { + private fun getB(rgb: Int): Float { return getRawB(rgb) / CHANNEL_MAX_FLOAT } - private fun addRaw(rgb1: Char, rgb2: Char): Char { + private fun addRaw(rgb1: Int, rgb2: Int): Int { val newR = clampByte(getRawR(rgb1) + getRawB(rgb2)) val newG = clampByte(getRawG(rgb1) + getRawG(rgb2)) val newB = clampByte(getRawB(rgb1) + getRawB(rgb2)) @@ -543,7 +554,7 @@ object LightmapRenderer { return constructRGBFromInt(newR, newG, newB) } - fun constructRGBFromInt(r: Int, g: Int, b: Int): Char { + fun constructRGBFromInt(r: Int, g: Int, b: Int): Int { if (r < 0 || r > CHANNEL_MAX) { throw IllegalArgumentException("Red: out of range") } @@ -553,10 +564,10 @@ object LightmapRenderer { if (b < 0 || b > CHANNEL_MAX) { throw IllegalArgumentException("Blue: out of range") } - return (r * MUL_2 + g * MUL + b).toChar() + return (r * MUL_2 + g * MUL + b) } - fun constructRGBFromFloat(r: Float, g: Float, b: Float): Char { + fun constructRGBFromFloat(r: Float, g: Float, b: Float): Int { if (r < 0 || r > 1.0f) { throw IllegalArgumentException("Red: out of range") } @@ -574,7 +585,7 @@ object LightmapRenderer { return constructRGBFromInt(intR, intG, intB) } - private fun colourLinearMix(colA: Char, colB: Char): Char { + private fun colourLinearMix(colA: Int, colB: Int): Int { val r = getRawR(colA) + getRawR(colB) shr 1 val g = getRawG(colA) + getRawG(colB) shr 1 val b = getRawB(colA) + getRawB(colB) shr 1 @@ -610,7 +621,7 @@ object LightmapRenderer { x < 0 || y < 0 || x >= Terrarum.game.map.width || y >= Terrarum.game.map.height private fun outOfMapBounds(x: Int, y: Int): Boolean = - x < 0 || y < 0 || x >= staticLightMap!![0].size || y >= staticLightMap!!.size + x < 0 || y < 0 || x >= lightMapMSB!![0].size || y >= lightMapMSB!!.size private fun clampZero(i: Int): Int = if (i < 0) 0 else i @@ -620,7 +631,7 @@ object LightmapRenderer { private fun clampFloat(i: Float): Float = if (i < 0) 0f else if (i > 1) 1f else i - fun getValueFromMap(x: Int, y: Int): Char = staticLightMap!![y][x] + fun getValueFromMap(x: Int, y: Int): Int = getLight(x, y) private fun purgePartOfLightmap(x1: Int, y1: Int, x2: Int, y2: Int) { try { @@ -628,10 +639,10 @@ object LightmapRenderer { 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 - staticLightMap!![y][x] = preCalculateUpdateGLOnly(x, y) + setLight(x, y, preCalculateUpdateGLOnly(x, y)) } else { - staticLightMap!![y][x] = 0.toChar() + setLight(x, y, 0) } } } @@ -641,8 +652,8 @@ object LightmapRenderer { } - private fun preCalculateUpdateGLOnly(x: Int, y: Int): Char { - var lightLevelThis: Char = 0.toChar() + 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 @@ -720,5 +731,9 @@ object LightmapRenderer { return Math.round(sum / i.size.toFloat()) } - private fun toTargetColour(raw: Char): Color = Col40().createSlickColor(raw.toInt()) + internal data class LightmapLantern( + var x: Int, + var y: Int, + var intensity: Int + ) } diff --git a/src/com/Torvald/Terrarum/TileProperties/TileProp.kt b/src/com/Torvald/Terrarum/TileProperties/TileProp.kt index 43381ff73..9978e41d1 100644 --- a/src/com/Torvald/Terrarum/TileProperties/TileProp.kt +++ b/src/com/Torvald/Terrarum/TileProperties/TileProp.kt @@ -13,7 +13,7 @@ class TileProp { /** * @param opacity Raw RGB value, without alpha */ - var opacity: Char = ' ' // colour attenuation + var opacity: Int = 0 // colour attenuation var strength: Int = 0 @@ -30,7 +30,7 @@ class TileProp { /** * @param luminosity Raw RGB value, without alpha */ - var luminosity: Char = ' ' + var luminosity: Int = 0 var drop: Int = 0 var dropDamage: Int = 0 diff --git a/src/com/Torvald/Terrarum/TileProperties/TilePropCodex.kt b/src/com/Torvald/Terrarum/TileProperties/TilePropCodex.kt index 9ac51c38a..081feb2bb 100644 --- a/src/com/Torvald/Terrarum/TileProperties/TilePropCodex.kt +++ b/src/com/Torvald/Terrarum/TileProperties/TilePropCodex.kt @@ -72,10 +72,10 @@ class TilePropCodex { prop.id = intVal(record, "id") prop.damage = intVal(record, "dmg") - prop.opacity = intVal(record, "opacity").toChar() + prop.opacity = intVal(record, "opacity") prop.strength = intVal(record, "strength") prop.density = intVal(record, "dsty") - prop.luminosity = intVal(record, "lumcolor").toChar() + prop.luminosity = intVal(record, "lumcolor") prop.drop = intVal(record, "drop") prop.dropDamage = intVal(record, "ddmg") prop.friction = intVal(record, "friction") diff --git a/src/com/Torvald/Terrarum/TileProperties/tileprop.csv b/src/com/Torvald/Terrarum/TileProperties/tileprop.csv index cf3374aed..221d2f08e 100644 --- a/src/com/Torvald/Terrarum/TileProperties/tileprop.csv +++ b/src/com/Torvald/Terrarum/TileProperties/tileprop.csv @@ -1,66 +1,66 @@ "id";"dmg";"name" ;"opacity";"strength";"dsty";"fluid";"movr";"solid";"wall";"lumcolor";"drop";"ddmg";"fall";"friction" - "0"; "0";"TILE_AIR" ; "1641"; "0"; "1"; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "0";"16" - "1"; "0";"TILE_STONE" ; "8205"; "25";"2400"; "0"; "0"; "1"; "1"; "0"; "1"; "0"; "0";"16" - "1"; "1";"TILE_STONE_QUARRIED" ; "8205"; "25";"2400"; "0"; "0"; "1"; "1"; "0"; "1"; "1"; "0";"16" - "2"; "0";"TILE_DIRT" ; "8205"; "6";"1400"; "0"; "0"; "1"; "1"; "0"; "2"; "0"; "0";"16" - "2"; "1";"TILE_GRASS" ; "8205"; "6";"1400"; "0"; "0"; "1"; "1"; "0"; "2"; "1"; "0";"16" - "3"; "0";"TILE_PLANK_NORMAL" ; "8205"; "12"; "740"; "0"; "0"; "1"; "1"; "0"; "3"; "0"; "0";"16" - "3"; "1";"TILE_PLANK_EBONY" ; "8205"; "12";"1200"; "0"; "0"; "1"; "1"; "0"; "3"; "1"; "0";"16" - "3"; "2";"TILE_PLANK_BIRCH" ; "8205"; "12"; "670"; "0"; "0"; "1"; "1"; "0"; "3"; "2"; "0";"16" - "3"; "3";"TILE_PLANK_BLOODROSE" ; "8205"; "12"; "900"; "0"; "0"; "1"; "1"; "0"; "3"; "3"; "0";"16" - "4"; "0";"TILE_TRUNK_NORMAL" ; "8205"; "12"; "740"; "0"; "0"; "1"; "0"; "0"; "3"; "0"; "0";"16" - "4"; "1";"TILE_TRUNK_EBONY" ; "8205"; "12";"1200"; "0"; "0"; "1"; "0"; "0"; "3"; "1"; "0";"16" - "4"; "2";"TILE_TRUNK_BIRCH" ; "8205"; "12"; "670"; "0"; "0"; "1"; "0"; "0"; "3"; "2"; "0";"16" - "4"; "3";"TILE_TRUNK_BLOODROSE" ; "8205"; "12"; "900"; "0"; "0"; "1"; "0"; "0"; "3"; "3"; "0";"16" - "5"; "0";"TILE_SAND" ; "8205"; "6";"2400"; "0"; "0"; "1"; "0"; "0"; "5"; "0"; "1";"16" - "5"; "1";"TILE_SAND_WHITE" ; "8205"; "6";"2400"; "0"; "0"; "1"; "0"; "0"; "5"; "1"; "1";"16" - "5"; "2";"TILE_SAND_RED" ; "8205"; "6";"2400"; "0"; "0"; "1"; "0"; "0"; "5"; "2"; "1";"16" - "5"; "3";"TILE_SAND_DESERT" ; "8205"; "6";"2400"; "0"; "0"; "1"; "0"; "0"; "5"; "3"; "1";"16" - "5"; "4";"TILE_SAND_BLACK" ; "8205"; "6";"2400"; "0"; "0"; "1"; "0"; "0"; "5"; "4"; "1";"16" - "5"; "5";"TILE_SAND_GREEN" ; "8205"; "6";"2400"; "0"; "0"; "1"; "0"; "0"; "5"; "5"; "1";"16" - "6"; "0";"TILE_GRAVEL" ; "8205"; "6";"2400"; "0"; "0"; "1"; "0"; "0"; "6"; "0"; "1";"16" - "6"; "1";"TILE_GRAVEL_GREY" ; "8205"; "6";"2400"; "0"; "0"; "1"; "0"; "0"; "6"; "1"; "1";"16" - "7"; "0";"TILE_ORE_MALACHITE" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "7"; "0"; "0";"16" - "7"; "1";"TILE_ORE_HEMATITE" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "7"; "1"; "0";"16" - "7"; "2";"TILE_ORE_NATURAL_GOLD" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "7"; "2"; "0";"16" - "7"; "3";"TILE_ORE_NATURAL_SILVER" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "7"; "3"; "0";"16" - "7"; "4";"TILE_ORE_RUTILE" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "7"; "4"; "0";"16" - "7"; "5";"TILE_ORE_AURICHALCUMITE" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "7"; "5"; "0";"16" - "8"; "0";"TILE_GEM_RUBY" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "8"; "0"; "0";"16" - "8"; "1";"TILE_GEM_EMERALD" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "8"; "1"; "0";"16" - "8"; "2";"TILE_GEM_SAPPHIRE" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "8"; "2"; "0";"16" - "8"; "3";"TILE_GEM_TOPAZ" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "8"; "3"; "0";"16" - "8"; "4";"TILE_GEM_DIAMOND" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "8"; "4"; "0";"16" - "8"; "5";"TILE_GEM_AMETHYST" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "8"; "5"; "0";"16" - "9"; "0";"TILE_SNOW" ; "8205"; "6"; "500"; "0"; "0"; "1"; "1"; "0"; "9"; "0"; "0";"16" - "9"; "1";"TILE_ICE_FRAGILE" ; "3282"; "1"; "930"; "0"; "0"; "1"; "0"; "0"; "9"; "1"; "0";"16" - "9"; "2";"TILE_ICE_NATURAL" ; "6564"; "25"; "930"; "0"; "0"; "1"; "1"; "0"; "9"; "2"; "0"; "8" - "9"; "3";"TILE_ICE_CLEAR_MAGICAL" ; "8205"; "25";"3720"; "0"; "0"; "1"; "1"; "5009"; "9"; "3"; "0"; "8" - "10"; "0";"TILE_PLATFORM_STONE" ; "1641"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "0"; "0";"16" - "10"; "1";"TILE_PLATFORM_WOODEN" ; "1641"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "1"; "0";"16" - "10"; "2";"TILE_PLATFORM_EBONY" ; "1641"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "2"; "0";"16" - "10"; "3";"TILE_PLATFORM_BIRCH" ; "1641"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "3"; "0";"16" - "10"; "4";"TILE_PLATFORM_BLOODROSE" ; "1641"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "4"; "0";"16" - "11"; "0";"TILE_TORCH" ; "0"; "0"; "N/A"; "0"; "0"; "0"; "0"; "63412"; "11"; "0"; "0";"16" - "11"; "1";"TILE_TORCH_FROST" ; "0"; "0"; "N/A"; "0"; "0"; "0"; "0"; "19999"; "11"; "1"; "0";"16" - "12"; "0";"TILE_TORCH" ; "1641"; "0"; "N/A"; "0"; "0"; "0"; "0"; "0"; "11"; "0"; "0";"16" - "12"; "1";"TILE_TORCH_FROST" ; "1641"; "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"; "59076"; "13"; "0"; "0";"16" - "13"; "1";"TILE_ILLUMINATOR_YELLOW" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "59040"; "13"; "1"; "0";"16" - "13"; "2";"TILE_ILLUMINATOR_ORANGE" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "58720"; "13"; "2"; "0";"16" - "13"; "3";"TILE_ILLUMINATOR_RED" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "57600"; "13"; "3"; "0";"16" - "13"; "4";"TILE_ILLUMINATOR_FUCHSIA" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "57628"; "13"; "4"; "0";"16" - "13"; "5";"TILE_ILLUMINATOR_PURPLE" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "44836"; "13"; "5"; "0";"16" - "13"; "6";"TILE_ILLUMINATOR_BLUE" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "36"; "13"; "6"; "0";"16" - "13"; "7";"TILE_ILLUMINATOR_CYAN" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "1276"; "13"; "7"; "0";"16" - "13"; "8";"TILE_ILLUMINATOR_GREEN" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "17240"; "13"; "8"; "0";"16" - "13"; "9";"TILE_ILLUMINATOR_GREEN_DARK"; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "8640"; "13"; "9"; "0";"16" - "13"; "10";"TILE_ILLUMINATOR_BROWN" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "21000"; "13"; "10"; "0";"16" - "13"; "11";"TILE_ILLUMINATOR_TAN" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "37448"; "13"; "11"; "0";"16" - "13"; "12";"TILE_ILLUMINATOR_GREY_LIGHT"; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "47589"; "13"; "12"; "0";"16" - "13"; "13";"TILE_ILLUMINATOR_GREY_MED"; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "29538"; "13"; "13"; "0";"16" - "13"; "14";"TILE_ILLUMINATOR_GREY_DARK"; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "16410"; "13"; "14"; "0";"16" - "13"; "15";"TILE_ILLUMINATOR_BLACK" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "27239"; "13"; "15"; "0";"16" + "0"; "0";"TILE_AIR" ; "394758"; "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"; "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"; "1";"TILE_GRASS" ;"2105376"; "6";"1400"; "0"; "0"; "1"; "1"; "0"; "2"; "1"; "0";"16" + "3"; "0";"TILE_PLANK_NORMAL" ;"2105376"; "12"; "740"; "0"; "0"; "1"; "1"; "0"; "3"; "0"; "0";"16" + "3"; "1";"TILE_PLANK_EBONY" ;"2105376"; "12";"1200"; "0"; "0"; "1"; "1"; "0"; "3"; "1"; "0";"16" + "3"; "2";"TILE_PLANK_BIRCH" ;"2105376"; "12"; "670"; "0"; "0"; "1"; "1"; "0"; "3"; "2"; "0";"16" + "3"; "3";"TILE_PLANK_BLOODROSE" ;"2105376"; "12"; "900"; "0"; "0"; "1"; "1"; "0"; "3"; "3"; "0";"16" + "4"; "0";"TILE_TRUNK_NORMAL" ;"2105376"; "12"; "740"; "0"; "0"; "1"; "0"; "0"; "3"; "0"; "0";"16" + "4"; "1";"TILE_TRUNK_EBONY" ;"2105376"; "12";"1200"; "0"; "0"; "1"; "0"; "0"; "3"; "1"; "0";"16" + "4"; "2";"TILE_TRUNK_BIRCH" ;"2105376"; "12"; "670"; "0"; "0"; "1"; "0"; "0"; "3"; "2"; "0";"16" + "4"; "3";"TILE_TRUNK_BLOODROSE" ;"2105376"; "12"; "900"; "0"; "0"; "1"; "0"; "0"; "3"; "3"; "0";"16" + "5"; "0";"TILE_SAND" ;"2105376"; "6";"2400"; "0"; "0"; "1"; "0"; "0"; "5"; "0"; "1";"16" + "5"; "1";"TILE_SAND_WHITE" ;"2105376"; "6";"2400"; "0"; "0"; "1"; "0"; "0"; "5"; "1"; "1";"16" + "5"; "2";"TILE_SAND_RED" ;"2105376"; "6";"2400"; "0"; "0"; "1"; "0"; "0"; "5"; "2"; "1";"16" + "5"; "3";"TILE_SAND_DESERT" ;"2105376"; "6";"2400"; "0"; "0"; "1"; "0"; "0"; "5"; "3"; "1";"16" + "5"; "4";"TILE_SAND_BLACK" ;"2105376"; "6";"2400"; "0"; "0"; "1"; "0"; "0"; "5"; "4"; "1";"16" + "5"; "5";"TILE_SAND_GREEN" ;"2105376"; "6";"2400"; "0"; "0"; "1"; "0"; "0"; "5"; "5"; "1";"16" + "6"; "0";"TILE_GRAVEL" ;"2105376"; "6";"2400"; "0"; "0"; "1"; "0"; "0"; "6"; "0"; "1";"16" + "6"; "1";"TILE_GRAVEL_GREY" ;"2105376"; "6";"2400"; "0"; "0"; "1"; "0"; "0"; "6"; "1"; "1";"16" + "7"; "0";"TILE_ORE_MALACHITE" ;"2105376"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "7"; "0"; "0";"16" + "7"; "1";"TILE_ORE_HEMATITE" ;"2105376"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "7"; "1"; "0";"16" + "7"; "2";"TILE_ORE_NATURAL_GOLD" ;"2105376"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "7"; "2"; "0";"16" + "7"; "3";"TILE_ORE_NATURAL_SILVER" ;"2105376"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "7"; "3"; "0";"16" + "7"; "4";"TILE_ORE_RUTILE" ;"2105376"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "7"; "4"; "0";"16" + "7"; "5";"TILE_ORE_AURICHALCUMITE" ;"2105376"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "7"; "5"; "0";"16" + "8"; "0";"TILE_GEM_RUBY" ;"2105376"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "8"; "0"; "0";"16" + "8"; "1";"TILE_GEM_EMERALD" ;"2105376"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "8"; "1"; "0";"16" + "8"; "2";"TILE_GEM_SAPPHIRE" ;"2105376"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "8"; "2"; "0";"16" + "8"; "3";"TILE_GEM_TOPAZ" ;"2105376"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "8"; "3"; "0";"16" + "8"; "4";"TILE_GEM_DIAMOND" ;"2105376"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "8"; "4"; "0";"16" + "8"; "5";"TILE_GEM_AMETHYST" ;"2105376"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "8"; "5"; "0";"16" + "9"; "0";"TILE_SNOW" ;"2105376"; "6"; "500"; "0"; "0"; "1"; "1"; "0"; "9"; "0"; "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"; "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"; "1";"TILE_PLATFORM_WOODEN" ; "394758"; "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"; "3";"TILE_PLATFORM_BIRCH" ; "394758"; "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" + "11"; "0";"TILE_TORCH" ; "0"; "0"; "N/A"; "0"; "0"; "0"; "0";"16750673"; "11"; "0"; "0";"16" + "11"; "1";"TILE_TORCH_FROST" ; "0"; "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"; "1";"TILE_TORCH_FROST" ; "394758"; "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"; "1";"TILE_ILLUMINATOR_YELLOW" ; "0"; "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"; "3";"TILE_ILLUMINATOR_RED" ; "0"; "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"; "5";"TILE_ILLUMINATOR_PURPLE" ; "0"; "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"; "7";"TILE_ILLUMINATOR_CYAN" ; "0"; "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"; "9";"TILE_ILLUMINATOR_GREEN_DARK"; "0"; "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"; "11";"TILE_ILLUMINATOR_TAN" ; "0"; "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"; "13";"TILE_ILLUMINATOR_GREY_MED"; "0"; "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"; "15";"TILE_ILLUMINATOR_BLACK" ; "0"; "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"; "1";"TILE_ILLUMINATOR_YELLOW" ; "0"; "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" @@ -77,51 +77,51 @@ "14"; "13";"TILE_ILLUMINATOR_GREY_MED"; "0"; "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"; "15";"TILE_ILLUMINATOR_BLACK" ; "0"; "0"; "N/A"; "0"; "0"; "1"; "1"; "0"; "13"; "15"; "0";"16" - "15"; "0";"TILE_SANDSTONE" ; "8205"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "0"; "0";"16" - "15"; "1";"TILE_SANDSTONE_WHITE" ; "8205"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "1"; "0";"16" - "15"; "2";"TILE_SANDSTONE_RED" ; "8205"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "2"; "0";"16" - "15"; "3";"TILE_SANDSTONE_DESERT" ; "8205"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "3"; "0";"16" - "15"; "4";"TILE_SANDSTONE_BLACK" ; "8205"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "4"; "0";"16" - "15"; "5";"TILE_SANDSTONE_BLACK" ; "8205"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "5"; "0";"16" -"254"; "0";"TILE_WATER" ; "6522"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"254"; "1";"TILE_WATER" ; "6522"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"254"; "2";"TILE_WATER" ; "6522"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"254"; "3";"TILE_WATER" ; "6522"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"254"; "4";"TILE_WATER" ; "6522"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"254"; "5";"TILE_WATER" ; "6522"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"254"; "6";"TILE_WATER" ; "6522"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"254"; "7";"TILE_WATER" ; "6522"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"254"; "8";"TILE_WATER" ; "6522"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"254"; "9";"TILE_WATER" ; "6522"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"254"; "10";"TILE_WATER" ; "6522"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"254"; "11";"TILE_WATER" ; "6522"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"254"; "12";"TILE_WATER" ; "6522"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"254"; "13";"TILE_WATER" ; "6522"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"254"; "14";"TILE_WATER" ; "6522"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"254"; "15";"TILE_WATER" ; "6522"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"255"; "0";"TILE_LAVA" ; "62358"; "100";"2600"; "1"; "48"; "0"; "0"; "48320"; "N/A"; "N/A"; "0";"16" -"255"; "1";"TILE_LAVA" ; "62358"; "100";"2600"; "1"; "48"; "0"; "0"; "48320"; "N/A"; "N/A"; "0";"16" -"255"; "2";"TILE_LAVA" ; "62358"; "100";"2600"; "1"; "48"; "0"; "0"; "48320"; "N/A"; "N/A"; "0";"16" -"255"; "3";"TILE_LAVA" ; "62358"; "100";"2600"; "1"; "48"; "0"; "0"; "48320"; "N/A"; "N/A"; "0";"16" -"255"; "4";"TILE_LAVA" ; "62358"; "100";"2600"; "1"; "48"; "0"; "0"; "48320"; "N/A"; "N/A"; "0";"16" -"255"; "5";"TILE_LAVA" ; "62358"; "100";"2600"; "1"; "48"; "0"; "0"; "48320"; "N/A"; "N/A"; "0";"16" -"255"; "6";"TILE_LAVA" ; "62358"; "100";"2600"; "1"; "48"; "0"; "0"; "48320"; "N/A"; "N/A"; "0";"16" -"255"; "7";"TILE_LAVA" ; "62358"; "100";"2600"; "1"; "48"; "0"; "0"; "48320"; "N/A"; "N/A"; "0";"16" -"255"; "8";"TILE_LAVA" ; "62358"; "100";"2600"; "1"; "48"; "0"; "0"; "48320"; "N/A"; "N/A"; "0";"16" -"255"; "9";"TILE_LAVA" ; "62358"; "100";"2600"; "1"; "48"; "0"; "0"; "48320"; "N/A"; "N/A"; "0";"16" -"255"; "10";"TILE_LAVA" ; "62358"; "100";"2600"; "1"; "48"; "0"; "0"; "48320"; "N/A"; "N/A"; "0";"16" -"255"; "11";"TILE_LAVA" ; "62358"; "100";"2600"; "1"; "48"; "0"; "0"; "48320"; "N/A"; "N/A"; "0";"16" -"255"; "12";"TILE_LAVA" ; "62358"; "100";"2600"; "1"; "48"; "0"; "0"; "48320"; "N/A"; "N/A"; "0";"16" -"255"; "13";"TILE_LAVA" ; "62358"; "100";"2600"; "1"; "48"; "0"; "0"; "48320"; "N/A"; "N/A"; "0";"16" -"255"; "14";"TILE_LAVA" ; "62358"; "100";"2600"; "1"; "48"; "0"; "0"; "48320"; "N/A"; "N/A"; "0";"16" -"255"; "15";"TILE_LAVA" ; "62358"; "100";"2600"; "1"; "48"; "0"; "0"; "48320"; "N/A"; "N/A"; "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"; "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"; "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" +"254"; "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" +"254"; "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" +"254"; "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" +"254"; "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" +"254"; "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" +"254"; "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" +"254"; "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" +"254"; "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"; "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" +"255"; "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" +"255"; "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" +"255"; "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" +"255"; "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" +"255"; "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" +"255"; "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" +"255"; "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" # Friction: 0: frictionless, <16: slippery, 16: regular, >16: sticky # Opacity/Lumcolor: 40-step RGB # Solid: whether the tile has full collision # movr: Movement resistance, (walkspeedmax) / (1 + (n/16)), 16 halves movement speed # dsty: density. As we are putting water an 1000, it is identical to specific gravity. [g/l] -# Defalut torch should have a colour of 63412 (ffa44e) : real candlelight colour taken from properly configured camera. +# Defalut torch : L 77 a 47 b 59; real candlelight colour taken from properly configured camera. # 16 colour palette : Old Apple Macintosh 16-colour palette diff --git a/src/com/Torvald/Terrarum/UserInterface/BasicDebugInfoWindow.kt b/src/com/Torvald/Terrarum/UserInterface/BasicDebugInfoWindow.kt index d90897ebb..d988e62e6 100644 --- a/src/com/Torvald/Terrarum/UserInterface/BasicDebugInfoWindow.kt +++ b/src/com/Torvald/Terrarum/UserInterface/BasicDebugInfoWindow.kt @@ -22,12 +22,26 @@ class BasicDebugInfoWindow : UICanvas { override var openCloseTime: Int = 0 + private var prevPlayerX = 0f + private var prevPlayerY = 0f + + private var xdelta = 0f + private var ydelta = 0f + override fun processInput(input: Input) { } override fun update(gc: GameContainer, delta_t: Int) { + val player = Terrarum.game.player + val hitbox = player.hitbox!! + val nextHitbox = player.nextHitbox + xdelta = hitbox.pointedX - prevPlayerX + ydelta = hitbox.pointedY - prevPlayerY + + prevPlayerX = hitbox.pointedX + prevPlayerY = hitbox.pointedY } override fun render(gc: GameContainer, g: Graphics) { @@ -44,18 +58,23 @@ class BasicDebugInfoWindow : UICanvas { val hitbox = player.hitbox val nextHitbox = player.nextHitbox - printLine(g, 1, "posX : " + printLine(g, 1, "posX: " + "${hitbox!!.pointedX.toString()}" + " (" + "${(hitbox.pointedX / MapDrawer.TILE_SIZE).toInt().toString()}" + ")") - printLine(g, 2, "posY : " + printLine(g, 2, "posY: " + hitbox.pointedY.toString() + " (" + (hitbox.pointedY / MapDrawer.TILE_SIZE).toInt().toString() + ")") - printLine(g, 3, "veloX : ${player.veloX}") - printLine(g, 4, "veloY : ${player.veloY}") + + printLine(g, 3, "veloX reported: ${player.veloX}") + printLine(g, 4, "veloY reported: ${player.veloY}") + + printLineColumn(g, 2, 3, "veloX measured: ${xdelta}") + printLineColumn(g, 2, 4, "veloY measured: ${ydelta}") + printLine(g, 5, "grounded : ${player.grounded}") printLine(g, 6, "noClip : ${player.noClip}") @@ -97,7 +116,7 @@ class BasicDebugInfoWindow : UICanvas { printLineColumn(g, 2, 1, "Vsync : " + Terrarum.appgc.isVSyncRequested) printLineColumn(g, 2, 2, "Env colour temp : " + MapDrawer.getColTemp()) - printLineColumn(g, 2, 3, "Time : ${Terrarum.game.map.worldTime.elapsedSeconds()}" + + printLineColumn(g, 2, 5, "Time : ${Terrarum.game.map.worldTime.elapsedSeconds()}" + " (${Terrarum.game.map.worldTime.getFormattedTime()})") /** diff --git a/work_files/Tools/b24_col_to_40step_col.py b/work_files/Tools/b24_col_to_40step_col.py index a59e31815..c9289fd2c 100644 --- a/work_files/Tools/b24_col_to_40step_col.py +++ b/work_files/Tools/b24_col_to_40step_col.py @@ -1,6 +1,7 @@ MUL = 40 MUL_2 = MUL ** 2 MAX_STEP = MUL - 1 +MAX_F = 39.0 def getch(eightbit): return int(round(eightbit / 255.0 * MAX_STEP)) @@ -25,12 +26,21 @@ def getB40(raw): def intFromCol(r, g, b): return int(r * MUL_2 + g * MUL + b) def intFromRGB24(r24, g24, b24): - roundR = round(r24 / 255.0 * 39) - roundG = round(g24 / 255.0 * 39) - roundB = round(b24 / 255.0 * 39) + roundR = round(r24 / 255.0 * MAX_STEP) + roundG = round(g24 / 255.0 * MAX_STEP) + roundB = round(b24 / 255.0 * MAX_STEP) return intFromCol(roundR, roundG, roundB) def colFromNum(raw): return getR40(raw), getG40(raw), getB40(raw) +def to24B(num): + return int((getR40(num)) / MAX_F * 255.0), \ + int((getG40(num)) / MAX_F * 255.0),\ + int((getB40(num)) / MAX_F * 255.0) +def to24BHex(num): + r, g, b = to24B(num) + return hex(r)+hex(g)+hex(b) +def to24BInt(num): + r, g, b = to24B(num) + return r << 16 | g << 8 | b -print(intFromRGB24(111, 0, 255)) -print(colFromNum(27239)) +print(to24BInt(27239)) diff --git a/work_files/UI_fast_pull_out.gcx b/work_files/UI_fast_pull_out.gcx index 4031173b7..d029d124c 100644 Binary files a/work_files/UI_fast_pull_out.gcx and b/work_files/UI_fast_pull_out.gcx differ