Merge remote-tracking branch 'upstream/main' into pulls/small-crouch-hitbox-fix

This commit is contained in:
KirbyKidJ
2025-10-09 08:23:38 -07:00
130 changed files with 13963 additions and 12828 deletions

View File

@@ -1,4 +1,4 @@
@icon("res://Assets/Sprites/Editor/Block.png")
@icon("res://Assets/Sprites/Editor/Block.svg")
class_name Block
extends AnimatableBody2D
signal player_block_hit(player: Player)

View File

@@ -11,11 +11,9 @@ signal sprites_updated
static var cache := {}
func _enter_tree() -> void:
func _ready() -> void:
Global.level_theme_changed.connect(update_sprites)
Global.level_time_changed.connect(update_sprites)
func _ready() -> void:
update_sprites()
func update_sprites() -> void:

View File

@@ -18,7 +18,7 @@ static var property_cache := {}
var current_json_path := ""
static var state := [0, 0]
static var state := [0, 0, 0]
static var pack_configs := {}
@@ -36,31 +36,33 @@ var update_on_spawn := true
func _init() -> void:
set_process_mode(Node.PROCESS_MODE_ALWAYS)
func _ready() -> void:
Global.level_time_changed.connect(update_resource)
Global.level_theme_changed.connect(update_resource)
func _enter_tree() -> void:
safety_check()
if update_on_spawn:
update_resource()
Global.level_time_changed.connect(update_resource)
Global.level_theme_changed.connect(update_resource)
func safety_check() -> void:
if Settings.file.visuals.resource_packs.has("BaseAssets") == false:
Settings.file.visuals.resource_packs.append("BaseAssets")
if Settings.file.visuals.resource_packs.has(Global.ROM_PACK_NAME) == false:
Settings.file.visuals.resource_packs.insert(Global.ROM_PACK_NAME, 0)
func update_resource() -> void:
randomize()
if is_inside_tree() == false or is_queued_for_deletion() or resource_json == null or node_to_affect == null:
return
if state != [Global.level_theme, Global.theme_time]:
if state != [Global.level_theme, Global.theme_time, Global.current_room]:
cache.clear()
property_cache.clear()
if node_to_affect != null:
print(resource_json.data)
var resource = get_resource(resource_json)
node_to_affect.set(property_name, resource)
if node_to_affect is AnimatedSprite2D:
node_to_affect.play()
state = [Global.level_theme, Global.theme_time]
state = [Global.level_theme, Global.theme_time, Global.current_room]
updated.emit()
func get_resource(json_file: JSON) -> Resource:
@@ -244,6 +246,15 @@ func get_variation_json(json := {}) -> Dictionary:
else:
json = get_variation_json(json[level_string])
var room = Global.room_strings[Global.current_room]
if json.has(room) == false:
room = Global.room_strings[0]
if json.has(room):
if json.get(room).has("link"):
json = get_variation_json(json[json.get(room).get("link")])
else:
json = get_variation_json(json[room])
var game_mode = "GameMode:" + Global.game_mode_strings[Global.current_game_mode]
if json.has(game_mode) == false:
game_mode = "GameMode:" + Global.game_mode_strings[0]
@@ -336,4 +347,6 @@ func load_audio_from_path(path := "") -> AudioStream:
stream = AudioStreamWAV.load_from_file(path)
elif path.contains(".mp3"):
stream = AudioStreamMP3.load_from_file(path)
elif path.contains(".ogg"):
stream = AudioStreamOggVorbis.load_from_file(path)
return stream

View File

@@ -16,6 +16,7 @@ func _ready() -> void:
texture_changed.connect(update)
func update() -> void:
print(name)
var source = tile_map.tile_set.get_source(atlas_id)
if source != null:
source.texture = texture

View File

@@ -7,7 +7,6 @@ func open_menu() -> void:
editing_start.emit()
$CanvasLayer.show()
func on_pressed() -> void:
set_value(Global.sanitize_string($CanvasLayer/Panel/VBoxContainer/TextEdit.text))
editing_finished.emit()

View File

@@ -21,7 +21,11 @@ func rise_tween() -> void:
var dir = sign(target_player.global_position.x - global_position.x)
var target_position := Vector2(32 * dir, -32)
var final_position = global_position + target_position
final_position.y = clamp(final_position.y, -176, 64)
var top_point = -176
if Global.current_level != null:
top_point = Global.current_level.vertical_height + 32
final_position.y = clamp(final_position.y, top_point, 64)
tween.tween_property(self, "global_position", final_position, 0.75)
await tween.finished
falling = true

View File

@@ -82,7 +82,7 @@ func throw_spiny() -> void:
node.velocity = Vector2(0, -150)
if fixed_throw:
node.velocity.x = 50 * (sign(player.global_position.x - global_position.x))
node.set("direction", sign(node.velocity.x))
node.set("direction", sign(node.velocity.x))
add_sibling(node)
if Settings.file.audio.extra_sfx == 1:
AudioManager.play_sfx("lakitu_throw", global_position)

View File

@@ -1,4 +1,4 @@
@icon("res://Assets/Sprites/Editor/Enemy.png")
@icon("res://Assets/Sprites/Editor/Enemy.svg")
class_name Enemy
extends CharacterBody2D

View File

@@ -57,6 +57,7 @@ func run_door_check() -> void:
if same_scene_exiting_door != null:
if same_scene_exiting_door != self and exiting_door_id == door_id:
door_found = true
get_tree().call_group("CameraLimits", "return_camera_to_normal")
for i in get_tree().get_nodes_in_group("Players"):
player_exit(i)
return

View File

@@ -1,5 +1,5 @@
@tool
@icon("res://Assets/Sprites/Editor/Pipe.png")
@icon("res://Assets/Sprites/Editor/Pipe.svg")
class_name PipeArea
extends Node2D

View File

@@ -605,7 +605,7 @@ func death_load() -> void:
Global.death_load = true
# Handle lives decrement for CAMPAIGN and MARATHON
if [Global.GameMode.CAMPAIGN, Global.GameMode.MARATHON, Global.GameMode.LEVEL_EDITOR, Global.GameMode.CUSTOM_LEVEL].has(Global.current_game_mode):
if [Global.GameMode.CAMPAIGN, Global.GameMode.MARATHON].has(Global.current_game_mode):
if Settings.file.difficulty.inf_lives == 0:
Global.lives -= 1
@@ -617,6 +617,7 @@ func death_load() -> void:
Global.GameMode.LEVEL_EDITOR: func():
owner.stop_testing(),
Global.GameMode.CHALLENGE: func():
Global.transition_to_scene("res://Scenes/Levels/ChallengeMiss.tscn"),
@@ -643,10 +644,10 @@ func death_load() -> void:
# Determine which action to take
if death_actions.has(Global.current_game_mode):
death_actions[Global.current_game_mode].call()
elif Global.time <= 0:
death_actions["time_up"].call()
elif Global.lives <= 0 and Settings.file.difficulty.inf_lives == 0:
death_actions["game_over"].call()
elif Global.time <= 0:
death_actions["time_up"].call()
else:
death_actions["default_reload"].call()
@@ -682,11 +683,13 @@ func get_power_up(power_name := "") -> void:
await power_up_animation(power_name)
else:
return
check_for_block()
power_state = new_power_state
Global.player_power_states[player_id] = str(power_state.get_index())
handle_power_up_states(0)
can_hurt = true
refresh_hitbox()
await get_tree().physics_frame
check_for_block()
func check_for_block() -> void:
if test_move(global_transform, (Vector2.UP * gravity_vector) * 4):

View File

@@ -1,4 +1,4 @@
@icon("res://Assets/Sprites/Editor/Level.png")
@icon("res://Assets/Sprites/Editor/Level.svg")
class_name Level
extends Node
@@ -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,11 +126,16 @@ func update_theme() -> void:
if Global.current_campaign == "SMBANN":
theme_time = "Night"
ResourceSetterNew.cache.clear()
if self is CoinHeaven:
Global.current_room = Global.Room.COIN_HEAVEN
else:
Global.current_room = get_room_type()
Global.current_campaign = campaign
Global.level_theme = theme
Global.theme_time = theme_time
TitleScreen.last_theme = theme
$LevelBG.update_visuals()
if get_node_or_null("LevelBG") != null:
$LevelBG.update_visuals()
func update_next_level_info() -> void:
next_level = wrap(level_id + 1, 1, 5)
@@ -164,3 +176,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

View File

@@ -5,6 +5,7 @@ const DEFAULT_SFX_LIBRARY := {
"big_jump": ("res://Assets/Audio/SFX/BigJump.wav"),
"coin": ("res://Assets/Audio/SFX/Coin.wav"),
"bump": ("res://Assets/Audio/SFX/Bump.wav"),
"skid": ("res://Assets/Audio/SFX/Skid.wav"),
"pipe": ("res://Assets/Audio/SFX/Pipe.wav"),
"damage": ("res://Assets/Audio/SFX/Damage.wav"),
"power_up": ("res://Assets/Audio/SFX/Powerup.wav"),

View File

@@ -89,6 +89,12 @@ var world_num := 1
var level_num := 1
var disco_mode := false
enum Room{MAIN_ROOM, BONUS_ROOM, COIN_HEAVEN, PIPE_CUTSCENE, TITLE_SCREEN}
const room_strings := ["MainRoom", "BonusRoom", "CoinHeaven", "PipeCutscene", "TitleScreen"]
var current_room: Room = Room.MAIN_ROOM
signal transition_finished
var transitioning_scene := false
var awaiting_transition := false
@@ -327,6 +333,8 @@ func reset_values() -> void:
Level.in_vine_level = false
Level.vine_return_level = ""
Level.vine_warp_level = ""
p_switch_active = false
p_switch_timer = 0.0
func clear_saved_values() -> void:
coins = 0

View File

@@ -81,8 +81,6 @@ func write_save(campaign: String = Global.current_campaign, force := false) -> v
save_json = SAVE_TEMPLATE.duplicate(true)
match Global.current_game_mode:
Global.GameMode.CAMPAIGN:
if Global.world_num < 0:
Global.world_num = 1
if Global.high_score < Global.score:
Global.high_score = Global.score
save_json["World"] = Global.world_num
@@ -117,7 +115,10 @@ func write_save_to_file(json := {}, path := "") -> void:
file.close()
func apply_save(json := {}) -> void:
Global.world_num = json.get_or_add("World", 1)
if Global.world_num < 1:
Global.world_num = 1
Global.level_num = json.get_or_add("Level", 1)
Global.lives = json["Lives"]
Global.coins = json["Coins"]

View File

@@ -12,9 +12,9 @@ var file := {
"frame_limit" : 0,
},
"audio": {
"master": 10.0,
"music": 10.0,
"sfx": 10.0,
"master": 10,
"music": 10,
"sfx": 10,
"athletic_bgm": 1,
"extra_bgm": 1,
"skid_sfx": 1,
@@ -24,8 +24,7 @@ var file := {
},
"game": {
"campaign": "SMB1",
"lang": "en",
"character": "0000"
"lang": "en"
},
"keyboard":
{

View File

@@ -25,5 +25,5 @@ func physics_update(delta: float) -> void:
player.velocity.y += (player.JUMP_GRAVITY / delta) * delta
player.velocity.y = clamp(player.velocity.y, -INF, player.MAX_FALL_SPEED)
player.move_and_slide()
if Input.is_action_just_pressed("jump_0"):
if Input.is_action_just_pressed("ui_accept") or Input.is_action_just_pressed("jump_0"):
player.death_load()

View File

@@ -268,8 +268,9 @@ func get_animation_name() -> String:
return "StarFall"
return "JumpFall"
else:
player.sprite.speed_scale = 0
player.sprite.frame = walk_frame
# guzlad: Fixes characters with fall anims not playing them, but also prevents old characters without that anim not being accurate
if !player.sprite.sprite_frames.has_animation("Fall"):
player.sprite.frame = walk_frame
return "Fall"
func exit() -> void:

View File

@@ -47,6 +47,8 @@ func handle_main_hud() -> void:
world_num = ["A", "B", "C", "D"][int(world_num) % 10]
elif int(world_num) < 1:
world_num = " "
else:
print(Global.world_num)
%LevelNum.text = world_num + "-" + str(Global.level_num)
%Crown.visible = Global.second_quest
%Time.text = " " + str(Global.time).pad_zeros(3)