[Scummvm-cvs-logs] CVS: scummvm/saga game.cpp,1.92,1.93 rscfile.cpp,1.36,1.37 script.cpp,1.75,1.76 script.h,1.103,1.104 sthread.cpp,1.98,1.99
Eugene Sandulenko
sev at users.sourceforge.net
Tue Aug 9 11:09:57 CEST 2005
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15534
Modified Files:
game.cpp rscfile.cpp script.cpp script.h sthread.cpp
Log Message:
o Fix some game parameters for IHNM
o Load voices LUT for IHNM
Index: game.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/game.cpp,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -d -r1.92 -r1.93
--- game.cpp 6 Aug 2005 12:20:09 -0000 1.92
+++ game.cpp 9 Aug 2005 16:01:03 -0000 1.93
@@ -527,7 +527,7 @@
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 @@
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
Index: rscfile.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/rscfile.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- rscfile.cpp 7 Aug 2005 11:20:43 -0000 1.36
+++ rscfile.cpp 9 Aug 2005 16:01:03 -0000 1.37
@@ -522,46 +522,48 @@
// 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
Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.cpp,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- script.cpp 8 Aug 2005 19:46:32 -0000 1.75
+++ script.cpp 9 Aug 2005 16:01:03 -0000 1.76
@@ -52,8 +52,6 @@
size_t stringsLength;
//initialize member variables
- _voiceLUTPresent = false;
-
_abortEnabled = true;
_skipSpeeches = false;
_conversingThread = NULL;
@@ -118,11 +116,6 @@
_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 @@
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::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();
}
}
Index: script.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.h,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -d -r1.103 -r1.104
--- script.h 7 Aug 2005 18:57:30 -0000 1.103
+++ script.h 9 Aug 2005 16:01:03 -0000 1.104
@@ -216,8 +216,12 @@
uint16 voicesCount;
uint16 *voices;
void freeMem() {
+ voicesCount = 0;
free(voices);
}
+ VoiceLUT() {
+ memset(this, 0, sizeof(*this));
+ }
};
struct ModuleData {
@@ -356,8 +360,6 @@
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 @@
private:
SagaEngine *_vm;
- bool _voiceLUTPresent;
ResourceContext *_scriptContext;
uint16 _modulesLUTEntryLen;
@@ -422,6 +423,8 @@
bool _skipSpeeches;
bool _abortEnabled;
+ VoiceLUT _globalVoiceLUT;
+
public:
ScriptThread *createThread(uint16 scriptModuleNumber, uint16 scriptEntryPointNumber);
int executeThread(ScriptThread *thread, int entrypointNumber);
@@ -433,9 +436,10 @@
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);
Index: sthread.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sthread.cpp,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -d -r1.98 -r1.99
--- sthread.cpp 8 Aug 2005 19:46:33 -0000 1.98
+++ sthread.cpp 9 Aug 2005 16:01:04 -0000 1.99
@@ -57,7 +57,11 @@
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 @@
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 @@
}
}
- 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);
More information about the Scummvm-git-logs
mailing list