Issue 377 (#383)

* feat: Implements speech fixes #377

* docs: Automatic update of API docs

* chore: Updated speech translation.

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-09-06 08:52:16 +02:00
committed by GitHub
parent 3dc779311c
commit c8958e7454
54 changed files with 279 additions and 85 deletions

View File

@@ -1,7 +1,7 @@
# `play_snd file [player]`
#
# Plays the sound specificed with the "file" parameter on the sound player
# `player`, without blocking. (player defaults to bg_sound)
# `player`, without blocking. (player defaults to _sound)
#
# @ESC
extends ESCBaseCommand
@@ -13,7 +13,7 @@ func configure() -> ESCCommandArgumentDescriptor:
return ESCCommandArgumentDescriptor.new(
2,
[TYPE_STRING, TYPE_STRING],
[null, "bg_sound"]
[null, "_sound"]
)

View File

@@ -72,14 +72,10 @@ func run(command_params: Array) -> int:
)
return ESCExecution.RC_ERROR
var _line = command_params[1]
if ":" in _line:
_line = tr(_line.split(":")[0])
escoria.dialog_player.say(
command_params[0],
dialog_scene_name,
_line
command_params[1]
)
yield(escoria.dialog_player, "dialog_line_finished")
return ESCExecution.RC_OK

View File

@@ -2,7 +2,7 @@
#
# Change the sound playing on `player` to `sound` with optional looping if
# `loop` is true.
# Valid players are "bg_music" and "bg_sound".
# Valid players are "_music" and "_sound".
# Aside from paths to sound or music files, the values *off* and *default*.
# *default* is the default value.
# are also valid for `sound`
@@ -23,7 +23,7 @@ func configure() -> ESCCommandArgumentDescriptor:
# Validate wether the given arguments match the command descriptor
func validate(arguments: Array):
if not arguments[0] in ["bg_music", "bg_sound"]:
if not arguments[0] in ["_music", "_sound", "_speech"]:
escoria.logger.report_errors(
"SetSoundStateCommand.validate: invalid player",
[
@@ -45,6 +45,6 @@ func validate(arguments: Array):
# Run the command
func run(command_params: Array) -> int:
escoria.main.get_node(command_params[0])\
escoria.object_manager.get_object(command_params[0]).node\
.set_state(command_params[1], command_params[2])
return ESCExecution.RC_OK

View File

@@ -4,8 +4,9 @@ class_name ESCObjectManager
const RESERVED_OBJECTS = [
"bg_music",
"bg_sound"
"_music",
"_sound",
"_speech"
]

View File

@@ -75,7 +75,7 @@ func get_save_data() -> Dictionary:
save_data["last_deg"] = wrapi(self.node._movable._get_angle() + 1, 0, 360)
save_data["last_dir"] = self.node._movable.last_dir
if (self.global_id == "bg_music" or self.global_id == "bg_sound") \
if (self.global_id == "_music" or self.global_id == "_sound") \
and self.node.get("state"):
save_data["state"] = self.node.get("state")

View File

@@ -162,7 +162,7 @@ func load_game(id: int):
save_game.objects[object_global_id]["last_deg"]])
)
if object_global_id == "bg_music" or object_global_id == "bg_sound":
if object_global_id == "_music" or object_global_id == "_sound":
load_statements.append(ESCCommand.new("set_sound_state %s %s true" \
% [object_global_id,
save_game.objects[object_global_id]["state"]])
@@ -185,7 +185,7 @@ func save_settings():
settings_res.master_volume = escoria.settings.master_volume
settings_res.music_volume = escoria.settings.music_volume
settings_res.sfx_volume = escoria.settings.sfx_volume
settings_res.voice_volume = escoria.settings.voice_volume
settings_res.speech_volume = escoria.settings.speech_volume
settings_res.fullscreen = escoria.settings.fullscreen
settings_res.skip_dialog = escoria.settings.skip_dialog

View File

@@ -6,10 +6,14 @@ class_name ESCSaveSettings
export var escoria_version: String
# Language of displayed text
export var text_lang: String = ProjectSettings.get_setting("escoria/main/text_lang")
export var text_lang: String = ProjectSettings.get_setting(
"escoria/main/text_lang"
)
# Language of voice speech
export var voice_lang: String = ProjectSettings.get_setting("escoria/main/voice_lang")
export var voice_lang: String = ProjectSettings.get_setting(
"escoria/main/voice_lang"
)
# Whether speech is enabled
export var speech_enabled: bool = ProjectSettings.get_setting(
@@ -24,10 +28,12 @@ export var music_volume: float = ProjectSettings.get_setting(
"escoria/sound/music_volume")
# Volume of SFX only
export var sfx_volume: float = ProjectSettings.get_setting("escoria/sound/sfx_volume")
export var sfx_volume: float = ProjectSettings.get_setting(
"escoria/sound/sfx_volume"
)
# Voice volume only
export var voice_volume: float = ProjectSettings.get_setting(
# Speech volume only
export var speech_volume: float = ProjectSettings.get_setting(
"escoria/sound/speech_volume")
# True if game has to be fullscreen