Voice mother with Carol and synchronize all call events
This commit is contained in:
@@ -371,7 +371,7 @@ func show_menu() -> void:
|
||||
box.add_child(button("Позвонить маме" if completed == 0 else "Продолжить · звонок %d" % mini(completed + 1, 10), "start", func(): begin_call(mini(completed + 1, 10), false)))
|
||||
box.add_child(button("Проверка сцен · выбрать любой из 10 звонков", "testing", show_test_menu))
|
||||
box.add_child(button("Звук и титры", "settings", show_settings))
|
||||
box.add_child(label("0.2.1 · Катя: Jessica / ElevenLabs · Мама: Windows Speech\nПрогресс сохраняется после находок и законченных звонков.", 16, MUTED))
|
||||
box.add_child(label("0.2.2 · Катя: Jessica · Мама: Carol · ElevenLabs\nПрогресс сохраняется после находок и законченных звонков.", 16, MUTED))
|
||||
|
||||
func show_settings() -> void:
|
||||
var box := modal()
|
||||
@@ -393,7 +393,7 @@ func show_settings() -> void:
|
||||
master_volume = value
|
||||
AudioServer.set_bus_volume_db(0, linear_to_db(maxf(0.0001, value))))
|
||||
box.add_child(slider)
|
||||
box.add_child(label("Все фразы доступны в субтитрах.\nКатя: Jessica — Playful, Bright, Warm / ElevenLabs, 48 реплик.\nМама: Microsoft Irina, временный локальный синтез, 54 реплики.\nВзрыв: Synthesized explosion — qubodup / Iwan Gabovitch, CC0.\nОстальные звуки: оригинальный процедурный синтез проекта.\nПолные источники — AUDIO_CREDITS.md рядом с игрой.", 20, MUTED))
|
||||
box.add_child(label("Все фразы доступны в субтитрах.\nКатя: Jessica — Playful, Bright, Warm / ElevenLabs, 48 реплик.\nМама: Carol — Relatable, Real, Likeable Grandma / ElevenLabs, 54 реплики.\nВзрыв: Synthesized explosion — qubodup / Iwan Gabovitch, CC0.\nОстальные звуки: оригинальный процедурный синтез проекта.\nПолные источники — AUDIO_CREDITS.md рядом с игрой.", 20, MUTED))
|
||||
box.add_child(button("Назад", "back_menu", show_menu))
|
||||
|
||||
func show_test_menu() -> void:
|
||||
@@ -482,14 +482,13 @@ func advance() -> void:
|
||||
# boundaries. An action completed at 44 s still counts after a 46 s frame;
|
||||
# a laptop action completing at 46 s is cancelled by the 45 s power cut.
|
||||
var target := elapsed
|
||||
var alarm_at := 43.0 if chapter == 1 else 24.0
|
||||
while running:
|
||||
var next_time := 90.0
|
||||
var next_time := float(story.timeline.impact)
|
||||
var kind := "impact"
|
||||
for entry in [{"at": alarm_at, "id": "alarm"}, {"at": 45.0, "id": "power"}, {"at": 85.0, "id": "hum"}]:
|
||||
if not fired.has(entry.id) and float(entry.at) < next_time:
|
||||
next_time = entry.at
|
||||
kind = entry.id
|
||||
for id in ["alarm", "power", "hum"]:
|
||||
if not fired.has(id) and float(story.timeline[id]) < next_time:
|
||||
next_time = story.timeline[id]
|
||||
kind = id
|
||||
if not events.is_empty() and float(events[0].at) < next_time:
|
||||
next_time = events[0].at
|
||||
kind = "dialogue"
|
||||
@@ -504,23 +503,24 @@ func advance() -> void:
|
||||
elapsed = next_time
|
||||
match kind:
|
||||
"impact":
|
||||
fired.impact = elapsed
|
||||
strike()
|
||||
return
|
||||
"alarm":
|
||||
fired.alarm = true
|
||||
fired.alarm = elapsed
|
||||
siren.play()
|
||||
if chapter != 1: system_caption("На мамином конце слышна сирена.")
|
||||
system_caption("На мамином конце слышна сирена.")
|
||||
"power":
|
||||
fired.power = true
|
||||
system_caption("Щелчок. Гул холодильника исчезает.")
|
||||
fired.power = elapsed
|
||||
system_caption("Свет в квартире погас. Щелчок — гул холодильника исчезает.")
|
||||
room.volume_db = -35
|
||||
if not busy.is_empty() and busy.get("power", false):
|
||||
busy = {}
|
||||
say("late_mail")
|
||||
elif chapter != 1: say("power")
|
||||
elif busy.is_empty(): say("power")
|
||||
refresh_commands()
|
||||
"hum":
|
||||
fired.hum = true
|
||||
fired.hum = elapsed
|
||||
hum.play()
|
||||
say("hum")
|
||||
"dialogue":
|
||||
@@ -534,10 +534,10 @@ func advance() -> void:
|
||||
refresh_live()
|
||||
|
||||
func command_allowed(action: Dictionary) -> bool:
|
||||
if not running or chapter == 1 or elapsed >= 90 or not busy.is_empty(): return false
|
||||
if not running or chapter == 1 or elapsed >= float(story.timeline.impact) or not busy.is_empty(): return false
|
||||
if action.get("once", false) and done.has(action.id): return false
|
||||
if action.has("places") and place not in action.places: return false
|
||||
if action.get("power", false) and elapsed >= 45: return false
|
||||
if action.get("power", false) and elapsed >= float(story.timeline.power): return false
|
||||
for key in action.get("facts", []):
|
||||
if not facts.has(key): return false
|
||||
for key in action.get("unknown", []):
|
||||
@@ -550,7 +550,7 @@ func command_allowed(action: Dictionary) -> bool:
|
||||
|
||||
func action_duration(action: Dictionary) -> float:
|
||||
var length := maxf(float(action.seconds), voice_length(action.request) + voice_length(action.response) + 0.35)
|
||||
if action.get("needs_light", false) and elapsed >= 45 and not items.has("lamp"):
|
||||
if action.get("needs_light", false) and elapsed >= float(story.timeline.power) and not items.has("lamp"):
|
||||
length += 7
|
||||
return length
|
||||
|
||||
@@ -574,7 +574,7 @@ func choose_action(id: String) -> void:
|
||||
reply_at = maxf(elapsed + voice_length(selected.request) + 0.15, busy_end - voice_length(selected.response))
|
||||
replied = false
|
||||
say(selected.request)
|
||||
if selected.get("needs_light", false) and elapsed >= 45 and not items.has("lamp"):
|
||||
if selected.get("needs_light", false) and elapsed >= float(story.timeline.power) and not items.has("lamp"):
|
||||
system_caption("Без фонаря мама будет искать на ощупь. Это займёт дольше.")
|
||||
refresh_commands()
|
||||
|
||||
@@ -718,7 +718,7 @@ func refresh_live() -> void:
|
||||
status_label.text = "Плохая связь" if place == "alcove" and not items.has("connected") else "На линии"
|
||||
if not running: status_label.text = "Соединение прервано"
|
||||
var names := {"flat": "В квартире", "inner": "Внутренний коридор", "landing": "Лестничная площадка", "alcove": "Боковой тамбур"}
|
||||
place_label.text = names[place] + (" · темно" if elapsed >= 45 else "")
|
||||
place_label.text = names[place] + (" · темно" if fired.has("power") else "")
|
||||
var held: Array[String] = []
|
||||
for key in items:
|
||||
held.append({"keys": "ключи", "lamp": "фонарь", "spare": "запасной ключ", "connected": "телефон на полке"}[key])
|
||||
@@ -729,7 +729,7 @@ func refresh_live() -> void:
|
||||
for i in range(wave_bars.size()):
|
||||
var bar := wave_bars[i]
|
||||
bar.custom_minimum_size.y = 5 + (absf(sin(elapsed * 8.0 + i * 1.8)) * 30 if voice.playing else absf(sin(elapsed + i)) * 3)
|
||||
bar.color = ACCENT if elapsed >= 85 else GREEN
|
||||
bar.color = ACCENT if fired.has("hum") else GREEN
|
||||
|
||||
func action_button(id: String, node: Node = null) -> Button:
|
||||
if node == null: node = ui
|
||||
|
||||
@@ -104,18 +104,60 @@ func run(target: Node) -> void:
|
||||
check(game.voice_stream(id) != null and game.voice_length(id) > 0.1, "Playable audio " + id)
|
||||
var voices: Dictionary = JSON.parse_string(FileAccess.get_file_as_string("res://data/voice_manifest.json"))
|
||||
var jessica_count := 0
|
||||
var carol_count := 0
|
||||
for id in game.story.lines:
|
||||
if game.story.lines[id].speaker == "Катя":
|
||||
check(voices[id].provider == "ElevenLabs" and voices[id].voice_id == "cgSgspJ2msm6clMCkdW9", "Jessica assigned: " + id)
|
||||
jessica_count += 1
|
||||
else:
|
||||
check(voices[id].provider == "Windows Speech / draft", "Mother voice preserved: " + id)
|
||||
check(voices[id].provider == "ElevenLabs" and voices[id].voice_id == "5u41aNhyCU6hXOcjPPv0", "Carol assigned: " + id)
|
||||
carol_count += 1
|
||||
check(jessica_count == 48, "All 48 Katya lines use Jessica")
|
||||
check(carol_count == 54, "All 54 mother lines use Carol")
|
||||
check(game.voice_length("greeting") <= game.story.intro[0].at, "Greeting fits before prologue")
|
||||
check(45 + game.voice_length("power") <= 51, "Blackout reaction fits before conversation resumes")
|
||||
check(85 + game.voice_length("hum") <= 90, "Hum reaction fits before strike")
|
||||
for index in range(game.story.intro.size()):
|
||||
var beat: Dictionary = game.story.intro[index]
|
||||
var next_at: float = game.story.intro[index + 1].at if index + 1 < game.story.intro.size() else 85.0
|
||||
if float(beat.at) < 45: next_at = minf(next_at, 45)
|
||||
check(float(beat.at) + game.voice_length(beat.line) <= next_at, "Intro line fits before next cue: " + str(beat.line))
|
||||
await capture("phone-menu")
|
||||
click("settings")
|
||||
await capture("phone-credits")
|
||||
click("back_menu")
|
||||
# Every redial repeats the same external world, including the first call.
|
||||
for number in range(1, 11):
|
||||
start(number)
|
||||
at(23.99)
|
||||
check(not game.fired.has("alarm"), "No early siren: " + str(number))
|
||||
at(24.01)
|
||||
check(game.fired.get("alarm") == 24.0, "Same siren time: " + str(number))
|
||||
at(44.99)
|
||||
check(not game.fired.has("power") and "темно" not in game.place_label.text, "Lights stay on until 45: " + str(number))
|
||||
at(45.01)
|
||||
check(game.fired.get("power") == 45.0 and "темно" in game.place_label.text, "Same visible blackout: " + str(number))
|
||||
check("power" in game.heard, "Mother acknowledges blackout: " + str(number))
|
||||
at(84.99)
|
||||
check(not game.fired.has("hum"), "No early hum: " + str(number))
|
||||
at(85.01)
|
||||
check(game.fired.get("hum") == 85.0, "Same hum time: " + str(number))
|
||||
at(89.99)
|
||||
check(not game.impacted, "No early strike: " + str(number))
|
||||
finish("flat")
|
||||
check(game.fired.get("impact") == 90.0, "Same strike time: " + str(number))
|
||||
start(1)
|
||||
at(45.01)
|
||||
await capture("phone-first-blackout")
|
||||
start(2)
|
||||
at(45.01)
|
||||
await capture("phone-second-blackout")
|
||||
start(2)
|
||||
at(38)
|
||||
click("keys_search")
|
||||
at(45.01)
|
||||
check(not game.busy.is_empty() and "power" not in game.heard, "Blackout does not interrupt an unrelated spoken task")
|
||||
check(game.fired.get("power") == 45.0 and "темно" in game.place_label.text, "Busy task cannot postpone blackout")
|
||||
for number in range(1, 11):
|
||||
start(number)
|
||||
check(game.chapter == number and game.place == "flat" and game.items.is_empty(), "Fresh chapter " + str(number))
|
||||
@@ -124,7 +166,7 @@ func run(target: Node) -> void:
|
||||
check(game.action_button("keys_search") == null, "Prologue has no commands")
|
||||
check(game.clock_label.text == "Разговор", "Prologue hides time")
|
||||
for beat in game.story.intro: at(beat.at + 0.01)
|
||||
check(game.heard.size() == 10, "All ordinary conversation lines")
|
||||
check(game.heard.size() == 11 and "power" in game.heard, "Ordinary conversation and blackout acknowledgement")
|
||||
else:
|
||||
var entry: Dictionary = game.story.chapters[number - 1]
|
||||
var opening_at: float = game.events[0].at
|
||||
|
||||
Reference in New Issue
Block a user