aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/scicore
diff options
context:
space:
mode:
authorFilippos Karapetis2009-04-25 08:50:42 +0000
committerFilippos Karapetis2009-04-25 08:50:42 +0000
commitf1893d8f25b8f4fc5f6ed48e61dec0c2050bd567 (patch)
treef2d7efbb07066bfa142f4e130b96ebef479e2ad9 /engines/sci/scicore
parent86debbd679d20f1188d2ba015e9d108cbbc85f1a (diff)
downloadscummvm-rg350-f1893d8f25b8f4fc5f6ed48e61dec0c2050bd567.tar.gz
scummvm-rg350-f1893d8f25b8f4fc5f6ed48e61dec0c2050bd567.tar.bz2
scummvm-rg350-f1893d8f25b8f4fc5f6ed48e61dec0c2050bd567.zip
WIP (still non-working) code for speech sync in CD talkie games (like e.g. KQ5 CD and SQ4 CD), taken from Greg's SCI implementation.
svn-id: r40142
Diffstat (limited to 'engines/sci/scicore')
-rw-r--r--engines/sci/scicore/resource.cpp32
-rw-r--r--engines/sci/scicore/resource.h16
2 files changed, 48 insertions, 0 deletions
diff --git a/engines/sci/scicore/resource.cpp b/engines/sci/scicore/resource.cpp
index ec738fea44..6132e4bae5 100644
--- a/engines/sci/scicore/resource.cpp
+++ b/engines/sci/scicore/resource.cpp
@@ -1167,4 +1167,36 @@ int ResourceManager::decompress(Resource *res, Common::File *file) {
return error;
}
+void ResourceSync::startSync(Object *obj) {
+ _syncTime = _syncCue = 0xFFFF;
+ // TODO: Convert the following from Greg's code to SCI's code
+ //obj.setPropertyN(g_sci->_objOfs[0x33], 0); // Greg's
+ //obj->variables[s->game_obj.offset[0x33]] = 0; // something like this?
+ _ptr = (uint16 *)data;
+ //syncStarted = true; // not used
+}
+
+void ResourceSync::nextSync(Object *obj) {
+ if (_ptr) {
+ _syncTime = READ_LE_UINT16(_ptr);
+ if (_syncTime == 0xFFFF) {
+ stopSync();
+ } else {
+ _syncCue = READ_LE_UINT16(_ptr + 1);
+ _ptr += 2;
+ }
+ // TODO: Convert the following from Greg's code to SCI's code
+ //obj.setPropertyN(g_sci->_objOfs[0x32], _syncTime); // Greg's
+ //obj->variables[s->game_obj.offset[0x32]] = _syncTime; // something like this?
+ //obj.setPropertyN(g_sci->_objOfs[0x33], _syncCue); // Greg's
+ //obj->variables[s->game_obj.offset[0x33]] = _syncCue; // something like this?
+ }
+}
+//--------------------------------
+void ResourceSync::stopSync() {
+ _ptr = 0;
+ _syncCue = 0xFFFF;
+ //syncStarted = false; // not used
+}
+
} // End of namespace Sci
diff --git a/engines/sci/scicore/resource.h b/engines/sci/scicore/resource.h
index 2f8abf8170..f9d95205d1 100644
--- a/engines/sci/scicore/resource.h
+++ b/engines/sci/scicore/resource.h
@@ -30,6 +30,7 @@
#include "common/file.h"
#include "common/archive.h"
+#include "sci/engine/vm.h" // for Object
#include "sci/scicore/decompressor.h"
namespace Common {
@@ -301,6 +302,21 @@ protected:
void removeFromLRU(Resource *res);
};
+class ResourceSync : public Resource {
+public:
+ ResourceSync() {}
+ ~ResourceSync() {}
+
+ void startSync(Object *obj);
+ void nextSync(Object *obj);
+ void stopSync();
+
+protected:
+ uint16 *_ptr;
+ uint16 _syncTime, _syncCue;
+ //bool _syncStarted; // not used
+};
+
} // End of namespace Sci
#endif // SCI_SCICORE_RESOURCE_H