Dialogue narration and wall tone retrigger fix
Game-file footprint unchanged: still one line in main.lua.
Wall tones: stop the previous tone per direction before playing the new one.
The tones are 2.33s mono; steps land far faster than that and up to four
directions sound at once, so overlapping them stacked into a continuous drone
instead of reading as a per-step cue. Cutting the old tone also means the
distance/volume you hear always reflects where you are standing now.
ingame_dialogue descriptor: speaks speaker and message on a node change, but
only the response on a selection change -- re-reading the whole speech every
time you move between responses would be unusable.
Two more bugs found by the testbed:
4. Nested states.switch announced in reverse. ingame.open() sees
world.pendingDialogue and switches straight to ingame_dialogue; because we
announce after realSwitch returns, the inner announcement fired first and the
outer one interrupted and clobbered it, so entering a conversation said
'Game' rather than 'Conversation'. Now we stay quiet if we are no longer the
current state.
5. The game already numbers response text ('1. (Continue)'), matching the number
key that picks it, so our own numbering produced '1. 1. (Continue)'.
9/9 testbed checks, history unit tests passing.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
9945703fb7
commit
da512fc67e
@@ -70,6 +70,10 @@ local directions = {
|
||||
|
||||
local sources = {}
|
||||
|
||||
-- The currently-sounding source per direction, so a tone is never retriggered on
|
||||
-- top of itself. See playTone.
|
||||
local playing = {}
|
||||
|
||||
local lastX, lastY, lastLevel
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
@@ -143,6 +147,19 @@ local function playTone(name, dx, dy, distance)
|
||||
return
|
||||
end
|
||||
|
||||
-- One tone per direction at a time: stop the previous one, start the new one.
|
||||
--
|
||||
-- The tones are 2.33s long and steps land far faster than that, with up to
|
||||
-- four directions sounding at once -- so letting them overlap stacked into a
|
||||
-- continuous drone instead of reading as a per-step cue. Cutting the old tone
|
||||
-- keeps this a layer on top of footsteps, and means the distance/volume you
|
||||
-- hear always reflects where you are standing now.
|
||||
local existing = playing[name]
|
||||
if existing then
|
||||
pcall(existing.stop, existing)
|
||||
playing[name] = nil
|
||||
end
|
||||
|
||||
-- Tagged so the game's own sfx/interface volume sliders apply.
|
||||
local ok, source = pcall(TEsound.play, path, "static", {"sfx", "interface"}, volumeFor(distance))
|
||||
if not ok or not source then
|
||||
@@ -157,6 +174,8 @@ local function playTone(name, dx, dy, distance)
|
||||
lz -- same height as the listener: maximise horizontal pan
|
||||
)
|
||||
end)
|
||||
|
||||
playing[name] = source
|
||||
end
|
||||
|
||||
function walltones.playFor(level, x, y)
|
||||
@@ -208,6 +227,7 @@ function walltones.update()
|
||||
if level ~= lastLevel then
|
||||
lastLevel = level
|
||||
lastX, lastY = x, y
|
||||
playing = {}
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user