diff --git a/assets/mods/basegame/sprites/test_werebeastf2/taimu_torso_0.tga b/assets/mods/basegame/sprites/test_werebeastf2/taimu_torso_0.tga index c139b6fb4..7423aa5ef 100644 --- a/assets/mods/basegame/sprites/test_werebeastf2/taimu_torso_0.tga +++ b/assets/mods/basegame/sprites/test_werebeastf2/taimu_torso_0.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e40f6d3d974a869113e93fbdf503c5eba37bc756c58d2fb71cdd2027eb383c86 +oid sha256:c6c8b15c1a0a2e51717e54e8fcfc599e784973e8e25acbdc66cfc2dcae107839 size 4310 diff --git a/assets/mods/basegame/weathers/clut_daylight.tga b/assets/mods/basegame/weathers/clut_daylight.tga index 90a02ab96..0bf481a66 100644 --- a/assets/mods/basegame/weathers/clut_daylight.tga +++ b/assets/mods/basegame/weathers/clut_daylight.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fd4b6f11e751826e3b093285188919a91bdc47551900819f882ed6c451aacb30 -size 2418 +oid sha256:b1f3ba6060ad826ee0461465b317a69d3378e013cad5df6e762c9dcb51535047 +size 3618 diff --git a/src/net/torvald/terrarum/IngameInstance.kt b/src/net/torvald/terrarum/IngameInstance.kt index a1fa1814d..62376b967 100644 --- a/src/net/torvald/terrarum/IngameInstance.kt +++ b/src/net/torvald/terrarum/IngameInstance.kt @@ -167,7 +167,9 @@ open class IngameInstance(val batch: FlippingSpriteBatch, val isMultiplayer: Boo override fun show() { // the very basic show() implementation - KeyToggler.forceSet(Input.Keys.F4, false) + for (k in Input.Keys.F1..Input.Keys.F12) { + KeyToggler.forceSet(k, false) + } // add blockmarking_actor into the actorlist (CommonResourcePool.get("blockmarking_actor") as BlockMarkerActor).let { diff --git a/src/net/torvald/terrarum/SavegameCollection.kt b/src/net/torvald/terrarum/SavegameCollection.kt index 85188cc86..62b9da99d 100644 --- a/src/net/torvald/terrarum/SavegameCollection.kt +++ b/src/net/torvald/terrarum/SavegameCollection.kt @@ -353,11 +353,15 @@ class SavegameCollectionPair(private val player: SavegameCollection?, private va } fun getPlayerThumbnailPixmap(width: Int, height: Int, shrinkage: Double): Pixmap? { - return player?.loadable()?.getThumbnailPixmap(width, height, shrinkage) + return player?.loadable()?.getThumbnailPixmap(width, height, shrinkage)?.let { + if (it.isDisposed) null else it + } } fun getWorldThumbnailPixmap(width: Int, height: Int, shrinkage: Double): Pixmap? { - return world?.loadable()?.getThumbnailPixmap(width, height, shrinkage) + return world?.loadable()?.getThumbnailPixmap(width, height, shrinkage)?.let { + if (it.isDisposed) null else it + } } } diff --git a/src/net/torvald/terrarum/modulebasegame/TitleScreen.kt b/src/net/torvald/terrarum/modulebasegame/TitleScreen.kt index 1981a8d73..3c6bd1489 100644 --- a/src/net/torvald/terrarum/modulebasegame/TitleScreen.kt +++ b/src/net/torvald/terrarum/modulebasegame/TitleScreen.kt @@ -258,7 +258,9 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) { override fun show() { printdbg(this, "show() called") - KeyToggler.forceSet(Input.Keys.F4, false) + for (k in Input.Keys.F1..Input.Keys.F12) { + KeyToggler.forceSet(k, false) + } initViewPort(App.scr.width, App.scr.height) diff --git a/src/net/torvald/terrarum/weather/WeatherMixer.kt b/src/net/torvald/terrarum/weather/WeatherMixer.kt index 053926d19..211b1f8c5 100644 --- a/src/net/torvald/terrarum/weather/WeatherMixer.kt +++ b/src/net/torvald/terrarum/weather/WeatherMixer.kt @@ -63,6 +63,7 @@ internal object WeatherMixer : RNGConsumer { lateinit var mixedWeather: BaseModularWeather val globalLightNow = Cvec(0) + private val cloudDrawColour = Color() private val moonlightMax = Cvec(0.23f, 0.24f, 0.25f, 0.21f) // actual moonlight is around ~4100K but our mesopic vision makes it appear blueish (wikipedia: Purkinje effect) // Weather indices @@ -546,7 +547,7 @@ internal object WeatherMixer : RNGConsumer { batch.shader.setUniformf("shadeCol", 0.06f, 0.07f, 0.08f, 1f) // TODO temporary value clouds.forEach { - batch.color = Color(globalLightNow.r, globalLightNow.g, globalLightNow.b, it.alpha) + batch.color = Color(cloudDrawColour.r, cloudDrawColour.g, cloudDrawColour.b, it.alpha) it.render(batch, 0f, 0f) } } @@ -569,9 +570,11 @@ internal object WeatherMixer : RNGConsumer { val daylightClut = currentWeather.daylightClut // calculate global light val moonSize = (-(2.0 * world.worldTime.moonPhase - 1.0).abs() + 1.0).toFloat() - val globalLightBySun: Cvec = getGradientColour2(daylightClut, solarElev, timeNow) + val globalLightBySun: Cvec = getGradientColour2(daylightClut, solarElev, timeNow, GradientColourMode.DAYLIGHT) val globalLightByMoon: Cvec = moonlightMax * moonSize + val cloudCol = getGradientColour2(daylightClut, solarElev, timeNow, GradientColourMode.CLOUD_COLOUR) globalLightNow.set(globalLightBySun max globalLightByMoon) + cloudDrawColour.set(cloudCol max globalLightByMoon) /* (copied from the shader source) UV mapping coord.y @@ -690,7 +693,7 @@ internal object WeatherMixer : RNGConsumer { return Cvec(newCol) } - fun getGradientColour2(colorMap: GdxColorMap, solarAngleInDeg: Double, timeOfDay: Int): Cvec { + fun getGradientColour2(colorMap: GdxColorMap, solarAngleInDeg: Double, timeOfDay: Int, mode: GradientColourMode): Cvec { val pNowRaw = (solarAngleInDeg + 75.0) / 150.0 * colorMap.width val pStartRaw = pNowRaw.floorToInt() @@ -709,20 +712,31 @@ internal object WeatherMixer : RNGConsumer { if (pSx == 0) { pNx = 0; pNy = 0 } else { pNx = pSx - 1; pNy = 1 } } - - val colourThisRGB = colorMap.get(pSx, pSy) - val colourNextRGB = colorMap.get(pNx, pNy) - val colourThisUV = colorMap.get(pSx, pSy + 2) - val colourNextUV = colorMap.get(pNx, pNy + 2) - // interpolate R, G, B and A var scale = (pNowRaw - pStartRaw).toFloat() if (timeOfDay >= HALF_DAY) scale = 1f - scale - val newColRGB = colourThisRGB.cpy().lerp(colourNextRGB, scale)//CIELuvUtil.getGradient(scale, colourThis, colourNext) - val newColUV = colourThisUV.cpy().lerp(colourNextUV, scale)//CIELuvUtil.getGradient(scale, colourThis, colourNext) + return when (mode) { + GradientColourMode.DAYLIGHT -> { + val colourThisRGB = colorMap.get(pSx, pSy) + val colourNextRGB = colorMap.get(pNx, pNy) + val colourThisUV = colorMap.get(pSx, pSy + 2) + val colourNextUV = colorMap.get(pNx, pNy + 2) - return Cvec(newColRGB, newColUV.r) + val newColRGB = colourThisRGB.cpy().lerp(colourNextRGB, scale)//CIELuvUtil.getGradient(scale, colourThis, colourNext) + val newColUV = colourThisUV.cpy().lerp(colourNextUV, scale)//CIELuvUtil.getGradient(scale, colourThis, colourNext) + + Cvec(newColRGB, newColUV.r) + } + GradientColourMode.CLOUD_COLOUR -> { + val colourThisRGB = colorMap.get(pSx, pSy + 4) + val colourNextRGB = colorMap.get(pNx, pNy + 4) + + val newColRGB = colourThisRGB.cpy().lerp(colourNextRGB, scale)//CIELuvUtil.getGradient(scale, colourThis, colourNext) + + Cvec(newColRGB) + } + } } fun getWeatherList(classification: String) = weatherList[classification]!! @@ -819,3 +833,14 @@ internal object WeatherMixer : RNGConsumer { } } +enum class GradientColourMode { + DAYLIGHT, CLOUD_COLOUR +} + +private fun Color.set(cvec: Cvec) { + this.r = cvec.r + this.g = cvec.g + this.b = cvec.b + this.a = cvec.a +} +