clouds on titlescreen

This commit is contained in:
minjaesong
2023-08-22 23:17:49 +09:00
parent d6145fd0da
commit ac2c7b1148
3 changed files with 14 additions and 4 deletions

View File

@@ -5,7 +5,7 @@
"cloudChance": 133, "cloudChance": 133,
"cloudGamma": [0.48, 1.8], "cloudGamma": [0.48, 1.8],
"cloudGammaVariance": [0.1, 0.1], "cloudGammaVariance": [0.1, 0.1],
"cloudDriftSpeed": 20.16, "cloudDriftSpeed": 0.16,
"clouds": { "clouds": {
"cumulonimbus": { "cumulonimbus": {
"filename": "cloud_large.png", "tw": 2048, "th": 1024, "probability": 0.25, "filename": "cloud_large.png", "tw": 2048, "th": 1024, "probability": 0.25,

View File

@@ -211,6 +211,7 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
IngameRenderer.setRenderedWorld(demoWorld) IngameRenderer.setRenderedWorld(demoWorld)
WeatherMixer.internalReset() WeatherMixer.internalReset()
WeatherMixer.titleScreenInitWeather()
// load a half-gradient texture that would be used throughout the titlescreen and its sub UIs // 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.globalLightNow
// demoWorld.globalLight = WeatherMixer.getGlobalLightOfTimeOfNoon() // demoWorld.globalLight = WeatherMixer.getGlobalLightOfTimeOfNoon()
demoWorld.updateWorldTime(delta) demoWorld.updateWorldTime(delta)
// WeatherMixer.update(delta, cameraPlayer, demoWorld) WeatherMixer.update(delta, cameraPlayer, demoWorld)
WeatherMixer.forceTimeAt = forcedTime WeatherMixer.forceTimeAt = forcedTime
cameraPlayer.update(delta) cameraPlayer.update(delta)
// worldcamera update AFTER cameraplayer in this case; the other way is just an exception for actual ingame SFX // worldcamera update AFTER cameraplayer in this case; the other way is just an exception for actual ingame SFX
WorldCamera.update(demoWorld, cameraPlayer) WorldCamera.update(demoWorld, cameraPlayer)
// update UIs // // update UIs //
uiContainer.forEach { it?.update(delta) } uiContainer.forEach { it?.update(delta) }
} }

View File

@@ -100,6 +100,7 @@ internal object WeatherMixer : RNGConsumer {
override fun loadFromSave(s0: Long, s1: Long) { override fun loadFromSave(s0: Long, s1: Long) {
super.loadFromSave(s0, s1) super.loadFromSave(s0, s1)
currentWeather = weatherList[WEATHER_GENERIC]!![0]
internalReset(s0, s1) internalReset(s0, s1)
initClouds() initClouds()
} }
@@ -117,7 +118,7 @@ internal object WeatherMixer : RNGConsumer {
clouds.clear() clouds.clear()
cloudsSpawned = 0 cloudsSpawned = 0
cloudDriftVector = Vector3(-0.98f, -0.02f, 0.21f) cloudDriftVector = Vector3(-0.98f, 0f, 0.21f)
oldCamPos.set(WorldCamera.camVector) oldCamPos.set(WorldCamera.camVector)
} }
@@ -151,6 +152,7 @@ internal object WeatherMixer : RNGConsumer {
// initialise // initialise
try { try {
weatherList["titlescreen"] = arrayListOf(weatherList[WEATHER_GENERIC]!![0].copy(cloudDriftSpeed = 1f))
currentWeather = weatherList[WEATHER_GENERIC]!![0] currentWeather = weatherList[WEATHER_GENERIC]!![0]
nextWeather = getRandomWeather(WEATHER_GENERIC) 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) { private fun <T> Array<T?>.addAtFreeSpot(obj: T) {
var c = 0 var c = 0
while (true) { while (true) {