Skip to content

Commit

Permalink
fix VERY SMALL potential mem leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
what-is-a-git committed Dec 27, 2024
1 parent eb6bc14 commit 0b2e2f9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 195 deletions.
188 changes: 2 additions & 186 deletions resources/freeplay_list.tres
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="FreeplayList" load_steps=64 format=3 uid="uid://c6srsdtwew2dx"]
[gd_resource type="Resource" script_class="FreeplayList" load_steps=30 format=3 uid="uid://c6srsdtwew2dx"]

[ext_resource type="Script" uid="uid://b7lu04jsahckp" path="res://scripts/resources/icon.gd" id="1_6tpon"]
[ext_resource type="Script" uid="uid://d3miep1y6ya1p" path="res://scripts/resources/freeplay_list.gd" id="1_bpwad"]
Expand Down Expand Up @@ -155,190 +155,6 @@ song_name = &"test"
song_difficulties = [&"normal"]
icon = SubResource("Resource_hyym4")

[sub_resource type="Resource" id="Resource_q0jyw"]
script = ExtResource("1_vnt78")
song_name = &"extra/blammed erect"
song_difficulties = ["erect"]

[sub_resource type="Resource" id="Resource_idgcb"]
script = ExtResource("1_vnt78")
song_name = &"extra/game-on grindset"
song_difficulties = ["hard"]

[sub_resource type="Resource" id="Resource_1vsam"]
script = ExtResource("1_vnt78")
song_name = &"extra/authenticity"
song_difficulties = ["hard"]

[sub_resource type="Resource" id="Resource_w07p7"]
script = ExtResource("1_vnt78")
song_name = &"extra/agro nerd"
song_difficulties = ["hard"]

[sub_resource type="Resource" id="Resource_y5b8f"]
script = ExtResource("1_vnt78")
song_name = &"extra/the potato warrior"
song_difficulties = ["hard"]

[sub_resource type="Resource" id="Resource_tyn3p"]
script = ExtResource("1_vnt78")
song_name = &"extra/hell"
song_difficulties = ["hard"]

[sub_resource type="Resource" id="Resource_ch8bj"]
script = ExtResource("1_vnt78")
song_name = &"extra/voiid sporting"
song_difficulties = ["hard"]

[sub_resource type="Resource" id="Resource_gfny3"]
script = ExtResource("1_vnt78")
song_name = &"extra/silly spookeez"
song_difficulties = ["hard"]

[sub_resource type="Resource" id="Resource_c1753"]
script = ExtResource("1_vnt78")
song_name = &"extra/silly monster"
song_difficulties = ["hard"]

[sub_resource type="Resource" id="Resource_bopu4"]
script = ExtResource("1_vnt78")
song_name = &"extra/boingo-doo"
song_difficulties = ["hard"]

[sub_resource type="Resource" id="Resource_51d1y"]
script = ExtResource("1_vnt78")
song_name = &"extra/shitno"
song_difficulties = ["hard"]

[sub_resource type="Resource" id="Resource_0dxe2"]
script = ExtResource("1_vnt78")
song_name = &"extra/monochrome"
song_difficulties = ["hard"]

[sub_resource type="Resource" id="Resource_wtxqs"]
script = ExtResource("1_vnt78")
song_name = &"extra/amusia"
song_difficulties = ["hard"]

[sub_resource type="Resource" id="Resource_ikqmb"]
script = ExtResource("1_vnt78")
song_name = &"extra/crossing my road"
song_difficulties = ["hard"]

[sub_resource type="Resource" id="Resource_a62cv"]
script = ExtResource("1_6tpon")
texture = ExtResource("6_j6a78")
color = Color(0.447059, 0.368627, 0.690196, 1)
frames = Vector2i(2, 1)
filter = 0
metadata/_custom_type_script = ExtResource("1_6tpon")

[sub_resource type="Resource" id="Resource_lqup2"]
script = ExtResource("1_vnt78")
song_name = &"extra/weekend1/darnell"
song_difficulties = ["easy", "normal", "hard"]
icon = SubResource("Resource_a62cv")

[sub_resource type="Resource" id="Resource_sci4v"]
script = ExtResource("1_6tpon")
texture = ExtResource("6_j6a78")
color = Color(0.447059, 0.368627, 0.690196, 1)
frames = Vector2i(2, 1)
filter = 0
metadata/_custom_type_script = ExtResource("1_6tpon")

[sub_resource type="Resource" id="Resource_8axvm"]
script = ExtResource("1_vnt78")
song_name = &"extra/weekend1/lit up"
song_difficulties = ["easy", "normal", "hard"]
icon = SubResource("Resource_sci4v")

[sub_resource type="Resource" id="Resource_8sb6t"]
script = ExtResource("1_6tpon")
texture = ExtResource("6_j6a78")
color = Color(0.447059, 0.368627, 0.690196, 1)
frames = Vector2i(2, 1)
filter = 0
metadata/_custom_type_script = ExtResource("1_6tpon")

[sub_resource type="Resource" id="Resource_yss6v"]
script = ExtResource("1_vnt78")
song_name = &"extra/weekend1/2hot"
song_difficulties = ["easy", "normal", "hard"]
icon = SubResource("Resource_8sb6t")

[sub_resource type="Resource" id="Resource_qjme5"]
script = ExtResource("1_vnt78")
song_name = &"extra/yipe"
song_difficulties = ["hard"]

[sub_resource type="Resource" id="Resource_dqwpl"]
script = ExtResource("1_vnt78")
song_name = &"extra/the final verdict"
song_difficulties = ["challenge"]

[sub_resource type="Resource" id="Resource_mtd2w"]
script = ExtResource("1_vnt78")
song_name = &"extra/psycho_red/breathe"
song_difficulties = [&"easy", &"normal", &"hard"]

[sub_resource type="Resource" id="Resource_ri8gu"]
script = ExtResource("1_vnt78")
song_name = &"extra/psycho_red/artery"
song_difficulties = [&"easy", &"normal", &"hard"]

[sub_resource type="Resource" id="Resource_33qe6"]
script = ExtResource("1_vnt78")
song_name = &"extra/lovesick cannibal"
song_difficulties = ["hard"]

[sub_resource type="Resource" id="Resource_k8xfe"]
script = ExtResource("1_vnt78")
song_name = &"extra/funkadelix/dad battle"
song_difficulties = [&"easy", &"normal", &"hard"]

[sub_resource type="Resource" id="Resource_h5ncf"]
script = ExtResource("1_vnt78")
song_name = &"extra/gamblecore/gambling"
song_difficulties = ["normal"]

[sub_resource type="Resource" id="Resource_ynvnj"]
script = ExtResource("1_vnt78")
song_name = &"extra/camellia/ghost"
song_difficulties = ["normal", "hard", "maniac"]

[sub_resource type="Resource" id="Resource_5tr04"]
script = ExtResource("1_vnt78")
song_name = &"extra/camellia/ghost vip"
song_difficulties = ["normal", "hard", "maniac"]

[sub_resource type="Resource" id="Resource_uwajg"]
script = ExtResource("1_vnt78")
song_name = &"extra/camellia/ghoul"
song_difficulties = [&"normal", &"hard", "maniac"]

[sub_resource type="Resource" id="Resource_1tk38"]
script = ExtResource("1_vnt78")
song_name = &"extra/candy"
song_difficulties = [&"easy", &"normal", &"hard"]

[sub_resource type="Resource" id="Resource_30exd"]
script = ExtResource("1_vnt78")
song_name = &"extra/vs_sword/starburst"
song_difficulties = ["hard"]
metadata/_custom_type_script = ExtResource("1_vnt78")

[sub_resource type="Resource" id="Resource_wndv4"]
script = ExtResource("1_vnt78")
song_name = &"extra/vs_matt/sporting"
song_difficulties = [&"easy", &"normal", &"hard"]
metadata/_custom_type_script = ExtResource("1_vnt78")

[sub_resource type="Resource" id="Resource_3o6rh"]
script = ExtResource("1_vnt78")
song_name = &"invalid_song"
song_difficulties = ["this", "song", "does", "not", "exist", ":3", "lol"]

[resource]
script = ExtResource("1_bpwad")
list = Array[ExtResource("1_vnt78")]([SubResource("Resource_bsxmn"), SubResource("Resource_bvc40"), SubResource("Resource_w108v"), SubResource("Resource_hu5ot"), SubResource("Resource_08tpj"), SubResource("Resource_1l15e"), SubResource("Resource_smd7f"), SubResource("Resource_y6hjn"), SubResource("Resource_22f7a"), SubResource("Resource_q0jyw"), SubResource("Resource_idgcb"), SubResource("Resource_1vsam"), SubResource("Resource_w07p7"), SubResource("Resource_y5b8f"), SubResource("Resource_tyn3p"), SubResource("Resource_ch8bj"), SubResource("Resource_gfny3"), SubResource("Resource_c1753"), SubResource("Resource_bopu4"), SubResource("Resource_51d1y"), SubResource("Resource_0dxe2"), SubResource("Resource_wtxqs"), SubResource("Resource_ikqmb"), SubResource("Resource_lqup2"), SubResource("Resource_8axvm"), SubResource("Resource_yss6v"), SubResource("Resource_qjme5"), SubResource("Resource_dqwpl"), SubResource("Resource_mtd2w"), SubResource("Resource_ri8gu"), SubResource("Resource_33qe6"), SubResource("Resource_k8xfe"), SubResource("Resource_h5ncf"), SubResource("Resource_ynvnj"), SubResource("Resource_5tr04"), SubResource("Resource_uwajg"), SubResource("Resource_1tk38"), SubResource("Resource_30exd"), SubResource("Resource_wndv4"), SubResource("Resource_3o6rh")])
list = Array[ExtResource("1_vnt78")]([SubResource("Resource_bsxmn"), SubResource("Resource_bvc40"), SubResource("Resource_w108v"), SubResource("Resource_hu5ot"), SubResource("Resource_08tpj"), SubResource("Resource_1l15e"), SubResource("Resource_smd7f"), SubResource("Resource_y6hjn"), SubResource("Resource_22f7a")])
15 changes: 9 additions & 6 deletions scenes/game/game.gd
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,6 @@ func _song_finished(force: bool = false) -> void:
return

playing = false

if save_score:
var current_score := Scores.get_score(song, difficulty)

Expand All @@ -426,24 +425,28 @@ func _song_finished(force: bool = false) -> void:
if not (playlist.is_empty() or force):
var new_song: StringName = playlist[0].name
var new_difficulty: StringName = playlist[0].difficulty
Game.chart = Chart.load_song(new_song, new_difficulty)
chart = Chart.load_song(new_song, new_difficulty)

if not is_instance_valid(Game.chart):
if not is_instance_valid(chart):
var json_path := 'res://songs/%s/charts/%s.json' % [new_song, new_difficulty.to_lower()]
printerr('Song at path %s doesn\'t exist!' % json_path)
GlobalAudio.get_player('MENU/CANCEL').play()
SceneManager.switch_to('scenes/menus/main_menu.tscn')
playlist.clear()
return

Game.song = new_song
Game.difficulty = new_difficulty.to_lower()
song = new_song
difficulty = new_difficulty.to_lower()
playlist.pop_front()
get_tree().reload_current_scene()
return

GlobalAudio.get_player('MENU/CANCEL').play()
chart = null
instance = null
playlist.clear()
camera_position = Vector2.INF
camera_zoom = Vector2.INF
GlobalAudio.get_player('MENU/CANCEL').play()
match mode:
PlayMode.STORY:
SceneManager.switch_to('scenes/menus/story_mode_menu.tscn')
Expand Down
5 changes: 4 additions & 1 deletion scenes/menus/options/category.gd
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
class_name Category extends Control


@export var category: PackedScene = preload('res://scenes/menus/options/sections/no_section.tscn')
@export var category: PackedScene = null
@onready var sprite: AnimatedSprite = $sprite

var target_alpha: float = 0.6
var target_scale: float = 0.8


func _ready() -> void:
if category == null:
category = load('res://scenes/menus/options/sections/no_section.tscn')

sprite.modulate.a = target_alpha
sprite.scale = Vector2(target_scale, target_scale)

Expand Down
3 changes: 1 addition & 2 deletions scenes/menus/options/previews/offset.gd
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
extends Node2D


const NOTE: PackedScene = preload('res://scenes/game/notes/note.tscn')

@onready var NOTE: PackedScene = load('res://scenes/game/notes/note.tscn')
@onready var notes: NoteField = $notes

var lane: int = 0
Expand Down

1 comment on commit 0b2e2f9

@what-is-a-git
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still technically there are mem leaks with certain preloaded assets (like alphabet and the ratings)

but they're so small i don't think it matters much 😭 (and it makes some things just so much easier lol)

Please sign in to comment.