From 91f44064dc4047e487384979c15f4bb680670c1a Mon Sep 17 00:00:00 2001 From: LoafyLemon Date: Tue, 31 May 2022 15:31:41 +0100 Subject: [PATCH] Weather improvements * Reimplemented weather using renpy image methods * Fixed weather causing fps drop * Added cached weather results to the main room * Reduced animation overhead * Removed weather screen * Unified day and night cloud images --- game/images/rooms/_weather_/day_cloud_01.webp | 3 + game/images/rooms/_weather_/day_cloud_02.webp | 3 + game/images/rooms/_weather_/day_cloud_03.webp | 3 + game/scripts/events/ending.rpy | 1 - game/scripts/rooms/main_room/init.rpy | 3 +- .../rooms/main_room/objects/weather.rpy | 173 +++++++++--------- 6 files changed, 93 insertions(+), 93 deletions(-) create mode 100644 game/images/rooms/_weather_/day_cloud_01.webp create mode 100644 game/images/rooms/_weather_/day_cloud_02.webp create mode 100644 game/images/rooms/_weather_/day_cloud_03.webp diff --git a/game/images/rooms/_weather_/day_cloud_01.webp b/game/images/rooms/_weather_/day_cloud_01.webp new file mode 100644 index 00000000..e78798b6 --- /dev/null +++ b/game/images/rooms/_weather_/day_cloud_01.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b0095e632114c2da6ce2d87ab6deffe2b8c777c1a7d9f70882ade6bac72d910 +size 462 diff --git a/game/images/rooms/_weather_/day_cloud_02.webp b/game/images/rooms/_weather_/day_cloud_02.webp new file mode 100644 index 00000000..98e9b0e4 --- /dev/null +++ b/game/images/rooms/_weather_/day_cloud_02.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:272b069780af7ee4672b5511a4e7cd9cb59c8b2e1b625e53c8e55e7e0ea6219e +size 1078 diff --git a/game/images/rooms/_weather_/day_cloud_03.webp b/game/images/rooms/_weather_/day_cloud_03.webp new file mode 100644 index 00000000..a1ba0cf0 --- /dev/null +++ b/game/images/rooms/_weather_/day_cloud_03.webp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47b824482587ab3e5b3032e7caa79cc379de1d3bd93df9db6c548b3593f277f9 +size 626 diff --git a/game/scripts/events/ending.rpy b/game/scripts/events/ending.rpy index 977d0804..5c379a63 100644 --- a/game/scripts/events/ending.rpy +++ b/game/scripts/events/ending.rpy @@ -2739,7 +2739,6 @@ label ball_ending_E2: $ game.weather = "random" call weather_sound - show screen weather show screen main_room $ chair_OBJ.hidden = False diff --git a/game/scripts/rooms/main_room/init.rpy b/game/scripts/rooms/main_room/init.rpy index 6b0a6b43..c30e5160 100644 --- a/game/scripts/rooms/main_room/init.rpy +++ b/game/scripts/rooms/main_room/init.rpy @@ -25,12 +25,13 @@ screen main_room(): sensitive room_menu_active default objects = sorted(main_room.objects, key=lambda x: x.zorder) + default weather = "weather_[game.weather]" # Hotkeys if room_menu_active and game.day > 1 and not renpy.android: use hotkeys_main - use weather + add weather pos (430, 218) anchor (0.5, 0.5) # Walls if game.daytime: diff --git a/game/scripts/rooms/main_room/objects/weather.rpy b/game/scripts/rooms/main_room/objects/weather.rpy index 55896a22..ac342830 100644 --- a/game/scripts/rooms/main_room/objects/weather.rpy +++ b/game/scripts/rooms/main_room/objects/weather.rpy @@ -10,51 +10,6 @@ label weather_sound: stop weather fadeout 0.5 return -screen weather(): - zorder -1 - sensitive False - - if game.daytime: - if game.weather in ("clear", "cloudy"): - add "images/rooms/_weather_/sky.webp" pos (430, 218) anchor (0.5, 0.5) - - if game.weather == "cloudy": - add "images/rooms/_weather_/cloud_small.webp" at cloud_move - - if game.weather in ("overcast", "blizzard", "snow", "storm", "rain"): - add "images/rooms/_weather_/sky_overcast.webp" pos (430, 218) anchor (0.5, 0.5) - - elif game.moon: - if game.weather in ("clear", "cloudy"): - add "images/rooms/_weather_/night_sky_moon.webp" pos (430, 218) anchor (0.5, 0.5) - - if game.weather == "cloudy": - add "images/rooms/_weather_/night_cloud_02.webp" at cloud_night_move_01 - add "images/rooms/_weather_/night_cloud_01.webp" at cloud_night_move_02 - add "images/rooms/_weather_/night_cloud_03.webp" at cloud_night_move_03 - - if game.weather in ("overcast", "blizzard", "snow", "storm", "rain"): - add "images/rooms/_weather_/night_sky_moon_overcast.webp" pos (430, 218) anchor (0.5, 0.5) - - else: - if game.weather in ("clear", "cloudy"): - add "images/rooms/_weather_/night_sky.webp" pos (430, 218) anchor (0.5, 0.5) - - if game.weather == "cloudy": - add "images/rooms/_weather_/night_cloud_02.webp" at cloud_night_move_01 - add "images/rooms/_weather_/night_cloud_01.webp" at cloud_night_move_02 - add "images/rooms/_weather_/night_cloud_03.webp" at cloud_night_move_03 - - if game.weather in ("overcast", "blizzard", "snow", "storm", "rain"): - add "images/rooms/_weather_/night_sky_overcast.webp" pos (430, 218) anchor (0.5, 0.5) - - if game.weather in ("blizzard", "snow", "storm", "rain"): - add game.weather pos (430, 218) anchor (0.5, 0.5) - - if game.weather == "storm": - add "rain" pos (430, 218) anchor (0.5, 0.5) - - transform cloud_move: xpos 520 choice: @@ -72,36 +27,53 @@ transform cloud_move: pause 7 repeat -transform cloud_night_move_01: - xpos 520 +image weather_clear = ConditionSwitch( + "game.daytime == True", "images/rooms/_weather_/sky.webp", + "game.moon == True", "images/rooms/_weather_/night_sky_moon.webp", + "game.daytime == False", "images/rooms/_weather_/night_sky.webp", + ) + +image weather_overcast = ConditionSwitch( + "game.daytime == True", "images/rooms/_weather_/sky_overcast.webp", + "game.moon == True", "images/rooms/_weather_/night_sky_moon_overcast.webp", + "game.daytime == False", "images/rooms/_weather_/night_sky_overcast.webp", + ) + +image weather_cloudy_clouds_night = Composite( + (155, 230), + (40, 40), "images/rooms/_weather_/night_cloud_01.webp", + (60, 60), "images/rooms/_weather_/night_cloud_02.webp", + (80, 80), "images/rooms/_weather_/night_cloud_03.webp", + ) + +image weather_cloudy_clouds_day = Composite( + (155, 230), + (40, 40), "images/rooms/_weather_/day_cloud_01.webp", + (60, 60), "images/rooms/_weather_/day_cloud_02.webp", + (80, 80), "images/rooms/_weather_/day_cloud_03.webp", + ) + +image weather_cloudy_clouds = ConditionSwitch( + "game.daytime == True", "weather_cloudy_clouds_day", + "game.daytime == False", "weather_cloudy_clouds_night", + ) + +image weather_cloudy_fx: + "weather_cloudy_clouds" choice: - ypos 130 + pos (-100, 0) choice: - ypos 150 + pos (-100, 15) choice: - ypos 150 - linear 30.0 xpos 280 + pos (-100, 30) + + ease 15.0 xpos 120 pause 2 repeat -transform cloud_night_move_02: - xpos 520 - choice: - ypos 150 - choice: - ypos 170 - linear 70.0 xpos 280 - pause 2 - repeat +image weather_cloudy = Fixed("weather_clear", "weather_cloudy_fx", fit_first=True) -transform cloud_night_move_03: - xpos 520 - ypos 160 - linear 50.0 xpos 280 - pause 2 - repeat - -image rain: +image weather_rain_fx: "images/rooms/_weather_/rain_01.webp" pause.1 "images/rooms/_weather_/rain_02.webp" @@ -110,7 +82,9 @@ image rain: pause.1 repeat -image snow: +image weather_rain = Fixed("weather_overcast", "weather_rain_fx", fit_first=True) + +image weather_snow_fx: "images/rooms/_weather_/snow_01.webp" pause.07 "images/rooms/_weather_/snow_02.webp" @@ -133,7 +107,9 @@ image snow: pause.07 repeat -image blizzard: +image weather_snow = Fixed("weather_overcast", "weather_snow_fx", fit_first=True) + +image weather_blizzard_fx: "images/rooms/_weather_/blizzard_01.webp" pause.05 "images/rooms/_weather_/blizzard_02.webp" @@ -156,24 +132,39 @@ image blizzard: pause.05 repeat -image storm: - pause 20 - "images/rooms/_weather_/lightning_01.webp" - pause.1 - "images/rooms/_weather_/lightning_02.webp" - pause.1 - "images/rooms/_weather_/lightning_03.webp" - pause.1 - "images/rooms/_weather_/lightning_04.webp" - pause.1 - "images/rooms/_weather_/lightning_05.webp" - pause.1 - "images/rooms/_weather_/lightning_06.webp" - pause.1 - "images/rooms/_weather_/lightning_05.webp" - pause.1 - "images/rooms/_weather_/lightning_06.webp" - pause.1 - "images/rooms/_weather_/lightning_05.webp" - pause 20 - repeat +image weather_blizzard= Fixed("weather_overcast", "weather_blizzard_fx", fit_first=True) + +image weather_storm_fx: + + parallel: + pause 20 + "images/rooms/_weather_/lightning_01.webp" + pause.1 + "images/rooms/_weather_/lightning_02.webp" + pause.1 + "images/rooms/_weather_/lightning_03.webp" + pause.1 + "images/rooms/_weather_/lightning_04.webp" + pause.1 + "images/rooms/_weather_/lightning_05.webp" + pause.1 + "images/rooms/_weather_/lightning_06.webp" + pause.1 + "images/rooms/_weather_/lightning_05.webp" + pause.1 + "images/rooms/_weather_/lightning_06.webp" + pause.1 + "images/rooms/_weather_/lightning_05.webp" + pause 20 + repeat + + parallel: + "images/rooms/_weather_/rain_01.webp" + pause.1 + "images/rooms/_weather_/rain_02.webp" + pause.1 + "images/rooms/_weather_/rain_03.webp" + pause.1 + repeat + +image weather_storm= Fixed("weather_overcast", "weather_storm_fx", fit_first=True)