mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
clouds on titlescreen
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
"cloudChance": 133,
|
||||
"cloudGamma": [0.48, 1.8],
|
||||
"cloudGammaVariance": [0.1, 0.1],
|
||||
"cloudDriftSpeed": 20.16,
|
||||
"cloudDriftSpeed": 0.16,
|
||||
"clouds": {
|
||||
"cumulonimbus": {
|
||||
"filename": "cloud_large.png", "tw": 2048, "th": 1024, "probability": 0.25,
|
||||
|
||||
@@ -211,6 +211,7 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
IngameRenderer.setRenderedWorld(demoWorld)
|
||||
WeatherMixer.internalReset()
|
||||
WeatherMixer.titleScreenInitWeather()
|
||||
|
||||
|
||||
// load a half-gradient texture that would be used throughout the titlescreen and its sub UIs
|
||||
@@ -292,14 +293,13 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
demoWorld.globalLight = WeatherMixer.globalLightNow
|
||||
// demoWorld.globalLight = WeatherMixer.getGlobalLightOfTimeOfNoon()
|
||||
demoWorld.updateWorldTime(delta)
|
||||
// WeatherMixer.update(delta, cameraPlayer, demoWorld)
|
||||
WeatherMixer.update(delta, cameraPlayer, demoWorld)
|
||||
WeatherMixer.forceTimeAt = forcedTime
|
||||
cameraPlayer.update(delta)
|
||||
|
||||
// worldcamera update AFTER cameraplayer in this case; the other way is just an exception for actual ingame SFX
|
||||
WorldCamera.update(demoWorld, cameraPlayer)
|
||||
|
||||
|
||||
// update UIs //
|
||||
uiContainer.forEach { it?.update(delta) }
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ internal object WeatherMixer : RNGConsumer {
|
||||
|
||||
override fun loadFromSave(s0: Long, s1: Long) {
|
||||
super.loadFromSave(s0, s1)
|
||||
currentWeather = weatherList[WEATHER_GENERIC]!![0]
|
||||
internalReset(s0, s1)
|
||||
initClouds()
|
||||
}
|
||||
@@ -117,7 +118,7 @@ internal object WeatherMixer : RNGConsumer {
|
||||
|
||||
clouds.clear()
|
||||
cloudsSpawned = 0
|
||||
cloudDriftVector = Vector3(-0.98f, -0.02f, 0.21f)
|
||||
cloudDriftVector = Vector3(-0.98f, 0f, 0.21f)
|
||||
|
||||
oldCamPos.set(WorldCamera.camVector)
|
||||
}
|
||||
@@ -151,6 +152,7 @@ internal object WeatherMixer : RNGConsumer {
|
||||
|
||||
// initialise
|
||||
try {
|
||||
weatherList["titlescreen"] = arrayListOf(weatherList[WEATHER_GENERIC]!![0].copy(cloudDriftSpeed = 1f))
|
||||
currentWeather = weatherList[WEATHER_GENERIC]!![0]
|
||||
nextWeather = getRandomWeather(WEATHER_GENERIC)
|
||||
}
|
||||
@@ -332,6 +334,14 @@ internal object WeatherMixer : RNGConsumer {
|
||||
|
||||
}
|
||||
|
||||
internal fun titleScreenInitWeather() {
|
||||
val hCloudSize = 1024f
|
||||
currentWeather = weatherList["titlescreen"]!![0]
|
||||
repeat((currentWeather.cloudChance * 3.3f).ceilToInt()) { // multiplier is an empirical value that depends on the 'rZ'
|
||||
tryToSpawnCloud(currentWeather, takeUniformRand(-hCloudSize..App.scr.width + hCloudSize))
|
||||
}
|
||||
}
|
||||
|
||||
private fun <T> Array<T?>.addAtFreeSpot(obj: T) {
|
||||
var c = 0
|
||||
while (true) {
|
||||
|
||||
Reference in New Issue
Block a user