From f1893d8f25b8f4fc5f6ed48e61dec0c2050bd567 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 25 Apr 2009 08:50:42 +0000 Subject: 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 --- engines/sci/scicore/resource.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'engines/sci/scicore/resource.cpp') 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 -- cgit v1.2.3