Expanded world/level icons (#763)

* Expanded Level Icons

Level icons are now defined in their own custom JSON file (LevelIcons.json) which determines which icons will be shown, along with an area where the user can input the size of their icons for custom sizing (larger sizes will likely be a bit odd in behavior, smaller should work fine though)

Along with that, icons have been greatly expanded, with 32 new level icons available for levels to use now, (a total of 45!) along with various older icons recieving slight touch-ups. Various levels now use these new icons to better represent major recognizable elements from those levels, and to give them a bit more variation between each other.

If there are any additional level icons that would make sense for implementation, let me know. I think this should cover most of the important ones, though.

* Delete LevelIcons.png.import

* Marathon + ANN Medal Icons on World Select

Marathon mode and ANN now show the highest ranking achieved on all levels when applicable. So if you manage to get a gold medal on every level, but get a bronze on one, then it'll display a bronze medal for your world completion.

Side note: Why the fuck was the only solution to the GPU particle emitting behavior to make a massive array of node paths. I hate this! This sucks! Joe, why did you do that? And why was it the only thing I could find that worked?

* Optimized particle emitting for world/level select

* ANN now has its own menu + bugfixes

This gives ANN its own dedicated menu rather than throwing you directly into the world selection menu, which additionally fixes an issue with rendering medal icons when selecting the campaign, and a few other fixes like the DiscoResults menu not using the ANN visual settings.

* Challenge Hunt Icons + menu bugfixes

Challenge Hunt icons are now implemented, so you can see all of your red coins, eggs and score requirements if you've met them. Along with that, fixed a bug where you could enter Worlds 9-D in marathon when you aren't supposed to by selecting a story mode option and then entering marathon.

* New icons + layout change for Challenge Hunt icons

By recommendation by Vanny, Challenge Hunt icons have been changed. Along with this, all icons for progress tracking are now in their own relegated image file for separate modification, and have been updated to use white outlines similar to the world icons themselves.

* Update ChallengeModeResults.tscn

Forgot to update this to use challenge icons for the world select screen.

* Eggs cycle through color again

Accidentally got rid of this, but didn't want to update every node. It simply does it based on the world number now rather than needing to be manually set.
This commit is contained in:
SkyanUltra 2025-12-02 08:30:32 -05:00 committed by GitHub
parent 2773d2e8e1
commit becdf9ba77
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 2890 additions and 586 deletions

View file

@ -507,3 +507,11 @@ func get_base_asset_version() -> int:
func get_version_num_int(ver_num := "0.0.0") -> int:
return int(ver_num.replace(".", ""))
func merge_dict(target: Dictionary, source: Dictionary) -> void:
# SkyanUltra: Used to properly merge dictionaries JSONs rather than out right overwriting entries.
for key in source.keys():
if target.has(key) and target[key] is Dictionary and source[key] is Dictionary:
merge_dict(target[key], source[key])
else:
target[key] = source[key]

View file

@ -54,6 +54,11 @@ var best_level_warpless_times := [
[-1, -1, -1, -1],
[-1, -1, -1, -1],
[-1, -1, -1, -1],
[-1, -1, -1, -1],
[-1, -1, -1, -1],
[-1, -1, -1, -1],
[-1, -1, -1, -1],
[-1, -1, -1, -1],
[-1, -1, -1, -1]
]
@ -95,7 +100,12 @@ const SMB1_LEVEL_GOLD_WARPLESS_TIMES := [
[22, 22, 17, 16], # World 5
[21, 25, 18, 16], # World 6
[20, 38, 25, 23], # World 7
[40, 24, 24, 50] # World 8
[40, 24, 24, 50], # World 8
[-1, -1, -1, -1], # World 9
[-1, -1, -1, -1], # World A
[-1, -1, -1, -1], # World B
[-1, -1, -1, -1], # World C
[-1, -1, -1, -1] # World D
]
const SMBLL_LEVEL_GOLD_WARPLESS_TIMES := [
@ -107,6 +117,11 @@ const SMBLL_LEVEL_GOLD_WARPLESS_TIMES := [
[28, 39, 23, 29],
[21, 26, 32, 36],
[24, 27, 25, 60],
[-1, -1, -1, -1],
[-1, -1, -1, -1],
[-1, -1, -1, -1],
[-1, -1, -1, -1],
[-1, -1, -1, -1]
]
const SMB1_LEVEL_GOLD_ANY_TIMES := {
@ -135,6 +150,11 @@ const SMBS_LEVEL_GOLD_TIMES := [
[24, 21, 23, 20],
[24, 40, 30, 27],
[30, 35, 30, 43],
[-1, -1, -1, -1],
[-1, -1, -1, -1],
[-1, -1, -1, -1],
[-1, -1, -1, -1],
[-1, -1, -1, -1]
]
const SMB1_WARP_LEVELS := ["1-2", "4-2"]
@ -262,7 +282,7 @@ func load_best_times(campaign = Global.current_campaign) -> void:
return
best_time_campaign = campaign
best_level_any_times.clear()
for world_num in 8:
for world_num in 13:
for level_num in 4:
var path = Global.config_path.path_join("marathon_recordings/" + campaign + "/" + str(world_num + 1) + "-" + str(level_num + 1) + ".json")
if FileAccess.file_exists(path):

View file

@ -71,14 +71,13 @@ func _process(_delta: float) -> void:
$BGM.play()
func campaign_selected() -> void:
$CanvasLayer/Options1.close()
if last_campaign != Global.current_campaign:
last_campaign = Global.current_campaign
update_title()
if Global.current_campaign == "SMBANN":
Global.current_game_mode = Global.GameMode.CAMPAIGN
$CanvasLayer/AllNightNippon/WorldSelect.open()
$CanvasLayer/Options2Stripped.open()
return
$CanvasLayer/Options1.close()
$CanvasLayer/Options2.open()
func open_story_options() -> void:

View file

@ -12,49 +12,136 @@ var starting_value := -1
@export var has_challenge_stuff := false
@export var has_disco_stuff := false
const LEVEL_ICON_JSON_PATH := "res://Assets/Sprites/UI/LevelIcons/LevelIcons.json"
const LEVEL_ICONS := {
"SMB1": SMB1_ICONS,
"SMBLL": SMBLL_ICONS,
"SMBS": SMBS_ICONS,
"SMBANN": SMB1_ICONS
"SMBANN": SMBANN_ICONS
}
const SMB1_ICONS := [
"0123",
"0453",
"0023",
"0163",
"8893",
"8893",
"8AB3",
"8883"
[
["day", [0,0]],["day", [0,4]],["day", [1,0]],["day", [1,4]],
],
[
["day", [0,2]],["day", [3,1]],["day", [1,2]],["day", [1,5]],
],
[
["day", [0,0]],["day", [0,1]],["day", [1,0]],["day", [1,4]],
],
[
["day", [0,1]],["day", [0,5]],["day", [1,3]],["day", [1,6]],
],
[
["night", [0,1]],["night", [0,3]],["night", [1,0]],["night", [1,5]],
],
[
["night", [0,0]],["night", [0,2]],["night", [1,1]],["night", [1,4]],
],
[
["night", [0,3]],["night", [0,4]],["night", [1,2]],["night", [1,5]],
],
[
["night", [0,1]],["night", [0,3]],["night", [2,0]],["night", [1,6]],
],
]
const SMBLL_ICONS := [
"0123",
"0053",
"0423",
"0023",
"8193",
"8AB3",
"8993",
"88D3",
"8888",
"0123",
"0423",
"0523",
"0003"
[
["day", [0,2]],["day", [0,7]],["day", [1,0]],["day", [1,4]],
],
[
["day", [1,2]],["day", [0,1]],["day", [1,2]],["day", [1,7]],
],
[
["day", [0,3]],["day", [3,0]],["day", [1,1]],["day", [1,6]],
],
[
["day", [0,1]],["day", [0,3]],["day", [1,1]],["day", [1,5]],
],
[
["night", [0,2]],["night", [0,6]],["night", [1,0]],["night", [1,5]],
],
[
["night", [0,0]],["night", [3,1]],["night", [1,2]],["night", [1,7]],
],
[
["night", [0,2]],["night", [1,2]],["night", [1,1]],["night", [1,5]],
],
[
["night", [0,2]],["night", [2,0]],["night", [2,2]],["night", [1,7]],
],
[
["night", [0,0]],["night", [3,6]],["night", [3,7]],["night", [4,4]],
],
[
["day", [0,2]],["day", [0,5]],["day", [1,0]],["day", [1,4]],
],
[
["day", [0,0]],["day", [3,1]],["day", [1,1]],["day", [1,6]],
],
[
["day", [0,2]],["day", [1,0]],["day", [1,1]],["day", [1,5]],
],
[
["day", [2,6]],["day", [2,6]],["day", [2,7]],["day", [1,7]],
],
]
const SMBS_ICONS := [
"0123",
"0453",
"0023",
"0163",
"8893",
"8893",
"8AB3",
"CA13"
[
["day", [0,1]],["day", [0,4]],["day", [1,0]],["day", [1,6]],
],
[
["day", [0,0]],["day", [3,1]],["day", [1,2]],["day", [1,7]],
],
[
["day", [3,0]],["day", [1,2]],["day", [1,0]],["day", [1,4]],
],
[
["day", [0,1]],["day", [0,5]],["day", [1,3]],["day", [1,6]],
],
[
["night", [0,1]],["night", [0,0]],["night", [1,0]],["night", [1,5]],
],
[
["night", [0,1]],["night", [0,2]],["night", [1,0]],["night", [1,4]],
],
[
["night", [0,3]],["night", [3,1]],["night", [1,2]],["night", [1,7]],
],
[
["night", [1,3]],["night", [2,1]],["night", [0,7]],["night", [1,5]],
],
]
const SMBANN_ICONS := [
[
["night", [0,0]],["night", [0,4]],["night", [1,0]],["night", [1,4]],
],
[
["night", [0,2]],["night", [3,1]],["night", [1,2]],["night", [1,5]],
],
[
["night", [0,0]],["night", [0,1]],["night", [1,0]],["night", [1,4]],
],
[
["night", [0,1]],["night", [0,5]],["night", [1,3]],["night", [1,6]],
],
[
["night", [0,1]],["night", [0,3]],["night", [1,1]],["night", [1,7]],
],
[
["night", [0,0]],["night", [0,2]],["night", [1,1]],["night", [1,5]],
],
[
["night", [0,3]],["night", [3,1]],["night", [1,2]],["night", [1,5]],
],
[
["night", [0,1]],["night", [0,3]],["night", [2,0]],["night", [1,7]],
],
]
const NUMBER_Y := [
@ -69,7 +156,7 @@ const NUMBER_Y := [
func _ready() -> void:
for i in %SlotContainer.get_children():
i.focus_entered.connect(slot_selected.bind(i.get_index()))
for i in [$Panel/MarginContainer/VBoxContainer/HBoxContainer/ScrollContainer/SlotContainer/Slot1/Icon/RankMedal/SRankParticles, $Panel/MarginContainer/VBoxContainer/HBoxContainer/ScrollContainer/SlotContainer/Slot1/Icon/RankMedal/PRankParticles, $Panel/MarginContainer/VBoxContainer/HBoxContainer/ScrollContainer/SlotContainer/Slot2/Icon/RankMedal/SRankParticles, $Panel/MarginContainer/VBoxContainer/HBoxContainer/ScrollContainer/SlotContainer/Slot2/Icon/RankMedal/PRankParticles, $Panel/MarginContainer/VBoxContainer/HBoxContainer/ScrollContainer/SlotContainer/Slot3/Icon/RankMedal/SRankParticles, $Panel/MarginContainer/VBoxContainer/HBoxContainer/ScrollContainer/SlotContainer/Slot3/Icon/RankMedal/PRankParticles, $Panel/MarginContainer/VBoxContainer/HBoxContainer/ScrollContainer/SlotContainer/Slot4/Icon/RankMedal/SRankParticles, $Panel/MarginContainer/VBoxContainer/HBoxContainer/ScrollContainer/SlotContainer/Slot4/Icon/RankMedal/PRankParticles]:
for i in get_tree().get_nodes_in_group("Particles"):
start_particle(i)
func start_particle(particle: GPUParticles2D) -> void:
@ -86,6 +173,7 @@ func open() -> void:
starting_value = Global.level_num
print([Global.level_num, starting_value])
selected_level = Global.level_num - 1
setup_level_icon_data()
setup_visuals()
update_pb()
show()
@ -93,10 +181,22 @@ func open() -> void:
await get_tree().create_timer(0.1).timeout
active = true
const CHARSET := "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
var visited_levels := "0000"
const ICON_DAY := preload("res://Assets/Sprites/UI/LevelIcons/DayLevelIcons.png")
const ICON_NIGHT := preload("res://Assets/Sprites/UI/LevelIcons/NightLevelIcons.png")
const ICON_LOCKED := preload("res://Assets/Sprites/UI/LevelIcons/LockedLevelIcon.png")
var icon_size := [56, 32]
func setup_level_icon_data() -> void:
var json = JSON.parse_string(FileAccess.open(LEVEL_ICON_JSON_PATH, FileAccess.READ).get_as_text())
icon_size = json.icon_size
for key in json.icon_data:
if get(key) is Dictionary and json.icon_data[key] is Dictionary:
Global.merge_dict(get(key), json.icon_data[key])
else:
set(key, json.icon_data[key])
func setup_visuals() -> void:
%MarathonBits.visible = Global.current_game_mode == Global.GameMode.MARATHON_PRACTICE
%ChallengeBits.visible = Global.current_game_mode == Global.GameMode.CHALLENGE
@ -107,16 +207,18 @@ func setup_visuals() -> void:
var level_theme = Global.LEVEL_THEMES[Global.current_campaign][Global.world_num - 1]
visited_levels = (SaveManager.visited_levels.substr((Global.world_num - 1) * 4, 4))
var level_visited = SaveManager.visited_levels[SaveManager.get_level_idx(Global.world_num, idx + 1)] != "0" or Global.debug_mode
var num = CHARSET.find(LEVEL_ICONS[Global.current_campaign][Global.world_num - 1][idx])
if level_visited == false:
num = 7
i.get_node("ChallengeModeBits").visible = Global.current_game_mode == Global.GameMode.CHALLENGE
if Global.current_game_mode == Global.GameMode.CHALLENGE:
setup_challenge_mode_bits(i.get_node("ChallengeModeBits"), idx + 1)
i.get_node("Icon").region_rect = Rect2((num % 4) * 56, (num / 4) * 32, 56, 32)
var cur_level = LEVEL_ICONS[Global.current_campaign][Global.world_num - 1][idx]
var cur_icon = ICON_LOCKED if not level_visited else ICON_NIGHT if cur_level[0] == "night" else ICON_DAY
var grid_size = [cur_icon.get_width() - icon_size[0], cur_icon.get_height() - icon_size[1]]
var clamp_icon = clamp([cur_level[1][0] * icon_size[0], cur_level[1][1] * icon_size[1]], [0, 0], grid_size)
i.get_node("Icon").texture = cur_icon
i.get_node("Icon").region_rect = Rect2(clamp_icon[0], clamp_icon[1], icon_size[0], icon_size[1])
i.get_node("Icon/Number").region_rect.position.y = clamp(NUMBER_Y.find(level_theme) * 12, 0, 9999)
i.get_node("Icon/Number").region_rect.position.x = (idx) * 12
i.get_node("Icon/RankMedal").visible = Global.current_campaign == "SMBANN"
i.get_node("ChallengeModeBits").visible = Global.current_game_mode == Global.GameMode.CHALLENGE
if Global.current_game_mode == Global.GameMode.CHALLENGE:
setup_challenge_mode_bits(i.get_node("ChallengeModeBits"), idx + 1)
if Global.current_campaign == "SMBANN":
i.get_node("Icon/RankMedal").frame = "ZFDCBASP".find(DiscoLevel.level_ranks[SaveManager.get_level_idx(Global.world_num, idx + 1)])
i.get_node("Icon/RankMedal/SRankParticles").visible = i.get_node("Icon/RankMedal").frame == 6
@ -138,7 +240,6 @@ func update_score() -> void:
func update_pb() -> void:
if has_speedrun_stuff == false: return
var best_warpless_time = SpeedrunHandler.best_level_warpless_times[Global.world_num - 1][selected_level]
print(SpeedrunHandler.best_level_warpless_times)
var best_any_time = SpeedrunHandler.best_level_any_times.get(str(Global.world_num) + "-" + str(selected_level + 1), -1)
%FullRunPB.text = "--:--:--" if best_warpless_time == -1 else SpeedrunHandler.gen_time_string(SpeedrunHandler.format_time(best_warpless_time))
%WarpRunPB.text = "--:--:--" if best_any_time == -1 else SpeedrunHandler.gen_time_string(SpeedrunHandler.format_time(best_any_time))

View file

@ -2,6 +2,10 @@ extends Control
var selected_world := 0
@export var has_speedrun_stuff := false
@export var has_challenge_stuff := false
@export var has_disco_stuff := false
@export var world_offset := 0
@export var num_of_worlds := 7
@ -26,6 +30,12 @@ const NUMBER_Y := [
func _ready() -> void:
for i in %SlotContainer.get_children():
i.focus_entered.connect(slot_focused.bind(i.get_index()))
for i in get_tree().get_nodes_in_group("Particles"):
start_particle(i)
func start_particle(particle: GPUParticles2D) -> void:
await get_tree().create_timer(randf_range(0, 5)).timeout
particle.emitting = true
func _process(_delta: float) -> void:
if active:
@ -36,6 +46,7 @@ func open() -> void:
if starting_value == -1:
starting_value = Global.world_num
selected_world = Global.world_num - 1 - world_offset
if has_speedrun_stuff and not Global.current_game_mode in [Global.GameMode.MARATHON, Global.GameMode.MARATHON_PRACTICE]: Global.current_game_mode = Global.GameMode.MARATHON
setup_visuals()
show()
await get_tree().process_frame
@ -64,10 +75,74 @@ func setup_visuals() -> void:
var resource_getter = ResourceGetter.new() #Is it safe to be making a new one of these per icon?
i.get_node("Icon").region_rect = CustomLevelContainer.THEME_RECTS[level_theme]
i.get_node("Icon").texture = resource_getter.get_resource(CustomLevelContainer.ICON_TEXTURES[0 if (idx <= 3 or idx >= 8) and Global.current_campaign != "SMBANN" else 1])
i.get_node("Icon/Number").position.y = 10 if has_challenge_stuff else 17
i.get_node("Icon/Number").region_rect.position.y = clamp(NUMBER_Y.find(level_theme) * 12, 0, 9999)
i.get_node("Icon/Number").region_rect.position.x = (idx + world_offset) * 12
setup_challenge_mode_bits(i.get_node("Icon/RedCoins"), i.get_node("Icon/Egg"), i.get_node("Icon/Score"), i.get_node("Icon/RedCoins/Full"), i.get_node("Icon/Egg/Full"), i.get_node("Icon/Score/Full"), idx + world_offset)
setup_marathon_bits(i.get_node("Icon/Medal"), i.get_node("Icon/Medal/Full"), idx + world_offset)
setup_disco_bits(i.get_node("Icon/Medal"), i.get_node("Icon/Medal/Full"), i.get_node("Icon/Medal/Full/SRankParticles"), i.get_node("Icon/Medal/Full/PRankParticles"), idx + world_offset)
idx += 1
func setup_challenge_mode_bits(red_coins_outline: TextureRect, egg_outline: TextureRect, score_outline: TextureRect, red_coins: NinePatchRect, egg: NinePatchRect, score: NinePatchRect, world_num := 1) -> void:
if has_challenge_stuff == false: return
var red_coins_collected = []
var eggs_collected = []
var scores_collected = []
for level in 4:
for i in 5:
red_coins_collected.append(ChallengeModeHandler.is_coin_collected(i, ChallengeModeHandler.red_coins_collected[world_num][level]))
eggs_collected.append(ChallengeModeHandler.is_coin_collected(ChallengeModeHandler.CoinValues.YOSHI_EGG, ChallengeModeHandler.red_coins_collected[world_num][level]))
scores_collected.append(ChallengeModeHandler.top_challenge_scores[world_num][level] >= ChallengeModeHandler.CHALLENGE_TARGETS[Global.current_campaign][world_num][level])
for i in [red_coins_outline, egg_outline, score_outline]:
i.visible = true
red_coins.visible = not red_coins_collected.has(false)
egg.visible = not eggs_collected.has(false)
var egg_frame = 10 * (world_num % 4)
egg.region_rect = Rect2(egg_frame, 0, 10, 10)
score.visible = not scores_collected.has(false)
func setup_marathon_bits(medal_outline: TextureRect, medal: NinePatchRect, world_num := 1) -> void:
if has_speedrun_stuff == false: return
var saved_medal_ids = []
for i in 4:
var best_warpless_time = SpeedrunHandler.best_level_warpless_times[world_num][i]
var best_any_time = SpeedrunHandler.best_level_any_times.get(str(world_num + 1) + "-" + str(i + 1), -1)
var gold_warpless_time = SpeedrunHandler.LEVEL_GOLD_WARPLESS_TIMES[Global.current_campaign][world_num][i]
var gold_any_time := -1.0
if SpeedrunHandler.LEVEL_GOLD_ANY_TIMES[Global.current_campaign].has(str(world_num + 1) + "-" + str(i + 1)):
gold_any_time = SpeedrunHandler.LEVEL_GOLD_ANY_TIMES[Global.current_campaign][str(world_num + 1) + "-" + str(i + 1)]
var medal_id = -1
for o in SpeedrunHandler.MEDAL_CONVERSIONS:
var target_time = gold_warpless_time * SpeedrunHandler.MEDAL_CONVERSIONS[o]
medal_id += 1 if SpeedrunHandler.met_target_time(best_warpless_time, target_time) else 0
saved_medal_ids.append(medal_id)
if gold_any_time != -1:
medal_id = -1
for o in SpeedrunHandler.MEDAL_CONVERSIONS:
var target_time = gold_any_time * SpeedrunHandler.MEDAL_CONVERSIONS[o]
medal_id += 1 if SpeedrunHandler.met_target_time(best_any_time, target_time) else 0
saved_medal_ids.append(medal_id)
medal_outline.visible = true
medal.visible = saved_medal_ids.min() >= 0
var medal_rect_x = saved_medal_ids.min() * 10
medal.region_rect = Rect2(10 + medal_rect_x, 10, 10, 10)
func setup_disco_bits(medal_outline: TextureRect, medal: NinePatchRect, s_rank_pfx: GPUParticles2D, p_rank_pfx: GPUParticles2D, world_num := 1) -> void:
if has_disco_stuff == false: return
var saved_rank_ids = []
var lowest_rank = -1
for i in 4:
saved_rank_ids.append(DiscoLevel.level_ranks[SaveManager.get_level_idx(world_num + 1, i + 1)])
for rank in DiscoLevel.RANK_IDs.size():
if DiscoLevel.RANK_IDs[rank] == saved_rank_ids[i] and (lowest_rank > rank + 1 or lowest_rank < 0):
lowest_rank = rank + 1
medal_outline.visible = true
medal.visible = lowest_rank != -1
var medal_rect_x = lowest_rank * 10
medal.region_rect = Rect2(medal_rect_x, 20, 10, 10)
s_rank_pfx.visible = lowest_rank == 6
p_rank_pfx.visible = lowest_rank == 7
func handle_input() -> void:
if Input.is_action_just_pressed("ui_accept"):
if SaveManager.visited_levels.substr((selected_world + world_offset) * 4, 4) == "0000" and not Global.debug_mode and selected_world != 0: