aboutsummaryrefslogtreecommitdiff
path: root/saga
diff options
context:
space:
mode:
authorTorbjörn Andersson2005-01-02 14:30:50 +0000
committerTorbjörn Andersson2005-01-02 14:30:50 +0000
commit96785897790bdf6ff1679e45c7fdf4a98bbce9b6 (patch)
treea09619d567512ed0d25f738eac7add3b39058b0e /saga
parent5930ba2ed80b5715f93801db06fd1006ff18272d (diff)
downloadscummvm-rg350-96785897790bdf6ff1679e45c7fdf4a98bbce9b6.tar.gz
scummvm-rg350-96785897790bdf6ff1679e45c7fdf4a98bbce9b6.tar.bz2
scummvm-rg350-96785897790bdf6ff1679e45c7fdf4a98bbce9b6.zip
The 'n_voices' field of the voice LUT was never assigned a value. So if
anyone heard any voices - I did, except under Valgrind - it was pure luck. svn-id: r16406
Diffstat (limited to 'saga')
-rw-r--r--saga/script.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/saga/script.cpp b/saga/script.cpp
index de996347b8..76f10e4b5d 100644
--- a/saga/script.cpp
+++ b/saga/script.cpp
@@ -501,7 +501,6 @@ void Script::loadStrings(const byte *stringsPointer, size_t stringsLength, Strin
VOICE_LUT *Script::loadVoiceLUT(const byte *voicelut_p, size_t voicelut_len, SCRIPTDATA *script) {
VOICE_LUT *voice_lut;
- uint16 n_voices;
uint16 i;
voice_lut = (VOICE_LUT *)malloc(sizeof *voice_lut);
@@ -509,13 +508,13 @@ VOICE_LUT *Script::loadVoiceLUT(const byte *voicelut_p, size_t voicelut_len, SCR
return NULL;
}
- n_voices = voicelut_len / 2;
- if (n_voices != script->strings->stringsCount) {
+ voice_lut->n_voices = voicelut_len / 2;
+ if (voice_lut->n_voices != script->strings->stringsCount) {
warning("Error: Voice LUT entries do not match dialogue entries");
return NULL;
}
- voice_lut->voices = (int *)malloc(n_voices * sizeof *voice_lut->voices);
+ voice_lut->voices = (int *)malloc(voice_lut->n_voices * sizeof *voice_lut->voices);
if (voice_lut->voices == NULL) {
return NULL;
@@ -523,7 +522,7 @@ VOICE_LUT *Script::loadVoiceLUT(const byte *voicelut_p, size_t voicelut_len, SCR
MemoryReadStreamEndian scriptS(voicelut_p, voicelut_len, IS_BIG_ENDIAN);
- for (i = 0; i < n_voices; i++) {
+ for (i = 0; i < voice_lut->n_voices; i++) {
voice_lut->voices[i] = scriptS.readUint16();
}