mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 15:38:14 +00:00
Merge remote-tracking branch 'upstream/main' into pulls/resource-pack-expansion
This commit is contained in:
@@ -10,12 +10,15 @@ var has_downloaded := false
|
||||
|
||||
signal level_play
|
||||
|
||||
var level_thumbnail = null
|
||||
|
||||
func _ready() -> void:
|
||||
set_process(false)
|
||||
|
||||
func open(container: OnlineLevelContainer) -> void:
|
||||
has_downloaded = FileAccess.file_exists("user://custom_levels/downloaded/" + container.level_id + ".lvl")
|
||||
show()
|
||||
level_thumbnail = container.level_thumbnail
|
||||
%Download.text = "DOWNLOAD"
|
||||
if has_downloaded:
|
||||
%OnlinePlay.grab_focus()
|
||||
@@ -34,7 +37,7 @@ func setup_visuals(container: OnlineLevelContainer) -> void:
|
||||
%SelectedOnlineLevel.level_author = container.level_author
|
||||
%SelectedOnlineLevel.level_id = container.level_id
|
||||
%SelectedOnlineLevel.thumbnail_url = container.thumbnail_url
|
||||
%SelectedOnlineLevel.level_thumbnail = container.level_thumbnail
|
||||
%SelectedOnlineLevel.level_thumbnail = level_thumbnail
|
||||
%SelectedOnlineLevel.difficulty = container.difficulty
|
||||
%SelectedOnlineLevel.setup_visuals()
|
||||
$Description.request(LEVEL_INFO_URL + container.level_id)
|
||||
@@ -76,10 +79,17 @@ func level_downloaded(result: int, response_code: int, headers: PackedStringArra
|
||||
data = json.levelData
|
||||
file.store_string(JSON.stringify(str_to_var(data)))
|
||||
file.close()
|
||||
save_thumbnail()
|
||||
%Download.hide()
|
||||
%OnlinePlay.show()
|
||||
%OnlinePlay.grab_focus()
|
||||
|
||||
func save_thumbnail() -> void:
|
||||
if OnlineLevelContainer.cached_thumbnails.has(level_id):
|
||||
var thumbnail = OnlineLevelContainer.cached_thumbnails.get(level_id)
|
||||
DirAccess.make_dir_recursive_absolute("user://custom_levels/downloaded/thumbnails")
|
||||
thumbnail.get_image().save_png("user://custom_levels/downloaded/thumbnails/"+ level_id + ".png")
|
||||
|
||||
func play_level() -> void:
|
||||
var file_path := "user://custom_levels/downloaded/" + level_id + ".lvl"
|
||||
var file = JSON.parse_string(FileAccess.open(file_path, FileAccess.READ).get_as_text())
|
||||
|
@@ -13,7 +13,10 @@ func _ready() -> void:
|
||||
|
||||
func on_file_dropped(files: PackedStringArray) -> void:
|
||||
for i in files:
|
||||
if is_valid_rom(i):
|
||||
if i.contains(".zip"):
|
||||
zip_error()
|
||||
return
|
||||
elif is_valid_rom(i):
|
||||
Global.rom_path = i
|
||||
verified()
|
||||
copy_rom(i)
|
||||
@@ -35,6 +38,10 @@ func error() -> void:
|
||||
%Error.show()
|
||||
$ErrorSFX.play()
|
||||
|
||||
func zip_error() -> void:
|
||||
$ErrorSFX.play()
|
||||
%ZipError.show()
|
||||
|
||||
func verified() -> void:
|
||||
$BGM.queue_free()
|
||||
%DefaultText.queue_free()
|
||||
|
@@ -28,8 +28,6 @@ func handle_inputs() -> void:
|
||||
selected_index = clamp(selected_index, 0, options.size() - 1)
|
||||
if Input.is_action_just_pressed("ui_accept"):
|
||||
option_selected()
|
||||
if Input.is_action_just_pressed("pause"):
|
||||
close()
|
||||
|
||||
func option_selected() -> void:
|
||||
emit_signal("option_" + str(selected_index + 1) + "_selected")
|
||||
|
@@ -22,6 +22,7 @@ func window_size_changed(new_value := 0) -> void:
|
||||
|
||||
func vsync_changed(new_value := 0) -> void:
|
||||
DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_ENABLED if new_value == 1 else DisplayServer.VSYNC_DISABLED)
|
||||
|
||||
Settings.file.video.vsync = new_value
|
||||
|
||||
func drop_shadows_changed(new_value := 0) -> void:
|
||||
@@ -44,6 +45,20 @@ func language_changed(new_value := 0) -> void:
|
||||
Settings.file.game.lang = Global.lang_codes[new_value]
|
||||
%Flag.region_rect.position.x = new_value * 16
|
||||
|
||||
func frame_limit_changed(new_value := 0) -> void:
|
||||
print_debug(str(new_value))
|
||||
|
||||
var new_framerate := 0
|
||||
match new_value:
|
||||
|
||||
1: new_framerate = 60
|
||||
2: new_framerate = 120
|
||||
3: new_framerate = 144
|
||||
4: new_framerate = 240
|
||||
|
||||
Engine.max_fps = new_framerate
|
||||
Settings.file.video.frame_limit = new_value
|
||||
|
||||
func set_value(value_name := "", value := 0) -> void:
|
||||
{
|
||||
"mode": window_mode_changed,
|
||||
@@ -54,5 +69,6 @@ func set_value(value_name := "", value := 0) -> void:
|
||||
"visuals": visuals_changed,
|
||||
"palette": null_function,
|
||||
"hud_size": hud_style_changed,
|
||||
"hud_style": hud_style_changed
|
||||
"hud_style": hud_style_changed,
|
||||
"frame_limit": frame_limit_changed,
|
||||
}[value_name].call(value)
|
||||
|
Reference in New Issue
Block a user