Opened 2 days ago
Last modified 36 hours ago
#15514 new defect
SCI: KQ5CD Issue with the audio when adding text dialogues multilingual
Reported by: | LaZar00 | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | Engine: SCI |
Version: | Keywords: | ||
Cc: | LaZar00 | Game: | King's Quest 5 |
Description
ScummVM Version: any (tested with 2.0.0 (GOG version of KQ5 CD), 2.1.0, 2.8.1)
Game/Language: KQ5 CD Talkie English (GOG version)
OS: PC Windows 11
Bug:
I decided open this ticket to report a strange behaviour in King's Quest V CD Talkie english version under ScummVM.
This version has NOT dialogue boxes for spoken dialogue in game. I decided to do add them modifying the code with SCI Companion 3.0.1.7. I had success adding them and show the dialogues with the audio and it works well in ScummVM and DosBox (for one unique language).
Ok, now here comes the issue and the reason I decided to open the ticket.
I added the feature to show multilingual text (in my case English/Spanish). This feature works for example when we have a string like "{Hello#SHola}", and when selecting the language (lang=en or lang=es) scummvm should show "Hello" for english and "Hola" for spanish.
Ok, what I have done for make this possible? I have added into Main.sc the properties for parseLang and printLang to 34. I have also a switch in "about" window for change among language 1 (english) and language 34 (spanish).
Using this method, this DOES NOT work in ScummVM, BUT, surprisingly, it WORKS in DosBox. I can change the language and I can see the texts with the language specified in printLang y parseLang when set in Main.sc.
So, this is a big difference between how sci engine works in DosBox and how it works ScummVM (at least for this specific game).
I think that somehow, in this game specifically [KQ5 CD Talkie english], the language is set by DoAudio kernel function (in scummvm). So, if we use another language, it looks for that audio, and as it does not exists, does not makes the change. But what scummvm should do is use the default language (english) as it does commonly with the texts.
Do you think you could apply this to ScummVM? To make the sci engine work as in DosBox?
If you have any further questions don't hesitate to ask. And sorry for my english, I'm not native english speaker.
Attachments (1)
Change History (5)
by , 2 days ago
Attachment: | kq5cd-DoAudioSetLanguage.jpg added |
---|
kq5 cd kDoAudio / Language disassembly
comment:2 by , 2 days ago
Summary: | [KQ5 CD] Issue with the audio when adding text dialogues multilingual → SCI: KQ5CD Issue with the audio when adding text dialogues multilingual |
---|
comment:3 by , 2 days ago
¡Hola, LaZar00!
That's impressive that you're making a KQ5CD mod with text and speech *and* in Spanish. Can it display text while playing speech at the same time?
I agree that you should be able to toggle between English and Spanish text with KQ5:printLang
while separately controlling which audio files to use with kDoAudio \ kSciAudioLanguage
. You've figured out a lot!
While the KQ5CD interpreter code for this is straightforward (Thanks, Martin!), our code is trickier because of all the versions it supports. I am cautious about making changes there, so I think we need a test case so that we can make sure we're fixing this for you while not breaking anything else.
I will try to manually recreate the scripts you've described (decompile, alter, recompile), but if that doesn't work, I may ask you to privately share your mod so I can make the right adjustment.
comment:4 by , 2 days ago
Hi sluicebox,
It is a pleasure to meet you. I looked a LOT of your KQ5 CD source code in github to understand SCI. I'm very beginner in it. I have even downloaded scummvm source code to understand some things (which helped me to found how to use audio files for localized language) and registered in sciprogramming doing some questioning to kawa or the people there. xD
This is a sample of the intro with dialogue boxes:
Youtube KQ5 CD Intro with speech+text
I have even rm001 stage done and part of the menu. I programmed two or three functions that help me to show message boxes similar to DLetter.sc and Printf (in new scripts). Only with procedures, I have not defined new classes. I try to left it all centralized in 2-3 scripts, but I have to do some minor changes in specific strings. For example, when the kDoAudio function is present, I need to modify that script.
Ok, about our issue in question.
I have finally made possible the change of the language in game, but in scummVM does not work the lang property in the .ini file by default. This is my Main.sc source code:
(instance KQ5 of Game (properties parseLang 34 printLang 34 ) (method (init &tmp [temp0 270] temp270 [temp271 19] temp290) (= global394 1) ;(DoAudio audLANGUAGE 1) ; for English (DoAudio audLANGUAGE 34) ; for Spanish (DoAudio audRATE 11025) (if (and (>= (= global105 (Graph grGET_COLOURS)) 2) (<= global105 16)) (= global159 0) else (= global159 1) )
And I needed to copy AUDIO001.MAP to AUDIO034.MAP and the file AUDIO001.002 to AUDIO034.002. This has helped and has made the subtitles with printLang 34 available. But the thing is that in DosBox I DON'T NEED to do this. It seems Scumm does not defaults to the english audio when it has not the files with the voices. I checked the code in github and seen that this is the issue, that's why I have copied the files of the audio with the number/code of the language.
In DosBox it works directly, without the files for the language (it gets by default the English one XXXXX001) and I don't need either to use the "DoAudio audLANGUAGE 34". It seems only needs the printLang and parseLang code of the spanish language. I don't even know if this flag of DoAudio audLANGUAGE is useful. I mean, at the end, the game uses printLang anyway, right? But it could be interesting for localized voices (if anytime somebody a bit crazy decides to do them).
PD: In any case, I want to use a solution that works with ScummVM 2.0.0 (the one supplied with GOG version), and I have this alternative (although this is not accurate with the SCI Engine).
PD2: If you need any code I will supply, but I think you need only Main.sc with the code I pasted. Then use the own SIERRA intro where it shows "Present", and after, the KQV shot asking if you have played the game previously (using multilingual texts, of course). With that, you should have enough.
PD3: Oh, I forget. For change language in game I have in about.sc:
(instance about of Code (properties) (method (doit &tmp temp0 [temp1 255]) (= global394 (DoAudio 9 -1)) (switch (= temp0 (Print 756 0 33 1 81 {About KQV#SSobre KQV} 1 81 {Help#SAyuda} 2 81 {Cancel#SCancelar} 0 81 {Spanish\nMessages#SMensajes\nen ingl‚s} 3 ) ) (1 (Format @temp1 756 1 gVersion) (Print @temp1 #mode 1) (Print 756 2 70 210) (Print 756 3 70 210) (Print 756 4 70 210) (Print 756 5 70 210) (Print 756 6 70 210) (Print 756 7) (Print 756 8 70 210) (Print 756 9 70 210) ((File new:) name: {HELP.TXT} read: @local0 100 close: dispose: ) (Printf 756 10 @local0) (DisposeScript 993) ) (2 ((ScriptID 753) doit:)) (3 (if (== (gGame printLang?) 34) (gGame printLang: 1) (DoAudio audLANGUAGE 1) else (gGame printLang: 34) (DoAudio audLANGUAGE 34) ) ) ) ) )
This helps me to change language in game directly. In DosBox, I don't need the "DoAudio audLANGUAGE". With ScummVM I need it to work. With the audio files for the localized language, of course.
I just checked disassembly of the KQ5-CD SCI interpreter version.
It tries to load the audio-resource-map (AUDIOxxx.MAP). If it fails, it reverts TO THE PREVIOUS language and loads that (again).
It also defaults to language 1 (US English) on startup.
It also returns the audio language that was successfully set in acc.