Room variation types (#517)

* Global.gd now has an extra variable for current room type

* ResourceSetterNew.gd now has variation category for room types

The state variable also had to include the room type, since it wouldn't update properly when entering a bonus room from a level that's already underground

* LevelClass.gd sets room type on update_theme

A new function, get_room_type() allows for the level's room type to be detected, which can easily be overwritten by other level classes. Bonus Rooms are detected by comparing the level's scene path to a pre-defined list of bonus rooms.

* Added get_room_type() to CoinHeaven.gd

* Added get_room_type() to PipeCutscene.gd

Also updates the room type in _enter_tree() since update_theme() isn't called here.

* Added get_room_type() to TitleScreen.gd
This commit is contained in:
Tsank35
2025-10-06 14:05:43 -07:00
committed by GitHub
parent 6a48a5b32f
commit 27ae3d5612
6 changed files with 41 additions and 3 deletions

View File

@@ -51,6 +51,13 @@ const SMBS_THEMES := {
8: "Overworld"
}
const BONUS_ROOMS := {
"SMB1": ["1-1a", "1-2a", "2-1a", "3-1a", "4-1a", "4-2a", "5-1a", "6-2a", "6-2c", "7-1a", "8-1a", "8-2a"],
"SMBLL": ["1-1a", "2-1a", "2-2a", "3-1b", "4-2a", "5-1a", "5-3a", "7-1c", "7-2a", "10-1a", "12-1a", "13-1a", "13-2a", "13-4b"],
"SMBS": ["1-1a", "1-2a", "6-2a", "6-2b", "6-2c", "6-2d", "6-3a", "7-1a", "7-3a"],
"SMBANN": ["1-1a", "1-2a", "2-1a", "3-1a", "4-1a", "4-2a", "5-1a", "6-2a", "6-2c", "7-1a", "8-1a", "8-2a"]
}
@export var auto_set_theme := false
@export var time_limit := 400
@@ -119,6 +126,7 @@ func update_theme() -> void:
if Global.current_campaign == "SMBANN":
theme_time = "Night"
ResourceSetterNew.cache.clear()
Global.current_room = get_room_type()
Global.current_campaign = campaign
Global.level_theme = theme
Global.theme_time = theme_time
@@ -165,3 +173,8 @@ func reload_level() -> void:
Global.transition_to_scene(LevelTransition.level_to_transition_to)
else:
Global.transition_to_scene("res://Scenes/Levels/LevelTransition.tscn")
func get_room_type() -> Global.Room:
if BONUS_ROOMS[campaign].has(scene_file_path.get_file().get_basename()):
return Global.Room.BONUS_ROOM
return Global.Room.MAIN_ROOM