Lots of little tweaks and fixes

This commit is contained in:
2026-06-12 20:26:00 -05:00
parent 7fc1a4645c
commit 3d01fcce86
32 changed files with 570 additions and 160 deletions
+7 -19
View File
@@ -5,8 +5,7 @@ const SCENE:PackedScene = preload("res://ui/component/DialogueTextbox.tscn")
enum AdvancementMode { PLAYER, TIMED }
const LINES_PER_PAGE:int = 4
const CHARS_PER_SECOND:float = 20.0
const SPEEDUP_MULTIPLIER:float = 4.0
const CHARS_PER_SECOND:float = 24.0
const PAUSE_COMMA:float = 0.15
const PAUSE_SENTENCE:float = 0.4
const PAUSE_ELLIPSIS_DOT:float = 0.3
@@ -24,7 +23,6 @@ var _pauseTimer:float = 0.0
var _autoAdvanceTimer:float = 0.0
var _isRevealing:bool = false
var _isWaitingForInput:bool = false
var _hasLetGoOfInteract:bool = true
var _advancementMode:AdvancementMode = AdvancementMode.PLAYER
@onready var _speakerLabel:Label = $VBoxContainer/SpeakerLabel
@@ -68,7 +66,6 @@ func setup(line:DialogueLine, entity:Entity, mode:AdvancementMode = AdvancementM
_autoAdvanceTimer = 0.0
_isRevealing = true
_isWaitingForInput = false
_hasLetGoOfInteract = !Input.is_action_pressed("interact")
_updateWorldPosition()
visible = true
@@ -85,9 +82,10 @@ func _process(delta:float) -> void:
return
_updateWorldPosition()
_advanceIndicator.visible = _isWaitingForInput
if _isWaitingForInput:
_advanceIndicator.modulate.a = 0.5 + 0.5 * sin(Time.get_ticks_msec() / 300.0)
else:
_advanceIndicator.modulate.a = 0.0
if _isRevealing:
_processReveal(delta)
@@ -119,16 +117,13 @@ func _buildPreWrappedText(parsed:String) -> String:
return result
func _processReveal(delta:float) -> void:
if Input.is_action_just_released("interact"):
_hasLetGoOfInteract = true
var speedMult:float = SPEEDUP_MULTIPLIER if (_hasLetGoOfInteract and Input.is_action_pressed("interact")) else 1.0
var scaledDelta:float = delta * SETTINGS.textSpeed
if _pauseTimer > 0.0:
_pauseTimer -= delta * speedMult
_pauseTimer -= scaledDelta
return
_revealTimer += delta * speedMult
_revealTimer += scaledDelta
while _revealTimer >= 1.0 / CHARS_PER_SECOND:
_revealTimer -= 1.0 / CHARS_PER_SECOND
@@ -185,12 +180,6 @@ func _onRevealComplete() -> void:
_isWaitingForInput = true
func _processAdvanceInput() -> void:
if Input.is_action_just_released("interact"):
_hasLetGoOfInteract = true
if not _hasLetGoOfInteract:
return
if Input.is_action_just_pressed("interact"):
_advance()
@@ -200,8 +189,7 @@ func _processAutoAdvance(delta:float) -> void:
_advance()
func _advance() -> void:
_advanceIndicator.visible = false
_advanceIndicator.modulate.a = 1.0
_advanceIndicator.modulate.a = 0.0
var totalLines:int = _parsedText.count("\n") + 1
var hasMorePages:bool = _startLine + _linesPerPage < totalLines
if hasMorePages: