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:
@@ -3,6 +3,9 @@ extends Level
|
||||
|
||||
@export var all_coins_check: AllCoinsCollectedCheck = null
|
||||
|
||||
func _ready() -> void:
|
||||
Level.in_vine_level = true
|
||||
|
||||
func warp_back(player: Player) -> void:
|
||||
player.state_machine.transition_to("Freeze")
|
||||
if all_coins_check != null:
|
||||
|
@@ -67,7 +67,6 @@ func handle_player_interaction(delta: float) -> void:
|
||||
func on_player_entered(_player: Player) -> void:
|
||||
if can_tele == false:
|
||||
return
|
||||
Level.in_vine_level = true
|
||||
Level.vine_return_level = Global.current_level.scene_file_path
|
||||
Global.transition_to_scene(Level.vine_warp_level)
|
||||
|
||||
|
@@ -507,7 +507,7 @@ func do_i_frames() -> void:
|
||||
refresh_hitbox()
|
||||
|
||||
func die(pit := false) -> void:
|
||||
if state_machine.state.name == "Dead" or state_machine.state.name == "Pipe":
|
||||
if ["Dead", "Pipe", "LevelExit"].has(state_machine.state.name):
|
||||
return
|
||||
is_dead = true
|
||||
visible = not pit
|
||||
|
@@ -8,7 +8,8 @@ var file := {
|
||||
"drop_shadows": 1,
|
||||
"scaling": 0,
|
||||
"visuals": 0,
|
||||
"hud_size": 0
|
||||
"hud_size": 0,
|
||||
"frame_limit" : 0,
|
||||
},
|
||||
"audio": {
|
||||
"master": 10.0,
|
||||
|
@@ -12,6 +12,8 @@ var show_timer := false
|
||||
|
||||
signal level_finished
|
||||
|
||||
var paused_time := 0.0
|
||||
|
||||
var start_time := 0.0
|
||||
|
||||
const GHOST_RECORDING_TEMPLATE := {
|
||||
@@ -147,12 +149,17 @@ const MEDAL_CONVERSIONS := [2, 1.5, 1]
|
||||
func _ready() -> void:
|
||||
process_mode = Node.PROCESS_MODE_ALWAYS
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
func _physics_process(delta: float) -> void:
|
||||
if timer_active:
|
||||
timer = abs(start_time - Time.get_ticks_msec()) / 1000
|
||||
if Global.game_paused and Global.current_game_mode != Global.GameMode.MARATHON:
|
||||
paused_time += delta
|
||||
else:
|
||||
timer = (abs(start_time - Time.get_ticks_msec()) / 1000) - paused_time
|
||||
if enable_recording:
|
||||
if get_tree().get_first_node_in_group("Players") != null:
|
||||
record_frame(get_tree().get_first_node_in_group("Players"))
|
||||
else:
|
||||
paused_time = 0
|
||||
Global.player_ghost.visible = ghost_visible
|
||||
if ghost_active and ghost_enabled:
|
||||
ghost_idx += 1
|
||||
@@ -163,6 +170,7 @@ func _physics_process(_delta: float) -> void:
|
||||
|
||||
func start_timer() -> void:
|
||||
timer = 0
|
||||
paused_time = 0
|
||||
timer_active = true
|
||||
show_timer = true
|
||||
start_time = Time.get_ticks_msec()
|
||||
|
@@ -24,6 +24,9 @@ func physics_update(delta: float) -> void:
|
||||
in_air()
|
||||
handle_movement(delta)
|
||||
handle_animations()
|
||||
handle_death_pits()
|
||||
|
||||
func handle_death_pits() -> void:
|
||||
if player.global_position.y > 64 and not Level.in_vine_level and player.auto_death_pit:
|
||||
player.die(true)
|
||||
elif player.global_position.y < Global.current_level.vertical_height - 32 and player.gravity_vector == Vector2.UP:
|
||||
|
@@ -5,8 +5,8 @@ extends Node2D
|
||||
|
||||
func _ready() -> void:
|
||||
Level.vine_warp_level = heaven_scene
|
||||
Level.in_vine_level = false
|
||||
if Level.in_vine_level and PipeArea.exiting_pipe_id == -1:
|
||||
Level.in_vine_level = false
|
||||
for i in get_tree().get_nodes_in_group("Players"):
|
||||
i.global_position = global_position
|
||||
i.reset_physics_interpolation()
|
||||
|
@@ -10,16 +10,27 @@ const base_info_json := {
|
||||
}
|
||||
|
||||
func create_template() -> void:
|
||||
get_directories("res://Assets/", files, directories)
|
||||
get_directories("res://Assets", files, directories)
|
||||
for i in directories:
|
||||
DirAccess.make_dir_recursive_absolute(i.replace("res://Assets", "user://resource_packs/new_pack/"))
|
||||
DirAccess.make_dir_recursive_absolute(i.replace("res://Assets", "user://resource_packs/new_pack"))
|
||||
for i in files:
|
||||
var destination = i
|
||||
if destination.contains("res://"):
|
||||
destination = i.replace("res://Assets", "user://resource_packs/new_pack/")
|
||||
destination = i.replace("res://Assets", "user://resource_packs/new_pack")
|
||||
else:
|
||||
destination = i.replace("user://resource_packs/BaseAssets", "user://resource_packs/new_pack")
|
||||
DirAccess.copy_absolute(i, destination)
|
||||
print("Copying '" + i + "' to: '" + destination)
|
||||
if i.contains(".bgm") or i.contains(".json") or i.contains("user://"):
|
||||
DirAccess.copy_absolute(i, destination)
|
||||
else:
|
||||
var resource = load(i)
|
||||
if resource is Texture:
|
||||
resource.get_image().save_png(destination)
|
||||
elif resource is AudioStream:
|
||||
var file = FileAccess.open(destination, FileAccess.WRITE)
|
||||
file.store_buffer(resource.data)
|
||||
file.close()
|
||||
|
||||
var file = FileAccess.open("user://resource_packs/new_pack/pack_info.json", FileAccess.WRITE)
|
||||
file.store_string(JSON.stringify(base_info_json, "\t"))
|
||||
file.close()
|
||||
@@ -34,7 +45,9 @@ func get_directories(base_dir := "", files := [], directories := []) -> void:
|
||||
|
||||
func get_files(base_dir := "", files := []) -> void:
|
||||
for i in DirAccess.get_files_at(base_dir):
|
||||
if i.contains(".import") == false and base_dir.contains("LevelGuides") == false:
|
||||
if base_dir.contains("LevelGuides") == false:
|
||||
i = i.replace(".import", "")
|
||||
print(i)
|
||||
var target_path = base_dir + "/" + i
|
||||
var rom_assets_path = target_path.replace("res://Assets", "user://resource_packs/BaseAssets")
|
||||
if FileAccess.file_exists(rom_assets_path):
|
||||
|
@@ -18,7 +18,6 @@ func _ready() -> void:
|
||||
idx += 1
|
||||
|
||||
func activate() -> void:
|
||||
CameraHandler.cam_locked = true
|
||||
for i in get_tree().get_nodes_in_group("Labels"):
|
||||
i.show()
|
||||
for i in get_tree().get_nodes_in_group("Plants"):
|
||||
|
@@ -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