aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2005-08-09 16:01:04 +0000
committerEugene Sandulenko2005-08-09 16:01:04 +0000
commitc6c5c8f868c0c0ea37ddef156b8581d304ad5cac (patch)
treedaf31f306fe90e796010b455466b05203c47aac5
parente64afc23b4199952ce77de16f94bf30f54fd6c57 (diff)
downloadscummvm-rg350-c6c5c8f868c0c0ea37ddef156b8581d304ad5cac.tar.gz
scummvm-rg350-c6c5c8f868c0c0ea37ddef156b8581d304ad5cac.tar.bz2
scummvm-rg350-c6c5c8f868c0c0ea37ddef156b8581d304ad5cac.zip
o Fix some game parameters for IHNM
o Load voices LUT for IHNM svn-id: r18640
-rw-r--r--saga/game.cpp8
-rw-r--r--saga/rscfile.cpp32
-rw-r--r--saga/script.cpp26
-rw-r--r--saga/script.h12
-rw-r--r--saga/sthread.cpp17
5 files changed, 44 insertions, 51 deletions
diff --git a/saga/game.cpp b/saga/game.cpp
index 6af7907aef..736be9f262 100644
--- a/saga/game.cpp
+++ b/saga/game.cpp
@@ -527,7 +527,7 @@ static GameDisplayInfo IHNM_DisplayInfo = { //TODO: fill it all
640, 480, // logical width&height
0, // scene path y offset
- 328, // scene height
+ 304, // scene height
0, // status x offset
304, // status y offset
@@ -535,9 +535,9 @@ static GameDisplayInfo IHNM_DisplayInfo = { //TODO: fill it all
24, // status height
8, // status text y offset
186, // status text color
- 11, // status BG color
- 0,0, // save reminder pos
- 0,0, // save reminder w&h
+ 250, // status BG color
+ 616, 304, // save reminder pos
+ 24, 24, // save reminder w&h
0,0, // save reminder sprite numbers
253, // verb text color
diff --git a/saga/rscfile.cpp b/saga/rscfile.cpp
index f7d2807984..f079c9aaec 100644
--- a/saga/rscfile.cpp
+++ b/saga/rscfile.cpp
@@ -522,46 +522,48 @@ void Resource::loadGlobalResources(int chapter, int actorsEntrance) {
// TODO: songTable
+ int voiceLUTResourceID = 0;
+
+ _vm->_script->_globalVoiceLUT.freeMem();
+
switch (chapter) {
case 1:
_vm->_sndRes->setVoiceBank(1);
- // chapterRes = "voices1.res"
- // hackVoiceTableListID = 23
+ voiceLUTResourceID = 23;
break;
case 2:
_vm->_sndRes->setVoiceBank(2);
- // chapterRes = "voices2.res"
- // hackVoiceTableListID = 24
+ voiceLUTResourceID = 24;
break;
case 3:
_vm->_sndRes->setVoiceBank(3);
- // chapterRes = "voices3.res"
- // hackVoiceTableListID = 25
+ voiceLUTResourceID = 25;
break;
case 4:
_vm->_sndRes->setVoiceBank(4);
- // chapterRes = "voices4.res"
- // hackVoiceTableListID = 26
+ voiceLUTResourceID = 26;
break;
case 5:
_vm->_sndRes->setVoiceBank(5);
- // chapterRes = "voices5.res"
- // hackVoiceTableListID = 27
+ voiceLUTResourceID = 27;
break;
case 6:
_vm->_sndRes->setVoiceBank(6);
- // chapterRes = "voices6.res"
- // hackVoiceTableListID = 28
+ voiceLUTResourceID = 28;
break;
case 7:
break;
case 8:
_vm->_sndRes->setVoiceBank(0);
- // chapterRes = "voicess.res"
- // hackVoiceTableListID = 22
+ voiceLUTResourceID = 22;
break;
}
-
+
+ if (voiceLUTResourceID) {
+ _vm->_resource->loadResource(resourceContext, voiceLUTResourceID, resourcePointer, resourceLength);
+ _vm->_script->loadVoiceLUT(_vm->_script->_globalVoiceLUT, resourcePointer, resourceLength);
+ free(resourcePointer);
+ }
}
} // End of namespace Saga
diff --git a/saga/script.cpp b/saga/script.cpp
index 31dde01438..75180c787f 100644
--- a/saga/script.cpp
+++ b/saga/script.cpp
@@ -52,8 +52,6 @@ Script::Script(SagaEngine *vm) : _vm(vm) {
size_t stringsLength;
//initialize member variables
- _voiceLUTPresent = false;
-
_abortEnabled = true;
_skipSpeeches = false;
_conversingThread = NULL;
@@ -118,11 +116,6 @@ Script::Script(SagaEngine *vm) : _vm(vm) {
_modules[i].stringsResourceId = scriptS.readUint16();
_modules[i].voicesResourceId = scriptS.readUint16();
- if (_modules[i].voicesResourceId > 0) {
- _voiceLUTPresent = true;
- }
-
-
// Skip the unused portion of the structure
for (j = scriptS.pos(); j < prevTell + _modulesLUTEntryLen; j++) {
if (scriptS.readByte() != 0)
@@ -194,7 +187,7 @@ void Script::loadModule(int scriptModuleNumber) {
if (_modules[scriptModuleNumber].voicesResourceId > 0) {
_vm->_resource->loadResource(_scriptContext, _modules[scriptModuleNumber].voicesResourceId, resourcePointer, resourceLength);
- loadModuleVoiceLUT(_modules[scriptModuleNumber], resourcePointer, resourceLength);
+ loadVoiceLUT(_modules[scriptModuleNumber].voiceLUT, resourcePointer, resourceLength);
free(resourcePointer);
}
@@ -266,23 +259,20 @@ void Script::loadModuleBase(ModuleData &module, const byte *resourcePointer, siz
}
}
-void Script::loadModuleVoiceLUT(ModuleData &module, const byte *resourcePointer, size_t resourceLength) {
+void Script::loadVoiceLUT(VoiceLUT &voiceLUT, const byte *resourcePointer, size_t resourceLength) {
uint16 i;
- module.voiceLUT.voicesCount = resourceLength / 2;
- if (module.voiceLUT.voicesCount != module.strings.stringsCount) {
- error("Script::loadModuleVoiceLUT() Voice LUT entries do not match strings entries");
- }
+ voiceLUT.voicesCount = resourceLength / 2;
- module.voiceLUT.voices = (uint16 *)malloc(module.voiceLUT.voicesCount * sizeof(*module.voiceLUT.voices));
- if (module.voiceLUT.voices == NULL) {
- error("Script::loadModuleVoiceLUT() not enough memory");
+ voiceLUT.voices = (uint16 *)malloc(voiceLUT.voicesCount * sizeof(*voiceLUT.voices));
+ if (voiceLUT.voices == NULL) {
+ error("Script::loadVoiceLUT() not enough memory");
}
MemoryReadStreamEndian scriptS(resourcePointer, resourceLength, _scriptContext->isBigEndian);
- for (i = 0; i < module.voiceLUT.voicesCount; i++) {
- module.voiceLUT.voices[i] = scriptS.readUint16();
+ for (i = 0; i < voiceLUT.voicesCount; i++) {
+ voiceLUT.voices[i] = scriptS.readUint16();
}
}
diff --git a/saga/script.h b/saga/script.h
index ae9132c8eb..71a2634e8f 100644
--- a/saga/script.h
+++ b/saga/script.h
@@ -216,8 +216,12 @@ struct VoiceLUT {
uint16 voicesCount;
uint16 *voices;
void freeMem() {
+ voicesCount = 0;
free(voices);
}
+ VoiceLUT() {
+ memset(this, 0, sizeof(*this));
+ }
};
struct ModuleData {
@@ -356,8 +360,6 @@ public:
void loadModule(int scriptModuleNumber);
void freeModules();
- bool isVoiceLUTPresent() const { return _voiceLUTPresent; }
-
void doVerb();
void showVerb(int statusColor = -1);
void setVerb(int verb);
@@ -384,7 +386,6 @@ public:
private:
SagaEngine *_vm;
- bool _voiceLUTPresent;
ResourceContext *_scriptContext;
uint16 _modulesLUTEntryLen;
@@ -422,6 +423,8 @@ public:
bool _skipSpeeches;
bool _abortEnabled;
+ VoiceLUT _globalVoiceLUT;
+
public:
ScriptThread *createThread(uint16 scriptModuleNumber, uint16 scriptEntryPointNumber);
int executeThread(ScriptThread *thread, int entrypointNumber);
@@ -433,9 +436,10 @@ public:
void wakeUpThreads(int waitType);
void wakeUpThreadsDelayed(int waitType, int sleepTime);
+ void loadVoiceLUT(VoiceLUT &voiceLUT, const byte *resourcePointer, size_t resourceLength);
+
private:
void loadModuleBase(ModuleData &module, const byte *resourcePointer, size_t resourceLength);
- void loadModuleVoiceLUT(ModuleData &module, const byte *resourcePointer, size_t resourceLength);
// runThread returns true if we should break running of other threads
bool runThread(ScriptThread *thread, uint instructionLimit);
diff --git a/saga/sthread.cpp b/saga/sthread.cpp
index 5816c6c49f..4dd7a7deef 100644
--- a/saga/sthread.cpp
+++ b/saga/sthread.cpp
@@ -57,7 +57,11 @@ ScriptThread *Script::createThread(uint16 scriptModuleNumber, uint16 scriptEntry
newThread->_moduleBaseSize = _modules[scriptModuleNumber].moduleBaseSize;
newThread->_strings = &_modules[scriptModuleNumber].strings;
- newThread->_voiceLUT = &_modules[scriptModuleNumber].voiceLUT;
+
+ if (_vm->getGameType() == GType_IHNM)
+ newThread->_voiceLUT = &_globalVoiceLUT;
+ else
+ newThread->_voiceLUT = &_modules[scriptModuleNumber].voiceLUT;
return newThread;
}
@@ -611,11 +615,6 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
int16 first;
const char *strings[ACTOR_SPEECH_STRING_MAX];
- if (_vm->getGameType() == GType_IHNM) {
- warning("STUB: opSpeak");
- break;
- }
-
if (_vm->_actor->isSpeaking()) {
thread->wait(kWaitTypeSpeech);
return false;
@@ -650,10 +649,8 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
}
}
- if (_vm->getGameType() == GType_ITE) {
- if (sampleResourceId <= 0 || sampleResourceId > 4000) {
- sampleResourceId = -1;
- }
+ if (sampleResourceId < 0 || sampleResourceId > 4000) {
+ sampleResourceId = -1;
}
_vm->_actor->actorSpeech(actorId, strings, stringsCount, sampleResourceId, speechFlags);