mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-06 08:38:30 +09:00
modified light penetration to penetrate less
Former-commit-id: 43b6fa9456ab58d6c59b738c718d0dcbe27799d1 Former-commit-id: ac3da567accddaea19ede6f7fcf59aff4cc10c9a
This commit is contained in:
@@ -641,3 +641,4 @@ constructor() : BasicGameState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun Color.toInt() = redByte.shl(16) or greenByte.shl(8) or blueByte
|
fun Color.toInt() = redByte.shl(16) or greenByte.shl(8) or blueByte
|
||||||
|
fun Color.to10bit() = redByte.shl(20) or greenByte.shl(10) or blueByte
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ import net.torvald.terrarum.gameactors.faction.FactionFactory
|
|||||||
import net.torvald.terrarum.gameitem.EquipPosition
|
import net.torvald.terrarum.gameitem.EquipPosition
|
||||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||||
import net.torvald.terrarum.mapdrawer.MapDrawer
|
import net.torvald.terrarum.mapdrawer.MapDrawer
|
||||||
|
import net.torvald.terrarum.to10bit
|
||||||
|
import net.torvald.terrarum.toInt
|
||||||
|
import org.newdawn.slick.Color
|
||||||
import org.newdawn.slick.SlickException
|
import org.newdawn.slick.SlickException
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
|
||||||
@@ -57,7 +60,7 @@ object PlayerBuilderSigrid {
|
|||||||
|
|
||||||
p.actorValue[AVKey.INTELLIGENT] = true
|
p.actorValue[AVKey.INTELLIGENT] = true
|
||||||
|
|
||||||
p.actorValue[AVKey.LUMINOSITY] = 95487100
|
p.actorValue[AVKey.LUMINOSITY] = Color(0x434aff).to10bit()
|
||||||
|
|
||||||
p.actorValue[AVKey.BASEDEFENCE] = 141
|
p.actorValue[AVKey.BASEDEFENCE] = 141
|
||||||
|
|
||||||
|
|||||||
@@ -337,8 +337,10 @@ object LightmapRenderer {
|
|||||||
// loop x
|
// loop x
|
||||||
var x = this_x_start
|
var x = this_x_start
|
||||||
while (x < this_x_end) {
|
while (x < this_x_end) {
|
||||||
// smoothing enabled
|
// smoothing enabled and zoom is 0.75 or greater
|
||||||
if (Terrarum.gameConfig.getAsBoolean("smoothlighting") ?: false) {
|
// (zoom of 0.5 should not smoothed, for performance)
|
||||||
|
if (Terrarum.gameConfig.getAsBoolean("smoothlighting") ?: false &&
|
||||||
|
Terrarum.ingame.screenZoom >= 0.75) {
|
||||||
|
|
||||||
val thisLightLevel = getLight(x, y) ?: 0
|
val thisLightLevel = getLight(x, y) ?: 0
|
||||||
|
|
||||||
@@ -453,12 +455,20 @@ object LightmapRenderer {
|
|||||||
* @return darkened data (0-255) per channel
|
* @return darkened data (0-255) per channel
|
||||||
*/
|
*/
|
||||||
fun darkenColoured(data: Int, darken: Int): Int {
|
fun darkenColoured(data: Int, darken: Int): Int {
|
||||||
if (darken.toInt() < 0 || darken.toInt() >= COLOUR_RANGE_SIZE)
|
if (darken < 0 || darken >= COLOUR_RANGE_SIZE)
|
||||||
throw IllegalArgumentException("darken: out of range ($darken)")
|
throw IllegalArgumentException("darken: out of range ($darken)")
|
||||||
|
|
||||||
val r = data.r() * (1f - darken.r() * 4f)
|
// use equation with magic number 6.5:
|
||||||
val g = data.g() * (1f - darken.g() * 4f)
|
// =>> val r = data.r() * (1f + brighten.r() * 6.5f) <<=
|
||||||
val b = data.b() * (1f - darken.b() * 4f)
|
// gives 8-visible-tile penetration of sunlight, fairly smooth,
|
||||||
|
// DOES NOT GO BELOW (2,2,2)
|
||||||
|
|
||||||
|
val r = data.r() * (1f - darken.r() * 6.5f)
|
||||||
|
val g = data.g() * (1f - darken.g() * 6.5f)
|
||||||
|
val b = data.b() * (1f - darken.b() * 6.5f)
|
||||||
|
//val r = data.r() - darken.r()
|
||||||
|
//val g = data.g() - darken.g()
|
||||||
|
//val b = data.b() - darken.b()
|
||||||
|
|
||||||
return constructRGBFromFloat(r.clampZero(), g.clampZero(), b.clampZero())
|
return constructRGBFromFloat(r.clampZero(), g.clampZero(), b.clampZero())
|
||||||
}
|
}
|
||||||
@@ -471,12 +481,15 @@ object LightmapRenderer {
|
|||||||
* @return brightened data (0-255) per channel
|
* @return brightened data (0-255) per channel
|
||||||
*/
|
*/
|
||||||
fun brightenColoured(data: Int, brighten: Int): Int {
|
fun brightenColoured(data: Int, brighten: Int): Int {
|
||||||
if (brighten.toInt() < 0 || brighten.toInt() >= COLOUR_RANGE_SIZE)
|
if (brighten < 0 || brighten >= COLOUR_RANGE_SIZE)
|
||||||
throw IllegalArgumentException("brighten: out of range ($brighten)")
|
throw IllegalArgumentException("brighten: out of range ($brighten)")
|
||||||
|
|
||||||
val r = data.r() * (1f + brighten.r() * 4f)
|
val r = data.r() * (1f + brighten.r() * 6.5f)
|
||||||
val g = data.g() * (1f + brighten.g() * 4f)
|
val g = data.g() * (1f + brighten.g() * 6.5f)
|
||||||
val b = data.b() * (1f + brighten.b() * 4f)
|
val b = data.b() * (1f + brighten.b() * 6.5f)
|
||||||
|
//val r = data.r() + brighten.r()
|
||||||
|
//val g = data.g() + brighten.g()
|
||||||
|
//val b = data.b() + brighten.b()
|
||||||
|
|
||||||
return constructRGBFromFloat(r.clampChannel(), g.clampChannel(), b.clampChannel())
|
return constructRGBFromFloat(r.clampChannel(), g.clampChannel(), b.clampChannel())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user