mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 07:28:14 +00:00
Title Screen QOL Theming
This was supposed to be a quick quality of life addition for the Title Screen that applied the save and theme to the menu, but then I discovered a new bug I had to bypass with the character palette when doing it. So I ended up doing a bit more related to the Title Screen as a result. I also *had* a function which checks for the number of valid folders within the Pck to see how many worlds there are, but I think it might've been a bit slow so I replaced it with constant values. - Save for the currently loaded campaign gets applied on startup - Backing out of World 9 and over keeps you on said worlds at the title screen - Added Skyland and Volcano to SMB1 themes since it shares most of its themes with Lost Levels - Fixed Title Screen Stars for the Volcano Theme
This commit is contained in:
@@ -92,6 +92,6 @@
|
|||||||
"Castle": {"source": "TitleScreenStars.png", "rect": [0, 16, 24, 8]},
|
"Castle": {"source": "TitleScreenStars.png", "rect": [0, 16, 24, 8]},
|
||||||
"Snow": {"source": "TitleScreenStars.png", "rect": [0, 24, 24, 8]},
|
"Snow": {"source": "TitleScreenStars.png", "rect": [0, 24, 24, 8]},
|
||||||
"Space": {"source": "TitleScreenStars.png", "rect": [0, 32, 24, 8]},
|
"Space": {"source": "TitleScreenStars.png", "rect": [0, 32, 24, 8]},
|
||||||
"Volcano": {"source": "TitleScreenStars.png", "rect": [0, 48, 24, 8]}
|
"Volcano": {"source": "TitleScreenStars.png", "rect": [0, 40, 24, 8]}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,6 +9,13 @@ extends Node
|
|||||||
|
|
||||||
const THEME_IDXS := ["Overworld", "Underground", "Desert", "Snow", "Jungle", "Beach", "Garden", "Mountain", "Skyland", "Autumn", "Pipeland", "Space", "Underwater", "Volcano", "GhostHouse", "Castle", "CastleWater", "Airship", "Bonus"]
|
const THEME_IDXS := ["Overworld", "Underground", "Desert", "Snow", "Jungle", "Beach", "Garden", "Mountain", "Skyland", "Autumn", "Pipeland", "Space", "Underwater", "Volcano", "GhostHouse", "Castle", "CastleWater", "Airship", "Bonus"]
|
||||||
|
|
||||||
|
const WORLD_COUNTS := {
|
||||||
|
"SMB1": 8,
|
||||||
|
"SMBLL": 13,
|
||||||
|
"SMBS": 8,
|
||||||
|
"SMBANN": 8
|
||||||
|
}
|
||||||
|
|
||||||
const WORLD_THEMES := {
|
const WORLD_THEMES := {
|
||||||
"SMB1": SMB1_THEMES,
|
"SMB1": SMB1_THEMES,
|
||||||
"SMBLL": SMB1_THEMES,
|
"SMBLL": SMB1_THEMES,
|
||||||
@@ -29,6 +36,8 @@ const SMB1_THEMES := {
|
|||||||
9: "Space",
|
9: "Space",
|
||||||
10: "Autumn",
|
10: "Autumn",
|
||||||
11: "Pipeland",
|
11: "Pipeland",
|
||||||
|
12: "Skyland",
|
||||||
|
13: "Volcano"
|
||||||
}
|
}
|
||||||
|
|
||||||
const SMBS_THEMES := {
|
const SMBS_THEMES := {
|
||||||
@@ -131,6 +140,9 @@ func update_next_level_info() -> void:
|
|||||||
static func get_scene_string(world_num := 0, level_num := 0) -> String:
|
static func get_scene_string(world_num := 0, level_num := 0) -> String:
|
||||||
return "res://Scenes/Levels/" + Global.current_campaign + "/World" + str(world_num) + "/" + str(world_num) + "-" + str(level_num) + ".tscn"
|
return "res://Scenes/Levels/" + Global.current_campaign + "/World" + str(world_num) + "/" + str(world_num) + "-" + str(level_num) + ".tscn"
|
||||||
|
|
||||||
|
static func get_world_count() -> int:
|
||||||
|
return WORLD_COUNTS[Global.current_campaign]
|
||||||
|
|
||||||
func transition_to_next_level() -> void:
|
func transition_to_next_level() -> void:
|
||||||
if Global.current_game_mode == Global.GameMode.CHALLENGE:
|
if Global.current_game_mode == Global.GameMode.CHALLENGE:
|
||||||
Global.transition_to_scene("res://Scenes/Levels/ChallengeModeResults.tscn")
|
Global.transition_to_scene("res://Scenes/Levels/ChallengeModeResults.tscn")
|
||||||
|
@@ -113,7 +113,7 @@ func write_save_to_file(json := {}, path := "") -> void:
|
|||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
func apply_save(json := {}) -> void:
|
func apply_save(json := {}) -> void:
|
||||||
Global.world_num = clamp(json["World"], 1, 8)
|
Global.world_num = json.get_or_add("World", 1)
|
||||||
Global.level_num = json.get_or_add("Level", 1)
|
Global.level_num = json.get_or_add("Level", 1)
|
||||||
Global.lives = json["Lives"]
|
Global.lives = json["Lives"]
|
||||||
Global.coins = json["Coins"]
|
Global.coins = json["Coins"]
|
||||||
|
@@ -9,6 +9,7 @@ static var title_first_load = true
|
|||||||
@onready var cursor = %Cursor
|
@onready var cursor = %Cursor
|
||||||
|
|
||||||
static var last_theme := "Overworld"
|
static var last_theme := "Overworld"
|
||||||
|
var last_campaign := "SMB1"
|
||||||
var has_achievements_to_unlock := false
|
var has_achievements_to_unlock := false
|
||||||
@export var active_options: TitleScreenOptions = null
|
@export var active_options: TitleScreenOptions = null
|
||||||
|
|
||||||
@@ -21,6 +22,7 @@ func _enter_tree() -> void:
|
|||||||
Global.current_campaign = Settings.file.game.campaign
|
Global.current_campaign = Settings.file.game.campaign
|
||||||
Global.in_title_screen = true
|
Global.in_title_screen = true
|
||||||
Global.current_game_mode = Global.GameMode.NONE
|
Global.current_game_mode = Global.GameMode.NONE
|
||||||
|
last_campaign = Global.current_campaign
|
||||||
title_first_load = false
|
title_first_load = false
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
@@ -40,7 +42,11 @@ func _ready() -> void:
|
|||||||
Global.player_ghost.apply_data()
|
Global.player_ghost.apply_data()
|
||||||
get_tree().call_group("PlayerGhosts", "delete")
|
get_tree().call_group("PlayerGhosts", "delete")
|
||||||
Global.current_level = null
|
Global.current_level = null
|
||||||
Global.world_num = clamp(Global.world_num, 1, 8)
|
Global.world_num = clamp(Global.world_num, 1, get_world_count())
|
||||||
|
update_title()
|
||||||
|
|
||||||
|
func update_title() -> void:
|
||||||
|
SaveManager.apply_save(SaveManager.load_save(Global.current_campaign))
|
||||||
level_id = Global.level_num - 1
|
level_id = Global.level_num - 1
|
||||||
world_id = Global.world_num
|
world_id = Global.world_num
|
||||||
update_theme()
|
update_theme()
|
||||||
@@ -48,8 +54,6 @@ func _ready() -> void:
|
|||||||
$LevelBG.time_of_day = ["Day", "Night"].find(Global.theme_time)
|
$LevelBG.time_of_day = ["Day", "Night"].find(Global.theme_time)
|
||||||
$LevelBG.update_visuals()
|
$LevelBG.update_visuals()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func play_bgm() -> void:
|
func play_bgm() -> void:
|
||||||
if has_achievements_to_unlock:
|
if has_achievements_to_unlock:
|
||||||
await get_tree().create_timer(3, false).timeout
|
await get_tree().create_timer(3, false).timeout
|
||||||
@@ -66,7 +70,9 @@ func _process(_delta: float) -> void:
|
|||||||
$BGM.play()
|
$BGM.play()
|
||||||
|
|
||||||
func campaign_selected() -> void:
|
func campaign_selected() -> void:
|
||||||
SaveManager.apply_save(SaveManager.load_save(Global.current_campaign))
|
if last_campaign != Global.current_campaign:
|
||||||
|
last_campaign = Global.current_campaign
|
||||||
|
update_title()
|
||||||
if Global.current_campaign == "SMBANN":
|
if Global.current_campaign == "SMBANN":
|
||||||
Global.current_game_mode = Global.GameMode.CAMPAIGN
|
Global.current_game_mode = Global.GameMode.CAMPAIGN
|
||||||
$CanvasLayer/AllNightNippon/WorldSelect.open()
|
$CanvasLayer/AllNightNippon/WorldSelect.open()
|
||||||
|
@@ -21,7 +21,7 @@ func _process(_delta: float) -> void:
|
|||||||
handle_inputs()
|
handle_inputs()
|
||||||
|
|
||||||
func open() -> void:
|
func open() -> void:
|
||||||
Global.world_num = clamp(Global.world_num, 1, 8) # have this, cause i cba to make a fix for backing out of world 9 keeping you at world 9
|
Global.world_num = clamp(Global.world_num, 1, Level.get_world_count())
|
||||||
title_screen_parent.active_options = self
|
title_screen_parent.active_options = self
|
||||||
show()
|
show()
|
||||||
await get_tree().physics_frame
|
await get_tree().physics_frame
|
||||||
|
@@ -92,9 +92,9 @@ func cleanup() -> void:
|
|||||||
await get_tree().physics_frame
|
await get_tree().physics_frame
|
||||||
Global.world_num = starting_value
|
Global.world_num = starting_value
|
||||||
starting_value = -1
|
starting_value = -1
|
||||||
Global.world_num = clamp(Global.world_num, 1, 8)
|
Global.world_num = clamp(Global.world_num, 1, Level.get_world_count())
|
||||||
if owner is Level:
|
if owner is Level:
|
||||||
owner.world_id = clamp(owner.world_id, 1, 8)
|
owner.world_id = clamp(owner.world_id, 1, Level.get_world_count())
|
||||||
|
|
||||||
func close() -> void:
|
func close() -> void:
|
||||||
active = false
|
active = false
|
||||||
|
Reference in New Issue
Block a user