Unified
Split
Showing
with
46 additions
and 11 deletions.
- +4 −4 engines/director/archive.cpp
- +4 −0 engines/director/events.cpp
- +7 −4 engines/director/lingo/lingo-funcs.cpp
- +28 −2 engines/director/resource.cpp
- +3 −1 engines/director/score.cpp
| @@ -275,8 +275,8 @@ bool RIFFArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff | ||
| if (tag == 0) | ||
| break; | ||
|
|
||
| uint16 startResPos = stream->pos(); | ||
| stream->seek(offset + 12); | ||
| uint32 startResPos = stream->pos(); | ||
| stream->seek(startOffset + offset + 12); | ||
|
|
||
| Common::String name = ""; | ||
| byte nameSize = stream->readByte(); | ||
| @@ -289,11 +289,11 @@ bool RIFFArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff | ||
|
|
||
| stream->seek(startResPos); | ||
|
|
||
| debug(3, "Found RIFF resource '%s' %d: %d @ 0x%08x", tag2str(tag), id, size, offset); | ||
| debug(3, "Found RIFF resource '%s' %d: %d @ 0x%08x", tag2str(tag), id, size, startOffset + offset); | ||
|
|
||
| ResourceMap &resMap = _types[tag]; | ||
| Resource &res = resMap[id]; | ||
| res.offset = offset; | ||
| res.offset = offset + startOffset; | ||
| res.size = size; | ||
| res.name = name; | ||
| } | ||
| @@ -46,6 +46,10 @@ void DirectorEngine::processEvents() { | ||
| uint endTime = g_system->getMillis() + 200; | ||
|
|
||
| Score *sc = getCurrentScore(); | ||
| if (sc->getCurrentFrame() >= sc->_frames.size()) { | ||
| warning("processEvents: request to access frame %d of %d", sc->getCurrentFrame(), sc->_frames.size() - 1); | ||
| return; | ||
| } | ||
| Frame *currentFrame = sc->_frames[sc->getCurrentFrame()]; | ||
| uint16 spriteId = 0; | ||
|
|
||
| @@ -182,14 +182,15 @@ void Lingo::func_goto(Datum &frame, Datum &movie) { | ||
|
|
||
| Common::String cleanedFilename; | ||
|
|
||
| for (const byte *p = (const byte *)movie.u.s->c_str(); *p; p++) | ||
| if (*p >= 0x20 && *p <= 0x7f) | ||
| cleanedFilename += (const char) *p; | ||
|
|
||
| bool fileExists = false; | ||
|
|
||
| if (_vm->getPlatform() == Common::kPlatformMacintosh) { | ||
| Common::MacResManager resMan; | ||
|
|
||
| for (const byte *p = (const byte *)movie.u.s->c_str(); *p; p++) | ||
| if (*p >= 0x20 && *p <= 0x7f) | ||
| cleanedFilename += (const char) *p; | ||
|
|
||
| if (resMan.open(*movie.u.s)) { | ||
| fileExists = true; | ||
| cleanedFilename = *movie.u.s; | ||
| @@ -198,6 +199,8 @@ void Lingo::func_goto(Datum &frame, Datum &movie) { | ||
| } | ||
| } else { | ||
| Common::File file; | ||
| cleanedFilename = *movie.u.s + ".MMM"; | ||
|
|
||
| if (file.open(*movie.u.s)) { | ||
| fileExists = true; | ||
| cleanedFilename = *movie.u.s; | ||
| @@ -20,7 +20,9 @@ | ||
| * | ||
| */ | ||
|
|
||
| #include "common/config-manager.h" | ||
| #include "common/macresman.h" | ||
|
|
||
| #include "graphics/macgui/macwindowmanager.h" | ||
| #include "graphics/macgui/macfontmanager.h" | ||
|
|
||
| @@ -113,15 +115,39 @@ void DirectorEngine::loadEXEv3(Common::SeekableReadStream *stream) { | ||
| if (mmmSize) { | ||
| uint32 riffOffset = stream->pos(); | ||
|
|
||
| debugC(1, kDebugLoading, "RIFF offset: %d (%x)", riffOffset, riffOffset); | ||
|
|
||
| if (ConfMan.getBool("dump_scripts")) { | ||
| Common::DumpFile out; | ||
| byte *buf = (byte *)malloc(mmmSize); | ||
| stream->read(buf, mmmSize); | ||
| stream->seek(riffOffset); | ||
| Common::String fname = Common::String::format("./dumps/%s", mmmFileName.c_str()); | ||
|
|
||
|
|
||
| if (!out.open(fname.c_str())) { | ||
| warning("Can not open dump file %s", fname.c_str()); | ||
| return; | ||
| } | ||
|
|
||
| out.write(buf, mmmSize); | ||
|
|
||
| out.flush(); | ||
| out.close(); | ||
|
|
||
| free(buf); | ||
| } | ||
|
|
||
|
|
||
| _mainArchive = new RIFFArchive(); | ||
|
|
||
| if (!_mainArchive->openStream(stream, riffOffset)) | ||
| error("Failed to load RIFF from EXE"); | ||
|
|
||
| return; | ||
| } | ||
|
|
||
| openMainArchive(mmmFileName); | ||
|
|
||
| delete stream; | ||
| } | ||
|
|
||
| void DirectorEngine::loadEXEv4(Common::SeekableReadStream *stream) { | ||
| @@ -1078,7 +1078,9 @@ void Score::startLoop() { | ||
| while (!_stopPlay && _currentFrame < _frames.size()) { | ||
| debugC(1, kDebugImages, "****************************** Current frame: %d", _currentFrame + 1); | ||
| update(); | ||
| _vm->processEvents(); | ||
|
|
||
| if (_currentFrame < _frames.size()) | ||
| _vm->processEvents(); | ||
| } | ||
| } | ||
|
|
||