From bc13cdea24dd95a08e81be32a58d833ee8094626 Mon Sep 17 00:00:00 2001 From: Harmony Honey Date: Wed, 12 Apr 2023 16:01:42 -0400 Subject: [PATCH] MenuOptions Shared.is_weather! (-= --- src/autoload/Clouds.gd | 6 +++- src/autoload/Shared.gd | 13 ++++++-- src/menu/options/MenuOptions.tscn | 53 +++++++++++++++++++++++++------ 3 files changed, 59 insertions(+), 13 deletions(-) diff --git a/src/autoload/Clouds.gd b/src/autoload/Clouds.gd index 0b81603..bfb3bff 100644 --- a/src/autoload/Clouds.gd +++ b/src/autoload/Clouds.gd @@ -203,6 +203,10 @@ func set_is_rain(arg := is_rain): # if clouds_rain: # clouds_rain.material.blend_mode = 2 if is_rain else 1 +func set_is_weather(arg): + for i in precip_list: + i.visible = Shared.is_weather + func create_clouds(): cloud_dir = (-1.0 if randf() > 0.5 else 1.0) * rand_range(0.6, 1.0) precip_list = [] @@ -250,7 +254,7 @@ func create_clouds(): p.position = pos p.rotation = angle + (PI/2.0) - p.visible = true + p.visible = Shared.is_weather p.emitting = is_rain precip_list.append(p) diff --git a/src/autoload/Shared.gd b/src/autoload/Shared.gd index 1dca734..c1ea143 100644 --- a/src/autoload/Shared.gd +++ b/src/autoload/Shared.gd @@ -117,6 +117,7 @@ var radial_blur = 0 setget set_radial_blur var light_enabled := 1 setget set_light_enabled var shadow_enabled := 1 setget set_shadow_enabled var shadow_buffer := 2 setget set_shadow_buffer +var is_weather := true setget set_is_weather var is_demo := false @@ -166,6 +167,7 @@ func _ready(): set_light_enabled() set_shadow_enabled() set_shadow_buffer() + set_is_weather() func _input(event): if event is InputEventKey and event.pressed and !event.is_echo(): @@ -432,6 +434,10 @@ func set_shadow_buffer(arg := shadow_buffer): if is_instance_valid(Clouds.star_light): Clouds.star_light.shadow_buffer_size = [1024, 2048, 4096, 8192, 16384][shadow_buffer % 5] +func set_is_weather(arg := is_weather): + is_weather = bool(arg) + Clouds.set_is_weather(is_weather) + func set_clock_alpha(arg := clock_alpha): clock_alpha = clamp(arg, 0, 1) if is_instance_valid(UI.clock): @@ -624,12 +630,13 @@ func save_options(): o["sounds"] = int(volume[1] / 10) o["music"] = int(volume[2] / 10) - o["mouse"] = bool(Input.mouse_mode == Input.MOUSE_MODE_VISIBLE) + o["mouse"] = int(Input.mouse_mode == Input.MOUSE_MODE_VISIBLE) o["radial_blur"] = int(radial_blur) o["light_enabled"] = int(light_enabled) o["shadow_enabled"] = int(shadow_enabled) o["shadow_buffer"] = int(shadow_buffer) + o["is_weather"] = int(is_weather) o["clock_show"] = int(clock_show) o["clock_alpha"] = float(clock_alpha) @@ -657,7 +664,7 @@ func load_options(): set_volume(2, int(d["music"]) * 10) if d.has("mouse"): - Input.mouse_mode = Input.MOUSE_MODE_VISIBLE if bool(d["mouse"]) else Input.MOUSE_MODE_HIDDEN + Input.mouse_mode = Input.MOUSE_MODE_VISIBLE if int(d["mouse"]) else Input.MOUSE_MODE_HIDDEN if d.has("radial_blur"): self.radial_blur = int(d["radial_blur"]) @@ -667,6 +674,8 @@ func load_options(): self.shadow_enabled = int(d["shadow_enabled"]) if d.has("shadow_buffer"): self.shadow_buffer = int(d["shadow_buffer"]) + if d.has("is_weather"): + self.is_weather = int(d["is_weather"]) if d.has("clock_show"): clock_show = int(d["clock_show"]) diff --git a/src/menu/options/MenuOptions.tscn b/src/menu/options/MenuOptions.tscn index bdb4062..e9fe51f 100644 --- a/src/menu/options/MenuOptions.tscn +++ b/src/menu/options/MenuOptions.tscn @@ -636,19 +636,52 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="Spacer4" type="Control" parent="Control/Menu/List" groups=["no_item"]] +[node name="Weather" type="Control" parent="Control/Menu/List" groups=["light", "shadow"]] margin_top = 1410.0 margin_right = 640.0 -margin_bottom = 1440.0 +margin_bottom = 1480.0 +rect_min_size = Vector2( 0, 70 ) +script = ExtResource( 24 ) +__meta__ = { +"_edit_use_anchors_": false +} +var_name = "is_weather" + +[node name="Label" type="Label" parent="Control/Menu/List/Weather"] +anchor_right = 0.5 +anchor_bottom = 1.0 +size_flags_vertical = 6 +custom_fonts/font = ExtResource( 2 ) +text = "Weather" +valign = 1 + +[node name="Label2" type="Label" parent="Control/Menu/List/Weather"] +anchor_left = 0.5 +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 25.0 +size_flags_vertical = 6 +custom_fonts/font = ExtResource( 2 ) +text = "< OFF >" +align = 2 +valign = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Spacer4" type="Control" parent="Control/Menu/List" groups=["no_item"]] +margin_top = 1480.0 +margin_right = 640.0 +margin_bottom = 1510.0 rect_min_size = Vector2( 0, 30 ) __meta__ = { "_edit_use_anchors_": false } [node name="HeaderSpeed" type="Control" parent="Control/Menu/List" groups=["no_item"]] -margin_top = 1440.0 +margin_top = 1510.0 margin_right = 640.0 -margin_bottom = 1510.0 +margin_bottom = 1580.0 rect_min_size = Vector2( 0, 70 ) [node name="Tex" type="TextureRect" parent="Control/Menu/List/HeaderSpeed"] @@ -669,9 +702,9 @@ text = "Speedrun" valign = 1 [node name="Speedrun" type="Control" parent="Control/Menu/List"] -margin_top = 1510.0 +margin_top = 1580.0 margin_right = 640.0 -margin_bottom = 1580.0 +margin_bottom = 1650.0 rect_min_size = Vector2( 0, 70 ) script = ExtResource( 24 ) __meta__ = { @@ -706,9 +739,9 @@ __meta__ = { } [node name="Speedrun2" type="Control" parent="Control/Menu/List" groups=["speed"]] -margin_top = 1580.0 +margin_top = 1650.0 margin_right = 640.0 -margin_bottom = 1650.0 +margin_bottom = 1720.0 rect_min_size = Vector2( 0, 70 ) script = ExtResource( 24 ) __meta__ = { @@ -740,9 +773,9 @@ align = 2 valign = 1 [node name="Decimals" type="Control" parent="Control/Menu/List" groups=["speed"]] -margin_top = 1650.0 +margin_top = 1720.0 margin_right = 640.0 -margin_bottom = 1720.0 +margin_bottom = 1790.0 rect_min_size = Vector2( 0, 70 ) script = ExtResource( 24 ) __meta__ = {