weather only change on titlescreen

This commit is contained in:
minjaesong
2023-06-30 00:53:46 +09:00
parent 6db3baf691
commit e5e02681b8
4 changed files with 23 additions and 5 deletions

View File

@@ -205,7 +205,7 @@ object IngameRenderer : Disposable {
actorsRenderOverlay: List<ActorWithBody>,
particlesContainer : CircularArray<ParticleBase>,
player: ActorWithBody? = null,
uiContainer: UIContainer? = null
uiContainer: UIContainer? = null,
) {
renderingActorsCount = (actorsRenderBehind.size) +
(actorsRenderMiddle.size) +

View File

@@ -484,6 +484,7 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
actorGamer = player
forceAddActor(player)
WeatherMixer.internalReset()
}
KeyToggler.forceSet(Input.Keys.Q, false)

View File

@@ -165,7 +165,7 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
//ReadWorld.readWorldAndSetNewWorld(Terrarum.ingame!! as TerrarumIngame, reader)
val world = ReadSimpleWorld(reader, file)
demoWorld = world
demoWorld.worldTime.timeDelta = 0//60
demoWorld.worldTime.timeDelta = 440 // a year = 6 minutes
printdbg(this, "Demo world loaded")
}
catch (e: IOException) {
@@ -281,9 +281,14 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
}
private val updateScreen = { delta: Float ->
demoWorld.globalLight = WeatherMixer.globalLightNow
// TODO: desynched weather and time-of-day change
val forcedTime = 39693
// demoWorld.globalLight = WeatherMixer.globalLightNow
demoWorld.globalLight = WeatherMixer.getGlobalLightOfTime(demoWorld, forcedTime)
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

View File

@@ -57,6 +57,18 @@ internal object WeatherMixer : RNGConsumer {
// TODO to save from GL overhead, store lightmap to array; use GdxColorMap
var forceTimeAt: Int? = null
override fun loadFromSave(s0: Long, s1: Long) {
super.loadFromSave(s0, s1)
internalReset()
}
fun internalReset() {
globalLightOverridden = false
forceTimeAt = null
}
init {
weatherList = HashMap<String, ArrayList<BaseModularWeather>>()
@@ -146,7 +158,7 @@ internal object WeatherMixer : RNGConsumer {
// we will not care for nextSkybox for now
val timeNow = world.worldTime.TIME_T.toInt() % WorldTime.DAY_LENGTH
val timeNow = (forceTimeAt ?: world.worldTime.TIME_T.toInt()) % WorldTime.DAY_LENGTH
val skyboxColourMap = currentWeather.skyboxGradColourMap
// calculate global light