diff options
author | Max Lingua | 2014-01-23 18:33:15 -0500 |
---|---|---|
committer | Max Lingua | 2014-01-23 18:33:15 -0500 |
commit | 4ccdb3e2a30ead1fa015437306b046b69b69035b (patch) | |
tree | e7a75774b540d871848791a6a8db9358514a97b2 /engines | |
parent | b69a2c81a7b0ed535e23e91928bc8ba193db744a (diff) | |
parent | 2fe303ce3fff008a58e9750c66e707ec4e7c93d8 (diff) | |
download | scummvm-rg350-4ccdb3e2a30ead1fa015437306b046b69b69035b.tar.gz scummvm-rg350-4ccdb3e2a30ead1fa015437306b046b69b69035b.tar.bz2 scummvm-rg350-4ccdb3e2a30ead1fa015437306b046b69b69035b.zip |
Merge branch 'master' of git://github.com/scummvm/scummvm
Diffstat (limited to 'engines')
32 files changed, 882 insertions, 316 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 87a1228c6a..0b8e585f57 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -25,7 +25,6 @@ #include "engines/engine.h" -#include "common/archive.h" #include "common/array.h" #include "common/error.h" #include "common/keyboard.h" @@ -187,27 +186,6 @@ class Debugger; # define _OPCODE(ver, x) { &ver::x, "" } #endif -class ArchiveMan : public Common::SearchSet { -public: - ArchiveMan(); - - void enableFallback(bool val) { _fallBack = val; } - -#ifdef ENABLE_AGOS2 - void registerArchive(const Common::String &filename, int priority); -#endif - - virtual bool hasFile(const Common::String &name) const; - virtual int listMatchingMembers(Common::ArchiveMemberList &list, const Common::String &pattern) const; - virtual int listMembers(Common::ArchiveMemberList &list) const; - - virtual const Common::ArchiveMemberPtr getMember(const Common::String &name) const; - virtual Common::SeekableReadStream *createReadStreamForMember(const Common::String &filename) const; - -private: - bool _fallBack; -}; - class AGOSEngine : public Engine { protected: friend class Debugger; @@ -622,8 +600,6 @@ public: AGOSEngine(OSystem *system, const AGOSGameDescription *gd); virtual ~AGOSEngine(); - ArchiveMan _archives; - byte *_curSfxFile; uint32 _curSfxFileSize; uint16 _sampleEnd, _sampleWait; diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp index 40c9d1d049..d438de049a 100644 --- a/engines/agos/animation.cpp +++ b/engines/agos/animation.cpp @@ -251,8 +251,8 @@ bool MoviePlayerDXA::load() { } Common::String videoName = Common::String::format("%s.dxa", baseName); - Common::SeekableReadStream *videoStream = _vm->_archives.createReadStreamForMember(videoName); - if (!videoStream) + Common::File *videoStream = new Common::File(); + if (!videoStream->open(videoName)) error("Failed to load video file %s", videoName.c_str()); if (!loadStream(videoStream)) error("Failed to load video stream from file %s", videoName.c_str()); @@ -421,8 +421,8 @@ MoviePlayerSMK::MoviePlayerSMK(AGOSEngine_Feeble *vm, const char *name) bool MoviePlayerSMK::load() { Common::String videoName = Common::String::format("%s.smk", baseName); - Common::SeekableReadStream *videoStream = _vm->_archives.createReadStreamForMember(videoName); - if (!videoStream) + Common::File *videoStream = new Common::File(); + if (!videoStream->open(videoName)) error("Failed to load video file %s", videoName.c_str()); if (!loadStream(videoStream)) error("Failed to load video stream from file %s", videoName.c_str()); @@ -532,25 +532,25 @@ MoviePlayer *makeMoviePlayer(AGOSEngine_Feeble *vm, const char *name) { memcpy(shortName, baseName, 6); sprintf(filename, "%s~1.dxa", shortName); - if (vm->_archives.hasFile(filename)) { + if (Common::File::exists(filename)) { memset(baseName, 0, sizeof(baseName)); memcpy(baseName, filename, 8); } sprintf(filename, "%s~1.smk", shortName); - if (vm->_archives.hasFile(filename)) { + if (Common::File::exists(filename)) { memset(baseName, 0, sizeof(baseName)); memcpy(baseName, filename, 8); } } sprintf(filename, "%s.dxa", baseName); - if (vm->_archives.hasFile(filename)) { + if (Common::File::exists(filename)) { return new MoviePlayerDXA(vm, baseName); } sprintf(filename, "%s.smk", baseName); - if (vm->_archives.hasFile(filename)) { + if (Common::File::exists(filename)) { return new MoviePlayerSMK(vm, baseName); } diff --git a/engines/agos/detection.cpp b/engines/agos/detection.cpp index a5a42a86ad..b6d3c2f020 100644 --- a/engines/agos/detection.cpp +++ b/engines/agos/detection.cpp @@ -28,6 +28,7 @@ #include "common/savefile.h" #include "common/system.h" #include "common/textconsole.h" +#include "common/installshield_cab.h" #include "agos/intern.h" #include "agos/agos.h" @@ -269,8 +270,12 @@ void AGOSEngine::loadArchives() { if (getFeatures() & GF_PACKED) { for (ag = _gameDescription->desc.filesDescriptions; ag->fileName; ag++) { - if (!_archives.hasArchive(ag->fileName)) - _archives.registerArchive(ag->fileName, ag->fileType); + if (!SearchMan.hasArchive(ag->fileName)) { + Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(ag->fileName); + + if (stream) + SearchMan.add(ag->fileName, Common::makeInstallShieldArchive(stream, DisposeAfterUse::YES), ag->fileType); + } } } } diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp index cf1d062d96..1c79a073e8 100644 --- a/engines/agos/res.cpp +++ b/engines/agos/res.cpp @@ -24,7 +24,6 @@ #include "common/archive.h" -#include "common/installshield_cab.h" #include "common/file.h" #include "common/memstream.h" #include "common/textconsole.h" @@ -38,52 +37,6 @@ namespace AGOS { -ArchiveMan::ArchiveMan() { - _fallBack = true; -} - -#ifdef ENABLE_AGOS2 -void ArchiveMan::registerArchive(const Common::String &filename, int priority) { - Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(filename); - - if (stream) - add(filename, makeInstallShieldArchive(stream, DisposeAfterUse::YES), priority); -} -#endif - -bool ArchiveMan::hasFile(const Common::String &name) const { - if (_fallBack && SearchMan.hasFile(name)) - return true; - - return Common::SearchSet::hasFile(name); -} - -int ArchiveMan::listMatchingMembers(Common::ArchiveMemberList &list, const Common::String &pattern) const { - const int matches = _fallBack ? SearchMan.listMatchingMembers(list, pattern) : 0; - return matches + Common::SearchSet::listMatchingMembers(list, pattern); -} - -int ArchiveMan::listMembers(Common::ArchiveMemberList &list) const { - const int matches = _fallBack ? SearchMan.listMembers(list) : 0; - return matches + Common::SearchSet::listMembers(list); -} - -const Common::ArchiveMemberPtr ArchiveMan::getMember(const Common::String &name) const { - Common::ArchiveMemberPtr ptr = _fallBack ? SearchMan.getMember(name) : Common::ArchiveMemberPtr(); - if (ptr) - return ptr; - - return Common::SearchSet::getMember(name); -} - -Common::SeekableReadStream *ArchiveMan::createReadStreamForMember(const Common::String &filename) const { - if (_fallBack && SearchMan.hasFile(filename)) { - return SearchMan.createReadStreamForMember(filename); - } - - return Common::SearchSet::createReadStreamForMember(filename); -} - #ifdef ENABLE_AGOS2 uint16 AGOSEngine_Feeble::to16Wrapper(uint value) { return TO_LE_16(value); @@ -198,39 +151,35 @@ int AGOSEngine::allocGamePcVars(Common::SeekableReadStream *in) { } void AGOSEngine_PN::loadGamePcFile() { - Common::SeekableReadStream *in; - if (getFileName(GAME_BASEFILE) != NULL) { + Common::File in; // Read dataBase - in = _archives.createReadStreamForMember(getFileName(GAME_BASEFILE)); - if (!in) { + if (!in.open(getFileName(GAME_BASEFILE))) { error("loadGamePcFile: Can't load database file '%s'", getFileName(GAME_BASEFILE)); } - _dataBaseSize = in->size(); + _dataBaseSize = in.size(); _dataBase = (byte *)malloc(_dataBaseSize); if (_dataBase == NULL) error("loadGamePcFile: Out of memory for dataBase"); - in->read(_dataBase, _dataBaseSize); - delete in; + in.read(_dataBase, _dataBaseSize); if (_dataBase[31] != 0) error("Later version of system requested"); } if (getFileName(GAME_TEXTFILE) != NULL) { + Common::File in; // Read textBase - in = _archives.createReadStreamForMember(getFileName(GAME_TEXTFILE)); - if (!in) { + if (!in.open(getFileName(GAME_TEXTFILE))) { error("loadGamePcFile: Can't load textbase file '%s'", getFileName(GAME_TEXTFILE)); } - _textBaseSize = in->size(); + _textBaseSize = in.size(); _textBase = (byte *)malloc(_textBaseSize); if (_textBase == NULL) error("loadGamePcFile: Out of memory for textBase"); - in->read(_textBase, _textBaseSize); - delete in; + in.read(_textBase, _textBaseSize); if (_textBase[getlong(30L)] != 128) error("Unknown compression format"); @@ -238,20 +187,19 @@ void AGOSEngine_PN::loadGamePcFile() { } void AGOSEngine::loadGamePcFile() { - Common::SeekableReadStream *in; int fileSize; if (getFileName(GAME_BASEFILE) != NULL) { /* Read main gamexx file */ - in = _archives.createReadStreamForMember(getFileName(GAME_BASEFILE)); - if (!in) { + Common::File in; + if (!in.open(getFileName(GAME_BASEFILE))) { error("loadGamePcFile: Can't load gamexx file '%s'", getFileName(GAME_BASEFILE)); } if (getFeatures() & GF_CRUNCHED_GAMEPC) { - uint srcSize = in->size(); + uint srcSize = in.size(); byte *srcBuf = (byte *)malloc(srcSize); - in->read(srcBuf, srcSize); + in.read(srcBuf, srcSize); uint dstSize = READ_BE_UINT32(srcBuf + srcSize - 4); byte *dstBuf = (byte *)malloc(dstSize); @@ -262,25 +210,23 @@ void AGOSEngine::loadGamePcFile() { readGamePcFile(&stream); free(dstBuf); } else { - readGamePcFile(in); + readGamePcFile(&in); } - delete in; } if (getFileName(GAME_TBLFILE) != NULL) { /* Read list of TABLE resources */ - in = _archives.createReadStreamForMember(getFileName(GAME_TBLFILE)); - if (!in) { + Common::File in; + if (!in.open(getFileName(GAME_TBLFILE))) { error("loadGamePcFile: Can't load table resources file '%s'", getFileName(GAME_TBLFILE)); } - fileSize = in->size(); + fileSize = in.size(); _tblList = (byte *)malloc(fileSize); if (_tblList == NULL) error("loadGamePcFile: Out of memory for strip table list"); - in->read(_tblList, fileSize); - delete in; + in.read(_tblList, fileSize); /* Remember the current state */ _subroutineListOrg = _subroutineList; @@ -290,71 +236,67 @@ void AGOSEngine::loadGamePcFile() { if (getFileName(GAME_STRFILE) != NULL) { /* Read list of TEXT resources */ - in = _archives.createReadStreamForMember(getFileName(GAME_STRFILE)); - if (!in) + Common::File in; + if (!in.open(getFileName(GAME_STRFILE))) error("loadGamePcFile: Can't load text resources file '%s'", getFileName(GAME_STRFILE)); - fileSize = in->size(); + fileSize = in.size(); _strippedTxtMem = (byte *)malloc(fileSize); if (_strippedTxtMem == NULL) error("loadGamePcFile: Out of memory for strip text list"); - in->read(_strippedTxtMem, fileSize); - delete in; + in.read(_strippedTxtMem, fileSize); } if (getFileName(GAME_STATFILE) != NULL) { /* Read list of ROOM STATE resources */ - in = _archives.createReadStreamForMember(getFileName(GAME_STATFILE)); - if (!in) { + Common::File in; + if (!in.open(getFileName(GAME_STATFILE))) { error("loadGamePcFile: Can't load state resources file '%s'", getFileName(GAME_STATFILE)); } - _numRoomStates = in->size() / 8; + _numRoomStates = in.size() / 8; _roomStates = (RoomState *)calloc(_numRoomStates, sizeof(RoomState)); if (_roomStates == NULL) error("loadGamePcFile: Out of memory for room state list"); for (uint s = 0; s < _numRoomStates; s++) { - uint16 num = in->readUint16BE() - (_itemArrayInited - 2); + uint16 num = in.readUint16BE() - (_itemArrayInited - 2); - _roomStates[num].state = in->readUint16BE(); - _roomStates[num].classFlags = in->readUint16BE(); - _roomStates[num].roomExitStates = in->readUint16BE(); + _roomStates[num].state = in.readUint16BE(); + _roomStates[num].classFlags = in.readUint16BE(); + _roomStates[num].roomExitStates = in.readUint16BE(); } - delete in; } if (getFileName(GAME_RMSLFILE) != NULL) { /* Read list of ROOM ITEMS resources */ - in = _archives.createReadStreamForMember(getFileName(GAME_RMSLFILE)); - if (!in) { + Common::File in; + if (!in.open(getFileName(GAME_RMSLFILE))) { error("loadGamePcFile: Can't load room resources file '%s'", getFileName(GAME_RMSLFILE)); } - fileSize = in->size(); + fileSize = in.size(); _roomsList = (byte *)malloc(fileSize); if (_roomsList == NULL) error("loadGamePcFile: Out of memory for room items list"); - in->read(_roomsList, fileSize); - delete in; + in.read(_roomsList, fileSize); } if (getFileName(GAME_XTBLFILE) != NULL) { /* Read list of XTABLE resources */ - in = _archives.createReadStreamForMember(getFileName(GAME_XTBLFILE)); - if (!in) { + Common::File in; + if (!in.open(getFileName(GAME_XTBLFILE))) { error("loadGamePcFile: Can't load xtable resources file '%s'", getFileName(GAME_XTBLFILE)); } - fileSize = in->size(); + fileSize = in.size(); _xtblList = (byte *)malloc(fileSize); if (_xtblList == NULL) error("loadGamePcFile: Out of memory for strip xtable list"); - in->read(_xtblList, fileSize); - delete in; + in.read(_xtblList, fileSize); /* Remember the current state */ _xsubroutineListOrg = _subroutineList; @@ -828,7 +770,7 @@ void AGOSEngine::loadVGABeardFile(uint16 id) { uint32 offs, size; if (getFeatures() & GF_OLD_BUNDLE) { - Common::SeekableReadStream *in; + Common::File in; char filename[15]; if (id == 23) id = 112; @@ -844,22 +786,20 @@ void AGOSEngine::loadVGABeardFile(uint16 id) { sprintf(filename, "0%d.VGA", id); } - in = _archives.createReadStreamForMember(filename); - if (!in) + if (!in.open(filename)) error("loadSimonVGAFile: Can't load %s", filename); - size = in->size(); + size = in.size(); if (getFeatures() & GF_CRUNCHED) { byte *srcBuffer = (byte *)malloc(size); - if (in->read(srcBuffer, size) != size) + if (in.read(srcBuffer, size) != size) error("loadSimonVGAFile: Read failed"); decrunchFile(srcBuffer, _vgaBufferPointers[11].vgaFile2, size); free(srcBuffer); } else { - if (in->read(_vgaBufferPointers[11].vgaFile2, size) != size) + if (in.read(_vgaBufferPointers[11].vgaFile2, size) != size) error("loadSimonVGAFile: Read failed"); } - delete in; } else { offs = _gameOffsetsPtr[id]; @@ -869,7 +809,7 @@ void AGOSEngine::loadVGABeardFile(uint16 id) { } void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { - Common::SeekableReadStream *in; + Common::File in; char filename[15]; byte *dst; uint32 file, offs, srcSize, dstSize; @@ -922,8 +862,7 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { } } - in = _archives.createReadStreamForMember(filename); - if (!in) { + if (!in.open(filename)) { if (useError) error("loadVGAVideoFile: Can't load %s", filename); @@ -931,11 +870,11 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { return; } - dstSize = srcSize = in->size(); + dstSize = srcSize = in.size(); if (getGameType() == GType_PN && getPlatform() == Common::kPlatformDOS && id == 17 && type == 2) { // The A2.out file isn't compressed in PC version of Personal Nightmare dst = allocBlock(dstSize + extraBuffer); - if (in->read(dst, dstSize) != dstSize) + if (in.read(dst, dstSize) != dstSize) error("loadVGAVideoFile: Read failed"); } else if (getGameType() == GType_PN && (getFeatures() & GF_CRUNCHED)) { Common::Stack<uint32> data; @@ -943,7 +882,7 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { int dataOutSize = 0; for (uint i = 0; i < srcSize / 4; ++i) { - uint32 dataVal = in->readUint32BE(); + uint32 dataVal = in.readUint32BE(); // Correct incorrect byte, in corrupt 72.out file, included in some PC versions. if (dataVal == 168042714) data.push(168050906); @@ -957,7 +896,7 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { delete[] dataOut; } else if (getFeatures() & GF_CRUNCHED) { byte *srcBuffer = (byte *)malloc(srcSize); - if (in->read(srcBuffer, srcSize) != srcSize) + if (in.read(srcBuffer, srcSize) != srcSize) error("loadVGAVideoFile: Read failed"); dstSize = READ_BE_UINT32(srcBuffer + srcSize - 4); @@ -966,10 +905,9 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { free(srcBuffer); } else { dst = allocBlock(dstSize + extraBuffer); - if (in->read(dst, dstSize) != dstSize) + if (in.read(dst, dstSize) != dstSize) error("loadVGAVideoFile: Read failed"); } - delete in; } else { id = id * 2 + (type - 1); offs = _gameOffsetsPtr[id]; diff --git a/engines/agos/res_snd.cpp b/engines/agos/res_snd.cpp index 2777d4f269..86d24e0b07 100644 --- a/engines/agos/res_snd.cpp +++ b/engines/agos/res_snd.cpp @@ -450,17 +450,14 @@ static const char *const dimpSoundList[32] = { void AGOSEngine::loadSoundFile(const char* filename) { - Common::SeekableReadStream *in; - - in = _archives.createReadStreamForMember(filename); - if (!in) + Common::File in; + if (!in.open(filename)) error("loadSound: Can't load %s", filename); - uint32 dstSize = in->size(); + uint32 dstSize = in.size(); byte *dst = (byte *)malloc(dstSize); - if (in->read(dst, dstSize) != dstSize) + if (in.read(dst, dstSize) != dstSize) error("loadSound: Read failed"); - delete in; _sound->playSfxData(dst, 0, 0, 0); } @@ -469,21 +466,19 @@ void AGOSEngine::loadSound(uint16 sound, int16 pan, int16 vol, uint16 type) { byte *dst; if (getGameId() == GID_DIMP) { - Common::SeekableReadStream *in; + Common::File in; char filename[15]; assert(sound >= 1 && sound <= 32); sprintf(filename, "%s.wav", dimpSoundList[sound - 1]); - in = _archives.createReadStreamForMember(filename); - if (!in) + if (!in.open(filename)) error("loadSound: Can't load %s", filename); - uint32 dstSize = in->size(); + uint32 dstSize = in.size(); dst = (byte *)malloc(dstSize); - if (in->read(dst, dstSize) != dstSize) + if (in.read(dst, dstSize) != dstSize) error("loadSound: Read failed"); - delete in; } else if (getFeatures() & GF_ZLIBCOMP) { char filename[15]; diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp index 8eb7f066b3..8b133971de 100644 --- a/engines/agos/saveload.cpp +++ b/engines/agos/saveload.cpp @@ -1031,7 +1031,12 @@ bool AGOSEngine::loadGame(const Common::String &filename, bool restartMode) { if (restartMode) { // Load restart state - f = _archives.createReadStreamForMember(filename); + Common::File *file = new Common::File(); + if (!file->open(filename)) { + delete file; + file = nullptr; + } + f = file; } else { f = _saveFileMan->openForLoading(filename); } @@ -1205,7 +1210,12 @@ bool AGOSEngine_Elvira2::loadGame(const Common::String &filename, bool restartMo if (restartMode) { // Load restart state - f = _archives.createReadStreamForMember(filename); + Common::File *file = new Common::File(); + if (!file->open(filename)) { + delete file; + file = nullptr; + } + f = file; } else { f = _saveFileMan->openForLoading(filename); } diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp index f5aad2dcc8..7a84a20808 100644 --- a/engines/agos/subroutine.cpp +++ b/engines/agos/subroutine.cpp @@ -266,8 +266,8 @@ Common::SeekableReadStream *AGOSEngine::openTablesFile(const char *filename) { } Common::SeekableReadStream *AGOSEngine::openTablesFile_simon1(const char *filename) { - Common::SeekableReadStream *in = _archives.createReadStreamForMember(filename); - if (!in) + Common::File *in = new Common::File(); + if (!in->open(filename)) error("openTablesFile: Can't open '%s'", filename); return in; } diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index dbe434cde3..a7e7be0ad3 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -532,75 +532,9 @@ Common::Error AvalancheEngine::run() { do { runAvalot(); - -#if 0 - switch (_storage._operation) { - case kRunShootemup: - run("seu.avx", kJsb, kBflight, kNormal); - break; - case kRunDosshell: - dosShell(); - break; - case kRunGhostroom: - run("g-room.avx", kJsb, kNoBflight, kNormal); - break; - case kRunGolden: - run("golden.avx", kJsb, kBflight, kMusical); - break; - } -#endif - } while (!_letMeOut && !shouldQuit()); return Common::kNoError; } -#if 0 -void AvalancheEngine::run(Common::String what, bool withJsb, bool withBflight, Elm how) { - // Probably there'll be no need of this function, as all *.AVX-es will become classes. - warning("STUB: run(%s)", what.c_str()); -} - -Common::String AvalancheEngine::elmToStr(Elm how) { - switch (how) { - case kNormal: - case kMusical: - return Common::String("jsb"); - case kRegi: - return Common::String("REGI"); - case kElmpoyten: - return Common::String("ELMPOYTEN"); - // Useless, but silent a warning - default: - return Common::String(""); - } -} - -// Same as keypressed1(). -void AvalancheEngine::flushBuffer() { - warning("STUB: flushBuffer()"); -} - -void AvalancheEngine::dosShell() { - warning("STUB: dosShell()"); -} - -// Needed in dos_shell(). TODO: Remove later. -Common::String AvalancheEngine::commandCom() { - warning("STUB: commandCom()"); - return ("STUB: commandCom()"); -} - -// Needed for run_avalot()'s errors. TODO: Remove later. -void AvalancheEngine::explain(byte error) { - warning("STUB: explain()"); -} - -// Needed later. -void AvalancheEngine::quit() { - cursorOn(); -} - -#endif - } // End of namespace Avalanche diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index ef2338e629..fe13fa8d9e 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -128,43 +128,6 @@ private: AvalancheConsole *_console; Common::Platform _platform; -#if 0 - struct { - byte _operation; - uint16 _skellern; - byte _contents[1000]; - } _storage; - - static const int16 kRunShootemup = 1, kRunDosshell = 2, kRunGhostroom = 3, kRunGolden = 4; - static const int16 kReset = 0; - - static const bool kJsb = true, kNoJsb = false, kBflight = true, kNoBflight = false; - - // From bootstrp: - enum Elm {kNormal, kMusical, kElmpoyten, kRegi}; - - Common::String _argsWithNoFilename; - byte _originalMode; - byte *_old1c; - Common::String _segofs; - int32 _soundcard, _speed, _baseaddr, _irq, _dma; - bool _zoomy; - - void run(Common::String what, bool withJsb, bool withBflight, Elm how); - void bFlightOn(); - void bFlightOff(); - Common::String elmToStr(Elm how); - bool keyPressed(); - void flushBuffer(); - void dosShell(); - void bFlight(); - Common::String commandCom(); - void explain(byte error); - void cursorOff(); - void cursorOn(); - void quit(); -#endif - public: // For Thinkabout: static const bool kThing = true; @@ -173,7 +136,6 @@ public: static const char kSpludwicksOrder[3]; static const uint16 kNotes[12]; - static const TuneType kTune; bool _holdLeftMouse; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 04fd2a8d98..6648e8d961 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -76,11 +76,6 @@ namespace Avalanche { const char AvalancheEngine::kSpludwicksOrder[3] = {kObjectOnion, kObjectInk, kObjectMushroom}; const uint16 AvalancheEngine::kNotes[12] = {196, 220, 247, 262, 294, 330, 350, 392, 440, 494, 523, 587}; -const TuneType AvalancheEngine::kTune = { - kPitchHigher, kPitchHigher, kPitchLower, kPitchSame, kPitchHigher, kPitchHigher, kPitchLower, kPitchHigher, kPitchHigher, kPitchHigher, - kPitchLower, kPitchHigher, kPitchHigher, kPitchSame, kPitchHigher, kPitchLower, kPitchLower, kPitchLower, kPitchLower, kPitchHigher, - kPitchHigher, kPitchLower, kPitchLower, kPitchLower, kPitchLower, kPitchSame, kPitchLower, kPitchHigher, kPitchSame, kPitchLower, kPitchHigher -}; Room AvalancheEngine::_whereIs[29] = { // The Lads @@ -257,13 +252,6 @@ void AvalancheEngine::init() { _also[i][j] = nullptr; } -#if 0 - if (_vm->_enhanced->atbios) - atkey = "f1"; - else - atkey = "alt-"; -#endif - _letMeOut = false; _currentMouse = 177; _dropsOk = true; @@ -1287,7 +1275,7 @@ void AvalancheEngine::minorRedraw() { } void AvalancheEngine::majorRedraw() { - warning("STUB: major_redraw()"); + _graphics->refreshScreen(); } uint16 AvalancheEngine::bearing(byte whichPed) { diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index e5b8f3d490..9afb4a7b63 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -38,9 +38,6 @@ class AvalancheEngine; static const byte kObjectNum = 18; // always preface with a # static const int16 kCarryLimit = 12; // carry limit -static const int16 kNumlockCode = 32; // Code for Num Lock -static const int16 kMouseSize = 134; - struct PedType { int16 _x, _y; Direction _direction; @@ -59,8 +56,6 @@ struct LineType : public FieldType { Color _color; }; -typedef int8 TuneType[31]; - struct QuasipedType { byte _whichPed; Color _textColor; @@ -69,15 +64,6 @@ struct QuasipedType { People _who; }; -#if 0 -struct Sundry { // Things which must be saved over a backtobootstrap, outside DNA. - Common::String _qEnidFilename; - bool _qSoundFx; - byte _qThinks; - bool _qThinkThing; -}; -#endif - } // End of namespace Avalanche #endif // AVALANCHE_AVALOT_H diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index c68ad4b002..2174df3580 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -34,6 +34,12 @@ namespace Avalanche { +const Dialogs::TuneType Dialogs::kTune = { + kPitchHigher, kPitchHigher, kPitchLower, kPitchSame, kPitchHigher, kPitchHigher, kPitchLower, kPitchHigher, kPitchHigher, kPitchHigher, + kPitchLower, kPitchHigher, kPitchHigher, kPitchSame, kPitchHigher, kPitchLower, kPitchLower, kPitchLower, kPitchLower, kPitchHigher, + kPitchHigher, kPitchLower, kPitchLower, kPitchLower, kPitchLower, kPitchSame, kPitchLower, kPitchHigher, kPitchSame, kPitchLower, kPitchHigher +}; + // A quasiped defines how people who aren't sprites talk. For example, quasiped // "A" is Dogfood. The rooms aren't stored because I'm leaving that to context. const QuasipedType Dialogs::kQuasipeds[16] = { @@ -270,7 +276,7 @@ bool Dialogs::theyMatch(TuneType &played) { byte mistakes = 0; for (unsigned int i = 0; i < sizeof(played); i++) { - if (played[i] != _vm->kTune[i]) + if (played[i] != kTune[i]) mistakes++; } diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h index 43e6a4fec6..defd152db5 100644 --- a/engines/avalanche/dialogs.h +++ b/engines/avalanche/dialogs.h @@ -70,6 +70,9 @@ private: kFontStyleItalic }; + typedef int8 TuneType[31]; + + static const TuneType kTune; static const int16 kHalfIconWidth = 19; static const QuasipedType kQuasipeds[16]; diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index ea3b621d69..636ae6fdf9 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -123,6 +123,7 @@ public: void removeBackup(); private: + static const int16 kMouseSize = 134; static const uint16 kBackgroundWidth = kScreenWidth; static const byte kEgaPaletteIndex[16]; static const byte kBackgroundHeight = 8 * 12080 / kScreenWidth; // With 640 width it's 151. diff --git a/engines/engine.cpp b/engines/engine.cpp index 52020c772e..8326a1fe89 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -154,6 +154,10 @@ Engine::~Engine() { CursorMan.popCursorPalette(); } +void Engine::initializePath(const Common::FSNode &gamePath) { + SearchMan.addDirectory(gamePath.getPath(), gamePath, 0, 4); +} + void initCommonGFX(bool defaultTo1XScaler) { const Common::ConfigManager::Domain *transientDomain = ConfMan.getDomain(Common::ConfigManager::kTransientDomain); const Common::ConfigManager::Domain *gameDomain = ConfMan.getActiveDomain(); diff --git a/engines/engine.h b/engines/engine.h index 4f4223384a..33416dda44 100644 --- a/engines/engine.h +++ b/engines/engine.h @@ -37,6 +37,7 @@ class Error; class EventManager; class SaveFileManager; class TimerManager; +class FSNode; } namespace GUI { class Debugger; @@ -142,6 +143,16 @@ public: virtual ~Engine(); /** + * Init SearchMan according to the game path. + * + * By default it adds the directory in non-flat mode with a depth of 4 as + * priority 0 to SearchMan. + * + * @param gamePath The base directory of the game data. + */ + virtual void initializePath(const Common::FSNode &gamePath); + + /** * Init the engine and start its main loop. * @return returns kNoError on success, else an error code. */ diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index 29680486c3..e25a6f464a 100644 --- a/engines/fullpipe/constants.h +++ b/engines/fullpipe/constants.h @@ -1298,6 +1298,73 @@ namespace Fullpipe { #define ST_RNG_CLOSED2 4865 #define ST_RNG_OPEN 2606 +// Scene 38 +#define ANI_BOTTLE38 2188 +#define ANI_DOMINO38 2200 +#define ANI_DOMINOS 3317 +#define ANI_DYLDA 2169 +#define ANI_GLAVAR 2154 +#define ANI_MALYSH 2165 +#define MSG_SC38_DRINK 2225 +#define MSG_SC38_HMRKICK 2224 +#define MSG_SC38_POINT 2226 +#define MSG_SC38_POSTHMRKICK 2256 +#define MSG_SC38_PROPOSE 2287 +#define MSG_SC38_TRYTAKEBOTTLE 3179 +#define MV_DMS_FOUR 3322 +#define MV_DMS_THREE 3321 +#define MV_GLV_LOOKMAN 2167 +#define ST_BTL38_FULL 3172 +#define ST_DMN38_6 2288 +#define ST_DMN38_NORM3 2251 +#define ST_DMN38_NORM4 2253 +#define ST_DMS_3 3319 +#define ST_DMS_4 3320 +#define ST_GLV_HAMMER 2156 +#define ST_GLV_NOHAMMER 2159 +#define ST_GLV_SLEEP2 2166 +#define ST_MLS_LEFT2 2291 +#define ST_MLS_RIGHT2 3323 +#define QU_DLD_BLINK 2216 +#define QU_DLD_DENY 2218 +#define QU_DLD_GLOT 2217 +#define QU_DLD_ICK 2219 +#define QU_DLD_TAKE1 2214 +#define QU_DLD_TAKE2 2215 +#define QU_GLV_DRINK 2210 +#define QU_GLV_DRINKBOTTLE 2286 +#define QU_GLV_DRINK_NOHMR 2211 +#define QU_GLV_HMRKICK 2207 +#define QU_GLV_PROPOSE 2280 +#define QU_GLV_PROPOSE_NOHMR 2281 +#define QU_GLV_TAKEDOMINO 2170 +#define QU_GLV_TAKEDOMINO_NOHMR 3182 +#define QU_GLV_TOSMALL 2208 +#define QU_GLV_TOSMALL_NOHMR 2209 +#define QU_MLS_BLINK 2222 +#define QU_MLS_HAND 2223 +#define QU_MLS_TURNL 2220 +#define QU_MLS_TURNR 2221 +#define QU_SC38_SHOWBOTTLE 2199 +#define QU_SC38_SHOWBOTTLE_ONTABLE 2838 +#define QU_SC38_ENTERLIFT 2836 +#define QU_SC38_EXITLIFT 2837 + +// Final scene +#define ANI_FIN_COIN 5014 +#define MSG_FIN_ENDFINAL 5109 +#define MSG_FIN_GOTO2 5024 +#define MSG_FIN_GOTO3 5071 +#define MSG_FIN_GOTO4 5075 +#define MSG_FIN_STARTFINAL 5025 +#define MSG_FN4_STARTMUSIC 5356 +#define QU_FIN1_FALLCOIN 5018 +#define QU_FIN1_TAKECOIN 5023 +#define QU_FN2_DOFINAL 5066 +#define QU_FN3_DOFINAL 5072 +#define QU_FN4_DOFINAL 5108 +#define ST_FCN_NORM 5017 + // Debug scene #define MSG_RESTARTGAME 4767 #define PIC_SCD_1 727 diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index ecf3c12982..aa6e0dac3a 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -269,6 +269,7 @@ public: int lift_getButtonIdP(int objid); void lift_setButton(const char *name, int state); void lift_sub5(Scene *sc, int qu1, int qu2); + void lift_sub7(Scene *sc, int buttonId); void lift_exitSeq(ExCommand *ex); void lift_closedoorSeq(); void lift_animation3(); diff --git a/engines/fullpipe/lift.cpp b/engines/fullpipe/lift.cpp index cb811d610c..e5c566ebcf 100644 --- a/engines/fullpipe/lift.cpp +++ b/engines/fullpipe/lift.cpp @@ -111,4 +111,9 @@ bool FullpipeEngine::lift_checkButton(const char *varname) { return false; } +void FullpipeEngine::lift_sub7(Scene *sc, int buttonId) { + warning("STUB: lift_sub7()"); +} + + } // End of namespace Fullpipe diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h index af52e1b6a9..65210aaab3 100644 --- a/engines/fullpipe/modal.h +++ b/engines/fullpipe/modal.h @@ -106,6 +106,18 @@ class ModalMap : public BaseModalObject { PictureObject *getScenePicture(); }; +class ModalFinal : public BaseModalObject { + public: + ModalFinal() {} + virtual ~ModalFinal() {} + + virtual bool pollEvent() { return true; } + virtual bool handleMessage(ExCommand *message) { return false; } + virtual bool init(int counterdiff) { return true; } + virtual void update() {} + virtual void saveload() {} +}; + } // End of namespace Fullpipe #endif /* FULLPIPE_MODAL_H */ diff --git a/engines/fullpipe/module.mk b/engines/fullpipe/module.mk index a6924911bc..f6a94de421 100644 --- a/engines/fullpipe/module.mk +++ b/engines/fullpipe/module.mk @@ -58,6 +58,8 @@ MODULE_OBJS = \ scenes/scene35.o \ scenes/scene36.o \ scenes/scene37.o \ + scenes/scene38.o \ + scenes/sceneFinal.o \ scenes/sceneDbg.o # This module can be built as a plugin diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp index c021a02d74..71c8b1efb5 100644 --- a/engines/fullpipe/scenes.cpp +++ b/engines/fullpipe/scenes.cpp @@ -365,6 +365,27 @@ Vars::Vars() { scene37_soundFlipper = 0; scene37_dudeX = 0; + scene38_boss = 0; + scene38_tally = 0; + scene38_shorty = 0; + scene38_domino0 = 0; + scene38_dominos = 0; + scene38_domino1 = 0; + scene38_bottle = 0; + scene38_bossCounter = 0; + scene38_lastBossAnim = 0; + scene38_bossAnimCounter = 0; + scene38_tallyCounter = 0; + scene38_lastTallyAnim = 0; + scene38_tallyAnimCounter = 0; + scene38_shortyCounter = 0; + scene38_lastShortyAnim = 0; + scene38_shortyAnimCounter = 0; + + sceneFinal_var01 = 0; + sceneFinal_var02 = 0; + sceneFinal_var03 = 0; + selector = 0; } @@ -954,7 +975,6 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { _updateCursorCallback = scene37_updateCursor; break; -#if 0 case SC_38: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_38"); scene->preloadMovements(sceneVar); @@ -969,14 +989,13 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { case SC_FINAL1: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_FINAL1"); scene->preloadMovements(sceneVar); - sceneFinal1_initScene(); + sceneFinal_initScene(); _behaviorManager->initBehavior(scene, sceneVar); scene->initObjectCursors("SC_FINAL1"); setSceneMusicParameters(sceneVar); - addMessageHandler(sceneHandlerFinal1, 2); - _updateCursorCallback = sceneFinal1_updateCursor; + addMessageHandler(sceneHandlerFinal, 2); + _updateCursorCallback = sceneFinal_updateCursor; break; -#endif case SC_DBGMENU: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_DBGMENU"); diff --git a/engines/fullpipe/scenes.h b/engines/fullpipe/scenes.h index 61fb5b33ab..5f77f74706 100644 --- a/engines/fullpipe/scenes.h +++ b/engines/fullpipe/scenes.h @@ -173,6 +173,13 @@ void scene37_initScene(Scene *sc); int sceneHandler37(ExCommand *ex); int scene37_updateCursor(); +void scene38_initScene(Scene *sc); +int sceneHandler38(ExCommand *ex); + +int sceneFinal_updateCursor(); +void sceneFinal_initScene(); +int sceneHandlerFinal(ExCommand *cmd); + void sceneDbgMenu_initScene(Scene *sc); int sceneHandlerDbgMenu(ExCommand *cmd); @@ -516,6 +523,27 @@ public: int scene37_soundFlipper; int scene37_dudeX; + StaticANIObject *scene38_boss; + StaticANIObject *scene38_tally; + StaticANIObject *scene38_shorty; + StaticANIObject *scene38_domino0; + StaticANIObject *scene38_dominos; + StaticANIObject *scene38_domino1; + StaticANIObject *scene38_bottle; + int scene38_bossCounter; + int scene38_lastBossAnim; + int scene38_bossAnimCounter; + int scene38_tallyCounter; + int scene38_lastTallyAnim; + int scene38_tallyAnimCounter; + int scene38_shortyCounter; + int scene38_lastShortyAnim; + int scene38_shortyAnimCounter; + + int sceneFinal_var01; + int sceneFinal_var02; + int sceneFinal_var03; + PictureObject *selector; }; diff --git a/engines/fullpipe/scenes/scene38.cpp b/engines/fullpipe/scenes/scene38.cpp new file mode 100644 index 0000000000..198a88f25d --- /dev/null +++ b/engines/fullpipe/scenes/scene38.cpp @@ -0,0 +1,409 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene38_setBottleState(Scene *sc) { + ExCommand *ex = sc->getMessageQueueById(QU_SC38_SHOWBOTTLE_ONTABLE)->getExCommandByIndex(0); + + if (g_vars->scene38_bottle->_ox == ex->_x && g_vars->scene38_bottle->_oy == ex->_y) { + if (g_fp->lift_checkButton(sO_Level5) ) { + ex = sc->getMessageQueueById(QU_SC38_SHOWBOTTLE)->getExCommandByIndex(0); + + g_vars->scene38_bottle->setOXY(ex->_x, ex->_y); + g_vars->scene38_bottle->_priority = ex->_field_14; + + g_fp->setObjectState(sO_Bottle_38, g_fp->getObjectEnumState(sO_Bottle_38, sO_Blocked)); + } + } +} + +void scene38_initScene(Scene *sc) { + g_vars->scene38_boss = sc->getStaticANIObject1ById(ANI_GLAVAR, -1); + g_vars->scene38_tally = sc->getStaticANIObject1ById(ANI_DYLDA, -1); + g_vars->scene38_shorty = sc->getStaticANIObject1ById(ANI_MALYSH, -1); + g_vars->scene38_domino0 = sc->getStaticANIObject1ById(ANI_DOMINO38, 0); + g_vars->scene38_dominos = sc->getStaticANIObject1ById(ANI_DOMINOS, 0); + g_vars->scene38_domino1 = sc->getStaticANIObject1ById(ANI_DOMINO38, 1); + g_vars->scene38_bottle = sc->getStaticANIObject1ById(ANI_BOTTLE38, 0); + g_vars->scene38_bossCounter = 0; + g_vars->scene38_lastBossAnim = 0; + g_vars->scene38_bossAnimCounter = 0; + g_vars->scene38_tallyCounter = 15; + g_vars->scene38_lastTallyAnim = 0; + g_vars->scene38_tallyAnimCounter = 0; + g_vars->scene38_shortyCounter = 30; + g_vars->scene38_lastShortyAnim = 0; + g_vars->scene38_shortyAnimCounter = 0; + + scene38_setBottleState(sc); + + if (g_fp->getObjectState(sO_Boss) == g_fp->getObjectEnumState(sO_Boss, sO_IsSleeping)) { + g_vars->scene38_shorty->_flags &= 0xFFFB; + + g_vars->scene38_tally->stopAnim_maybe(); + g_vars->scene38_tally->_flags &= 0xFFFB; + + g_vars->scene38_domino0->_flags &= 0xFFFB; + g_vars->scene38_dominos->_flags &= 0xFFFB; + g_vars->scene38_domino1->_flags &= 0xFFFB; + } + + g_fp->lift_sub5(sc, QU_SC38_ENTERLIFT, QU_SC38_EXITLIFT); + g_fp->lift_sub7(sc, ST_LBN_0N); +} + +void sceneHandler38_tryTakeBottle() { + g_vars->scene38_boss->changeStatics2(ST_GLV_NOHAMMER); + g_vars->scene38_boss->startAnim(MV_GLV_LOOKMAN, 0, -1); + + g_vars->scene38_bossCounter = 0; +} + +void sceneHandler38_postHammerKick() { + g_vars->scene38_domino1->setOXY(g_vars->scene38_domino1->_ox, g_vars->scene38_domino1->_oy + 2); +} + +void sceneHandler38_propose() { + if (!g_vars->scene38_tally->_movement) { + if (g_vars->scene38_tally->_flags & 4) { + if (!(g_vars->scene38_tally->_flags & 2) && g_vars->scene38_tallyCounter > 0 + && g_fp->_rnd->getRandomNumber(32767) < 32767) { + chainQueue(QU_DLD_DENY, 0); + g_vars->scene38_tallyCounter = 0; + } + } + } +} + +void sceneHandler38_point() { + if ((!g_vars->scene38_boss->_movement && ((g_vars->scene38_boss->_flags & 4) || !(g_vars->scene38_boss->_flags & 2))) + && g_vars->scene38_bossCounter > 0 + && g_fp->_rnd->getRandomNumber(32767) < 32767) { + if (g_vars->scene38_boss->_statics->_staticsId == ST_GLV_HAMMER) { + chainQueue(QU_GLV_TOSMALL, 0); + g_vars->scene38_bossCounter = 0; + } else { + if (g_vars->scene38_boss->_statics->_staticsId == ST_GLV_NOHAMMER) + chainQueue(QU_GLV_TOSMALL_NOHMR, 0); + + g_vars->scene38_bossCounter = 0; + } + } +} + +void sceneHandler38_hammerKick() { + if (!g_vars->scene38_shorty->_movement) { + if (g_vars->scene38_shorty->_flags & 4) { + if (!(g_vars->scene38_shorty->_flags & 2) && g_vars->scene38_shortyCounter > 1 + && g_vars->scene38_shorty->_statics->_staticsId == ST_MLS_LEFT2 + && g_fp->_rnd->getRandomNumber(32767) < 3276) { + chainQueue(QU_MLS_TURNR, 0); + g_vars->scene38_shortyCounter = 0; + } + } + } + + g_vars->scene38_domino1->setOXY(g_vars->scene38_domino1->_ox, g_vars->scene38_domino1->_oy - 2); + + if (g_vars->scene38_dominos->_statics->_staticsId == ST_DMS_3) + g_vars->scene38_dominos->startAnim(MV_DMS_THREE, 0, -1); + else if (g_vars->scene38_dominos->_statics->_staticsId == ST_DMS_4) + g_vars->scene38_dominos->startAnim(MV_DMS_FOUR, 0, -1); +} + +void sceneHandler38_drink() { + if (!g_vars->scene38_shorty->_movement) { + if (g_vars->scene38_shorty->_flags & 4) { + if (!(g_vars->scene38_shorty->_flags & 2) && g_vars->scene38_shortyCounter > 0 + && g_vars->scene38_shorty->_statics->_staticsId == ST_MLS_LEFT2 + && g_fp->_rnd->getRandomNumber(32767) < 3276) { + chainQueue(QU_MLS_TURNR, 0); + g_vars->scene38_shortyCounter = 0; + } + } + } +} + +void sceneHandler38_animateAlcoholics() { + MessageQueue *mq; + + if (g_vars->scene38_boss->_movement || !(g_vars->scene38_boss->_flags & 4) || (g_vars->scene38_boss->_flags & 2)) { + g_vars->scene38_bossCounter = 0; + } else { + g_vars->scene38_bossCounter++; + } + + if (g_vars->scene38_bossCounter >= 50) { + int bossSt = g_vars->scene38_boss->_statics->_staticsId; + + if (bossSt == ST_GLV_SLEEP2) { + g_vars->scene38_bossCounter = 0; + } else if ((g_vars->scene38_domino0->_flags & 4) && g_vars->scene38_domino0->_statics->_staticsId == ST_DMN38_6) { + if (bossSt == ST_GLV_HAMMER) { + chainQueue(QU_GLV_TAKEDOMINO, 1); + g_vars->scene38_bossCounter = 0; + } + + if (bossSt == ST_GLV_NOHAMMER) { + chainQueue(QU_GLV_TAKEDOMINO_NOHMR, 1); + g_vars->scene38_bossCounter = 0; + } + } else { + if ((g_vars->scene38_bottle->_flags & 4) && g_vars->scene38_bottle->_statics->_staticsId == ST_BTL38_FULL && bossSt == ST_GLV_NOHAMMER) { + chainQueue(QU_GLV_DRINKBOTTLE, 1); + g_vars->scene38_bossCounter = 0; + } else { + int bossAnim = 0; + + if (g_fp->_rnd->getRandomNumber(32767) >= 1310 || g_vars->scene38_boss->_statics->_staticsId != ST_GLV_HAMMER) { + if (g_fp->_rnd->getRandomNumber(32767) >= 1310) { + if (g_fp->_rnd->getRandomNumber(32767) < 1310) { + if (bossSt == ST_GLV_HAMMER) + bossAnim = QU_GLV_DRINK; + else if (bossSt == ST_GLV_NOHAMMER) + bossAnim = QU_GLV_DRINK_NOHMR; + } + } else { + if (bossSt == ST_GLV_HAMMER) + bossAnim = QU_GLV_PROPOSE; + else if (bossSt == ST_GLV_NOHAMMER) + bossAnim = QU_GLV_PROPOSE_NOHMR; + } + } else { + bossAnim = QU_GLV_HMRKICK; + } + + if (g_vars->scene38_lastBossAnim == bossAnim) { + g_vars->scene38_bossAnimCounter++; + + if (g_vars->scene38_bossAnimCounter > 2) + bossAnim = 0; + } else { + g_vars->scene38_lastBossAnim = bossAnim; + g_vars->scene38_bossAnimCounter = 1; + } + + if (bossAnim > 0) { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(bossAnim), 0, 0); + + mq->chain(0); + + g_vars->scene38_bossCounter = 0; + } + } + } + } + + if (g_vars->scene38_tally->_movement || !(g_vars->scene38_tally->_flags & 4) || (g_vars->scene38_tally->_flags & 2)) { + g_vars->scene38_tallyCounter = 0; + } else { + g_vars->scene38_tallyCounter++; + } + + if (g_vars->scene38_tallyCounter >= 50) { + int tallyAnim = 0; + + if (g_fp->_rnd->getRandomNumber(32767) >= 1310) { + if (g_fp->_rnd->getRandomNumber(32767) >= 1310) { + if (g_fp->_rnd->getRandomNumber(32767) >= 1310) { + if (g_fp->_rnd->getRandomNumber(32767) < 1310) + tallyAnim = QU_DLD_ICK; + } else { + tallyAnim = QU_DLD_GLOT; + } + } else { + tallyAnim = QU_DLD_BLINK; + } + } else { + if (g_vars->scene38_domino1->_statics->_staticsId == ST_DMN38_NORM3) { + tallyAnim = QU_DLD_TAKE1; + } else if (g_vars->scene38_domino1->_statics->_staticsId == ST_DMN38_NORM4) { + tallyAnim = QU_DLD_TAKE2; + } + } + + if (g_vars->scene38_lastTallyAnim == tallyAnim) { + g_vars->scene38_tallyAnimCounter++; + + if (g_vars->scene38_tallyAnimCounter++ > 2) + tallyAnim = 0; + } else { + g_vars->scene38_lastTallyAnim = tallyAnim; + g_vars->scene38_tallyAnimCounter = 1; + } + if (tallyAnim > 0) { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(tallyAnim), 0, 0); + + mq->chain(0); + g_vars->scene38_tallyCounter = 0; + } + } + + if (g_vars->scene38_shorty->_movement || !(g_vars->scene38_shorty->_flags & 4) || (g_vars->scene38_shorty->_flags & 2)) { + g_vars->scene38_shortyCounter = 0; + return; + } + + g_vars->scene38_shortyCounter++; + + if (g_vars->scene38_shortyCounter < 50) + return; + + int shortyAnim = 0; + + if (g_fp->_rnd->getRandomNumber(32767) >= 1310) { + if (g_fp->_rnd->getRandomNumber(32767) >= 1310 || g_vars->scene38_shorty->_statics->_staticsId != ST_MLS_LEFT2) { + if (g_vars->scene38_boss->_statics->_staticsId != ST_GLV_SLEEP2 && g_vars->scene38_bossCounter > 30 && g_fp->_rnd->getRandomNumber(32767) < 0x3FFF && g_vars->scene38_shorty->_statics->_staticsId == ST_MLS_LEFT2) + shortyAnim = QU_MLS_HAND; + } else { + shortyAnim = QU_MLS_BLINK; + } + } else { + if (g_vars->scene38_shorty->_statics->_staticsId == ST_MLS_RIGHT2) { + shortyAnim = QU_MLS_TURNL; + } else if (g_vars->scene38_shorty->_statics->_staticsId == ST_MLS_LEFT2) { + shortyAnim = QU_MLS_TURNR; + } + } + + if (g_vars->scene38_lastShortyAnim == shortyAnim) { + g_vars->scene38_shortyAnimCounter++; + if (g_vars->scene38_shortyAnimCounter > 2) + return; + } else { + g_vars->scene38_lastShortyAnim = shortyAnim; + g_vars->scene38_shortyAnimCounter = 1; + } + + if (shortyAnim > 0) { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(shortyAnim), 0, 0); + + mq->chain(0); + + g_vars->scene38_shortyCounter = 0; + } +} + +int sceneHandler38(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_LIFT_EXITLIFT: + g_fp->lift_exitSeq(cmd); + break; + + case MSG_LIFT_CLOSEDOOR: + g_fp->lift_closedoorSeq(); + break; + + case MSG_LIFT_STARTEXITQUEUE: + g_fp->lift_startExitQueue(); + break; + + case MSG_SC38_TRYTAKEBOTTLE: + sceneHandler38_tryTakeBottle(); + break; + + case MSG_SC38_POSTHMRKICK: + sceneHandler38_postHammerKick(); + break; + + case MSG_SC38_PROPOSE: + sceneHandler38_propose(); + break; + + case MSG_LIFT_CLICKBUTTON: + g_fp->lift_animation3(); + break; + + case MSG_SC38_POINT: + sceneHandler38_point(); + break; + + case MSG_LIFT_GO: + g_fp->lift_goAnimation(); + break; + + case MSG_SC38_HMRKICK: + sceneHandler38_hammerKick(); + break; + + case MSG_SC38_DRINK: + sceneHandler38_drink(); + break; + + case 64: + g_fp->lift_sub05(cmd); + break; + + case 29: + { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(g_fp->_sceneRect.left + cmd->_x, g_fp->_sceneRect.top + cmd->_y); + + if (ani && ani->_id == ANI_LIFTBUTTON) { + g_fp->lift_sub1(ani); + + cmd->_messageKind = 0; + } + break; + } + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + sceneHandler38_animateAlcoholics(); + + g_fp->_behaviorManager->updateBehaviors(); + + g_fp->startSceneTrack(); + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/sceneFinal.cpp b/engines/fullpipe/scenes/sceneFinal.cpp new file mode 100644 index 0000000000..e483e8bab7 --- /dev/null +++ b/engines/fullpipe/scenes/sceneFinal.cpp @@ -0,0 +1,174 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + +#include "fullpipe/modal.h" + + +namespace Fullpipe { + +void sceneFinal_initScene() { + g_fp->_gameLoader->loadScene(SC_FINAL2); + g_fp->accessScene(SC_FINAL2)->setPictureObjectsFlag4(); + g_fp->_gameLoader->loadScene(SC_FINAL3); + g_fp->accessScene(SC_FINAL3)->setPictureObjectsFlag4(); + g_fp->_gameLoader->loadScene(SC_FINAL4); + g_fp->accessScene(SC_FINAL4)->setPictureObjectsFlag4(); + + getGameLoaderInventory()->setIsLocked(0); + getGameLoaderInventory()->slideIn(); + + g_fp->_updateFlag = 0; + g_fp->_flgCanOpenMap = 0; + + g_vars->sceneFinal_var01 = 0; + g_vars->sceneFinal_var02 = 0; + g_vars->sceneFinal_var03 = 0; +} + +int sceneFinal_updateCursor() { + if (g_vars->sceneFinal_var01) + g_fp->_cursorId = 0; + else + g_fp->updateCursorCommon(); + + return g_fp->_cursorId; +} + +void sceneHandlerFinal_endFinal() { + g_vars->sceneFinal_var01 = 0; +} + +void sceneHandlerFinal_startMusic(const char *track) { + warning("STUB: sceneHandlerFinal_startMusic()"); +} + +void sceneHandlerFinal_goto4() { + g_fp->_currentScene = g_fp->accessScene(SC_FINAL4); + + g_fp->_gameLoader->loadScene(SC_FINAL4); + + chainQueue(QU_FN4_DOFINAL, 1); +} + +void sceneHandlerFinal_goto3() { + g_fp->_currentScene = g_fp->accessScene(SC_FINAL3); + + chainQueue(QU_FN3_DOFINAL, 1); +} + +void sceneHandlerFinal_goto2() { + g_fp->_currentScene = g_fp->accessScene(SC_FINAL2); + + chainQueue(QU_FN2_DOFINAL, 1); +} + +void sceneHandlerFinal_startFinal() { + g_vars->sceneFinal_var01 = 1; + + getCurrSceneSc2MotionController()->clearEnabled(); + getGameLoaderInteractionController()->disableFlag24(); + + g_fp->_aniMan2 = 0; + + g_fp->_aniMan->_flags &= 0xFFFB; + + chainQueue(QU_FIN1_TAKECOIN, 1); + + g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_FINAL1"), "MUSIC2", 1); + + g_fp->_modalObject = new ModalFinal; +} + +void sceneHandlerFinal_fallCoin() { + StaticANIObject *coin = g_fp->_currentScene->getStaticANIObject1ById(ANI_FIN_COIN, -1); + + if (!coin->_movement) { + if (!coin->_statics || coin->_statics->_staticsId != ST_FCN_NORM) + chainQueue(QU_FIN1_FALLCOIN, 1); + } +} + +int sceneHandlerFinal(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_FIN_ENDFINAL: + sceneHandlerFinal_endFinal(); + break; + + case MSG_FN4_STARTMUSIC: + sceneHandlerFinal_startMusic("track16.ogg"); + break; + + case MSG_FIN_GOTO4: + sceneHandlerFinal_goto4(); + + g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_FINAL1"), "MUSIC3", 1); + break; + + case MSG_FIN_GOTO3: + sceneHandlerFinal_goto3(); + break; + + case MSG_FIN_GOTO2: + sceneHandlerFinal_goto2(); + break; + + case MSG_FIN_STARTFINAL: + sceneHandlerFinal_startFinal(); + break; + + case 33: + if (g_fp->_aniMan2) { + g_vars->sceneFinal_var03 = g_fp->_aniMan2->_ox; + + if (g_vars->sceneFinal_var03 < 450 && g_vars->sceneFinal_var02 >= 450 ) + sceneHandlerFinal_fallCoin(); + + g_vars->sceneFinal_var02 = g_vars->sceneFinal_var03; + } + + g_fp->_behaviorManager->updateBehaviors(); + + g_fp->startSceneTrack(); + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp index 5d410e62c7..5ba3c5e80a 100644 --- a/engines/tinsel/tinsel.cpp +++ b/engines/tinsel/tinsel.cpp @@ -835,14 +835,6 @@ TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc) // Setup mixer syncSoundSettings(); - // Add DW2 subfolder to search path in case user is running directly from the CDs - const Common::FSNode gameDataDir(ConfMan.get("path")); - SearchMan.addSubDirectoryMatching(gameDataDir, "dw2"); - - // Add subfolders needed for psx versions of Discworld 1 - if (TinselV1PSX) - SearchMan.addDirectory(gameDataDir.getPath(), gameDataDir, 0, 3, true); - const GameSettings *g; const char *gameid = ConfMan.get("gameid").c_str(); @@ -892,6 +884,17 @@ Common::String TinselEngine::getSavegameFilename(int16 saveNum) const { return Common::String::format("%s.%03d", getTargetName().c_str(), saveNum); } +void TinselEngine::initializePath(const Common::FSNode &gamePath) { + if (TinselV1PSX) { + // Add subfolders needed for psx versions of Discworld 1 + SearchMan.addDirectory(gamePath.getPath(), gamePath, 0, 3, true); + } else { + // Add DW2 subfolder to search path in case user is running directly from the CDs + SearchMan.addSubDirectoryMatching(gamePath, "dw2"); + Engine::initializePath(gamePath); + } +} + Common::Error TinselEngine::run() { // Initialize backend if (getGameID() == GID_DW2) { diff --git a/engines/tinsel/tinsel.h b/engines/tinsel/tinsel.h index d26153245d..efa9355dd5 100644 --- a/engines/tinsel/tinsel.h +++ b/engines/tinsel/tinsel.h @@ -161,6 +161,7 @@ class TinselEngine : public Engine { protected: // Engine APIs + virtual void initializePath(const Common::FSNode &gamePath); virtual Common::Error run(); virtual bool hasFeature(EngineFeature f) const; Common::Error loadGameState(int slot); diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index ff63789d18..35918b8e90 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -399,10 +399,23 @@ void BaseRenderOSystem::drawTickets() { return; } - // Apply the clear-color to the dirty rect. - _renderSurface->fillRect(*_dirtyRect, _clearColor); + it = _renderQueue.begin(); _lastFrameIter = _renderQueue.end(); - for (it = _renderQueue.begin(); it != _renderQueue.end(); ++it) { + // A special case: If the screen has one giant OPAQUE rect to be drawn, then we skip filling + // the background colour. Typical use-case: Fullscreen FMVs. + // Caveat: The FPS-counter will invalidate this. + if (it != _lastFrameIter && _renderQueue.front() == _renderQueue.back() && (*it)->_transform._alphaDisable == true) { + // If our single opaque rect fills the dirty rect, we can skip filling. + if (*_dirtyRect != (*it)->_dstRect) { + // Apply the clear-color to the dirty rect. + _renderSurface->fillRect(*_dirtyRect, _clearColor); + } + // Otherwise Do NOT fill. + } else { + // Apply the clear-color to the dirty rect. + _renderSurface->fillRect(*_dirtyRect, _clearColor); + } + for (; it != _renderQueue.end(); ++it) { RenderTicket *ticket = *it; if (ticket->_dstRect.intersects(*_dirtyRect)) { // dstClip is the area we want redrawn. diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp index 9ec8573a87..c33e8ba54b 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp @@ -447,8 +447,14 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, Rect32 *newRect, bool BaseSurfaceOSystem::putSurface(const Graphics::Surface &surface, bool hasAlpha) { _loaded = true; - _surface->free(); - _surface->copyFrom(surface); + if (surface.format == _surface->format && surface.w == _surface->w && surface.h == _surface->h) { + const byte *src = (const byte *)surface.getBasePtr(0, 0); + byte *dst = (byte *)_surface->getBasePtr(0, 0); + memcpy(dst, src, surface.pitch * surface.h); + } else { + _surface->free(); + _surface->copyFrom(surface); + } if (hasAlpha) { _alphaType = TransparentSurface::ALPHA_FULL; } else { diff --git a/engines/wintermute/configure.engine b/engines/wintermute/configure.engine index 673549b46b..bdaf49de3f 100644 --- a/engines/wintermute/configure.engine +++ b/engines/wintermute/configure.engine @@ -1,3 +1,3 @@ # This file is included from the main "configure" script # add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] -add_engine wintermute "Wintermute" no "" "" "jpeg png zlib vorbis 16bit" +add_engine wintermute "Wintermute" yes "" "" "jpeg png zlib vorbis 16bit" diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 053acf29e9..79722439bd 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -519,9 +519,9 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p byte *ino= (byte *)img->getBasePtr(xp, yp); byte *outo = (byte *)target.getBasePtr(posX, posY); - if (color == 0xFFFFFF && blendMode == BLEND_NORMAL && _alphaMode == ALPHA_OPAQUE) { + if (color == 0xFFFFFFFF && blendMode == BLEND_NORMAL && _alphaMode == ALPHA_OPAQUE) { doBlitOpaqueFast(ino, outo, img->w, img->h, target.pitch, inStep, inoStep); - } else if (color == 0xFFFFFF && blendMode == BLEND_NORMAL && _alphaMode == ALPHA_BINARY) { + } else if (color == 0xFFFFFFFF && blendMode == BLEND_NORMAL && _alphaMode == ALPHA_BINARY) { doBlitBinaryFast(ino, outo, img->w, img->h, target.pitch, inStep, inoStep); } else { if (blendMode == BLEND_ADDITIVE) { diff --git a/engines/wintermute/video/video_theora_player.cpp b/engines/wintermute/video/video_theora_player.cpp index 44eecf93a8..299b64f915 100644 --- a/engines/wintermute/video/video_theora_player.cpp +++ b/engines/wintermute/video/video_theora_player.cpp @@ -305,8 +305,15 @@ bool VideoTheoraPlayer::update() { if (!_theoraDecoder->endOfVideo() && _theoraDecoder->getTimeToNextFrame() == 0) { const Graphics::Surface *decodedFrame = _theoraDecoder->decodeNextFrame(); if (decodedFrame) { - _surface.free(); - _surface.copyFrom(*decodedFrame); + if (decodedFrame->format == _surface.format && decodedFrame->w == _surface.w && decodedFrame->h == _surface.h) { + const byte *src = (const byte *)decodedFrame->getBasePtr(0, 0); + byte *dst = (byte *)_surface.getBasePtr(0, 0); + memcpy(dst, src, _surface.pitch * _surface.h); + } else { + _surface.free(); + _surface.copyFrom(*decodedFrame); + } + if (_texture) { writeVideo(); } |