aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/support/mouse_cursor.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2016-04-10 14:40:59 -0400
committerPaul Gilbert2016-04-10 14:40:59 -0400
commit1ee3f334d39be6944e643c22cd376d5ae4ffaaf5 (patch)
treec41f2a1b5e5b0f340c47aa7dae0c34c6822d5209 /engines/titanic/support/mouse_cursor.cpp
parent62b087adce4a0fdd0ff6a99ed5a9843ec0b722be (diff)
downloadscummvm-rg350-1ee3f334d39be6944e643c22cd376d5ae4ffaaf5.tar.gz
scummvm-rg350-1ee3f334d39be6944e643c22cd376d5ae4ffaaf5.tar.bz2
scummvm-rg350-1ee3f334d39be6944e643c22cd376d5ae4ffaaf5.zip
TITANIC: Change back to using original AVIDecoder
Diffstat (limited to 'engines/titanic/support/mouse_cursor.cpp')
-rw-r--r--engines/titanic/support/mouse_cursor.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp
index a2bd11657c..6ddfecfd2a 100644
--- a/engines/titanic/support/mouse_cursor.cpp
+++ b/engines/titanic/support/mouse_cursor.cpp
@@ -20,8 +20,9 @@
*
*/
-#include "graphics/cursorman.h"
+#include "common/memstream.h"
#include "common/textconsole.h"
+#include "graphics/cursorman.h"
#include "titanic/support/mouse_cursor.h"
#include "titanic/support/movie.h"
#include "titanic/support/screen_manager.h"
@@ -62,20 +63,39 @@ CMouseCursor::~CMouseCursor() {
void CMouseCursor::loadCursorImages() {
const CString name("ycursors.avi");
- const CResourceKey key(name);
g_vm->_filesManager.fn4(name);
+ // WORKAROUND: We need to manipulate ycursors.avi file so it can be read
+ // by the ScummVM AVIDecoder, by removing the redundant second video track
+ Common::File f;
+ if (!f.open(name))
+ error("Could not open cursors file");
+
+ // Read in the entire file
+ byte *movieData = (byte *)malloc(f.size());
+ f.read(movieData, f.size());
+
+ if (READ_BE_UINT32(movieData + 254) == MKTAG('s', 't', 'r', 'h')) {
+ // Change the second video chunk to junk data so it gets ignored
+ WRITE_BE_UINT32(movieData + 254, MKTAG('J', 'U', 'N', 'K'));
+ WRITE_LE_UINT32(movieData + 258, 1128);
+ }
+
// Iterate through each cursor
for (int idx = 0; idx < NUM_CURSORS; ++idx) {
assert(CURSOR_DATA[idx][0] == (idx + 1));
_cursors[idx]._centroid = Common::Point(CURSOR_DATA[idx][2],
CURSOR_DATA[idx][3]);
+ // Create the surface
CVideoSurface *surface = _screenManager->createSurface(64, 64);
_cursors[idx]._videoSurface = surface;
- OSMovie movie(key, surface);
+ Common::SeekableReadStream *stream = new Common::MemoryReadStream(
+ movieData, f.size(), DisposeAfterUse::NO);
+ OSMovie movie(stream, surface);
movie.setFrame(idx);
+
_cursors[idx]._ptrUnknown = movie.proc21();
surface->set40(_cursors[idx]._ptrUnknown);
}