Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre alpha13 fixes #2058

Merged
merged 2 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions addons/dialogic/Modules/Text/node_dialog_text.gd
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ enum Alignment {LEFT, CENTER, RIGHT}
var revealing := false
var base_visible_characters := 0

# Letter speed used per revealed character.
var lspeed: float = 0.01
# The used speed per revealed character.
# May be overwritten when syncing reveal speed to voice.
var active_speed: float = lspeed
var active_speed: float = 0.01

var speed_counter: float = 0

func _set(property: StringName, what: Variant) -> bool:
Expand Down Expand Up @@ -80,19 +79,20 @@ func reveal_text(_text: String, keep_previous:=false) -> void:
visible_characters = 1
return

revealing = true
speed_counter = 0
started_revealing_text.emit()


func set_speed(delay_per_character:float) -> void:
if DialogicUtil.autoload().Text.is_text_voice_synced() and DialogicUtil.autoload().Voice.is_running():
var total_characters := get_total_character_count() as float
var remaining_time: float = DialogicUtil.autoload().Voice.get_remaining_time()
var synced_speed := remaining_time / total_characters
active_speed = synced_speed

else:
active_speed = lspeed


revealing = true
speed_counter = 0
started_revealing_text.emit()
active_speed = delay_per_character


## Reveals one additional character.
Expand Down
11 changes: 6 additions & 5 deletions addons/dialogic/Modules/Text/subsystem_text.gd
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ func update_dialog_text(text: String, instant := false, additional := false) ->

dialogic.current_state_info['text_parsed'] = (text_node as RichTextLabel).get_parsed_text()

# Reset speed multiplier
update_text_speed(-1, false, 1)
# Reset Auto-Advance temporarily and the No-Skip setting:
update_text_speed(-1, false, 1, -1)
dialogic.Inputs.auto_advance.enabled_until_next_event = false
dialogic.Inputs.auto_advance.override_delay_for_current_event = -1
dialogic.Inputs.set_manualadvance(true, true)
Expand Down Expand Up @@ -278,9 +279,9 @@ func update_text_speed(letter_speed: float = -1,

for text_node in get_tree().get_nodes_in_group('dialogic_dialog_text'):
if absolute:
text_node.lspeed = letter_speed
text_node.set_speed(letter_speed)
else:
text_node.lspeed = letter_speed * _speed_multiplier * user_speed
text_node.set_speed(letter_speed * _speed_multiplier * user_speed)


func set_text_reveal_skippable(skippable:= true, temp:=false) -> void:
Expand Down Expand Up @@ -491,9 +492,9 @@ func effect_speed(text_node:Control, skipped:bool, argument:String) -> void:
if skipped:
return
if argument:
update_text_speed(-1, false, float(argument), -1)
update_text_speed(-1, false, float(argument))
else:
update_text_speed(-1, false, 1, -1)
update_text_speed(-1, false, 1)


func effect_lspeed(text_node:Control, skipped:bool, argument:String) -> void:
Expand Down
2 changes: 1 addition & 1 deletion addons/dialogic/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ name="Dialogic"
description="Create dialogs, characters and scenes to display conversations in your Godot games.
https://github.com/dialogic-godot/dialogic"
author="Emi, Jowan Spooner, Exelia, and more!"
version="2.0-Alpha-13 (WIP! Godot 4.2+)"
version="2.0-Alpha-13 (Godot 4.2+)"
script="plugin.gd"
Loading