mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
changing the way weatherbox gets updated
This commit is contained in:
@@ -348,6 +348,7 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
|
||||
private val colHairline = Color(0xf22100ff.toInt())
|
||||
private val colGraph = Toolkit.Theme.COL_SELECTED
|
||||
private val colGrapi = Toolkit.Theme.COL_SELECTED.cpy().mul(0.5f, 0.5f, 0.5f, 1f)
|
||||
private val colGraphBack = Toolkit.Theme.COL_CELL_FILL
|
||||
private val colGraphFore = Color(1f, 1f, 1f, 0.5f)
|
||||
private val colGraphForf = Color(1f, 1f, 1f, 0.25f)
|
||||
@@ -424,19 +425,22 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
}
|
||||
val pys2 = (0 until xw).map {
|
||||
val px = it.toFloat() / xw
|
||||
bh - (bh * WeatherStateBox.interpolate(px, box.p1, box.p2, box.p3, box.p4) / ymax).toFloat()
|
||||
bh - (bh * WeatherStateBox.interpolate(px, box.p1, box.p2, box.p3, box.p3) / ymax).toFloat()
|
||||
}
|
||||
val pys3 = (0 until xw).map {
|
||||
val px = it.toFloat() / xw
|
||||
bh - (bh * WeatherStateBox.interpolate(px, box.p2, box.p3, box.p4, box.p5) / ymax).toFloat()
|
||||
bh - (bh * WeatherStateBox.interpolate(px, box.p2, box.p3, box.p3, box.p3) / ymax).toFloat()
|
||||
}
|
||||
val pys = pysM1 + pys0 + pys1 + pys2 + pys3 + box.p4
|
||||
val pys = pysM1 + pys0 + pys1 + pys2 + pys3 + box.p3
|
||||
|
||||
|
||||
// interpolated values
|
||||
it.color = colGraph
|
||||
val xis = xi + (xw / 2)
|
||||
for (index in xis until xis + bw - 1) {
|
||||
|
||||
if (index == xw * 3) it.color = colGrapi // uncertain points will get darker
|
||||
|
||||
val px = x - xis + index + 1f
|
||||
it.rectLine(
|
||||
px,
|
||||
@@ -452,6 +456,7 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
if (box.x < 0.5) it.circle(x + (GRAPH_CW * 0.5f) - xi, App.scr.hf - 1 - (y + bh-(box.p0 * bh / ymax).toFloat()), 2.5f)
|
||||
it.circle(x + (GRAPH_CW * 1.5f) - xi, App.scr.hf - 1 - (y + bh-(box.p1 * bh / ymax).toFloat()), 2.5f)
|
||||
it.circle(x + (GRAPH_CW * 2.5f) - xi, App.scr.hf - 1 - (y + bh-(box.p2 * bh / ymax).toFloat()), 2.5f)
|
||||
it.color = colGrapi
|
||||
if (box.x > 0.5) it.circle(x + (GRAPH_CW * 3.5f) - xi, App.scr.hf - 1 - (y + bh-(box.p3 * bh / ymax).toFloat()), 2.5f)
|
||||
}
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ internal object WeatherMixer : RNGConsumer {
|
||||
weatherbox.windDir.p1 = it[2]
|
||||
weatherbox.windDir.p2 = it[3]
|
||||
weatherbox.windDir.p3 = it[4]
|
||||
weatherbox.windDir.p4 = it[5]
|
||||
// weatherbox.windDir.p4 = it[5]
|
||||
}
|
||||
(0..5).map { takeUniformRand(-1f..1f) }.let {
|
||||
weatherbox.windSpeed.pM1 = currentWeather.getRandomWindSpeed(it[0])
|
||||
@@ -147,7 +147,7 @@ internal object WeatherMixer : RNGConsumer {
|
||||
weatherbox.windSpeed.p1 = currentWeather.getRandomWindSpeed(it[2])
|
||||
weatherbox.windSpeed.p2 = currentWeather.getRandomWindSpeed(it[3])
|
||||
weatherbox.windSpeed.p3 = currentWeather.getRandomWindSpeed(it[4])
|
||||
weatherbox.windSpeed.p4 = currentWeather.getRandomWindSpeed(it[5])
|
||||
// weatherbox.windSpeed.p4 = currentWeather.getRandomWindSpeed(it[5])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,10 @@ data class WeatherStateBox(
|
||||
var p1: Float = 0f,
|
||||
var p2: Float = 0f,
|
||||
var p3: Float = 0f,
|
||||
var p4: Float = 0f,
|
||||
var p5: Float = 0f,
|
||||
// var p4: Float = 0f,
|
||||
// var p5: Float = 0f,
|
||||
// pM1 and p4 only exists for the sake of better weather forecasting
|
||||
// - removing p4 and beyond: for faster response to the changing weather schedule and make the forecasting less accurate like irl
|
||||
) {
|
||||
|
||||
fun get() = interpolate(x, p0, p1, p2, p3)
|
||||
@@ -35,9 +36,12 @@ data class WeatherStateBox(
|
||||
p0 = p1
|
||||
p1 = p2
|
||||
p2 = p3
|
||||
p3 = p4
|
||||
p4 = p5
|
||||
p5 = next()
|
||||
p3 = next()
|
||||
|
||||
|
||||
// p3 = p4
|
||||
// p4 = p5
|
||||
// p5 = next()
|
||||
}
|
||||
return y
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user