diff options
32 files changed, 302 insertions, 49 deletions
diff --git a/audio/decoders/quicktime.cpp b/audio/decoders/quicktime.cpp index 331c850b1a..ff87e7a9f8 100644 --- a/audio/decoders/quicktime.cpp +++ b/audio/decoders/quicktime.cpp @@ -241,6 +241,15 @@ void QuickTimeAudioDecoder::QuickTimeAudioTrack::queueAudio(const Timestamp &len // If we have any samples that we need to skip (ie. we seeked into // the middle of a chunk), skip them here. if (_skipSamples != Timestamp()) { + if (_skipSamples > chunkLength) { + // If the amount we need to skip is greater than the size + // of the chunk, just skip it altogether. + _curMediaPos = _curMediaPos + chunkLength; + _skipSamples = _skipSamples - chunkLength; + delete stream; + continue; + } + skipSamples(_skipSamples, stream); _curMediaPos = _curMediaPos + _skipSamples; chunkLength = chunkLength - _skipSamples; diff --git a/engines/access/access.cpp b/engines/access/access.cpp index 7f59ae7ad6..0a4e519c91 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -94,6 +94,9 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc) _cheatFl = false; _restartFl = false; _printEnd = 0; + for (int i = 0; i < 100; i++) + _objectsTable[i] = nullptr; + _clearSummaryFlag = false; } AccessEngine::~AccessEngine() { diff --git a/engines/access/files.cpp b/engines/access/files.cpp index 42a7914638..4d734a67a9 100644 --- a/engines/access/files.cpp +++ b/engines/access/files.cpp @@ -40,6 +40,10 @@ void FileIdent::load(Common::SeekableReadStream &s) { /*------------------------------------------------------------------------*/ +CellIdent:: CellIdent() { + _cell = 0; +} + CellIdent::CellIdent(int cell, int fileNum, int subfile) { _cell = cell; _fileNum = fileNum; diff --git a/engines/access/files.h b/engines/access/files.h index 8b1aef0363..714ea44c75 100644 --- a/engines/access/files.h +++ b/engines/access/files.h @@ -46,7 +46,7 @@ struct FileIdent { struct CellIdent : FileIdent { byte _cell; - CellIdent() {} + CellIdent(); CellIdent(int cell, int fileNum, int subfile); }; diff --git a/engines/bbvs/minigames/bbairguitar.cpp b/engines/bbvs/minigames/bbairguitar.cpp index 1984dbb0fd..6f198cb42a 100644 --- a/engines/bbvs/minigames/bbairguitar.cpp +++ b/engines/bbvs/minigames/bbairguitar.cpp @@ -22,6 +22,12 @@ #include "bbvs/minigames/bbairguitar.h" +#include "common/savefile.h" +#include "common/translation.h" + +#include "gui/dialog.h" +#include "gui/message.h" + namespace Bbvs { static const char * const kNoteSoundFilenames[] = { @@ -805,7 +811,7 @@ void MinigameBbAirGuitar::update() { } if (_vm->_keyCode == Common::KEYCODE_ESCAPE) { - _gameDone = true; + _gameDone = querySaveModifiedTracks(); return; } @@ -925,7 +931,8 @@ void MinigameBbAirGuitar::afterButtonReleased() { break; case 4: *_currFrameIndex = 1; - // TODO Run load dialog + loadTracks(); + _objects[1].kind = 0; break; case 5: _objects[3].kind = 0; @@ -950,7 +957,8 @@ void MinigameBbAirGuitar::afterButtonReleased() { break; case 12: *_currFrameIndex = 1; - // TODO Run save dialog + saveTracks(); + _objects[2].kind = 0; break; case 13: _objects[4].kind = 0; @@ -1195,4 +1203,103 @@ void MinigameBbAirGuitar::stopNote(int noteNum) { stopSound(2 + _currPatchNum * kNoteSoundFilenamesCount + noteNum); } +bool MinigameBbAirGuitar::getLoadFilename(Common::String &filename) { + // TODO Run dialog and return actual filename + filename = "test.air"; + return true; +} + +bool MinigameBbAirGuitar::getSaveFilename(Common::String &filename) { + // TODO Run dialog and return actual filename + filename = "test.air"; + return true; +} + +bool MinigameBbAirGuitar::querySaveModifiedDialog() { + /* NOTE The original button captions don't fit so shortened variants are used + Original ok button caption: "Yeah, heh, heh, save it!" + Original discard button caption: "Who cares? It sucked!" + */ + GUI::MessageDialog query(_("Hey Beavis - you didn't save that last Jam!"), + _("Save it!"), + _("It sucked!")); + return query.runModal() == GUI::kMessageOK; +} + +bool MinigameBbAirGuitar::querySaveModifiedTracks() { + if (_modified && querySaveModifiedDialog()) { + if (!saveTracks()) + return false; + } + return true; +} + +bool MinigameBbAirGuitar::loadTracks() { + if (_playerMode != 0) + return false; + + if (!querySaveModifiedTracks()) + return false; + + Common::String filename; + if (!getLoadFilename(filename)) + return false; + + Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + Common::InSaveFile *stream = saveFileMan->openForLoading(filename); + if (!loadFromStream(stream)) { + Common::String msg = Common::String::format("%s is not a valid Air Guitar file", filename.c_str()); + GUI::MessageDialog dialog(msg); + dialog.runModal(); + } + delete stream; + + return true; +} + +bool MinigameBbAirGuitar::saveTracks() { + if (_playerMode != 0) + return false; + + Common::String filename; + if (!getSaveFilename(filename)) + return false; + + Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + Common::OutSaveFile *stream = saveFileMan->openForSaving(filename); + saveToStream(stream); + delete stream; + _modified = false; + + return true; +} + +bool MinigameBbAirGuitar::loadFromStream(Common::ReadStream *stream) { + uint32 magic = stream->readUint32BE(); + if (magic != MKTAG('A', 'I', 'R', 'G')) + return false; + for (uint i = 0; i < kMaxTracks; ++i) { + _track[i].noteNum = stream->readByte(); + _track[i].ticks = stream->readUint16LE(); + } + _trackCount = 0; + _actionTrackPos = 0; + while (_track[_trackCount].noteNum != -1) { + _actionTrackPos += _track[_trackCount].ticks; + ++_trackCount; + } + _totalTrackLength = _actionTrackPos; + _trackIndex = 0; + _currTrackPos = 0; + return true; +} + +void MinigameBbAirGuitar::saveToStream(Common::WriteStream *stream) { + stream->writeUint32BE(MKTAG('A', 'I', 'R', 'G')); + for (uint i = 0; i < kMaxTracks; ++i) { + stream->writeByte(_track[i].noteNum); + stream->writeUint16LE(_track[i].ticks); + } +} + } // End of namespace Bbvs diff --git a/engines/bbvs/minigames/bbairguitar.h b/engines/bbvs/minigames/bbairguitar.h index 40b8a50a03..b8b92ef433 100644 --- a/engines/bbvs/minigames/bbairguitar.h +++ b/engines/bbvs/minigames/bbairguitar.h @@ -47,7 +47,7 @@ public: enum { kMaxObjectsCount = 256, - kMaxTracks = 2049 + kMaxTracks = 2048 }; struct PianoKeyInfo { @@ -141,6 +141,15 @@ public: void playNote(int noteNum); void stopNote(int noteNum); + bool getLoadFilename(Common::String &filename); + bool getSaveFilename(Common::String &filename); + bool querySaveModifiedDialog(); + bool querySaveModifiedTracks(); + bool loadTracks(); + bool saveTracks(); + bool loadFromStream(Common::ReadStream *stream); + void saveToStream(Common::WriteStream *stream); + }; } // End of namespace Bbvs diff --git a/engines/made/database.cpp b/engines/made/database.cpp index a9855ba1fe..3eab31acc2 100644 --- a/engines/made/database.cpp +++ b/engines/made/database.cpp @@ -252,6 +252,10 @@ byte *ObjectV3::getData() { GameDatabase::GameDatabase(MadeEngine *vm) : _vm(vm) { + _gameState = nullptr; + _gameStateSize = 0; + _mainCodeObjectIndex = 0; + _isRedSource = false; } GameDatabase::~GameDatabase() { @@ -595,6 +599,8 @@ const char *GameDatabaseV2::getString(uint16 offset) { /* GameDatabaseV3 */ GameDatabaseV3::GameDatabaseV3(MadeEngine *vm) : GameDatabase(vm) { + _gameText = nullptr; + _gameStateOffs = 0; } void GameDatabaseV3::load(Common::SeekableReadStream &sourceS) { diff --git a/engines/made/pmvplayer.cpp b/engines/made/pmvplayer.cpp index 3cac017e10..6ea0dc24d0 100644 --- a/engines/made/pmvplayer.cpp +++ b/engines/made/pmvplayer.cpp @@ -37,16 +37,18 @@ namespace Made { -PmvPlayer::PmvPlayer(MadeEngine *vm, Audio::Mixer *mixer) : _fd(NULL), _vm(vm), _mixer(mixer) { +PmvPlayer::PmvPlayer(MadeEngine *vm, Audio::Mixer *mixer) : _fd(nullptr), _vm(vm), _mixer(mixer) { + _audioStream = nullptr; + _surface = nullptr; + _aborted = false; } PmvPlayer::~PmvPlayer() { } bool PmvPlayer::play(const char *filename) { - _aborted = false; - _surface = NULL; + _surface = nullptr; _fd = new Common::File(); if (!_fd->open(filename)) { @@ -81,8 +83,11 @@ bool PmvPlayer::play(const char *filename) { // results to sound being choppy. Therefore, we set them to more // "common" values here (11025 instead of 11127 and 22050 instead // of 22254) - if (soundFreq == 11127) soundFreq = 11025; - if (soundFreq == 22254) soundFreq = 22050; + if (soundFreq == 11127) + soundFreq = 11025; + + if (soundFreq == 22254) + soundFreq = 22050; for (int i = 0; i < 22; i++) { int unk = _fd->readUint16LE(); diff --git a/engines/made/redreader.cpp b/engines/made/redreader.cpp index f5e6ca85b3..f92ffd8dd8 100644 --- a/engines/made/redreader.cpp +++ b/engines/made/redreader.cpp @@ -76,6 +76,22 @@ bool RedReader::seekFile(Common::File &fd, FileEntry &fileEntry, const char *fil } LzhDecompressor::LzhDecompressor() { + freq = nullptr; + len_table = nullptr; + sortptr = nullptr; + _source = nullptr; + + _compSize = 0; + _blockPos = 0; + _bitbuf = 0; + _subbitbuf = 0; + _bitcount = 0; + _blocksize = 0; + tree_n = 0; + heapsize = 0; + decode_i = 0; + decode_j = 0; + count_len_depth = 0; } LzhDecompressor::~LzhDecompressor() { diff --git a/engines/made/resource.cpp b/engines/made/resource.cpp index 2c75965976..f8e763e74e 100644 --- a/engines/made/resource.cpp +++ b/engines/made/resource.cpp @@ -241,6 +241,7 @@ void AnimationResource::load(byte *source, int size) { /* SoundResource */ SoundResource::SoundResource() : _soundSize(0), _soundData(NULL) { + _soundEnergyArray = nullptr; } SoundResource::~SoundResource() { @@ -377,6 +378,9 @@ void GenericResource::load(byte *source, int size) { ResourceReader::ResourceReader() { _isV1 = false; _cacheDataSize = 0; + + _fd = _fdMusic = _fdPics = _fdSounds = nullptr; + _cacheCount = 0; } ResourceReader::~ResourceReader() { diff --git a/engines/made/screenfx.cpp b/engines/made/screenfx.cpp index 2a155d67ac..3f98cbb9ab 100644 --- a/engines/made/screenfx.cpp +++ b/engines/made/screenfx.cpp @@ -51,7 +51,12 @@ ScreenEffects::ScreenEffects(Screen *screen) : _screen(screen) { vfxHeight = 0; _fxPalette = new byte[768]; - + + _blendedPaletteStatus._active = false; + _blendedPaletteStatus._palette = _blendedPaletteStatus._newPalette = nullptr; + _blendedPaletteStatus._colorCount = 0; + _blendedPaletteStatus._value = _blendedPaletteStatus._maxValue = 0; + _blendedPaletteStatus._incr = 0; } ScreenEffects::~ScreenEffects() { diff --git a/engines/made/screenfx.h b/engines/made/screenfx.h index fd216bfd63..cedb059927 100644 --- a/engines/made/screenfx.h +++ b/engines/made/screenfx.h @@ -38,7 +38,6 @@ struct BlendedPaletteStatus { byte *_palette, *_newPalette; int _colorCount; int16 _value, _maxValue, _incr; - int cnt; }; class ScreenEffects { diff --git a/engines/made/script.cpp b/engines/made/script.cpp index 20fa026a40..f9f7acffde 100644 --- a/engines/made/script.cpp +++ b/engines/made/script.cpp @@ -122,6 +122,11 @@ ScriptInterpreter::ScriptInterpreter(MadeEngine *vm) : _vm(vm) { _functions = new ScriptFunctions(_vm); _functions->setupExternalsTable(); + _localStackPos = 0; + _runningScriptObjectIndex = 0; + _codeBase = nullptr; + _codeIp = nullptr; + #undef COMMAND } diff --git a/engines/made/script.h b/engines/made/script.h index bf75bc0875..f28425d13b 100644 --- a/engines/made/script.h +++ b/engines/made/script.h @@ -84,7 +84,6 @@ protected: int16 _localStackPos; int16 _runningScriptObjectIndex; byte *_codeBase, *_codeIp; - bool _terminated; ScriptFunctions *_functions; diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp index efa765c7eb..bcc08e0dcc 100644 --- a/engines/made/scriptfuncs.cpp +++ b/engines/made/scriptfuncs.cpp @@ -42,6 +42,8 @@ ScriptFunctions::ScriptFunctions(MadeEngine *vm) : _vm(vm), _soundStarted(false) _pcSpeaker2 = new Audio::PCSpeaker(); _vm->_system->getMixer()->playStream(Audio::Mixer::kMusicSoundType, &_pcSpeakerHandle1, _pcSpeaker1); _vm->_system->getMixer()->playStream(Audio::Mixer::kMusicSoundType, &_pcSpeakerHandle2, _pcSpeaker2); + _soundResource = nullptr; + _musicRes = nullptr; } ScriptFunctions::~ScriptFunctions() { diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 556475d515..b7b9c1e000 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -571,6 +571,7 @@ void MortevielleEngine::fctSearch() { _curSearchObjId = getFirstObject(); if (_curSearchObjId != 0) { _searchCount = 0; + _is = 0; _heroSearching = true; _menu->setSearchMenu(); prepareNextObject(); @@ -1678,9 +1679,8 @@ void MortevielleEngine::endGame() { handleDescriptionText(2, 35); startMusicOrSpeech(0); testKey(false); - // A wait message was displayed. - // testKey (aka tkey1) was called before and after. - // This double call is useless, thus removed + displayInterScreenMessage(2036); + testKey(false); resetVariables(); } diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index b0faff3510..42d70fcb37 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -116,6 +116,7 @@ const int kInventoryStringIndex = 186; const int kQuestionStringIndex = 247; const int kDialogStringIndex = 292; const int kMenuPlaceStringIndex = 435; +const int kStartingScreenStringIndex = 456; const int kMenuActionStringIndex = 476; const int kMenuSelfStringIndex = 497; const int kMenuSayStringIndex = 502; @@ -416,6 +417,7 @@ public: int _maff; int _caff; int _crep; + int _is; // ??? byte _destinationArray[7][25]; @@ -466,6 +468,7 @@ public: void gameLoaded(); void initGame(); void displayAloneText(); + void displayInterScreenMessage(int mesgId); void draw(int x, int y); void charToHour(); void hourToChar(); diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 6a479c0859..5cbe4deab3 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -227,7 +227,31 @@ void TextHandler::taffich() { Common::String filename, altFilename; if ((a != 50) && (a != 51)) { + int m = a + 2000; + + if ((m > 2001) && (m < 2010)) + m = 2001; + else if (m == 2011) + m = 2010; + if (a == 32) + m = 2034; + else if ((a == 17) && (_vm->_maff == 14)) + m = 2018; + else if (a > 99) { + if ((_vm->_is == 1) || (_vm->_is == 0)) + m = 2031; + else + m = 2032; + } + + if ( ((a > 69) && (a < 80)) || (a == 30) || (a == 31) || (a == 144) || (a == 147) || (a == 149) ) + m = 2030; + else if ( ((a < 27) && ( ((_vm->_maff > 69) && (!_vm->_coreVar._alreadyEnteredManor)) || (_vm->_maff > 99) )) || ((_vm->_maff > 29) && (_vm->_maff < 33)) ) + m = 2033; + + _vm->displayInterScreenMessage(m); _vm->_maff = a; + if (a == 159) a = 86; else if (a > 140) diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index aa58dc6f7c..5fe47674c8 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -1359,6 +1359,7 @@ void MortevielleEngine::endSearch() { _heroSearching = false; _obpart = false; _searchCount = 0; + _is = 0; _menu->unsetSearchMenu(); } @@ -1469,6 +1470,7 @@ void MortevielleEngine::gameLoaded() { _num = 0; _startTime = 0; _endTime = 0; + _is = 0; _searchCount = 0; _roomDoorId = OWN_ROOM; _syn = true; @@ -1724,6 +1726,22 @@ void MortevielleEngine::showMoveMenuAlert() { * @remarks Originally called 'dialpre' */ void MortevielleEngine::showConfigScreen() { + // FIXME: need a DOS palette, index 9 (light blue). Also we should show DOS font here + Common::String tmpStr; + int width, cy = 0; + clearScreen(); + do { + ++cy; + tmpStr = getString(cy + kStartingScreenStringIndex); + width = _screenSurface->getStringWidth(tmpStr); + _text->displayStr(tmpStr, 320 - width / 2, cy * 8, 80, 1, 2); + } while (cy != 20); + + int ix = 0; + do { + ++ix; + } while (!(keyPressed() || ix == 0x5e5)); + _crep = 998; } @@ -2130,6 +2148,7 @@ void MortevielleEngine::showTitleScreen() { clearScreen(); draw(0, 0); + // FIXME: should be a DOS font here Common::String cpr = "COPYRIGHT 1989 : LANKHOR"; _screenSurface->putxy(104 + 72 * kResolutionScaler, 185); _screenSurface->drawString(cpr, 0); @@ -2989,6 +3008,26 @@ void MortevielleEngine::displayNarrativePicture(int af, int ob) { } /** + * Display a message switching from a screen to another. + * @remarks Originally called 'messint' + */ +void MortevielleEngine::displayInterScreenMessage(int mesgId) { + clearUpperLeftPart(); + clearDescriptionBar(); + clearVerbBar(); + + GfxSurface surface; + surface.decode(_rightFramePict + 1008); + surface._offset.x = 80; + surface._offset.y = 40; + setPal(90); + _screenSurface->drawPicture(surface, 0, 0); + _screenSurface->drawPicture(surface, 0, 70); + handleDescriptionText(7, mesgId); + delay(DISK_ACCESS_DELAY); +} + +/** * Prepare Display Text * @remarks Originally called 'affrep' */ @@ -3196,6 +3235,7 @@ void MortevielleEngine::prepareNextObject() { } while ((objId == 0) && (_searchCount <= 9)); if ((objId != 0) && (_searchCount < 11)) { + _is++; _caff = objId; _crep = _caff + 400; if (_currBitIndex != 0) diff --git a/engines/tsage/blue_force/blueforce_scenes8.cpp b/engines/tsage/blue_force/blueforce_scenes8.cpp index 6855fd41b9..337e73dad0 100644 --- a/engines/tsage/blue_force/blueforce_scenes8.cpp +++ b/engines/tsage/blue_force/blueforce_scenes8.cpp @@ -964,9 +964,10 @@ Scene810::Scene810(): SceneExt() { } void Scene810::synchronize(Serializer &s) { + int dummy = 0; SceneExt::synchronize(s); s.syncAsSint16LE(_fieldA70); - s.syncAsSint16LE(_fieldA72); + s.syncAsSint16LE(dummy); s.syncAsSint16LE(_fieldA74); } @@ -2220,6 +2221,7 @@ Scene840::Scene840(): PalettedScene() { _field1AC2 = 0; _field1AC4 = 0; _field1AC6 = (BF_GLOBALS._dayNumber > 3) ? 1 : 0; + _field1ABA = 0; } void Scene840::synchronize(Serializer &s) { diff --git a/engines/tsage/blue_force/blueforce_scenes8.h b/engines/tsage/blue_force/blueforce_scenes8.h index 140327e85d..09de14f150 100644 --- a/engines/tsage/blue_force/blueforce_scenes8.h +++ b/engines/tsage/blue_force/blueforce_scenes8.h @@ -229,7 +229,7 @@ public: Exit _exit; ASoundExt _sound1; Rect _rect1, _rect2, _rect3; - int _fieldA70, _fieldA72, _fieldA74; + int _fieldA70, _fieldA74; Scene810(); virtual void synchronize(Serializer &s); diff --git a/engines/tsage/blue_force/blueforce_scenes9.cpp b/engines/tsage/blue_force/blueforce_scenes9.cpp index 53000d6997..5ba82a4714 100644 --- a/engines/tsage/blue_force/blueforce_scenes9.cpp +++ b/engines/tsage/blue_force/blueforce_scenes9.cpp @@ -3521,7 +3521,7 @@ void Scene935::Action1::signal() { scene->_visualSpeaker.removeText(); scene->_visualSpeaker._textPos.y = scene->_sceneBounds.top + 80; scene->_visualSpeaker._color1 = 252; - scene->_visualSpeaker._color1 = 251; + scene->_visualSpeaker._color2 = 251; scene->_visualSpeaker.setText("Jake! Hide in the closet!"); setDelay(3); break; @@ -3538,7 +3538,7 @@ void Scene935::Action1::signal() { scene->_visualSpeaker.removeText(); scene->_visualSpeaker._textPos.y = scene->_sceneBounds.top + 150; scene->_visualSpeaker._color1 = 250; - scene->_visualSpeaker._color1 = 249; + scene->_visualSpeaker._color2 = 249; scene->_visualSpeaker.setText("Jake! Hide in the closet!"); setDelay(3); break; diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index f35aa583e2..3105a9008e 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -56,6 +56,9 @@ InvObject::InvObject(int sceneNumber, int rlbNum, int cursorNum, CursorType curs _bounds = s.getBounds(); DEALLOCATE(imgData); + _visage = 0; + _strip = 0; + _frame = 0; } InvObject::InvObject(int visage, int strip, int frame) { diff --git a/engines/tsage/ringworld/ringworld_scenes3.cpp b/engines/tsage/ringworld/ringworld_scenes3.cpp index d8556c691e..a515224964 100644 --- a/engines/tsage/ringworld/ringworld_scenes3.cpp +++ b/engines/tsage/ringworld/ringworld_scenes3.cpp @@ -494,7 +494,7 @@ void Scene2100::Action1::signal() { setDelay(1); else { setAction(&scene->_sequenceManager, this, 2102, &g_globals->_player, NULL); - scene->_sitFl = 0; + scene->_sitFl = false; } break; case 1: { @@ -1548,6 +1548,7 @@ Scene2100::Scene2100() : _area3._pt = Common::Point(200, 75); _area4.setup(2153, 1, 1, OBJECT_TRANSLATOR); _area4._pt = Common::Point(237, 77); + _sitFl = false; } void Scene2100::postInit(SceneObjectList *OwnerList) { @@ -1688,7 +1689,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { g_globals->_player._moveDiff.x = 4; g_globals->_player.changeZoom(-1); g_globals->_player.disableControl(); - _sitFl = 0; + _sitFl = false; switch (g_globals->_sceneManager._previousScene) { case 2120: @@ -1824,7 +1825,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { g_globals->_player.fixPriority(152); g_globals->_player.setStrip(2); - _sitFl = 1; + _sitFl = true; _object4.postInit(); _object4.setVisage(2102); @@ -1858,7 +1859,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) { g_globals->_player.fixPriority(152); g_globals->_player.setStrip(2); - _sitFl = 1; + _sitFl = true; setAction(&_action16); } break; @@ -1932,12 +1933,12 @@ void Scene2100::stripCallback(int v) { void Scene2100::signal() { switch (_sceneMode) { case 2101: - _sitFl = 1; + _sitFl = true; g_globals->_player._uiEnabled = true; g_globals->_events.setCursor(CURSOR_USE); break; case 2102: - _sitFl = 0; + _sitFl = false; g_globals->_player.enableControl(); break; case 2103: @@ -5789,6 +5790,7 @@ Scene2320::Scene2320() : _area3._pt = Common::Point(200, 75); _area4.setup(2153, 1, 1, 10); _area4._pt = Common::Point(237, 77); + _hotspotPtr = nullptr; } void Scene2320::postInit(SceneObjectList *OwnerList) { diff --git a/engines/tsage/ringworld/ringworld_scenes3.h b/engines/tsage/ringworld/ringworld_scenes3.h index a371f800b9..752b6acd48 100644 --- a/engines/tsage/ringworld/ringworld_scenes3.h +++ b/engines/tsage/ringworld/ringworld_scenes3.h @@ -283,7 +283,7 @@ public: Action15 _action15; Action16 _action16; Action17 _action17; - int _sitFl; + bool _sitFl; SceneArea _area1, _area2, _area3, _area4; Scene2100(); diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp index 7ce7351e65..320c92283c 100644 --- a/engines/voyeur/events.cpp +++ b/engines/voyeur/events.cpp @@ -403,7 +403,7 @@ void EventsManager::vDoCycleInt() { int palIndex = READ_LE_UINT16(pSrc); pPal[palIndex * 3] = pSrc[3]; pPal[palIndex * 3 + 1] = pSrc[4]; - pPal[palIndex * 3 + 1] = pSrc[5]; + pPal[palIndex * 3 + 2] = pSrc[5]; pSrc += 6; if ((int16)READ_LE_UINT16(pSrc) >= 0) { diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp index 0615c67ba0..53eb5ce3c5 100644 --- a/engines/voyeur/files_threads.cpp +++ b/engines/voyeur/files_threads.cpp @@ -1082,6 +1082,7 @@ int ThreadResource::doApt() { break; case 2: _vm->_voy->_aptLoadMode = 142; + break; case 5: _vm->_voy->_aptLoadMode = 141; break; diff --git a/engines/zvision/file/lzss_read_stream.cpp b/engines/zvision/file/lzss_read_stream.cpp index 6f27eaa765..ca10af7d72 100644 --- a/engines/zvision/file/lzss_read_stream.cpp +++ b/engines/zvision/file/lzss_read_stream.cpp @@ -31,8 +31,9 @@ LzssReadStream::LzssReadStream(Common::SeekableReadStream *source) // It's convention to set the starting cursor position to blockSize - 16 _windowCursor(0x0FEE), _eosFlag(false) { - // Clear the window to null - memset(_window, 0, BLOCK_SIZE); + // All values up to _windowCursor inits by 0x20 + memset(_window, 0x20, _windowCursor); + memset(_window + _windowCursor, 0, BLOCK_SIZE - _windowCursor); } uint32 LzssReadStream::decompressBytes(byte *destination, uint32 numberOfBytes) { diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp index 9a2f1d10ff..5238561149 100644 --- a/engines/zvision/scripting/actions.cpp +++ b/engines/zvision/scripting/actions.cpp @@ -79,8 +79,7 @@ ActionAssign::ActionAssign(ZVision *engine, int32 slotkey, const Common::String } ActionAssign::~ActionAssign() { - if (_value) - delete _value; + delete _value; } bool ActionAssign::execute() { @@ -445,16 +444,18 @@ bool ActionMenuBarEnable::execute() { ActionMusic::ActionMusic(ZVision *engine, int32 slotkey, const Common::String &line, bool global) : ResultAction(engine, slotkey), - _volume(255), _note(0), _prog(0), _universe(global) { uint type = 0; char fileNameBuffer[25]; uint loop = 0; - uint volume = 255; + char volumeBuffer[15]; - sscanf(line.c_str(), "%u %24s %u %u", &type, fileNameBuffer, &loop, &volume); + // Volume is optional. If it doesn't appear, assume full volume + strcpy(volumeBuffer, "100"); + + sscanf(line.c_str(), "%u %24s %u %14s", &type, fileNameBuffer, &loop, volumeBuffer); // Type 4 actions are MIDI commands, not files. These are only used by // Zork: Nemesis, for the flute and piano puzzles (tj4e and ve6f, as well @@ -463,26 +464,28 @@ ActionMusic::ActionMusic(ZVision *engine, int32 slotkey, const Common::String &l _midi = true; int note; int prog; - sscanf(line.c_str(), "%u %d %d %u", &type, &prog, ¬e, &volume); - _volume = volume; + sscanf(line.c_str(), "%u %d %d %14s", &type, &prog, ¬e, volumeBuffer); + _volume = new ValueSlot(_engine->getScriptManager(), volumeBuffer); _note = note; _prog = prog; } else { _midi = false; _fileName = Common::String(fileNameBuffer); _loop = loop == 1 ? true : false; - - // Volume is optional. If it doesn't appear, assume full volume - if (volume != 255) { - // Volume in the script files is mapped to [0, 100], but the ScummVM mixer uses [0, 255] - _volume = volume * 255 / 100; + if (volumeBuffer[0] != '[' && atoi(volumeBuffer) > 100) { + // I thought I saw a case like this in Zork Nemesis, so + // let's guard against it. + warning("ActionMusic: Adjusting volume for %s from %s to 100", _fileName.c_str(), volumeBuffer); + strcpy(volumeBuffer, "100"); } + _volume = new ValueSlot(engine->getScriptManager(), volumeBuffer); } } ActionMusic::~ActionMusic() { if (!_universe) _engine->getScriptManager()->killSideFx(_slotKey); + delete _volume; } bool ActionMusic::execute() { @@ -491,13 +494,16 @@ bool ActionMusic::execute() { _engine->getScriptManager()->setStateValue(_slotKey, 2); } + uint volume = _volume->getValue(); + if (_midi) { - _engine->getScriptManager()->addSideFX(new MusicMidiNode(_engine, _slotKey, _prog, _note, _volume)); + _engine->getScriptManager()->addSideFX(new MusicMidiNode(_engine, _slotKey, _prog, _note, volume)); } else { if (!_engine->getSearchManager()->hasFile(_fileName)) return true; - _engine->getScriptManager()->addSideFX(new MusicNode(_engine, _slotKey, _fileName, _loop, _volume)); + // Volume in the script files is mapped to [0, 100], but the ScummVM mixer uses [0, 255] + _engine->getScriptManager()->addSideFX(new MusicNode(_engine, _slotKey, _fileName, _loop, volume * 255 / 100)); } return true; @@ -797,8 +803,7 @@ ActionRandom::ActionRandom(ZVision *engine, int32 slotkey, const Common::String } ActionRandom::~ActionRandom() { - if (_max) - delete _max; + delete _max; } bool ActionRandom::execute() { @@ -1037,8 +1042,7 @@ ActionTimer::ActionTimer(ZVision *engine, int32 slotkey, const Common::String &l } ActionTimer::~ActionTimer() { - if (_time) - delete _time; + delete _time; _engine->getScriptManager()->killSideFx(_slotKey); } diff --git a/engines/zvision/scripting/actions.h b/engines/zvision/scripting/actions.h index 8d43309b74..94c2d041fc 100644 --- a/engines/zvision/scripting/actions.h +++ b/engines/zvision/scripting/actions.h @@ -224,7 +224,7 @@ public: private: Common::String _fileName; bool _loop; - byte _volume; + ValueSlot *_volume; bool _universe; bool _midi; int8 _note; diff --git a/icons/scummvm.info b/icons/scummvm.info Binary files differindex e30a7129ef..f603627122 100644 --- a/icons/scummvm.info +++ b/icons/scummvm.info diff --git a/icons/scummvm_drawer.info b/icons/scummvm_drawer.info Binary files differindex 26f6a8633d..03b62536a2 100644 --- a/icons/scummvm_drawer.info +++ b/icons/scummvm_drawer.info |