Merge branch 'main' into custom-level-loading-rewrite

This commit is contained in:
JHDev2006
2025-10-17 21:12:58 +01:00
200 changed files with 19511 additions and 16655 deletions

View File

@@ -26,6 +26,11 @@ const SCROLL_DIFFERENCE := 48.0
var can_diff := true
static var sp_screen_scroll := false
static var sp_scroll_style := 1
var sp_scrolling := false
func _exit_tree() -> void:
cam_locked = false
@@ -45,9 +50,12 @@ func handle_camera(delta: float) -> void:
return
if not cam_locked:
handle_horizontal_scrolling(delta)
handle_vertical_scrolling(delta)
handle_offsets(delta)
if not sp_screen_scroll:
handle_horizontal_scrolling(delta)
handle_vertical_scrolling(delta)
handle_offsets(delta)
else:
handle_sp_scrolling()
do_limits()
camera.global_position = camera_position + camera_offset
@@ -107,6 +115,31 @@ func handle_vertical_scrolling(_delta: float) -> void:
elif global_position.y > camera_position.y + 32:
camera_position.y = global_position.y - 32
func handle_sp_scrolling() -> void:
var distance = camera_position.x - owner.global_position.x
var limit = get_viewport().get_visible_rect().size.x / 2 - 16
if abs(distance) > limit:
do_sp_scroll(sign(owner.global_position.x - camera_position.x))
func do_sp_scroll(direction := 1) -> void:
if sp_scrolling: return
sp_scrolling = true
process_mode = Node.PROCESS_MODE_ALWAYS
get_tree().paused = true
var distance = get_viewport().get_visible_rect().size.x - 32
if sp_scroll_style == 0:
var tween = create_tween()
tween.tween_property(self, "camera_position:x", camera_position.x + (distance * direction), 1)
await tween.finished
else:
Global.get_node("Transition").show()
await get_tree().create_timer(0.5).timeout
camera_position.x += distance * direction
await get_tree().create_timer(0.5).timeout
Global.get_node("Transition").hide()
sp_scrolling = false
get_tree().paused = false
func tween_ahead() -> void:
if scrolling == false: return
await get_tree().create_timer(0.25).timeout

View File

@@ -70,10 +70,11 @@ func bridge_piece_fall(node: Node2D) -> void:
const BRIDGE_DESTRUCTION_PARTICLE = preload("uid://cwfjdgsyh35h6")
func bridge_piece_break(node: Node2D) -> void:
var particle = BRIDGE_DESTRUCTION_PARTICLE.instantiate()
particle.global_position = node.global_position
particle.process_mode = Node.PROCESS_MODE_ALWAYS
add_sibling(particle)
if Settings.file.visuals.extra_particles == 1:
var particle = BRIDGE_DESTRUCTION_PARTICLE.instantiate()
particle.global_position = node.global_position
particle.process_mode = Node.PROCESS_MODE_ALWAYS
add_sibling(particle)
node.modulate.a = 0
func _physics_process(delta: float) -> void:

View File

@@ -1,5 +1,5 @@
extends Area2D
func area_entered(area: Area2D) -> void:
if area.owner is Player and area.owner.state_machine.state.name != "Dead":
if area.owner is Player and area.name != "HammerHitbox" and area.owner.state_machine.state.name != "Dead":
area.owner.die(true)

View File

@@ -29,6 +29,7 @@ func _process(_delta: float) -> void:
go_to_menu()
func go_to_menu() -> void:
ResourceGenerator.updating = true
if Global.rom_path == "":
Global.transition_to_scene("res://Scenes/Levels/RomVerifier.tscn")
elif not Global.rom_assets_exist:

View File

@@ -1,13 +1,13 @@
class_name FontUpdater
extends Node
@onready var resource_getter_smb1 := ResourceGetter.new()
@onready var resource_getter_smbll := ResourceGetter.new()
@onready var resource_getter_score := ResourceGetter.new()
var main_font: FontFile = null
var score_font: FontFile = null
var ga_font: Resource = null
var jp_font: Resource = null
@onready var FONT_LL_MAIN = load("uid://djxdgxy1iv8yv")
@onready var FONT_MAIN = load("uid://bl7sbw4nx3l1t")
@onready var SCORE_FONT = load("uid://cflgloiossd8a")
var FONT_MAIN = preload("res://Resources/ThemedResources/FontMain.tres")
var SCORE_FONT = preload("res://Resources/ThemedResources/ScoreFont.tres")
static var current_font: Font = null
@@ -17,6 +17,7 @@ func _ready() -> void:
Global.level_theme_changed.connect(update_fonts)
func update_fonts() -> void:
FONT_MAIN.base_font = resource_getter_smb1.get_resource(FONT_MAIN.base_font)
FONT_LL_MAIN.base_font = resource_getter_smbll.get_resource(FONT_LL_MAIN.base_font)
SCORE_FONT.base_font = resource_getter_score.get_resource(SCORE_FONT.base_font)
if FONT_MAIN.base_font.get_meta("base_path", "") != main_font.get_meta("base_path", "null"):
print([FONT_MAIN.base_font.get_meta("base_path"), main_font.get_meta("base_path")])
FONT_MAIN.base_font = main_font
SCORE_FONT.base_font = score_font

View File

@@ -3,9 +3,8 @@ extends Node
@export var labels: Array[Label]
const SMB1 = preload("uid://bl7sbw4nx3l1t")
const SMBLL = preload("uid://djxdgxy1iv8yv")
const SCORE_FONT = preload("uid://bk0no5p6sifgu")
const MAIN_FONT = preload("res://Resources/ThemedResources/FontMain.tres")
const SCORE_FONT = preload("res://Resources/ThemedResources/ScoreFont.tres")
@export var use_score_font := false
@@ -16,18 +15,11 @@ func _ready() -> void:
Global.level_theme_changed.connect(refresh_font)
func refresh_font() -> void:
if Global.current_campaign == "SMBLL":
current_font = SMBLL
else:
current_font = SMB1
update_labels()
func update_labels() -> void:
var font_to_use = current_font
if use_score_font:
font_to_use = SCORE_FONT
for i in labels:
if i == null:
continue
i.remove_theme_font_override("font")
i.add_theme_font_override("font", font_to_use)
i.add_theme_font_override("font", MAIN_FONT)

View File

@@ -9,12 +9,12 @@ func _ready() -> void:
area_exited.connect(on_area_exited)
func on_area_entered(area: Area2D) -> void:
if area.owner is Player:
if area.owner is Player and area.name != "HammerHitbox":
player_entered.emit(area.owner)
func on_area_exited(area: Area2D) -> void:
if area.owner is Player:
if area.owner is Player and area.name != "HammerHitbox":
player_exited.emit(area.owner)
func is_player_in_area() -> bool:
return get_overlapping_areas().any(func(area: Area2D) -> bool: return area.owner is Player)
return get_overlapping_areas().any(func(area: Area2D) -> bool: return area.owner is Player and area.name != "HammerHitbox")

View File

@@ -36,7 +36,7 @@ func create_container(resource_pack := "") -> void:
container.icon = ImageTexture.create_from_image(image)
elif FileAccess.file_exists(resource_pack + "/icon.gif"):
container.icon = GifManager.animated_texture_from_file(resource_pack + "/icon.gif")
container.pack_name = resource_pack.replace(Global.config_path.path_join("resource_packs"), "")
container.pack_name = resource_pack.replace(Global.config_path.path_join("resource_packs"), "").trim_prefix("/")
$"../ScrollContainer/VBoxContainer".add_child(container)
containers.append(container)
container.add_to_group("Options")

View File

@@ -20,19 +20,14 @@ func create_template() -> void:
else:
destination = i.replace(Global.config_path.path_join("resource_packs/BaseAssets"), Global.config_path.path_join("resource_packs/new_pack"))
print("Copying '" + i + "' to: '" + destination)
if i.contains(".bgm") or i.contains(".json") or i.contains(Global.config_path):
DirAccess.copy_absolute(i, destination)
else:
var resource = load(i)
if resource is Texture:
resource.get_image().save_png(destination)
elif resource is AudioStreamWAV:
resource.save_to_wav(destination)
elif resource is AudioStream:
var file = FileAccess.open(destination, FileAccess.WRITE)
file.store_buffer(resource.data)
file.close()
var old_file = FileAccess.open(i, FileAccess.READ)
if old_file != null:
var new_file = FileAccess.open(destination, FileAccess.WRITE)
new_file.store_buffer(old_file.get_buffer(old_file.get_length()))
old_file.close()
new_file.close()
var pack_info_path = Global.config_path.path_join("resource_packs/new_pack/pack_info.json")
DirAccess.make_dir_recursive_absolute(pack_info_path.get_base_dir())
var file = FileAccess.open(pack_info_path, FileAccess.WRITE)