Checked all FIXMEs and TODOs (#353)

Co-authored-by: Dennis Ploeger <develop@dieploegers.de>
Co-authored-by: dploeger <dploeger@users.noreply.github.com>
This commit is contained in:
Dennis Ploeger
2021-08-02 21:23:57 +02:00
committed by GitHub
parent 90f880d090
commit 56bf96da8c
26 changed files with 66 additions and 198 deletions

View File

@@ -31,16 +31,16 @@ var walk_context: ESCWalkContext = null
# Wether the character was moved at all
var moved: bool
# Angle degrees to the last position (TODO is that correct?)
# Angle degrees from the last position to the next
var last_deg: int
# Direction of the last position (TODO is that correct?)
# Player Direction used to reflect the movement to the new position
var last_dir: int
# Scale of the last position (TODO is that correct?)
# The last scaling applied to the parent
var last_scale: Vector2
# TODO Isn't this actually the flip state of the current animation?
# Wether the current direction animation is flipped
var pose_scale: int
@@ -50,9 +50,6 @@ var _orig_speed: float = 0.0
# Shortcut variable that references the node's parent
onready var parent = get_parent()
# If character misses an animation, bypass it and proceed.
onready var bypass_missing_animation = false
# Currenly running task
onready var task = MovableTask.NONE
@@ -89,7 +86,6 @@ func _process(delta: float) -> void:
dist *= parent.terrain.player_doubleclick_speed_multiplier
var dir = (next - pos).normalized()
# TODO comment what this is all about
dir = dir * (dir.x * dir.x + dir.y * dir.y * parent.v_speed_damp)
var new_pos
@@ -115,33 +111,26 @@ func _process(delta: float) -> void:
var current_animation = ""
if parent.animation_sprite != null:
current_animation = parent.animation_sprite.animation
# elif animation != null:
# current_animation = animation.current_animation
# FIXME This is obviously wrong as bypass_missing_animation is
# always false
bypass_missing_animation = false
if !bypass_missing_animation:
var animation_to_play = \
parent.animations.directions[last_dir][0]
if current_animation != animation_to_play:
if parent.animation_sprite.frames.has_animation(
animation_to_play
):
parent.animation_sprite.play(animation_to_play)
else:
bypass_missing_animation = true
current_animation = animation_to_play
escoria.logger.report_warnings(
"movable.gd:_process()",
[
"Character %s has no animation %s "
% [parent.global_id, animation_to_play],
"Bypassing missing animation and " +
"proceed movement."
],
true
)
var animation_to_play = \
parent.animations.directions[last_dir][0]
if current_animation != animation_to_play:
if parent.animation_sprite.frames.has_animation(
animation_to_play
):
parent.animation_sprite.play(animation_to_play)
else:
current_animation = animation_to_play
escoria.logger.report_warnings(
"movable.gd:_process()",
[
"Character %s has no animation %s "
% [parent.global_id, animation_to_play],
"Bypassing missing animation and " +
"proceed movement."
],
true
)
pose_scale = parent.animations.directions[last_dir][1]
@@ -152,53 +141,43 @@ func _process(delta: float) -> void:
# Teleports this item to the target position.
# TODO angle is only used for logging and has no further use, so it probably
# can be removed
#
# #### Parameters
#
# - target: Position2d or ESCItem to teleport to
func teleport(target: Node, angle: Object = null) -> void:
if target is Position2D:
func teleport(target: Node) -> void:
if target.has_method("get_interact_position"):
parent.position = target.get_interact_position()
escoria.logger.info(
"Object %s teleported at position %s with angle" %
[parent.global_id, str(target.position)],
[angle]
"Object %s is teleported at position %s" % [
target.name,
parent.position
]
)
elif "position" in target:
escoria.logger.info(
"Object %s teleported at position %s" %
[parent.global_id, str(target.position)]
)
parent.position = target.position
elif typeof(target) == TYPE_OBJECT:
# FIXME this is better written as target is ESCItem if that's
# the only case here
# if target.get("interact_positions") != null:
# parent.position = target.interact_positions.default
# else:
# parent.position = target.position
parent.position = target.get_interact_position()
escoria.logger.info("Object " + target.name + " teleported at position "
+ str(parent.position) + " with angle ", str(angle))
else:
escoria.logger.report_errors("escitem.gd:teleport()",
["Target to teleport to is null or unusable (" + str(target) + ")"])
escoria.logger.report_errors(
"ESCMovable#teleport()",
["Couldn't understand how to manage teleport Target %s" % target]
)
# Teleports this item to the target position.
# TODO angle is only used for logging and has no further use, so it probably
# can be removed
#
# #### Parameters
#
# - target: Vector2 target position to teleport to
func teleport_to(target: Vector2, angle: Object = null) -> void:
if typeof(target) == TYPE_VECTOR2 :
escoria.logger.info(
"Object %s teleported at position %s with angle" %
[parent.global_id, str(target)],
[angle]
)
parent.position = target
else:
escoria.logger.report_errors("escitem.gd:teleport_to()",
["Target to teleport to is null or unusable (" + str(target) + ")"])
func teleport_to(target: Vector2) -> void:
escoria.logger.info(
"Object %s teleported to position %s" %
[parent.global_id, str(target)]
)
parent.position = target
# Walk to a given position
@@ -236,14 +215,6 @@ func walk_to(pos: Vector2, p_walk_context: ESCWalkContext = null) -> void:
set_process(true)
# FIXME this function doesn't seem to be used anywhere
func walk(target_pos, p_speed, context = null) -> void:
if p_speed:
_orig_speed = parent.speed
parent.speed = p_speed
walk_to(target_pos, context)
# We have finished walking. Set the idle pose and complete
#
# #### Parameters
@@ -331,7 +302,6 @@ func update_terrain(on_event_finished_name = null) -> void:
# Do not flip the entire character, because that would conflict
# with shadows that expect to be siblings of $texture
# TODO Make the character sprite not rely on the node name
if pose_scale == -1 and parent.get_node("sprite").scale.x > 0:
parent.get_node("sprite").scale.x *= pose_scale
parent.collision.scale.x *= pose_scale
@@ -340,18 +310,6 @@ func update_terrain(on_event_finished_name = null) -> void:
parent.collision.scale.x *= -1
# Get the player direction index based on rotation angles
#
# FIXME: This function doesn't seem to be used anymore
# #### Parameters
#
# - angle: The rotation angle
# - animations: The list of character animations
func _get_dir(angle: float, animations) -> int:
var deg = escoria.utils.get_deg_from_rad(angle)
return _get_dir_deg(deg, animations)
# Get the player direction index based on degrees
#
# #### Parameters
@@ -385,7 +343,6 @@ func _get_dir_deg(deg: int, animations: Script) -> int:
# Returns true if given angle is inside the interval given by a starting_angle
# and the size.
# TODO Refactor to make this stuff understandable :D
#
# #### Parameters
#
@@ -416,20 +373,10 @@ func is_angle_in_interval(angle: float, interval: Array) -> bool:
# Sets character's angle and plays according animation.
#
# TODO: depending on current angle and current angle, the character may
# directly turn around with no "progression". We may enhance this by
# calculating successive directions to turn the character to, so that he
# doesn't switch to opposite direction too fast.
# For example, if character looks WEST and set_angle(EAST) is called, we may
# want the character to first turn SOUTHWEST, then SOUTH, then SOUTHEAST and
# finally EAST, all more or less fast.
# Whatever the implementation, this should be activated using "parameter
# "immediate" set to false.
#
# #### Parameters
#
# - deg int angle to set the character
# - immediate bool (currently unused, see TODO below)
# - immediate
# If true, direction is switched immediately. Else, successive animations are
# used so that the character turns to target angle.
func set_angle(deg: int, immediate = true) -> void:

View File

@@ -1,7 +1,6 @@
# `teleport object1 object2`
#
# Sets the position of object1 to the position of object2.
# FIXME re-add the angle parameter here
#
# @ESC
extends ESCBaseCommand

View File

@@ -1,7 +1,6 @@
# `teleport_pos object1 x y`
#
# Sets the position of object1 to the position (x,y).
# FIXME re-add the angle parameter here
#
# @ESC
extends ESCBaseCommand

View File

@@ -18,7 +18,6 @@ var scheduled_events: Array = []
func _process(delta: float) -> void:
if events_queue.size() > 0:
var running_event = events_queue.pop_front()
# TODO: Handle event flags
if not running_event.is_connected(
"finished", self, "_on_event_finished"
):

View File

@@ -15,7 +15,6 @@ const END_REGEX = \
# Dialog type
# FIXME, currently unused, but needs reimplementation
var type: String = ""
# Avatar used in the dialog

View File

@@ -78,7 +78,6 @@ func _ready():
# Manage inputs reaching the Area2D and emit the events to the input manager
# TODO: Don't change private variables here, use an event for BUTTON_WHEEL
#
# #### Parameters
# - _viewport: (not used)

View File

@@ -1,8 +1,4 @@
# A playable character
# TODO
# - Currently the sprite node needs to be named "sprite". This is bad.
# - Animation management doesn't allow using AnimationPlayer yet. Need to find
# the best solution to manage both AnimatedSprite and AnimationPlayer.
tool
extends ESCItem
class_name ESCPlayer

View File

@@ -185,7 +185,6 @@ func save_settings():
settings_res.voice_volume = escoria.settings.voice_volume
settings_res.fullscreen = escoria.settings.fullscreen
settings_res.skip_dialog = escoria.settings.skip_dialog
settings_res.rate_shown = escoria.settings.rate_shown
var directory: Directory = Directory.new()
if not directory.dir_exists(settings_folder):

View File

@@ -35,6 +35,3 @@ export var fullscreen: bool = false
# True if skipping dialogs is allowed
export var skip_dialog: bool = true
# FIXME: to be defined (achievements?)
export var rate_shown: bool = false