diff options
Diffstat (limited to 'engines')
40 files changed, 1127 insertions, 1179 deletions
diff --git a/engines/composer/composer.h b/engines/composer/composer.h index 33a5356b3a..7d8022455a 100644 --- a/engines/composer/composer.h +++ b/engines/composer/composer.h @@ -23,7 +23,7 @@ #ifndef COMPOSER_H #define COMPOSER_H -#include "common/config-file.h" +#include "common/ini-file.h" #include "common/random.h" #include "common/system.h" #include "common/debug.h" @@ -174,7 +174,7 @@ private: Common::List<Sprite> _sprites; uint _directoriesToStrip; - Common::ConfigFile _bookIni; + Common::INIFile _bookIni; Common::String _bookGroup; Common::List<Library> _libraries; Common::Array<PendingPageChange> _pendingPageChanges; diff --git a/engines/gob/iniconfig.cpp b/engines/gob/iniconfig.cpp index bba531723c..032231bd4d 100644 --- a/engines/gob/iniconfig.cpp +++ b/engines/gob/iniconfig.cpp @@ -73,7 +73,7 @@ bool INIConfig::getConfig(const Common::String &file, Config &config) { } bool INIConfig::openConfig(const Common::String &file, Config &config) { - config.config = new Common::ConfigFile(); + config.config = new Common::INIFile(); config.created = false; if (!config.config->loadFromFile(file)) { @@ -89,7 +89,7 @@ bool INIConfig::openConfig(const Common::String &file, Config &config) { } bool INIConfig::createConfig(const Common::String &file, Config &config) { - config.config = new Common::ConfigFile(); + config.config = new Common::INIFile(); config.created = true; _configs.setVal(file, config); diff --git a/engines/gob/iniconfig.h b/engines/gob/iniconfig.h index bf60f2d125..c1890170dc 100644 --- a/engines/gob/iniconfig.h +++ b/engines/gob/iniconfig.h @@ -24,7 +24,7 @@ #define GOB_INICONFIG_H #include "common/str.h" -#include "common/config-file.h" +#include "common/ini-file.h" #include "common/hashmap.h" namespace Gob { @@ -43,7 +43,7 @@ public: private: struct Config { - Common::ConfigFile *config; + Common::INIFile *config; bool created; }; diff --git a/engines/kyra/scene_mr.cpp b/engines/kyra/scene_mr.cpp index c9486d9c45..d2b4907b6a 100644 --- a/engines/kyra/scene_mr.cpp +++ b/engines/kyra/scene_mr.cpp @@ -577,6 +577,7 @@ void KyraEngine_MR::initSceneScreen(int unk1) { } updateCharPal(0); + _screen->updateScreen(); if (!_menuDirectlyToLoad) { _emc->start(&_sceneScriptState, 3); diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 054397a34a..8c97e46a8f 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -718,6 +718,13 @@ void Screen::fadePalette(const Palette &pal, int delay, const UpdateFunctor *upF _vm->delay((delayAcc >> 8) * 1000 / 60); delayAcc &= 0xFF; } + + // In case we should quit we setup the final palette here. This avoids + // ugly palette glitches when quitting while fading. This can for example + // be noticed when quitting while viewing the family album in Kyra3. + if (_vm->shouldQuit()) { + setScreenPalette(pal); + } } void Screen::getFadeParams(const Palette &pal, int delay, int &delayInc, int &diff) { diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp index efd4051eba..d0b439677d 100644 --- a/engines/lure/hotspots.cpp +++ b/engines/lure/hotspots.cpp @@ -260,8 +260,10 @@ void Hotspot::setAnimation(HotspotAnimData *newRecord) { _anim = NULL; _numFrames = 0; _frameNumber = 0; - if (!newRecord) return; - if (!disk.exists(newRecord->animId)) return; + if (!newRecord) + return; + if (!disk.exists(newRecord->animId)) + return; // Scan for any size overrides - some animations get their size set after decoding, but // we want it in advance so we can decode the animation straight to a graphic surface @@ -516,7 +518,8 @@ void Hotspot::endAction() { } void Hotspot::setDirection(Direction dir) { - if ((_numFrames == 0) || (_direction == dir)) return; + if ((_numFrames == 0) || (_direction == dir)) + return; uint8 newFrameNumber = 0; switch (dir) { @@ -634,7 +637,8 @@ void Hotspot::setOccupied(bool occupiedFlag) { if (xp < 0) { xp = -xp; widthVal -= xp; - if (widthVal <= 0) return; + if (widthVal <= 0) + return; xp = 0; } @@ -642,7 +646,8 @@ void Hotspot::setOccupied(bool occupiedFlag) { int x2 = xp + widthVal - ROOM_PATHS_WIDTH - 1; if (x2 >= 0) { widthVal -= (x2 + 1); - if (widthVal <= 0) return; + if (widthVal <= 0) + return; } RoomPathsData &paths = Resources::getReference().getRoom(_roomNumber)->paths; @@ -656,14 +661,16 @@ void Hotspot::setOccupied(bool occupiedFlag) { // walks the character a single step in a sequence defined by the walking list bool Hotspot::walkingStep() { - if (_pathFinder.isEmpty()) return true; + if (_pathFinder.isEmpty()) + return true; // Check to see if the end of the next straight walking slice if (_pathFinder.stepCtr() >= _pathFinder.top().numSteps()) { // Move to next slice in walking sequence _pathFinder.stepCtr() = 0; _pathFinder.pop(); - if (_pathFinder.isEmpty()) return true; + if (_pathFinder.isEmpty()) + return true; } if (_pathFinder.stepCtr() == 0) @@ -782,13 +789,15 @@ void Hotspot::showMessage(uint16 messageId, uint16 destCharacterId) { uint16 *v = (uint16 *) (msgData + READ_LE_UINT16(msgData + idx + sizeof(uint16))); while ((idVal = READ_LE_UINT16(v)) != 0xffff) { ++v; - if (READ_LE_UINT16(v) == messageId) break; + if (READ_LE_UINT16(v) == messageId) + break; ++v; } // default response if a specific response not found - if (idVal == 0xffff) idVal = 0x8c4; + if (idVal == 0xffff) + idVal = 0x8c4; debugC(ERROR_DETAILED, kLureDebugStrings, "Hotspot::showMessage idVal=%xh", idVal); if (idVal == 0x76) { @@ -826,7 +835,8 @@ void Hotspot::handleTalkDialog() { Room &room = Room::getReference(); // Return if no talk dialog is necessary - if (_data->talkCountdown == 0) return; + if (_data->talkCountdown == 0) + return; debugC(ERROR_DETAILED, kLureDebugAnimations, "Talk countdown = %d", _data->talkCountdown); if (_data->talkCountdown == CONVERSE_COUNTDOWN_SIZE) { @@ -933,7 +943,8 @@ static const uint16 validRoomExitHotspots[] = {0x2711, 0x2712, 0x2714, 0x2715, 0 bool Hotspot::isRoomExit(uint16 id) { for (const uint16 *p = &validRoomExitHotspots[0]; *p != 0; ++p) - if (*p == id) return true; + if (*p == id) + return true; return false; } @@ -1043,7 +1054,7 @@ BarPlaceResult Hotspot::getBarPlace() { index = -1; while (++index < NUM_SERVE_CUSTOMERS) { if (barEntry.customers[index].hotspotId == 0) - break; + break; } if (index == NUM_SERVE_CUSTOMERS) @@ -1391,7 +1402,8 @@ void Hotspot::doGet(HotspotData *hotspot) { Resources &res = Resources::getReference(); HotspotPrecheckResult result = actionPrecheck(hotspot); - if (result == PC_WAIT) return; + if (result == PC_WAIT) + return; else if (result != PC_EXECUTE) { endAction(); return; @@ -1409,7 +1421,8 @@ void Hotspot::doGet(HotspotData *hotspot) { if (sequenceOffset != 0) { uint16 execResult = Script::execute(sequenceOffset); - if (execResult == 1) return; + if (execResult == 1) + return; else if (execResult != 0) { showMessage(execResult); return; @@ -1432,7 +1445,8 @@ void Hotspot::doOperate(HotspotData *hotspot) { Action action = currentActions().top().supportData().action(); HotspotPrecheckResult result = actionPrecheck(hotspot); - if (result == PC_WAIT) return; + if (result == PC_WAIT) + return; else if (result != PC_EXECUTE) { endAction(); return; @@ -1467,7 +1481,8 @@ void Hotspot::doOpen(HotspotData *hotspot) { } HotspotPrecheckResult result = actionPrecheck(hotspot); - if (result == PC_WAIT) return; + if (result == PC_WAIT) + return; else if (result != PC_EXECUTE) { endAction(); return; @@ -1487,7 +1502,8 @@ void Hotspot::doOpen(HotspotData *hotspot) { if (sequenceOffset != 0) { sequenceOffset = Script::execute(sequenceOffset); - if (sequenceOffset == 1) return; + if (sequenceOffset == 1) + return; if (sequenceOffset != 0) { if (_exitCtr != 0) _exitCtr = 4; @@ -1522,7 +1538,8 @@ void Hotspot::doClose(HotspotData *hotspot) { } HotspotPrecheckResult result = actionPrecheck(hotspot); - if (result == PC_WAIT) return; + if (result == PC_WAIT) + return; else if (result != PC_EXECUTE) { endAction(); return; @@ -1575,7 +1592,8 @@ void Hotspot::doUse(HotspotData *hotspot) { } HotspotPrecheckResult result = actionPrecheck(hotspot); - if (result == PC_WAIT) return; + if (result == PC_WAIT) + return; else if (result != PC_EXECUTE) { endAction(); return; @@ -1616,7 +1634,8 @@ void Hotspot::doGive(HotspotData *hotspot) { } HotspotPrecheckResult result = actionPrecheck(hotspot); - if (result == PC_WAIT) return; + if (result == PC_WAIT) + return; else if (result != PC_EXECUTE) { endAction(); return; @@ -1662,7 +1681,8 @@ void Hotspot::doTalkTo(HotspotData *hotspot) { (hotspot->hotspotId != BLACKSMITH_ID))) { HotspotPrecheckResult result = actionPrecheck(hotspot); - if (result == PC_WAIT) return; + if (result == PC_WAIT) + return; else if (result != PC_EXECUTE) { endAction(); return; @@ -1706,7 +1726,8 @@ void Hotspot::doTell(HotspotData *hotspot) { assert(character); HotspotPrecheckResult hsResult = actionPrecheck(hotspot); - if (hsResult == PC_WAIT) return; + if (hsResult == PC_WAIT) + return; else if (hsResult != PC_EXECUTE) { endAction(); return; @@ -1800,7 +1821,8 @@ void Hotspot::doAsk(HotspotData *hotspot) { _data->useHotspotId = usedId; HotspotPrecheckResult result = actionPrecheck(hotspot); - if (result == PC_WAIT) return; + if (result == PC_WAIT) + return; else if (result != PC_EXECUTE) { endAction(); return; @@ -1886,14 +1908,17 @@ void Hotspot::doStatus(HotspotData *hotspot) { HotspotData const &rec = **i; if (rec.roomNumber == PLAYER_ID) { - if (numItems++ == 0) strcat(buffer, ": "); - else strcat(buffer, ", "); + if (numItems++ == 0) + strcat(buffer, ": "); + else + strcat(buffer, ", "); strings.getString(rec.nameId, buffer + strlen(buffer)); } } // If there were no items, add in the word 'nothing' - if (numItems == 0) strcat(buffer, stringList.getString(S_INV_NOTHING)); + if (numItems == 0) + strcat(buffer, stringList.getString(S_INV_NOTHING)); // If the player has money, add it in uint16 numGroats = res.fieldList().numGroats(); @@ -1943,7 +1968,8 @@ void Hotspot::doBribe(HotspotData *hotspot) { fields.setField(USE_HOTSPOT_ID, hotspot->hotspotId); HotspotPrecheckResult result = actionPrecheck(hotspot); - if (result == PC_WAIT) return; + if (result == PC_WAIT) + return; else if (result != PC_EXECUTE) { endAction(); return; @@ -1968,7 +1994,8 @@ void Hotspot::doBribe(HotspotData *hotspot) { sequenceOffset = res.getHotspotAction(hotspot->actionsOffset, BRIBE); if (sequenceOffset != 0) { sequenceOffset = Script::execute(sequenceOffset); - if (sequenceOffset != 0) return; + if (sequenceOffset != 0) + return; } uint16 talkIndex = res.fieldList().getField(TALK_INDEX); @@ -2004,7 +2031,8 @@ void Hotspot::doLockUnlock(HotspotData *hotspot) { fields.setField(USE_HOTSPOT_ID, hotspot->hotspotId); HotspotPrecheckResult result = actionPrecheck(hotspot); - if (result == PC_WAIT) return; + if (result == PC_WAIT) + return; else if (result != PC_EXECUTE) { endAction(); return; @@ -2156,7 +2184,8 @@ void Hotspot::npcTalkNpcToNpc(HotspotData *hotspot) { fields.setField(USE_HOTSPOT_ID, hotspot->hotspotId); HotspotPrecheckResult result = actionPrecheck(hotspot); - if (result == PC_WAIT) return; + if (result == PC_WAIT) + return; else if (result != PC_EXECUTE) { endAction(); return; @@ -2594,7 +2623,8 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) { if (h.characterMode() == CHARMODE_PLAYER_WAIT) { h.updateMovement(); - if (bumpedPlayer) return; + if (bumpedPlayer) + return; } else { // All other character modes if (h.delayCtr() > 0) { @@ -2691,7 +2721,8 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) { res.pausedList().scan(h); pfResult = pathFinder.process(); - if (pfResult == PF_UNFINISHED) break; + if (pfResult == PF_UNFINISHED) + break; debugC(ERROR_DETAILED, kLureDebugAnimations, "pathFinder done: result = %d", pfResult); @@ -2863,7 +2894,8 @@ void HotspotTickHandlers::roomExitAnimHandler(Hotspot &h) { Room &room = Room::getReference(); RoomExitJoinData *rec = res.getExitJoin(h.hotspotId()); - if (!rec) return; + if (!rec) + return; RoomExitJoinStruct &rs = (rec->hotspots[0].hotspotId == h.hotspotId()) ? rec->hotspots[0] : rec->hotspots[1]; @@ -3036,7 +3068,8 @@ void HotspotTickHandlers::playerAnimHandler(Hotspot &h) { res.pausedList().scan(h); pfResult = pathFinder.process(); - if (pfResult == PF_UNFINISHED) break; + if (pfResult == PF_UNFINISHED) + break; // Pathfinding is now complete buffer = pathFinder.getDebugInfo(); @@ -3474,7 +3507,8 @@ void HotspotTickHandlers::talkAnimHandler(Hotspot &h) { showSelections |= (entry->descId & 0x3fff) != TALK_MAGIC_ID; } - if ((entry->preSequenceId & 0x8000) != 0) break; + if ((entry->preSequenceId & 0x8000) != 0) + break; } if (showSelections && (numLines > 1)) { @@ -3584,7 +3618,8 @@ void HotspotTickHandlers::talkAnimHandler(Hotspot &h) { debugC(ERROR_DETAILED, kLureDebugAnimations, "Character response pre id = %xh", _talkResponse->preSequenceId); - if (!_talkResponse->preSequenceId) break; + if (!_talkResponse->preSequenceId) + break; responseNumber = Script::execute(_talkResponse->preSequenceId); debugC(ERROR_DETAILED, kLureDebugAnimations, "Character response new response = %d", responseNumber); @@ -3680,9 +3715,12 @@ void HotspotTickHandlers::grubAnimHandler(Hotspot &h) { character = ratpouch; } - if (character->x() < 72) frameNumber = 0; - else if (character->x() < 172) frameNumber = 1; - else frameNumber = 2; + if (character->x() < 72) + frameNumber = 0; + else if (character->x() < 172) + frameNumber = 1; + else + frameNumber = 2; h.setActionCtr(frameNumber); h.setFrameNumber(frameNumber); @@ -3782,7 +3820,8 @@ void HotspotTickHandlers::barmanAnimHandler(Hotspot &h) { // Moving right h.setPosition(h.x() + 2, h.y()); h.setActionCtr(h.actionCtr() + 1); - if (h.actionCtr() >= 6) h.setActionCtr(0); + if (h.actionCtr() >= 6) + h.setActionCtr(0); } } else { // Stop the barman moving @@ -4231,7 +4270,8 @@ PathFinderResult PathFinder::process() { while (1) { // Loop through to process cells in the given area - if (!returnFlag) _yCtr = 0; + if (!returnFlag) + _yCtr = 0; while (returnFlag || (_yCtr < ROOM_PATHS_HEIGHT)) { if (!returnFlag) _xCtr = 0; @@ -4239,7 +4279,8 @@ PathFinderResult PathFinder::process() { if (!returnFlag) { processCell(&_layer[(_yChangeStart + _yCtr * _yChangeInc) * DECODED_PATHS_WIDTH + (_xChangeStart + _xCtr * _xChangeInc)]); - if (breakFlag && (_countdownCtr <= 0)) return PF_UNFINISHED; + if (breakFlag && (_countdownCtr <= 0)) + return PF_UNFINISHED; } else { returnFlag = false; } @@ -4249,7 +4290,8 @@ PathFinderResult PathFinder::process() { } // If the destination cell has been filled in, then break out of loop - if (*_pDest != 0) break; + if (*_pDest != 0) + break; if (_cellPopulated) { // At least one cell populated, so go repeat loop @@ -4307,27 +4349,37 @@ PathFinderResult PathFinder::process() { currDirection = NO_DIRECTION; while (1) { v = *pCurrent - 1; - if (v == 0) break; + if (v == 0) + break; newDirection = NO_DIRECTION; if (!altFlag && (currDirection != LEFT) && (currDirection != RIGHT)) { // Standard order direction checking - if (*(pCurrent - DECODED_PATHS_WIDTH) == v) newDirection = DOWN; - else if (*(pCurrent + DECODED_PATHS_WIDTH) == v) newDirection = UP; - else if (*(pCurrent + 1) == v) newDirection = LEFT; - else if (*(pCurrent - 1) == v) newDirection = RIGHT; + if (*(pCurrent - DECODED_PATHS_WIDTH) == v) + newDirection = DOWN; + else if (*(pCurrent + DECODED_PATHS_WIDTH) == v) + newDirection = UP; + else if (*(pCurrent + 1) == v) + newDirection = LEFT; + else if (*(pCurrent - 1) == v) + newDirection = RIGHT; } else { // Alternate order direction checking - if (*(pCurrent + 1) == v) newDirection = LEFT; - else if (*(pCurrent - 1) == v) newDirection = RIGHT; - else if (*(pCurrent - DECODED_PATHS_WIDTH) == v) newDirection = DOWN; - else if (*(pCurrent + DECODED_PATHS_WIDTH) == v) newDirection = UP; + if (*(pCurrent + 1) == v) + newDirection = LEFT; + else if (*(pCurrent - 1) == v) + newDirection = RIGHT; + else if (*(pCurrent - DECODED_PATHS_WIDTH) == v) + newDirection = DOWN; + else if (*(pCurrent + DECODED_PATHS_WIDTH) == v) + newDirection = UP; } if (newDirection == NO_DIRECTION) error("Path finding process failed"); // Process for the specified direction - if (newDirection != currDirection) add(newDirection, 0); + if (newDirection != currDirection) + add(newDirection, 0); switch (newDirection) { case UP: @@ -4374,8 +4426,10 @@ PathFinderResult PathFinder::process() { } // Final Step - if (_xPos < 0) add(RIGHT, -_xPos); - else if (_xPos > 0) add(LEFT, _xPos); + if (_xPos < 0) + add(RIGHT, -_xPos); + else if (_xPos > 0) + add(LEFT, _xPos); return result; } @@ -4402,16 +4456,20 @@ void PathFinder::processCell(uint16 *p) { // Check the surrounding cells (up,down,left,right) for values // Up vTemp = *(p - DECODED_PATHS_WIDTH); - if ((vTemp != 0) && (vTemp < vMax)) vMax = vTemp; + if ((vTemp != 0) && (vTemp < vMax)) + vMax = vTemp; // Down vTemp = *(p + DECODED_PATHS_WIDTH); - if ((vTemp != 0) && (vTemp < vMax)) vMax = vTemp; + if ((vTemp != 0) && (vTemp < vMax)) + vMax = vTemp; // Left vTemp = *(p - 1); - if ((vTemp != 0) && (vTemp < vMax)) vMax = vTemp; + if ((vTemp != 0) && (vTemp < vMax)) + vMax = vTemp; // Right vTemp = *(p + 1); - if ((vTemp != 0) && (vTemp < vMax)) vMax = vTemp; + if ((vTemp != 0) && (vTemp < vMax)) + vMax = vTemp; if (vMax != 0xffff) { // A surrounding cell with a value was found @@ -4433,7 +4491,8 @@ void PathFinder::scanLine(int numScans, int changeAmount, uint16 *&pEnd, int &v) for (int ctr = 1; ctr <= numScans; ++ctr) { pTemp += changeAmount; if ((*pTemp != 0) && (*pTemp != 0xffff)) { - if ((v < ctr) || ((v == ctr) && (*pTemp >= *pEnd))) return; + if ((v < ctr) || ((v == ctr) && (*pTemp >= *pEnd))) + return; pEnd = pTemp; v = ctr; break; @@ -4448,11 +4507,15 @@ void PathFinder::initVars() { _destX = _hotspot->destX(); _destY = _hotspot->destY(); - if (_destX < 10) _destX -= 50; - if (_destX >= FULL_SCREEN_WIDTH-10) _destX += 50; + if (_destX < 10) + _destX -= 50; + if (_destX >= FULL_SCREEN_WIDTH-10) + _destX += 50; - _xPos = 0; _yPos = 0; - _xDestPos = 0; _yDestPos = 0; + _xPos = 0; + _yPos = 0; + _xDestPos = 0; + _yDestPos = 0; _xCurrent = _hotspot->x(); if (_xCurrent < 0) { @@ -4622,7 +4685,8 @@ void Support::characterChangeRoom(Hotspot &h, uint16 roomNumber, if (h.hotspotId() == PLAYER_ID) { // Room change code for the player - if (room.cursorState() != CS_NONE) return; + if (room.cursorState() != CS_NONE) + return; PlayerNewPosition &p = fields.playerNewPos(); if (checkForIntersectingCharacter(h, newX, newY - 48, roomNumber)) { @@ -4679,7 +4743,8 @@ bool Support::charactersIntersecting(HotspotData *hotspot1, HotspotData *hotspot bool Support::isCharacterInList(uint16 *lst, int numEntries, uint16 charId) { while (numEntries-- > 0) - if (*lst++ == charId) return true; + if (*lst++ == charId) + return true; return false; } diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp index efa0dd3fd3..634ff441b6 100644 --- a/engines/mohawk/livingbooks.cpp +++ b/engines/mohawk/livingbooks.cpp @@ -311,8 +311,8 @@ void MohawkEngine_LivingBooks::loadBookInfo(const Common::String &filename) { // - fDebugWindow (always 0?) if (_bookInfoFile.hasSection("Globals")) { - const Common::ConfigFile::SectionKeyList globals = _bookInfoFile.getKeys("Globals"); - for (Common::ConfigFile::SectionKeyList::const_iterator i = globals.begin(); i != globals.end(); i++) { + const Common::INIFile::SectionKeyList globals = _bookInfoFile.getKeys("Globals"); + for (Common::INIFile::SectionKeyList::const_iterator i = globals.begin(); i != globals.end(); i++) { Common::String command = Common::String::format("%s = %s", i->key.c_str(), i->value.c_str()); LBCode tempCode(this, 0); uint offset = tempCode.parseCode(command); diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h index 76da7d8219..615fcd0e16 100644 --- a/engines/mohawk/livingbooks.h +++ b/engines/mohawk/livingbooks.h @@ -28,7 +28,7 @@ #include "mohawk/livingbooks_graphics.h" #include "mohawk/sound.h" -#include "common/config-file.h" +#include "common/ini-file.h" #include "common/rect.h" #include "common/queue.h" #include "common/random.h" @@ -759,7 +759,7 @@ public: private: LivingBooksConsole *_console; - Common::ConfigFile _bookInfoFile; + Common::INIFile _bookInfoFile; Common::String getBookInfoFileName() const; void loadBookInfo(const Common::String &filename); diff --git a/engines/mohawk/livingbooks_lbx.cpp b/engines/mohawk/livingbooks_lbx.cpp index 2b8b22ec81..dcf8caa4a5 100644 --- a/engines/mohawk/livingbooks_lbx.cpp +++ b/engines/mohawk/livingbooks_lbx.cpp @@ -33,7 +33,7 @@ public: bool call(uint callId, const Common::Array<LBValue> ¶ms, LBValue &result); protected: - Common::ConfigFile _dataFile; + Common::INIFile _dataFile; Common::String _curSection; void open(const Common::String &filename); @@ -77,8 +77,8 @@ bool LBXDataFile::call(uint callId, const Common::Array<LBValue> ¶ms, LBValu case kLBXDataFileGetSectionList: { Common::SharedPtr<LBList> list = Common::SharedPtr<LBList>(new LBList); - Common::ConfigFile::SectionList sections = _dataFile.getSections(); - for (Common::List<Common::ConfigFile::Section>::const_iterator i = sections.begin(); i != sections.end(); ++i) + Common::INIFile::SectionList sections = _dataFile.getSections(); + for (Common::List<Common::INIFile::Section>::const_iterator i = sections.begin(); i != sections.end(); ++i) list->array.push_back(LBValue(i->name)); result = LBValue(list); } @@ -103,8 +103,8 @@ bool LBXDataFile::call(uint callId, const Common::Array<LBValue> ¶ms, LBValu error("incorrect number of parameters (%d) to LBXDataFile::loadCurSectionVars", params.size()); { - const Common::ConfigFile::SectionKeyList globals = _dataFile.getKeys(_curSection); - for (Common::ConfigFile::SectionKeyList::const_iterator i = globals.begin(); i != globals.end(); i++) { + const Common::INIFile::SectionKeyList globals = _dataFile.getKeys(_curSection); + for (Common::INIFile::SectionKeyList::const_iterator i = globals.begin(); i != globals.end(); i++) { Common::String command = Common::String::format("%s = %s", i->key.c_str(), i->value.c_str()); LBCode tempCode(_vm, 0); uint offset = tempCode.parseCode(command); diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index 361917d53b..3e3db5b224 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -30,7 +30,6 @@ #include "mortevielle/menu.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" -#include "mortevielle/speech.h" #include "common/scummsys.h" @@ -630,7 +629,7 @@ void MortevielleEngine::fctOpen() { || (_coreVar._currPlace == PURPLE_ROOM) || (_coreVar._currPlace == BLUE_ROOM)) { if (getRandomNumber(1, 4) == 3) - _speechManager.startSpeech(7, 9, 1); + _soundManager.startSpeech(7, 9, 1); } _openObjects[i] = _num; displayAnimFrame(1, _num); @@ -699,7 +698,7 @@ void MortevielleEngine::fctPlace() { displayAnimFrame(1, 1); handleDescriptionText(2, 165); displayEmptyHand(); - _speechManager.startSpeech(6, -9, 1); + _soundManager.startSpeech(6, -9, 1); // Do you want to enter the hidden passage? int answer = _dialogManager.show(getEngineString(S_YES_NO), 1); @@ -800,7 +799,7 @@ void MortevielleEngine::fctTurn() { _crep = 997; if ((_coreVar._currPlace == ATTIC) && (_coreVar._atticRodHoleObjectId == 159) && (_coreVar._atticBallHoleObjectId == 141)) { handleDescriptionText(2, 167); - _speechManager.startSpeech(7, 9, 1); + _soundManager.startSpeech(7, 9, 1); int answer = _dialogManager.show(getEngineString(S_YES_NO), 1); if (answer == 1) _endGame = true; @@ -810,7 +809,7 @@ void MortevielleEngine::fctTurn() { if ((_coreVar._currPlace == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId == 143)) { handleDescriptionText(2, 175); clearVerbBar(); - _speechManager.startSpeech(6, -9, 1); + _soundManager.startSpeech(6, -9, 1); int answer = _dialogManager.show(getEngineString(S_YES_NO), 1); if (answer == 1) { _coreVar._currPlace = CRYPT; @@ -932,7 +931,7 @@ void MortevielleEngine::fctKnock() { if (_coreVar._currPlace == ROOM26) { int rand = (getRandomNumber(0, 8)) - 4; - _speechManager.startSpeech(11, rand, 1); + _soundManager.startSpeech(11, rand, 1); int p = getPresenceStats(rand, _coreVar._faithScore, _roomDoorId); int l = _roomDoorId; if (l != OWN_ROOM) { @@ -1146,7 +1145,7 @@ void MortevielleEngine::fctEnter() { _crep = 179; else { int randVal = (getRandomNumber(0, 10)) - 5; - _speechManager.startSpeech(7, randVal, 1); + _soundManager.startSpeech(7, randVal, 1); displayAnimFrame(1, 1); int charIndex = convertBitIndexToCharacterIndex(z); @@ -1167,7 +1166,7 @@ void MortevielleEngine::fctEnter() { } } else { int randVal = (getRandomNumber(0, 10)) - 5; - _speechManager.startSpeech(7, randVal, 1); + _soundManager.startSpeech(7, randVal, 1); displayAnimFrame(1, 1); _coreVar._currPlace = _roomDoorId; diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index ba5d984886..264839c158 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -30,7 +30,6 @@ #include "mortevielle/dialogs.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" -#include "mortevielle/speech.h" #include "common/str.h" @@ -428,7 +427,7 @@ void DialogManager::drawF3F8() { void DialogManager::checkForF8(int SpeechNum, bool drawFrame2Fl) { _vm->testKeyboard(); do { - _vm->_speechManager.startSpeech(SpeechNum, 0, 0); + _vm->_soundManager.startSpeech(SpeechNum, 0, 0); _vm->_key = waitForF3F8(); if (_vm->shouldQuit()) return; diff --git a/engines/mortevielle/module.mk b/engines/mortevielle/module.mk index e18657cb6a..a9f02c2a67 100644 --- a/engines/mortevielle/module.mk +++ b/engines/mortevielle/module.mk @@ -12,7 +12,6 @@ MODULE_OBJS := \ outtext.o \ saveload.o \ sound.o \ - speech.o \ utils.o # This module can be built as a plugin diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 7126df933f..0b6b82c1a9 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -56,7 +56,6 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _mouse.setParent(this); _text.setParent(this); _soundManager.setParent(this); - _speechManager.setParent(this); _savegameManager.setParent(this); _lastGameFrame = 0; @@ -100,18 +99,15 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *g _caff = -1; _day = 0; - memset(_mem, 0, sizeof(_mem)); _curPict = nullptr; _curAnim = nullptr; _rightFramePict = nullptr; - _compMusicBuf1 = nullptr; } MortevielleEngine::~MortevielleEngine() { free(_curPict); free(_curAnim); free(_rightFramePict); - free(_compMusicBuf1); } /** @@ -229,6 +225,9 @@ Common::ErrorCode MortevielleEngine::initialize() { _currGraphicalDevice = _newGraphicalDevice; hirs(); + _soundManager.loadNoise(); + _soundManager.loadAmbiantSounds(); + return Common::kNoError; } @@ -365,7 +364,7 @@ Common::Error MortevielleEngine::run() { // Cleanup (allocated in initialize()) _screenSurface.free(); - free(_speechManager._cfiphBuffer); + free(_soundManager._cfiphBuffer); free(_cfiecBuffer); return Common::kNoError; @@ -376,7 +375,6 @@ Common::Error MortevielleEngine::run() { */ void MortevielleEngine::showIntroduction() { _dialogManager.displayIntroScreen(false); - _speechManager._mlec = 0; _dialogManager.checkForF8(142, false); if (shouldQuit()) return; @@ -402,7 +400,6 @@ void MortevielleEngine::mainGame() { for (_crep = 1; _crep <= _x26KeyCount; ++_crep) decodeNumber(&_cfiecBuffer[161 * 16], (_cfiecBufferSize - (161 * 16)) / 64); - loadBRUIT5(); _menu.initMenu(this); charToHour(); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 8c7da8cc97..699ee3f37a 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -44,7 +44,6 @@ #include "mortevielle/mouse.h" #include "mortevielle/saveload.h" #include "mortevielle/sound.h" -#include "mortevielle/speech.h" #include "mortevielle/outtext.h" namespace Mortevielle { @@ -52,7 +51,8 @@ namespace Mortevielle { // Debug channels enum { kMortevielleCore = 1 << 0, - kMortevielleGraphics = 1 << 1 + kMortevielleGraphics = 1 << 1, + kMortevielleSounds = 1 << 2 }; // Game languages @@ -258,7 +258,6 @@ private: void displayCGAPattern(int n, Pattern *p, nhom *pal); void loadPalette(); void loadTexts(); - void loadBRUIT5(); void loadCFIEC(); void loadCFIPH(); void showTitleScreen(); @@ -434,12 +433,9 @@ public: int _resolutionScaler; byte _destinationArray[7][25]; - // TODO: Replace the following with proper implementations, or refactor out the code using them - byte _mem[65536 * 16]; byte *_curPict; byte *_curAnim; byte *_rightFramePict; - byte *_compMusicBuf1; Debugger _debugger; ScreenSurface _screenSurface; @@ -448,7 +444,6 @@ public: Common::RandomSource _randomSource; SoundManager _soundManager; SavegameManager _savegameManager; - SpeechManager _speechManager; Menu _menu; MouseHandler _mouse; TextHandler _text; diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 24cec8911d..30dc4ce79f 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -33,116 +33,52 @@ namespace Mortevielle { -/** - * Constructor - */ -PCSpeaker::PCSpeaker(int rate) { - _rate = rate; - _oscLength = 0; - _oscSamples = 0; - _remainingSamples = 0; - _volume = 255; -} - -/** - * Destructor - */ -PCSpeaker::~PCSpeaker() { -} - -/** - * Adds a new note to the queue of notes to be played. - */ -void PCSpeaker::play(int freq, uint32 length) { - assert((freq > 0) && (length > 0)); - Common::StackLock lock(_mutex); - - _pendingNotes.push(SpeakerNote(freq, length)); -} - -/** - * Stops the currently playing song - */ -void PCSpeaker::stop() { - Common::StackLock lock(_mutex); - - _remainingSamples = 0; - _pendingNotes.clear(); -} - -void PCSpeaker::setVolume(byte volume) { - _volume = volume; -} - -/** - * Return true if a song is currently playing - */ -bool PCSpeaker::isPlaying() const { - return !_pendingNotes.empty() || (_remainingSamples != 0); -} - -/** - * Method used by the mixer to pull off pending samples to play - */ -int PCSpeaker::readBuffer(int16 *buffer, const int numSamples) { - Common::StackLock lock(_mutex); - - int i; - - for (i = 0; (_remainingSamples || !_pendingNotes.empty()) && (i < numSamples); ++i) { - if (!_remainingSamples) - // Used up the current note, so queue the next one - dequeueNote(); - - buffer[i] = generateSquare(_oscSamples, _oscLength) * _volume; - if (_oscSamples++ >= _oscLength) - _oscSamples = 0; - - _remainingSamples--; - } - - // Clear the rest of the buffer - if (i < numSamples) - memset(buffer + i, 0, (numSamples - i) * sizeof(int16)); - - return numSamples; -} - -/** - * Dequeues a note from the pending note list - */ -void PCSpeaker::dequeueNote() { - SpeakerNote note = _pendingNotes.pop(); - - _oscLength = _rate / note.freq; - _oscSamples = 0; - _remainingSamples = (_rate * note.length) / 1000000; - assert((_oscLength > 0) && (_remainingSamples > 0)); -} - -/** - * Support method for generating a square wave - */ -int8 PCSpeaker::generateSquare(uint32 x, uint32 oscLength) { - return (x < (oscLength / 2)) ? 127 : -128; -} - -/*-------------------------------------------------------------------------*/ - -// The PC timer chip works at a frequency of 1.19318Mhz -#define TIMER_FREQUENCY 1193180 + const byte _tnocon[364] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; + + const byte _intcon[26] = {1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}; + const byte _typcon[26] = {0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3}; + const byte _tabdph[16] = {0, 10, 2, 0, 2, 10, 3, 0, 3, 7, 5, 0, 6, 7, 7, 10}; + const byte _tabdbc[18] = {7, 23, 7, 14, 13, 9, 14, 9, 5, 12, 6, 12, 13, 4, 0, 4, 5, 9}; SoundManager::SoundManager(Audio::Mixer *mixer) { _mixer = mixer; - _speakerStream = new PCSpeaker(mixer->getOutputRate()); - _mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle, - _speakerStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); + _audioStream = nullptr; + _ambiantNoiseBuf = nullptr; + _noiseBuf = nullptr; + + _soundType = 0; + _phonemeNumb = 0; + + for (int i = 0; i < 3; i++) { + _queue[i]._val = 0; + _queue[i]._code = 0; + _queue[i]._acc = 0; + _queue[i]._freq = 0; + _queue[i]._rep = 0; + } + _buildingSentence = false; } SoundManager::~SoundManager() { - _mixer->stopHandle(_speakerHandle); - delete _speakerStream; - + if (_audioStream) + _audioStream->finish(); + free(_ambiantNoiseBuf); + free(_noiseBuf); } /** @@ -176,17 +112,165 @@ int SoundManager::decodeMusic(const byte *PSrc, byte *PDest, int size) { return decompSize; } -void SoundManager::litph(tablint &t, int typ, int tempo) { - return; +/** + * Load sonmus.mor file + * @remarks Originally called 'charge_son' + */ +void SoundManager::loadAmbiantSounds() { + Common::File f; + if (!f.open("sonmus.mor")) + error("Missing file - sonmus.mor"); + + free(_ambiantNoiseBuf); + int size = f.size(); + byte *compMusicBuf1 = (byte *)malloc(sizeof(byte) * size); + _ambiantNoiseBuf = (byte *)malloc(sizeof(byte) * size * 2); + f.read(compMusicBuf1, size); + f.close(); + + decodeMusic(compMusicBuf1, _ambiantNoiseBuf, size); + free(compMusicBuf1); +} + +/** + * Speech function - Load Noise files + * @remarks Originally called 'charge_bruit' and 'charge_bruit5' + */ +void SoundManager::loadNoise() { + Common::File f1, f2; + + if (!f1.open("bruits")) //Translation: "noise" + error("Missing file - bruits"); + if (!f2.open("bruit5")) + error("Missing file - bruit5"); + + _noiseBuf = (byte *)malloc(sizeof(byte) * (f1.size() + f2.size())); + assert(f1.size() > 32000); + + f1.read(_noiseBuf, 32000); // 250 * 128 + f2.read(&_noiseBuf[32000], f2.size()); + f1.read(&_noiseBuf[32000 + f2.size()], f1.size() - 32000); // 19072 + + f1.close(); + f2.close(); } -void SoundManager::playNote(int frequency, int32 length) { - _speakerStream->play(frequency, length); +void SoundManager::regenbruit() { + int i = 69876; + for (int j = 0; j < 100; j++) { + _cfiphBuffer[j] = READ_BE_UINT16(&_noiseBuf[i]); + i += 2; + } } +void SoundManager::litph(tablint &t, int typ, int tempo) { + // Skip speech + if (_soundType == 0) + return; + + if (!_buildingSentence) { + if (_mixer->isSoundHandleActive(_soundHandle)) + _mixer->stopHandle(_soundHandle); + _buildingSentence = true; + } + int freq = tempo * 252; // 25.2 * 10 + int i = 0; + while (i < _ptr_oct) { + int idx = _troctBuf[i]; + i++; + switch(idx) { + case 0: { + int val = _troctBuf[i]; + i++; + if (_soundType == 0) + warning("TODO: vclas"); + else if (_soundType == 1) { + debugC(5, kMortevielleSounds, "litph - duson"); + const static int noiseAdr[] = {0, 17224, + 17224, 33676, + 33676, 51014, + 51014, 59396, + 59396, 61286, + 61286, 69875}; + if (val > 5) { + warning("unhandled index %d", val); + } else { + if (!_audioStream) + _audioStream = Audio::makeQueuingAudioStream(freq, false); + _audioStream->queueBuffer(&_noiseBuf[noiseAdr[val * 2]], noiseAdr[(val * 2) + 1] - noiseAdr[(val * 2)], DisposeAfterUse::NO, Audio::FLAG_UNSIGNED); + } + } else { // 2 + debugC(5, kMortevielleSounds, "litph - vadson"); + const static int ambiantNoiseAdr[] = {0, 14020, + 14020, 18994, + 18994, 19630, + 19630, 22258, + 22258, 37322, + 37322, 44472, + 44472, 52324, + 52324, 59598, + 59598, 69748}; + if (val > 8) { + warning("unhandled index %d", val); + } else { + if (!_audioStream) + _audioStream = Audio::makeQueuingAudioStream(freq, false); + _audioStream->queueBuffer(&_ambiantNoiseBuf[ambiantNoiseAdr[val * 2]], ambiantNoiseAdr[(val * 2) + 1] - ambiantNoiseAdr[(val * 2)], DisposeAfterUse::NO, Audio::FLAG_UNSIGNED); + } + } + i++; + break; + } + case 2: { + int val = _troctBuf[i]; + i++; + int tmpidx = (val * 12) + 268; + val = _troctBuf[i]; + i++; + warning("TODO: reech %d %d", tmpidx, val); + } + break; + case 4: + if (_soundType) { + i += 2; + } else { + // Speech + warning("TODO: Interphoneme: consonne:%d voyelle:%d", _troctBuf[i], _troctBuf[i + 1]); + i += 2; + } + break; + case 6: + warning("TODO: pari2"); + i += 2; + break; + default: + static byte emptyBuf[19] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + if (idx == 62) + warning("TODO: blab"); + else if (idx == 32) { + if (!_audioStream) + _audioStream = Audio::makeQueuingAudioStream(freq, false); + _audioStream->queueBuffer(emptyBuf, 19, DisposeAfterUse::NO, Audio::FLAG_UNSIGNED); + } else if (idx == 35) { + if (i < _ptr_oct) + warning("unexpected 35 - stop the buffering"); + i = _ptr_oct; + } else if (idx == 46) { + if (!_audioStream) + _audioStream = Audio::makeQueuingAudioStream(freq, false); + for (int i = 0; i < 10; i++) + _audioStream->queueBuffer(emptyBuf, 19, DisposeAfterUse::NO, Audio::FLAG_UNSIGNED); + } else { + warning("Other code: %d - %d %d", idx, _troctBuf[i], _troctBuf[i + 1]); + } + break; + } + } +} void SoundManager::playSong(const byte* buf, uint size, uint loops) { - Audio::SeekableAudioStream *raw = Audio::makeRawStream(buf, size, 11025, Audio::FLAG_UNSIGNED, DisposeAfterUse::NO); + int freq = kTempoMusic * 252; // 25.2 * 10 + Audio::SeekableAudioStream *raw = Audio::makeRawStream(buf, size, freq, Audio::FLAG_UNSIGNED, DisposeAfterUse::NO); Audio::AudioStream *stream = Audio::makeLoopingAudioStream(raw, loops); Audio::SoundHandle songHandle; _mixer->playStream(Audio::Mixer::kSFXSoundType, &songHandle, stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::YES); @@ -200,4 +284,504 @@ void SoundManager::playSong(const byte* buf, uint size, uint loops) { void SoundManager::setParent(MortevielleEngine *vm) { _vm = vm; } + +void SoundManager::spfrac(int wor) { + _queue[2]._rep = (uint)wor >> 12; + if ((_soundType == 0) && (_queue[2]._code != 9)) { + if (((_queue[2]._code > 4) && (_queue[2]._val != 20) && (_queue[2]._rep != 3) && (_queue[2]._rep != 6) && (_queue[2]._rep != 9)) || + ((_queue[2]._code < 5) && ((_queue[2]._val != 19) && (_queue[2]._val != 22) && (_queue[2]._rep != 4) && (_queue[2]._rep != 9)))) { + ++_queue[2]._rep; + } + } + + _queue[2]._freq = ((uint)wor >> 6) & 7; + _queue[2]._acc = ((uint)wor >> 9) & 7; +} + +void SoundManager::charg_car(int &currWordNumb) { + assert(currWordNumb < 1712); + int wor = READ_BE_UINT16(&_wordBuf[currWordNumb]); + int int_ = wor & 0x3f; // 63 + + if ((int_ >= 0) && (int_ <= 13)) { + _queue[2]._val = int_; + _queue[2]._code = 5; + } else if ((int_ >= 14) && (int_ <= 21)) { + _queue[2]._val = int_; + _queue[2]._code = 6; + } else if ((int_ >= 22) && (int_ <= 47)) { + int_ -= 22; + _queue[2]._val = int_; + _queue[2]._code = _typcon[int_]; + } else if ((int_ >= 48) && (int_ <= 56)) { + _queue[2]._val = int_ - 22; + _queue[2]._code = 4; + } else { + switch (int_) { + case 60: + _queue[2]._val = 32; /* " " */ + _queue[2]._code = 9; + break; + case 61: + _queue[2]._val = 46; /* "." */ + _queue[2]._code = 9; + break; + case 62: + _queue[2]._val = 35; /* "#" */ + _queue[2]._code = 9; + default: + break; + } + } + + spfrac(wor); + currWordNumb += 2; +} + + +void SoundManager::entroct(byte o) { + assert(_ptr_oct < 10576); + _troctBuf[_ptr_oct] = o; + ++_ptr_oct; +} + +void SoundManager::cctable(tablint &t) { + float tb[257]; + + tb[0] = 0; + for (int k = 0; k <= 255; ++k) { + tb[k + 1] = _vm->_addFix + tb[k]; + t[255 - k] = abs((int)tb[k] + 1); + } +} + +/** + * Load phoneme sound file + * @remarks Originally called 'charge_phbruit' + */ +void SoundManager::loadPhonemeSounds() { + Common::File f; + + if (!f.open("phbrui.mor")) + error("Missing file - phbrui.mor"); + + for (int i = 1; i <= f.size() / 2; ++i) + _cfiphBuffer[i] = f.readUint16BE(); + + f.close(); +} + +void SoundManager::trait_car() { + byte d3; + int d2, i; + + switch (_queue[1]._code) { + case 9: + if (_queue[1]._val != (int)'#') { + for (i = 0; i <= _queue[1]._rep; ++i) + entroct(_queue[1]._val); + } + break; + case 5: + case 6: + if (_queue[1]._code == 6) + d3 = _tabdph[(_queue[1]._val - 14) << 1]; + else + d3 = kNullValue; + if (_queue[0]._code >= 5) { + if (_queue[0]._code == 9) { + entroct(4); + if (d3 == kNullValue) + entroct(_queue[1]._val); + else + entroct(d3); + entroct(22); + } + } + + switch (_queue[1]._rep) { + case 0: + entroct(0); + entroct(_queue[1]._val); + if (d3 == kNullValue) + if (_queue[2]._code == 9) + entroct(2); + else + entroct(4); + else if (_queue[2]._code == 9) + entroct(0); + else + entroct(1); + break; + case 4: + case 5: + case 6: + if (_queue[1]._rep != 4) { + i = _queue[1]._rep - 5; + do { + --i; + entroct(0); + if (d3 == kNullValue) + entroct(_queue[1]._val); + else + entroct(d3); + entroct(3); + } while (i >= 0); + } + if (d3 == kNullValue) { + entroct(4); + entroct(_queue[1]._val); + entroct(0); + } else { + entroct(0); + entroct(_queue[1]._val); + entroct(3); + } + + break; + case 7: + case 8: + case 9: + if (_queue[1]._rep != 7) { + i = _queue[1]._rep - 8; + do { + --i; + entroct(0); + if (d3 == kNullValue) + entroct(_queue[1]._val); + else + entroct(d3); + entroct(3); + } while (i >= 0); + } + if (d3 == kNullValue) { + entroct(0); + entroct(_queue[1]._val); + entroct(2); + } else { + entroct(0); + entroct(_queue[1]._val); + entroct(0); + } + break; + case 1: + case 2: + case 3: + if (_queue[1]._rep != 1) { + i = _queue[1]._rep - 2; + do { + --i; + entroct(0); + if (d3 == kNullValue) + entroct(_queue[1]._val); + else + entroct(d3); + entroct(3); + } while (i >= 0); + } + entroct(0); + entroct(_queue[1]._val); + if (_queue[2]._code == 9) + entroct(0); + else + entroct(1); + + break; + default: + break; + } // switch c2.rep + break; + + case 2: + case 3: + d3 = _queue[1]._code + 5; // 7 ou 8 => Corresponding vowel + if (_queue[0]._code > 4) { + if (_queue[0]._code == 9) { + entroct(4); + entroct(d3); + entroct(22); + } + } + i = _queue[1]._rep; + assert(i >= 0); + if (i != 0) { + do { + --i; + entroct(0); + entroct(d3); + entroct(3); + } while (i > 0); + } + if (_queue[2]._code == 6) { + entroct(4); + entroct(_tabdph[(_queue[2]._val - 14) << 1]); + entroct(_queue[1]._val); + } else { + entroct(4); + if (_queue[2]._val == 4) + entroct(3); + else + entroct(_queue[2]._val); + entroct(_queue[1]._val); + } + break; + case 0: + case 1: + switch (_queue[2]._code) { + case 2: + d2 = 7; + break; + case 3: + d2 = 8; + break; + case 6: + d2 = _tabdph[(_queue[2]._val - 14) << 1]; + break; + case 5: + d2 = _queue[2]._val; + break; + default: + d2 = 10; + break; + } // switch c3._code + d2 = (d2 * 26) + _queue[1]._val; + if (_tnocon[d2] == 0) + d3 = 2; + else + d3 = 6; + if (_queue[1]._rep >= 5) { + _queue[1]._rep -= 5; + d3 = 8 - d3; // Swap 2 and 6 + } + if (_queue[1]._code == 0) { + i = _queue[1]._rep; + if (i != 0) { + do { + --i; + entroct(d3); + entroct(_queue[1]._val); + entroct(3); + } while (i > 0); + } + entroct(d3); + entroct(_queue[1]._val); + entroct(4); + } else { + entroct(d3); + entroct(_queue[1]._val); + entroct(3); + i = _queue[1]._rep; + if (i != 0) { + do { + --i; + entroct(d3); + entroct(_queue[1]._val); + entroct(4); + } while (i > 0); + } + } + if (_queue[2]._code == 9) { + entroct(d3); + entroct(_queue[1]._val); + entroct(5); + } else if ((_queue[2]._code != 0) && (_queue[2]._code != 1) && (_queue[2]._code != 4)) { + switch (_queue[2]._code) { + case 3: + d2 = 8; + break; + case 6: + d2 = _tabdph[(_queue[2]._val - 14) << 1]; + break; + case 5: + d2 = _queue[2]._val; + break; + default: + d2 = 7; + break; + } // switch c3._code + if (d2 == 4) + d2 = 3; + + if (_intcon[_queue[1]._val] != 0) + ++_queue[1]._val; + + if ((_queue[1]._val == 17) || (_queue[1]._val == 18)) + _queue[1]._val = 16; + + entroct(4); + entroct(d2); + entroct(_queue[1]._val); + } + + break; + case 4: + i = _queue[1]._rep; + if (i != 0) { + do { + --i; + entroct(2); + entroct(_queue[1]._val); + entroct(3); + } while (i > 0); + } + entroct(2); + entroct(_queue[1]._val); + entroct(4); + if (_queue[2]._code == 9) { + entroct(2); + entroct(_queue[1]._val); + entroct(5); + } else if ((_queue[2]._code != 0) && (_queue[2]._code != 1) && (_queue[2]._code != 4)) { + switch (_queue[2]._code) { + case 3: + d2 = 8; + break; + case 6: + d2 = _tabdph[(_queue[2]._val - 14) << 1]; + break; + case 5: + d2 = _queue[2]._val; + break; + default: + d2 = 7; + break; + } // switch c3._code + + if (d2 == 4) + d2 = 3; + + if (_intcon[_queue[1]._val] != 0) + ++_queue[1]._val; + + entroct(4); + entroct(d2); + entroct(_tabdbc[((_queue[1]._val - 26) << 1) + 1]); + } + + break; + default: + break; + } // switch c2.code +} + +/** + * Make the queue evolve by 1 value + * @remarks Originally called 'rot_chariot' + */ +void SoundManager::moveQueue() { + _queue[0] = _queue[1]; + _queue[1] = _queue[2]; + _queue[2]._val = 32; + _queue[2]._code = 9; +} + +/** + * initialize the queue + * @remarks Originally called 'init_chariot' + */ +void SoundManager::initQueue() { + _queue[2]._rep = 0; + _queue[2]._freq = 0; + _queue[2]._acc = 0; + moveQueue(); + moveQueue(); +} + +/** + * Handle a phoneme + * @remarks Originally called 'trait_ph' + */ +void SoundManager::handlePhoneme() { + const uint16 deca[3] = {300, 30, 40}; + + uint16 startPos = _cfiphBuffer[_phonemeNumb - 1] + deca[_soundType]; + uint16 endPos = _cfiphBuffer[_phonemeNumb] + deca[_soundType]; + int wordCount = endPos - startPos; + + startPos /= 2; + endPos /= 2; + assert((endPos - startPos) < 1711); + for (int i = startPos, currWord = 0; i < endPos; i++, currWord += 2) + WRITE_BE_UINT16(&_wordBuf[currWord], _cfiphBuffer[i]); + + _ptr_oct = 0; + int currWord = 0; + initQueue(); + + do { + moveQueue(); + charg_car(currWord); + trait_car(); + } while (currWord < wordCount); + + moveQueue(); + trait_car(); + entroct((int)'#'); + +#ifdef DEBUG + warning("---"); + for (int i = 0; i < _ptr_oct; ) { + if ((_troctBuf[i] == 32) || (_troctBuf[i] == 35) || (_troctBuf[i] == 46)) { + warning("%d", _troctBuf[i]); + i++; + } else { + warning("%d %d %d", _troctBuf[i], _troctBuf[i + 1], _troctBuf[i + 1]); + i += 3; + } + } + warning("---"); +#endif +} + +/** + * Start speech + * @remarks Originally called 'parole' + */ +void SoundManager::startSpeech(int rep, int ht, int typ) { + uint16 savph[501]; + int tempo; + + if (_vm->_soundOff) + return; + + _phonemeNumb = rep; + int haut = ht; + _soundType = typ; + if (_soundType != 0) { + for (int i = 0; i <= 500; ++i) + savph[i] = _cfiphBuffer[i]; + tempo = kTempoNoise; + } else if (haut > 5) + tempo = kTempoF; + else + tempo = kTempoM; + _vm->_addFix = (float)((tempo - 8)) / 256; + cctable(_tbi); + switch (typ) { + case 1: + regenbruit(); + break; + case 2: + loadPhonemeSounds(); + break; + default: + break; + } + handlePhoneme(); + litph(_tbi, typ, tempo); + + _buildingSentence = false; + if (typ != 0) { + _audioStream->finish(); + _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, _audioStream); + _audioStream = nullptr; + } + + if (_soundType != 0) { + for (int i = 0; i <= 500; ++i) + _cfiphBuffer[i] = savph[i]; + } + _vm->setPal(_vm->_numpal); +} + } // End of namespace Mortevielle diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index 1f9e0d9c4d..1e4a4cd54c 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -36,79 +36,68 @@ namespace Mortevielle { class MortevielleEngine; -typedef int tablint[256]; - -/** - * Structure used to store pending notes to play - */ -struct SpeakerNote { - int freq; - uint32 length; - - SpeakerNote(int noteFreq, uint32 noteLength) { - freq = noteFreq; - length = noteLength; - } +const int kNullValue = 255; +const int kTempoMusic = 71; +const int kTempoNoise = 78; +const int kTempoF = 80; +const int kTempoM = 89; + +struct SpeechQueue { + int _val; + int _code; + int _acc; + int _freq; + int _rep; }; -/** - * This is a modified PC Speaker class that allows the queueing of an entire song - * sequence one note at a time. - */ -class PCSpeaker : public Audio::AudioStream { -private: - Common::Queue<SpeakerNote> _pendingNotes; - Common::Mutex _mutex; - - int _rate; - uint32 _oscLength; - uint32 _oscSamples; - uint32 _remainingSamples; - uint32 _mixedSamples; - byte _volume; - - void dequeueNote(); -protected: - static int8 generateSquare(uint32 x, uint32 oscLength); -public: - PCSpeaker(int rate = 44100); - ~PCSpeaker(); - - /** Play a note for length microseconds. - */ - void play(int freq, uint32 length); - /** Stop the currently playing sequence */ - void stop(); - /** Adjust the volume. */ - void setVolume(byte volume); - - bool isPlaying() const; - - int readBuffer(int16 *buffer, const int numSamples); - - bool isStereo() const { return false; } - bool endOfData() const { return false; } - bool endOfStream() const { return false; } - int getRate() const { return _rate; } -}; +typedef int tablint[256]; class SoundManager { private: MortevielleEngine *_vm; - Audio::Mixer *_mixer; - PCSpeaker *_speakerStream; - Audio::SoundHandle _speakerHandle; + + byte *_ambiantNoiseBuf; + byte *_noiseBuf; + int _phonemeNumb; + int _soundType; + SpeechQueue _queue[3]; + byte _wordBuf[1712]; + byte _troctBuf[10576]; + bool _buildingSentence; + int _ptr_oct; + int _tbi[256]; + + Audio::QueuingAudioStream *_audioStream; + + void loadPhonemeSounds(); + void moveQueue(); + void initQueue(); + void handlePhoneme(); + + void spfrac(int wor); + void charg_car(int &currWordNumb); + void entroct(byte o); + void cctable(tablint &t); + void trait_car(); + + void regenbruit(); + void litph(tablint &t, int typ, int tempo); + public: SoundManager(Audio::Mixer *mixer); ~SoundManager(); + Audio::Mixer *_mixer; + Audio::SoundHandle _soundHandle; + uint16 *_cfiphBuffer; + void setParent(MortevielleEngine *vm); - void playNote(int frequency, int32 length); int decodeMusic(const byte *PSrc, byte *PDest, int size); void playSong(const byte *buf, uint usize, uint loops); - - void litph(tablint &t, int typ, int tempo); + void loadAmbiantSounds(); + void loadNoise(); + void startSpeech(int rep, int ht, int typ); }; } // End of namespace Mortevielle diff --git a/engines/mortevielle/speech.cpp b/engines/mortevielle/speech.cpp deleted file mode 100644 index 35eefc898f..0000000000 --- a/engines/mortevielle/speech.cpp +++ /dev/null @@ -1,611 +0,0 @@ -/* 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. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1987-1989 Lankhor - */ - -#include "mortevielle/mortevielle.h" - -#include "mortevielle/speech.h" -#include "mortevielle/sound.h" - -#include "common/endian.h" -#include "common/file.h" - -namespace Mortevielle { - -const byte _tnocon[364] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -const byte _intcon[26] = {1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}; -const byte _typcon[26] = {0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3}; -const byte _tabdph[16] = {0, 10, 2, 0, 2, 10, 3, 0, 3, 7, 5, 0, 6, 7, 7, 10}; -const byte _tabdbc[18] = {7, 23, 7, 14, 13, 9, 14, 9, 5, 12, 6, 12, 13, 4, 0, 4, 5, 9}; - -SpeechManager::SpeechManager() { - _typlec = 0; - _phonemeNumb = 0; - - for (int i = 0; i < 3; i++) { - _queue[i]._val = 0; - _queue[i]._code = 0; - _queue[i]._acc = 0; - _queue[i]._freq = 0; - _queue[i]._rep = 0; - } - _noise5Buf = nullptr; -} - -SpeechManager::~SpeechManager() { - free(_noise5Buf); -} - -void SpeechManager::spfrac(int wor) { - _queue[2]._rep = (uint)wor >> 12; - if ((_typlec == 0) && (_queue[2]._code != 9)) - if (((_queue[2]._code > 4) && (_queue[2]._val != 20) && (_queue[2]._rep != 3) && (_queue[2]._rep != 6) && (_queue[2]._rep != 9)) || - ((_queue[2]._code < 5) && ((_queue[2]._val != 19) && (_queue[2]._val != 22) && (_queue[2]._rep != 4) && (_queue[2]._rep != 9)))) { - ++_queue[2]._rep; - } - - _queue[2]._freq = ((uint)wor >> 6) & 7; - _queue[2]._acc = ((uint)wor >> 9) & 7; -} - -void SpeechManager::charg_car(int &currWordNumb) { - int wor = READ_BE_UINT16(&_vm->_mem[(kAdrWord * 16) + currWordNumb]); - int int_ = wor & 0x3f; // 63 - - if ((int_ >= 0) && (int_ <= 13)) { - _queue[2]._val = int_; - _queue[2]._code = 5; - } else if ((int_ >= 14) && (int_ <= 21)) { - _queue[2]._val = int_; - _queue[2]._code = 6; - } else if ((int_ >= 22) && (int_ <= 47)) { - int_ = int_ - 22; - _queue[2]._val = int_; - _queue[2]._code = _typcon[int_]; - } else if ((int_ >= 48) && (int_ <= 56)) { - _queue[2]._val = int_ - 22; - _queue[2]._code = 4; - } else { - switch (int_) { - case 60: - _queue[2]._val = 32; /* " " */ - _queue[2]._code = 9; - break; - case 61: - _queue[2]._val = 46; /* "." */ - _queue[2]._code = 9; - break; - case 62: - _queue[2]._val = 35; /* "#" */ - _queue[2]._code = 9; - default: - break; - } - } - - spfrac(wor); - currWordNumb += 2; -} - - -void SpeechManager::entroct(byte o) { - _vm->_mem[(kAdrTroct * 16) + _ptr_oct] = o; - ++_ptr_oct; -} - -void SpeechManager::veracf(byte b) { - ; -} - -void SpeechManager::cctable(tablint &t) { - float tb[257]; - - tb[0] = 0; - for (int k = 0; k <= 255; ++k) { - tb[k + 1] = _vm->_addFix + tb[k]; - t[255 - k] = abs((int)tb[k] + 1); - } -} - -void SpeechManager::regenbruit() { - int i = kOffsetB3 + 8590; - int j = 0; - do { - _cfiphBuffer[j] = READ_BE_UINT16(&_vm->_mem[(kAdrNoise3 * 16) + i]); - i += 2; - ++j; - } while (i < kOffsetB3 + 8790); -} - -/** - * Load sonmus.mor file - * @remarks Originally called 'charge_son' - */ -void SpeechManager::loadMusicSound() { - Common::File f; - if (!f.open("sonmus.mor")) - error("Missing file - sonmus.mor"); - - free(_vm->_compMusicBuf1); - int size = f.size(); - _vm->_compMusicBuf1 = (byte *)malloc(sizeof(byte) * size); - f.read(_vm->_compMusicBuf1, size); - - _vm->_soundManager.decodeMusic(_vm->_compMusicBuf1, &_vm->_mem[kAdrNoise * 16], size); - f.close(); -} - -/** - * Load phoneme sound file - * @remarks Originally called 'charge_phbruit' - */ -void SpeechManager::loadPhonemeSounds() { - Common::File f; - - if (!f.open("phbrui.mor")) - error("Missing file - phbrui.mor"); - - for (int i = 1; i <= f.size() / 2; ++i) - _cfiphBuffer[i] = f.readUint16BE(); - - f.close(); -} - -/** - * Speech function - Load Noise file - * @remarks Originally called 'charge_bruit' - */ -void SpeechManager::loadNoise() { - Common::File f; - - if (!f.open("bruits")) //Translation: "noise" - error("Missing file - bruits"); - - f.read(&_vm->_mem[kAdrNoise * 16], 250 * 128); // 32000 - for (int i = 0; i < _noise5Size; ++i) - _vm->_mem[(kAdrNoise * 16) + 32000 + i] = _noise5Buf[i]; - f.read(&_vm->_mem[(kAdrNoise1 * 16) + kOffsetB1], 149 * 128); // 19072 - - f.close(); -} - -void SpeechManager::trait_car() { - byte d3; - int d2, i; - - switch (_queue[1]._code) { - case 9: - if (_queue[1]._val != (int)'#') - for (i = 0; i <= _queue[1]._rep; ++i) - entroct(_queue[1]._val); - break; - case 5: - case 6: - if (_queue[1]._code == 6) - d3 = _tabdph[(_queue[1]._val - 14) << 1]; - else - d3 = kNullValue; - if (_queue[0]._code >= 5) { - veracf(_queue[1]._acc); - if (_queue[0]._code == 9) { - entroct(4); - if (d3 == kNullValue) - entroct(_queue[1]._val); - else - entroct(d3); - entroct(22); - } - } - - switch (_queue[1]._rep) { - case 0: - entroct(0); - entroct(_queue[1]._val); - if (d3 == kNullValue) - if (_queue[2]._code == 9) - entroct(2); - else - entroct(4); - else if (_queue[2]._code == 9) - entroct(0); - else - entroct(1); - break; - case 4: - case 5: - case 6: - if (_queue[1]._rep != 4) { - i = _queue[1]._rep - 5; - do { - --i; - entroct(0); - if (d3 == kNullValue) - entroct(_queue[1]._val); - else - entroct(d3); - entroct(3); - } while (i >= 0); - } - if (d3 == kNullValue) { - entroct(4); - entroct(_queue[1]._val); - entroct(0); - } else { - entroct(0); - entroct(_queue[1]._val); - entroct(3); - } - break; - case 7: - case 8: - case 9: - if (_queue[1]._rep != 7) { - i = _queue[1]._rep - 8; - do { - --i; - entroct(0); - if (d3 == kNullValue) - entroct(_queue[1]._val); - else - entroct(d3); - entroct(3); - } while (i >= 0); - } - if (d3 == kNullValue) { - entroct(0); - entroct(_queue[1]._val); - entroct(2); - } else { - entroct(0); - entroct(_queue[1]._val); - entroct(0); - } - break; - case 1: - case 2: - case 3: - if (_queue[1]._rep != 1) { - i = _queue[1]._rep - 2; - do { - --i; - entroct(0); - if (d3 == kNullValue) - entroct(_queue[1]._val); - else - entroct(d3); - entroct(3); - } while (i >= 0); - } - entroct(0); - entroct(_queue[1]._val); - if (_queue[2]._code == 9) - entroct(0); - else - entroct(1); - break; - default: - break; - } // switch c2.rep - break; - - case 2: - case 3: - d3 = _queue[1]._code + 5; // 7 ou 8 => Corresponding vowel - if (_queue[0]._code > 4) { - veracf(_queue[1]._acc); - if (_queue[0]._code == 9) { - entroct(4); - entroct(d3); - entroct(22); - } - } - i = _queue[1]._rep; - assert(i >= 0); - if (i != 0) { - do { - --i; - entroct(0); - entroct(d3); - entroct(3); - } while (i > 0); - } - veracf(_queue[2]._acc); - if (_queue[2]._code == 6) { - entroct(4); - entroct(_tabdph[(_queue[2]._val - 14) << 1]); - entroct(_queue[1]._val); - } else { - entroct(4); - if (_queue[2]._val == 4) - entroct(3); - else - entroct(_queue[2]._val); - entroct(_queue[1]._val); - } - break; - case 0: - case 1: - veracf(_queue[1]._acc); - switch (_queue[2]._code) { - case 2: - d2 = 7; - break; - case 3: - d2 = 8; - break; - case 6: - d2 = _tabdph[(_queue[2]._val - 14) << 1]; - break; - case 5: - d2 = _queue[2]._val; - break; - default: - d2 = 10; - break; - } // switch c3._code - d2 = (d2 * 26) + _queue[1]._val; - if (_tnocon[d2] == 0) - d3 = 2; - else - d3 = 6; - if (_queue[1]._rep >= 5) { - _queue[1]._rep -= 5; - d3 = 8 - d3; // Swap 2 and 6 - } - if (_queue[1]._code == 0) { - i = _queue[1]._rep; - if (i != 0) { - do { - --i; - entroct(d3); - entroct(_queue[1]._val); - entroct(3); - } while (i > 0); - } - entroct(d3); - entroct(_queue[1]._val); - entroct(4); - } else { - entroct(d3); - entroct(_queue[1]._val); - entroct(3); - i = _queue[1]._rep; - if (i != 0) { - do { - --i; - entroct(d3); - entroct(_queue[1]._val); - entroct(4); - } while (i > 0); - } - } - if (_queue[2]._code == 9) { - entroct(d3); - entroct(_queue[1]._val); - entroct(5); - } else if ((_queue[2]._code != 0) && (_queue[2]._code != 1) && (_queue[2]._code != 4)) { - veracf(_queue[2]._acc); - switch (_queue[2]._code) { - case 3: - d2 = 8; - break; - case 6: - d2 = _tabdph[(_queue[2]._val - 14) << 1]; - break; - case 5: - d2 = _queue[2]._val; - break; - default: - d2 = 7; - break; - } // switch c3._code - if (d2 == 4) - d2 = 3; - - if (_intcon[_queue[1]._val] != 0) - ++_queue[1]._val; - - if ((_queue[1]._val == 17) || (_queue[1]._val == 18)) - _queue[1]._val = 16; - - entroct(4); - entroct(d2); - entroct(_queue[1]._val); - } - - break; - case 4: - veracf(_queue[1]._acc); - i = _queue[1]._rep; - if (i != 0) { - do { - --i; - entroct(2); - entroct(_queue[1]._val); - entroct(3); - } while (i > 0); - } - entroct(2); - entroct(_queue[1]._val); - entroct(4); - if (_queue[2]._code == 9) { - entroct(2); - entroct(_queue[1]._val); - entroct(5); - } else if ((_queue[2]._code != 0) && (_queue[2]._code != 1) && (_queue[2]._code != 4)) { - veracf(_queue[2]._acc); - switch (_queue[2]._code) { - case 3: - d2 = 8; - break; - case 6: - d2 = _tabdph[(_queue[2]._val - 14) << 1]; - break; - case 5: - d2 = _queue[2]._val; - break; - default: - d2 = 7; - break; - } // switch c3._code - - if (d2 == 4) - d2 = 3; - - if (_intcon[_queue[1]._val] != 0) - ++_queue[1]._val; - - entroct(4); - entroct(d2); - entroct(_tabdbc[((_queue[1]._val - 26) << 1) + 1]); - } - - break; - default: - break; - } // switch c2.code -} - -/** - * Make the queue evolve by 1 value - * @remarks Originally called 'rot_chariot' - */ -void SpeechManager::moveQueue() { - _queue[0] = _queue[1]; - _queue[1] = _queue[2]; - _queue[2]._val = 32; - _queue[2]._code = 9; -} - -/** - * initialize the queue - * @remarks Originally called 'init_chariot' - */ -void SpeechManager::initQueue() { - _queue[2]._rep = 0; - _queue[2]._freq = 0; - _queue[2]._acc = 0; - moveQueue(); - moveQueue(); -} - -/** - * Handle a phoneme - * @remarks Originally called 'trait_ph' - */ -void SpeechManager::handlePhoneme() { - const uint16 deca[3] = {300, 30, 40}; - - uint16 startPos = _cfiphBuffer[_phonemeNumb - 1] + deca[_typlec]; - uint16 endPos = _cfiphBuffer[_phonemeNumb] + deca[_typlec]; - int wordCount = endPos - startPos; - - startPos /= 2; - endPos /= 2; - for (int i = startPos, currWord = 0; i < endPos; i++, currWord += 2) - WRITE_BE_UINT16(&_vm->_mem[(kAdrWord * 16) + currWord], _cfiphBuffer[i]); - - _ptr_oct = 0; - int currWord = 0; - initQueue(); - - do { - moveQueue(); - charg_car(currWord); - trait_car(); - } while (currWord < wordCount); - - moveQueue(); - trait_car(); - entroct((int)'#'); -} - -/** - * Start speech - * @remarks Originally called 'parole' - */ -void SpeechManager::startSpeech(int rep, int ht, int typ) { - uint16 savph[501]; - int tempo; - - if (_vm->_soundOff) - return; - - _phonemeNumb = rep; - int haut = ht; - _typlec = typ; - if (_typlec != 0) { - for (int i = 0; i <= 500; ++i) - savph[i] = _cfiphBuffer[i]; - tempo = kTempoNoise; - } else if (haut > 5) - tempo = kTempoF; - else - tempo = kTempoM; - _vm->_addFix = (float)((tempo - 8)) / 256; - cctable(_tbi); - switch (typ) { - case 1: - loadNoise(); - regenbruit(); - break; - case 2: - loadMusicSound(); - loadPhonemeSounds(); - break; - default: - break; - } - handlePhoneme(); - _vm->_soundManager.litph(_tbi, typ, tempo); - if (_typlec != 0) - for (int i = 0; i <= 500; ++i) { - _cfiphBuffer[i] = savph[i]; - _mlec = _typlec; - } - _vm->setPal(_vm->_numpal); -} - -void SpeechManager::setParent(MortevielleEngine *vm) { - _vm = vm; -} -} // End of namespace Mortevielle diff --git a/engines/mortevielle/speech.h b/engines/mortevielle/speech.h deleted file mode 100644 index c3c4c32942..0000000000 --- a/engines/mortevielle/speech.h +++ /dev/null @@ -1,106 +0,0 @@ -/* 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. - * - */ - -/* - * This code is based on original Mortville Manor DOS source code - * Copyright (c) 1987-1989 Lankhor - */ - -#ifndef MORTEVIELLE_SPEECH_H -#define MORTEVIELLE_SPEECH_H - -#include "mortevielle/sound.h" - -#include "common/scummsys.h" - -namespace Mortevielle { - -const int kAdrNoise = 0x5cb0;/*2C00;*/ -const int kAdrNoise1 = 0x6924; -const int kAdrNoise3 = 0x6ba6;/*3AF6;*/ -const int kAdrTroct = 0x406b; -const int kAdrWord = 0x4000; -const int kOffsetB1 = 6; -const int kOffsetB3 = 6; - -const float kfreq0 = 1.19318e6; -const int kNullValue = 255; -const int kTempoMusic = 71; -const int kTempoNoise = 78; -const int kTempoF = 80; -const int kTempoM = 89; - -// Useless constants -//const int segdon = 0x6c00; -//const int adbruit2 = 0x6b30;/*3A80;*/ -//const int adson2 = 0x60b0;/*3000;*/ -//const int seg_syst = 0x6fed; -//const int offsetb2 = 4; - -struct SpeechQueue { - int _val; - int _code; - int _acc; - int _freq; - int _rep; -}; - -class SpeechManager { -private: - MortevielleEngine *_vm; - - int _typlec; - int _phonemeNumb; - - SpeechQueue _queue[3]; - int _ptr_oct; - -public: - uint16 *_cfiphBuffer; - int _tbi[256]; - int _mlec; - byte *_noise5Buf; - int _noise5Size; - - SpeechManager(); - ~SpeechManager(); - void setParent(MortevielleEngine *vm); - void spfrac(int wor); - void charg_car(int &currWordNumb); - void entroct(byte o); - void veracf(byte b); - void cctable(tablint &t); - void regenbruit(); - void loadMusicSound(); - void loadPhonemeSounds(); - void loadNoise(); - void trait_car(); - - void moveQueue(); - void initQueue(); - void handlePhoneme(); - void startSpeech(int rep, int ht, int typ); -}; - -} // End of namespace Mortevielle - -#endif diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index 5667e6e5c0..80f19277df 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -31,7 +31,6 @@ #include "mortevielle/menu.h" #include "mortevielle/mouse.h" #include "mortevielle/outtext.h" -#include "mortevielle/speech.h" #include "common/scummsys.h" #include "graphics/cursorman.h" @@ -276,6 +275,9 @@ void MortevielleEngine::handleAction() { if (shouldQuit()) return; ++temps; + if (keyPressed() || _mouseClick) { + _soundManager._mixer->stopHandle(_soundManager._soundHandle); + } } while (!((_menu._menuSelected) || (temps > lim) || (funct) || (_anyone))); _inMainGameLoop = false; @@ -1256,24 +1258,24 @@ void MortevielleEngine::startMusicOrSpeech(int so) { ; } else if ((!_introSpeechPlayed) && (!_coreVar._alreadyEnteredManor)) { // Type 1: Speech - _speechManager.startSpeech(10, 1, 1); + _soundManager.startSpeech(10, 1, 1); _introSpeechPlayed = true; } else { if (((_coreVar._currPlace == MOUNTAIN) || (_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK)) && (getRandomNumber(1, 3) == 2)) // Type 1: Speech - _speechManager.startSpeech(9, getRandomNumber(2, 4), 1); + _soundManager.startSpeech(9, getRandomNumber(2, 4), 1); else if ((_coreVar._currPlace == CHAPEL) && (getRandomNumber(1, 2) == 1)) // Type 1: Speech - _speechManager.startSpeech(8, 1, 1); + _soundManager.startSpeech(8, 1, 1); else if ((_coreVar._currPlace == WELL) && (getRandomNumber(1, 2) == 2)) // Type 1: Speech - _speechManager.startSpeech(12, 1, 1); + _soundManager.startSpeech(12, 1, 1); else if (_coreVar._currPlace == INSIDE_WELL) // Type 1: Speech - _speechManager.startSpeech(13, 1, 1); + _soundManager.startSpeech(13, 1, 1); else // Type 2 : music - _speechManager.startSpeech(getRandomNumber(1, 17), 1, 2); + _soundManager.startSpeech(getRandomNumber(1, 17), 1, 2); } } @@ -1341,7 +1343,7 @@ void MortevielleEngine::startDialog(int16 rep) { key = 0; do { - _speechManager.startSpeech(rep, haut[_caff - 69], 0); + _soundManager.startSpeech(rep, haut[_caff - 69], 0); key = _dialogManager.waitForF3F8(); if (shouldQuit()) return; @@ -2132,19 +2134,6 @@ void MortevielleEngine::loadTexts() { } -void MortevielleEngine::loadBRUIT5() { - Common::File f; - - if (!f.open("bruit5")) - error("Missing file - bruit5"); - - free(_speechManager._noise5Buf); - _speechManager._noise5Size = f.size(); - _speechManager._noise5Buf = (byte *)malloc(sizeof(byte) * _speechManager._noise5Size); - f.read(_speechManager._noise5Buf, _speechManager._noise5Size); - f.close(); -} - void MortevielleEngine::loadCFIEC() { Common::File f; @@ -2179,10 +2168,10 @@ void MortevielleEngine::loadCFIPH() { error("Missing file - *cfiph.mor"); } - _speechManager._cfiphBuffer = (uint16 *)malloc(sizeof(uint16) * (f.size() / 2)); + _soundManager._cfiphBuffer = (uint16 *)malloc(sizeof(uint16) * (f.size() / 2)); for (int i = 0; i < (f.size() / 2); ++i) - _speechManager._cfiphBuffer[i] = f.readUint16BE(); + _soundManager._cfiphBuffer[i] = f.readUint16BE(); f.close(); } @@ -2210,9 +2199,6 @@ void MortevielleEngine::music() { int musicSize = _soundManager.decodeMusic(compMusicBuf, musicBuf, size); free(compMusicBuf); - _addFix = (float)((kTempoMusic - 8)) / 256; - _speechManager.cctable(_speechManager._tbi); - _soundManager.playSong(musicBuf, musicSize, 5); while (keyPressed()) getChar(); @@ -2398,7 +2384,7 @@ void MortevielleEngine::prepareRoom() { prepareScreenType2(); displayTextInVerbBar(getEngineString(S_HEAR_NOISE)); int rand = (getRandomNumber(0, 4)) - 2; - _speechManager.startSpeech(1, rand, 1); + _soundManager.startSpeech(1, rand, 1); clearVerbBar(); } } @@ -2524,7 +2510,7 @@ void MortevielleEngine::initCaveOrCellar() { prepareScreenType2(); displayTextInVerbBar(getEngineString(S_SOMEONE_ENTERS)); int rand = (getRandomNumber(0, 4)) - 2; - _speechManager.startSpeech(2, rand, 1); + _soundManager.startSpeech(2, rand, 1); // The original was doing here a useless loop. // It has been removed @@ -2877,8 +2863,10 @@ void MortevielleEngine::setPresenceFlags(int roomId) { void MortevielleEngine::initMaxAnswer() { static const byte maxAnswer[9] = { 0, 4, 5, 6, 7, 5, 6, 5, 8 }; - for (int idx = 0; idx < 9; ++idx) + for (int idx = 0; idx < 9; ++idx) { _charAnswerMax[idx] = maxAnswer[idx]; + _charAnswerCount[idx] = 0; + } } /** @@ -3222,9 +3210,9 @@ L1: _crep = 138; handleDescriptionText(2, _crep); if (_crep == 138) - _speechManager.startSpeech(5, 2, 1); + _soundManager.startSpeech(5, 2, 1); else - _speechManager.startSpeech(4, 4, 1); + _soundManager.startSpeech(4, 4, 1); if (_openObjCount == 0) _coreVar._faithScore += 2; @@ -3249,7 +3237,7 @@ L1: } else { handleDescriptionText(2, 136); int rand = (getRandomNumber(0, 4)) - 2; - _speechManager.startSpeech(3, rand, 1); + _soundManager.startSpeech(3, rand, 1); clearDescriptionBar(); displayAloneText(); resetRoomVariables(MANOR_FRONT); diff --git a/engines/neverhood/graphics.h b/engines/neverhood/graphics.h index 703e274576..b80bd60729 100644 --- a/engines/neverhood/graphics.h +++ b/engines/neverhood/graphics.h @@ -43,9 +43,11 @@ struct NDimensions { struct NRect { int16 x1, y1, x2, y2; - NRect() : x1(0), y1(0), x2(0), y2(0) {} - - NRect(int16 x01, int16 y01, int16 x02, int16 y02) : x1(x01), y1(y01), x2(x02), y2(y02) {} + static NRect make(int16 x01, int16 y01, int16 x02, int16 y02) { + NRect r; + r.set(x01, y01, x02, y02); + return r; + } void set(int16 x01, int16 y01, int16 x02, int16 y02) { x1 = x01; diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp index d59afa4ba5..7bf64a4602 100644 --- a/engines/neverhood/menumodule.cpp +++ b/engines/neverhood/menumodule.cpp @@ -338,15 +338,15 @@ MainMenu::MainMenu(NeverhoodEngine *vm, Module *parentModule) }; static const NRect kMenuButtonCollisionBounds[] = { - NRect(52, 121, 110, 156), - NRect(52, 192, 109, 222), - NRect(60, 257, 119, 286), - NRect(67, 326, 120, 354), - NRect(70, 389, 128, 416), - NRect(523, 113, 580, 144), - NRect(525, 176, 577, 206), - NRect(527, 384, 580, 412), - NRect(522, 255, 580, 289) + { 52, 121, 110, 156 }, + { 52, 192, 109, 222 }, + { 60, 257, 119, 286 }, + { 67, 326, 120, 354 }, + { 70, 389, 128, 416 }, + { 523, 113, 580, 144 }, + { 525, 176, 577, 206 }, + { 527, 384, 580, 412 }, + { 522, 255, 580, 289 } }; setBackground(0x08C0020C); @@ -1026,17 +1026,17 @@ static const uint32 kSaveGameMenuButtonFileHashes[] = { }; static const NRect kSaveGameMenuButtonCollisionBounds[] = { - NRect(518, 106, 602, 160), - NRect(516, 378, 596, 434), - NRect(394, 108, 458, 206), - NRect(400, 204, 458, 276), - NRect(398, 292, 456, 352), - NRect(396, 352, 460, 444) + { 518, 106, 602, 160 }, + { 516, 378, 596, 434 }, + { 394, 108, 458, 206 }, + { 400, 204, 458, 276 }, + { 398, 292, 456, 352 }, + { 396, 352, 460, 444 } }; -static const NRect kSaveGameMenuListBoxRect(0, 0, 320, 272); -static const NRect kSaveGameMenuTextEditRect(0, 0, 377, 17); -static const NRect kSaveGameMenuMouseRect(50, 47, 427, 64); +static const NRect kSaveGameMenuListBoxRect = { 0, 0, 320, 272 }; +static const NRect kSaveGameMenuTextEditRect = { 0, 0, 377, 17 }; +static const NRect kSaveGameMenuMouseRect = { 50, 47, 427, 64 }; SaveGameMenu::SaveGameMenu(NeverhoodEngine *vm, Module *parentModule, SavegameList *savegameList) : GameStateMenu(vm, parentModule, savegameList, kSaveGameMenuButtonFileHashes, kSaveGameMenuButtonCollisionBounds, @@ -1060,17 +1060,17 @@ static const uint32 kLoadGameMenuButtonFileHashes[] = { }; static const NRect kLoadGameMenuButtonCollisionBounds[] = { - NRect( 44, 115, 108, 147), - NRect( 52, 396, 112, 426), - NRect(188, 116, 245, 196), - NRect(189, 209, 239, 269), - NRect(187, 301, 233, 349), - NRect(182, 358, 241, 433) + { 44, 115, 108, 147 }, + { 52, 396, 112, 426 }, + { 188, 116, 245, 196 }, + { 189, 209, 239, 269 }, + { 187, 301, 233, 349 }, + { 182, 358, 241, 433 } }; -static const NRect kLoadGameMenuListBoxRect(0, 0, 320, 271); -static const NRect kLoadGameMenuTextEditRect(0, 0, 320, 17); -static const NRect kLoadGameMenuMouseRect(263, 48, 583, 65); +static const NRect kLoadGameMenuListBoxRect = { 0, 0, 320, 271 }; +static const NRect kLoadGameMenuTextEditRect = { 0, 0, 320, 17 }; +static const NRect kLoadGameMenuMouseRect = { 263, 48, 583, 65 }; LoadGameMenu::LoadGameMenu(NeverhoodEngine *vm, Module *parentModule, SavegameList *savegameList) : GameStateMenu(vm, parentModule, savegameList, kLoadGameMenuButtonFileHashes, kLoadGameMenuButtonCollisionBounds, @@ -1093,16 +1093,16 @@ static const uint32 kDeleteGameMenuButtonFileHashes[] = { }; static const NRect kDeleteGameMenuButtonCollisionBounds[] = { - NRect(518, 46, 595, 91), - NRect(524, 322, 599, 369), - NRect(395, 40, 462, 127), - NRect(405, 126, 460, 185), - NRect(397, 205, 456, 273), - NRect(395, 278, 452, 372) + { 518, 46, 595, 91 }, + { 524, 322, 599, 369 }, + { 395, 40, 462, 127 }, + { 405, 126, 460, 185 }, + { 397, 205, 456, 273 }, + { 395, 278, 452, 372 } }; -static const NRect kDeleteGameMenuListBoxRect(0, 0, 320, 271); -static const NRect kDeleteGameMenuTextEditRect(0, 0, 320, 17); +static const NRect kDeleteGameMenuListBoxRect = { 0, 0, 320, 271 }; +static const NRect kDeleteGameMenuTextEditRect = { 0, 0, 320, 17 }; DeleteGameMenu::DeleteGameMenu(NeverhoodEngine *vm, Module *parentModule, SavegameList *savegameList) : GameStateMenu(vm, parentModule, savegameList, kDeleteGameMenuButtonFileHashes, kDeleteGameMenuButtonCollisionBounds, @@ -1128,8 +1128,8 @@ QueryOverwriteMenu::QueryOverwriteMenu(NeverhoodEngine *vm, Module *parentModule }; static const NRect kQueryOverwriteMenuCollisionBounds[] = { - NRect(145, 334, 260, 385), - NRect(365, 340, 477, 388) + { 145, 334, 260, 385 }, + { 365, 340, 477, 388 } }; setBackground(0x043692C4); diff --git a/engines/neverhood/modules/module1100.cpp b/engines/neverhood/modules/module1100.cpp index 03810915dd..faa0516d7e 100644 --- a/engines/neverhood/modules/module1100.cpp +++ b/engines/neverhood/modules/module1100.cpp @@ -555,19 +555,19 @@ void Scene1105::createObjects() { _ssSymbolDice[1] = insertSprite<SsScene1105SymbolDie>(1, 339, 304); _ssSymbolDice[2] = insertSprite<SsScene1105SymbolDie>(2, 485, 304); - _ssSymbol1UpButton = insertSprite<SsScene1105Button>(this, 0x08002860, NRect(146, 362, 192, 403)); + _ssSymbol1UpButton = insertSprite<SsScene1105Button>(this, 0x08002860, NRect::make(146, 362, 192, 403)); addCollisionSprite(_ssSymbol1UpButton); - _ssSymbol1DownButton = insertSprite<SsScene1105Button>(this, 0x42012460, NRect(147, 404, 191, 442)); + _ssSymbol1DownButton = insertSprite<SsScene1105Button>(this, 0x42012460, NRect::make(147, 404, 191, 442)); addCollisionSprite(_ssSymbol1DownButton); - _ssSymbol2UpButton = insertSprite<SsScene1105Button>(this, 0x100030A0, NRect(308, 361, 355, 402)); + _ssSymbol2UpButton = insertSprite<SsScene1105Button>(this, 0x100030A0, NRect::make(308, 361, 355, 402)); addCollisionSprite(_ssSymbol2UpButton); - _ssSymbol2DownButton = insertSprite<SsScene1105Button>(this, 0x840228A0, NRect(306, 406, 352, 445)); + _ssSymbol2DownButton = insertSprite<SsScene1105Button>(this, 0x840228A0, NRect::make(306, 406, 352, 445)); addCollisionSprite(_ssSymbol2DownButton); - _ssSymbol3UpButton = insertSprite<SsScene1105Button>(this, 0x20000120, NRect(476, 358, 509, 394)); + _ssSymbol3UpButton = insertSprite<SsScene1105Button>(this, 0x20000120, NRect::make(476, 358, 509, 394)); addCollisionSprite(_ssSymbol3UpButton); - _ssSymbol3DownButton = insertSprite<SsScene1105Button>(this, 0x08043121, NRect(463, 401, 508, 438)); + _ssSymbol3DownButton = insertSprite<SsScene1105Button>(this, 0x08043121, NRect::make(463, 401, 508, 438)); addCollisionSprite(_ssSymbol3DownButton); - _ssActionButton = insertSprite<SsScene1105Button>(this, 0x8248AD35, NRect(280, 170, 354, 245)); + _ssActionButton = insertSprite<SsScene1105Button>(this, 0x8248AD35, NRect::make(280, 170, 354, 245)); addCollisionSprite(_ssActionButton); _isPanelOpen = true; diff --git a/engines/neverhood/modules/module2400.cpp b/engines/neverhood/modules/module2400.cpp index 3a152543cf..21ea390ba2 100644 --- a/engines/neverhood/modules/module2400.cpp +++ b/engines/neverhood/modules/module2400.cpp @@ -168,11 +168,11 @@ static const uint32 kScene2401FileHashes3[] = { }; static const NRect kScene2401Rects[] = { - NRect(369, 331, 394, 389), - NRect(395, 331, 419, 389), - NRect(420, 331, 441, 389), - NRect(442, 331, 464, 389), - NRect(465, 331, 491, 389) + { 369, 331, 394, 389 }, + { 395, 331, 419, 389 }, + { 420, 331, 441, 389 }, + { 442, 331, 464, 389 }, + { 465, 331, 491, 389 } }; static const uint32 kAsScene2401WaterSpitFileHashes2[] = { diff --git a/engines/neverhood/modules/module2500.cpp b/engines/neverhood/modules/module2500.cpp index 1b525f12af..46ce2ba4fc 100644 --- a/engines/neverhood/modules/module2500.cpp +++ b/engines/neverhood/modules/module2500.cpp @@ -29,25 +29,25 @@ static const uint32 kScene2505StaticSprites[] = { 0x4000A226, 0 }; -static const NRect kScene2505ClipRect = NRect(0, 0, 564, 480); +static const NRect kScene2505ClipRect = { 0, 0, 564, 480 }; static const uint32 kScene2506StaticSprites[] = { 0x4027AF02, 0 }; -static const NRect kScene2506ClipRect = NRect(0, 0, 640, 441); +static const NRect kScene2506ClipRect = { 0, 0, 640, 441 }; static const uint32 kScene2508StaticSprites1[] = { 0x2F08E610, 0xD844E6A0, 0 }; -static const NRect kScene2508ClipRect1 = NRect(0, 0, 594, 448); +static const NRect kScene2508ClipRect1 = { 0, 0, 594, 448 }; static const uint32 kScene2508StaticSprites2[] = { 0x2F08E610, 0 }; -static const NRect kScene2508ClipRect2 = NRect(0, 0, 594, 448); +static const NRect kScene2508ClipRect2 = { 0, 0, 594, 448 }; Module2500::Module2500(NeverhoodEngine *vm, Module *parentModule, int which) : Module(vm, parentModule), _soundIndex(0) { diff --git a/engines/neverhood/modules/module2700.cpp b/engines/neverhood/modules/module2700.cpp index f8f3c71042..7aea82f6b1 100644 --- a/engines/neverhood/modules/module2700.cpp +++ b/engines/neverhood/modules/module2700.cpp @@ -26,14 +26,14 @@ namespace Neverhood { -static const NRect kScene2710ClipRect = NRect(0, 0, 626, 480); +static const NRect kScene2710ClipRect = { 0, 0, 626, 480 }; static const uint32 kScene2710StaticSprites[] = { 0x0D2016C0, 0 }; -static const NRect kScene2711ClipRect = NRect(0, 0, 521, 480); +static const NRect kScene2711ClipRect = { 0, 0, 521, 480 }; static const uint32 kScene2711FileHashes1[] = { 0, @@ -68,14 +68,14 @@ static const uint32 kScene2711FileHashes3[] = { 0 }; -static const NRect kScene2724ClipRect = NRect(0, 141, 640, 480); +static const NRect kScene2724ClipRect = { 0, 141, 640, 480 }; static const uint32 kScene2724StaticSprites[] = { 0xC20D00A5, 0 }; -static const NRect kScene2725ClipRect = NRect(0, 0, 640, 413); +static const NRect kScene2725ClipRect = { 0, 0, 640, 413 }; static const uint32 kScene2725StaticSprites[] = { 0xC20E00A5, diff --git a/engines/neverhood/scene.cpp b/engines/neverhood/scene.cpp index e76a9ca521..c8d7490753 100644 --- a/engines/neverhood/scene.cpp +++ b/engines/neverhood/scene.cpp @@ -212,7 +212,7 @@ Sprite *Scene::insertStaticSprite(uint32 fileHash, int surfacePriority) { } void Scene::insertScreenMouse(uint32 fileHash, const NRect *mouseRect) { - NRect rect(-1, -1, -1, -1); + NRect rect = NRect::make(-1, -1, -1, -1); if (mouseRect) rect = *mouseRect; insertMouse(new Mouse(_vm, fileHash, rect)); diff --git a/engines/scumm/he/script_v80he.cpp b/engines/scumm/he/script_v80he.cpp index eb62b650a4..ae43d714ad 100644 --- a/engines/scumm/he/script_v80he.cpp +++ b/engines/scumm/he/script_v80he.cpp @@ -23,7 +23,7 @@ #ifdef ENABLE_HE #include "common/archive.h" -#include "common/config-file.h" +#include "common/ini-file.h" #include "common/config-manager.h" #include "common/macresman.h" #include "common/savefile.h" @@ -180,7 +180,7 @@ void ScummEngine_v80he::o80_readConfigFile() { } } else { // Normal Windows INI files - Common::ConfigFile confFile; + Common::INIFile confFile; if (!strcmp((char *)filename + r, "map.ini")) confFile.loadFromFile((const char *)filename + r); else @@ -250,7 +250,7 @@ void ScummEngine_v80he::o80_writeConfigFile() { memcpy(section, "BluesTreasureHunt-Disc2\0", 24); } - Common::ConfigFile ConfFile; + Common::INIFile ConfFile; ConfFile.loadFromSaveFile((const char *)filename + r); ConfFile.setKey((char *)option, (char *)section, (char *)string); ConfFile.saveToSaveFile((const char *)filename + r); diff --git a/engines/testbed/config.cpp b/engines/testbed/config.cpp index 6b56616c9b..a40d239ebf 100644 --- a/engines/testbed/config.cpp +++ b/engines/testbed/config.cpp @@ -213,22 +213,22 @@ void TestbedConfigManager::parseConfigFile() { return; } _configFileInterface.loadFromStream(*rs); - Common::ConfigFile::SectionList sections = _configFileInterface.getSections(); + Common::INIFile::SectionList sections = _configFileInterface.getSections(); Testsuite *currTS = 0; - for (Common::ConfigFile::SectionList::const_iterator i = sections.begin(); i != sections.end(); i++) { + for (Common::INIFile::SectionList::const_iterator i = sections.begin(); i != sections.end(); i++) { if (i->name.equalsIgnoreCase("Global")) { // Global params may be directly queried, ignore them } else { // A testsuite, process it. currTS = getTestsuiteByName(i->name); - Common::ConfigFile::SectionKeyList kList = i->getKeys(); + Common::INIFile::SectionKeyList kList = i->getKeys(); if (!currTS) { Testsuite::logPrintf("Warning! Error in config: Testsuite %s not found\n", i->name.c_str()); continue; } - for (Common::ConfigFile::SectionKeyList::const_iterator j = kList.begin(); j != kList.end(); j++) { + for (Common::INIFile::SectionKeyList::const_iterator j = kList.begin(); j != kList.end(); j++) { if (j->key.equalsIgnoreCase("this")) { currTS->enable(stringToBool(j->value)); } else { diff --git a/engines/testbed/config.h b/engines/testbed/config.h index fd5588aa31..d611ae4ec3 100644 --- a/engines/testbed/config.h +++ b/engines/testbed/config.h @@ -24,7 +24,7 @@ #include "common/array.h" -#include "common/config-file.h" +#include "common/ini-file.h" #include "common/str-array.h" #include "common/tokenizer.h" @@ -62,7 +62,7 @@ public: private: Common::Array<Testsuite *> &_testsuiteList; Common::String _configFileName; - Common::ConfigFile _configFileInterface; + Common::INIFile _configFileInterface; void parseConfigFile(); }; diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp index 9075e1adb1..5d410e62c7 100644 --- a/engines/tinsel/tinsel.cpp +++ b/engines/tinsel/tinsel.cpp @@ -868,9 +868,6 @@ TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc) } TinselEngine::~TinselEngine() { - if (_bmv->MoviePlaying()) - _bmv->FinishBMV(); - _system->getAudioCDManager()->stop(); delete _bmv; delete _sound; @@ -1007,6 +1004,9 @@ Common::Error TinselEngine::run() { g_system->delayMillis(10); } + if (_bmv->MoviePlaying()) + _bmv->FinishBMV(); + // Write configuration _vm->_config->writeToDisk(); diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 7ca529f2ed..6b4e2963a5 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -2762,8 +2762,8 @@ void BackgroundSceneObject::setup2(int visage, int stripFrameNum, int frameNum, fixPriority(priority); } -void BackgroundSceneObject::proc27() { - warning("STUB: BackgroundSceneObject::proc27()"); +void BackgroundSceneObject::copySceneToBackground() { + GLOBALS._sceneManager._scene->_backSurface.copyFrom(g_globals->gfxManager().getSurface(), 0, 0); } /*--------------------------------------------------------------------------*/ diff --git a/engines/tsage/core.h b/engines/tsage/core.h index 1f9d7cd3a5..f7a5a43b16 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -613,7 +613,7 @@ public: virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void draw(); void setup2(int visage, int stripFrameNum, int frameNum, int posX, int posY, int priority, int32 arg10); - void proc27(); + static void copySceneToBackground(); }; class SceneText : public SceneObject { diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index cb28d6d60b..f1f9f9fe5a 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -323,6 +323,12 @@ SceneExt::SceneExt(): Scene() { _savedUiEnabled = false; _savedCanWalk = false; _focusObject = NULL; + + // WORKAROUND: In the original, playing animations don't reset the global _animationCtr + // counter as scene changes unless the playing animation explicitly finishes. For now, + // to make inter-scene debugging easier, I'm explicitly resetting the _animationCtr + // on scene start, since scene objects aren't drawn while it's non-zero + R2_GLOBALS._animationCtr = 0; } void SceneExt::postInit(SceneObjectList *OwnerList) { diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index ead4f5c770..8d35fc7222 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -2976,7 +2976,7 @@ bool Scene300::Miranda::startAction(CursorType action, Event &event) { } else if (!R2_GLOBALS.getFlag(55)) { R2_GLOBALS._events.setCursor(CURSOR_ARROW); scene->_sceneMode = 10; - scene->_stripManager.start3(scene->_stripId, scene, R2_GLOBALS._stripManager_lookupList); + scene->_stripManager.start3(201, scene, R2_GLOBALS._stripManager_lookupList); } else { scene->_sceneMode = 16; @@ -3357,7 +3357,7 @@ void Scene300::postInit(SceneObjectList *OwnerList) { break; case 325: if (!R2_GLOBALS.getFlag(44) || R2_GLOBALS.getFlag(25)) - setAction(&_sequenceManager1, this, 309, &R2_GLOBALS._player, NULL); + setAction(&_sequenceManager1, this, 307, &R2_GLOBALS._player, NULL); else { R2_GLOBALS.setFlag(60); R2_GLOBALS._player.setup(302, 3, 1); @@ -3394,9 +3394,11 @@ void Scene300::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._events.setCursor(CURSOR_ARROW); if (R2_GLOBALS.getFlag(51)) { + // Things don't seem right _sceneMode = 13; _stripManager.start3(300, this, R2_GLOBALS._stripManager_lookupList); } else { + // Back in Ringworld space _sceneMode = 11; _stripManager.start3(200, this, R2_GLOBALS._stripManager_lookupList); } @@ -3885,7 +3887,7 @@ Scene325::Scene325(): SceneExt() { _field412 = 7; _iconFontNumber = 50; _field416 = _field418 = 0; - _field41A = _field41C = _field41E = _field420 = 0; + _field41A = _field41C = _field41E = _scannerLocation = 0; _soundCount = _soundIndex = 0; for (int idx = 0; idx < 10; ++idx) @@ -3893,8 +3895,8 @@ Scene325::Scene325(): SceneExt() { } void Scene325::postInit(SceneObjectList *OwnerList) { - SceneExt::postInit(); loadScene(325); + SceneExt::postInit(); R2_GLOBALS.clearFlag(50); _stripManager.addSpeaker(&_quinnSpeaker); @@ -3920,7 +3922,7 @@ void Scene325::synchronize(Serializer &s) { s.syncAsSint16LE(_field41A); s.syncAsSint16LE(_field41C); s.syncAsSint16LE(_field41E); - s.syncAsSint16LE(_field420); + s.syncAsSint16LE(_scannerLocation); s.syncAsSint16LE(_soundCount); s.syncAsSint16LE(_soundIndex); @@ -4021,19 +4023,19 @@ void Scene325::signal() { if (R2_GLOBALS.getFlag(44) && !R2_GLOBALS.getFlag(51)) { if (v != 13) { - setMessage(328, 0); + setMessage(328, v); } else { - _field420 = 864; + _scannerLocation = 864; _object12.postInit(); - _object2.setup(326, 4, 1); + _object12.setup(326, 4, 1); _object12.setPosition(Common::Point(149, 128)); _object12.fixPriority(20); - _object13.postInit(); - _object13.setup(326, 4, 2); - _object13.setPosition(Common::Point(149, (int)(_field420 * ADJUST_FACTOR))); - _object13.fixPriority(21); + _scannerTab.postInit(); + _scannerTab.setup(326, 4, 2); + _scannerTab.setPosition(Common::Point(149, 22 + (int)(_scannerLocation * ADJUST_FACTOR))); + _scannerTab.fixPriority(21); _object10.postInit(); _object10.setup(326, 1, 1); @@ -4043,7 +4045,7 @@ void Scene325::signal() { _object1.postInit(); _object1.setup(326, 1, 1); _object1.setPosition(Common::Point(210, 32)); - _object10.fixPriority(10); + _object1.fixPriority(10); _object2.postInit(); _object2.setup(326, 1, 1); @@ -4093,7 +4095,7 @@ void Scene325::signal() { } else if (R2_GLOBALS.getFlag(51)) { setMessage(329, (v == 12) ? 10 : v); } else { - setMessage(327, (v < 15) ? 1 : v); + setMessage(327, (v >= 15) ? 1 : v); } break; } @@ -4134,12 +4136,12 @@ void Scene325::signal() { setMessage(128, _field416); break; default: - R2_GLOBALS._player.enableControl(); - R2_GLOBALS._player._canWalk = false; - _field416 = 105; - setMessage(128, _field416); + _field416 = 0; break; } + + R2_GLOBALS._player.enableControl(); + R2_GLOBALS._player._canWalk = false; break; case 10: R2_GLOBALS._player.enableControl(); @@ -4221,31 +4223,50 @@ void Scene325::consoleAction(int id) { _icon1.hideIcon(); _icon2.hideIcon(); _icon3.hideIcon(); - // TODO: Finish - break; - case 3: - _icon1.setIcon(5); - _icon2.setIcon(6); - _icon3.setIcon(R2_GLOBALS.getFlag(50) ? 16 : 15); - break; - case 4: - case 5: - _field418 = id; - _icon1.setIcon(17); - _icon2.setIcon(18); - _icon3.setIcon(19); - break; - case 7: - consoleAction(((_field412 == 5) || (_field412 == 6) || (_field412 == 15)) ? 4 : 7); + + if (id == 2 || (id == 19 && _field418 == 5 && R2_GLOBALS.getFlag(50) && + R2_GLOBALS.getFlag(44) && !R2_GLOBALS.getFlag(51))) { + _icon5.setIcon(13); + _icon4.setPosition(Common::Point(52, 107)); + _icon4._sceneRegionId = 9; + _icon4.setIcon(14); + _icon4._object2.hide(); + + } else { + _icon4.hideIcon(); + _icon5.hideIcon(); + } + + _icon6.setIcon(12); + _sceneMode = 10; + _palette.loadPalette(161); + BF_GLOBALS._scenePalette.addFader(&_palette._palette[0], 256, 5, this); break; - case 8: - R2_GLOBALS._sceneManager.changeScene(300); - case 9: - case 10: - _iconFontNumber = (id - 1) == 9 ? 50 : 52; - _text1.remove(); - _icon6.setIcon(7); + + case 22: + case 23: + case 24: + case 25: + R2_GLOBALS._player.disableControl(); + consoleAction(2); + _field412 = id; + _icon1.hideIcon(); + _icon2.hideIcon(); + _icon3.hideIcon(); + _icon4.hideIcon(); + + _icon5.setIcon(13); + _icon4.setPosition(Common::Point(52, 107)); + _icon4._sceneRegionId = 9; + _icon4.setIcon(14); + _icon4._object2.hide(); + + _icon6.setIcon(12); + _sceneMode = 10; + _palette.loadPalette(161); + BF_GLOBALS._scenePalette.addFader(&_palette._palette[0], 256, 5, this); break; + case 11: if (R2_GLOBALS.getFlag(57) && (R2_GLOBALS._player._characterIndex == 1) && !R2_GLOBALS.getFlag(25)) { R2_GLOBALS._player.disableControl(); @@ -4254,6 +4275,7 @@ void Scene325::consoleAction(int id) { _stripManager.start(403, this); } else { R2_GLOBALS._player.disableControl(); + id = 8; _text1.remove(); _icon4.setPosition(Common::Point(80, 62)); @@ -4261,7 +4283,7 @@ void Scene325::consoleAction(int id) { _icon4.hideIcon(); _object12.remove(); - _object13.remove(); + _scannerTab.remove(); _object10.remove(); _object1.remove(); _object2.remove(); @@ -4280,6 +4302,31 @@ void Scene325::consoleAction(int id) { BF_GLOBALS._scenePalette.addFader(&_palette._palette[0], 256, 5, this); } break; + + case 3: + _icon1.setIcon(5); + _icon2.setIcon(6); + _icon3.setIcon(R2_GLOBALS.getFlag(50) ? 16 : 15); + break; + case 4: + case 5: + _field418 = id; + _icon1.setIcon(17); + _icon2.setIcon(18); + _icon3.setIcon(19); + _icon4.setIcon(20); + break; + case 7: + consoleAction(((_field412 == 5) || (_field412 == 6) || (_field412 == 15)) ? 4 : 7); + break; + case 8: + R2_GLOBALS._sceneManager.changeScene(300); + case 9: + case 10: + _iconFontNumber = (id - 1) == 9 ? 50 : 52; + _text1.remove(); + _icon6.setIcon(7); + break; case 12: _icon4.setIcon(14); _icon4._object2.hide(); @@ -4289,7 +4336,7 @@ void Scene325::consoleAction(int id) { case 18: case 19: case 20: - if (_field420) { + if (_scannerLocation) { R2_GLOBALS._player.disableControl(); _field41A = 1296; _field41E = 1; @@ -4309,7 +4356,7 @@ void Scene325::consoleAction(int id) { case 18: case 19: case 20: - if (_field420 < 1620) { + if (_scannerLocation < 1620) { R2_GLOBALS._player.disableControl(); _field41A = 1296; _field41E = -1; @@ -4331,31 +4378,6 @@ void Scene325::consoleAction(int id) { consoleAction(4); id = 4; break; - case 22: - case 23: - case 24: - case 25: - R2_GLOBALS._player.disableControl(); - consoleAction(2); - _field412 = id; - - _icon1.hideIcon(); - _icon2.hideIcon(); - _icon3.hideIcon(); - _icon4.hideIcon(); - - _icon5.setIcon(13); - _icon4.setPosition(Common::Point(52, 107)); - _icon4._sceneRegionId = 9; - _icon4.setIcon(14); - _icon4._object2.hide(); - - _icon6.setIcon(12); - _sceneMode = 10; - _palette.loadPalette(161); - - BF_GLOBALS._scenePalette.addFader(&_palette._palette[0], 256, 5, this); - break; case 6: default: _icon1.setIcon(1); @@ -4430,21 +4452,21 @@ void Scene325::dispatch() { if (yp >= 30) { yp -= 12; - --_field420; + --_scannerLocation; flag = true; } if (yp <= 10) { yp += 12; - ++_field420; + ++_scannerLocation; flag = true; } - _object3.setPosition(Common::Point(149, (int)(_field420 * ADJUST_FACTOR) + 22)); + _scannerTab.setPosition(Common::Point(149, 22 + (int)(_scannerLocation * ADJUST_FACTOR))); for (int idx = 0; idx < 4; ++idx) _objList[idx].remove(); if (flag) { - int v = _field420 - 758; + int v = _scannerLocation - 758; _object10.setFrame((v++ <= 0) ? 1 : v); _object1.setFrame((v++ <= 0) ? 1 : v); _object2.setFrame((v++ <= 0) ? 1 : v); @@ -4484,7 +4506,7 @@ void Scene325::dispatch() { R2_GLOBALS._sound3.stop(); _field41C = 0; - if (_field420 == 756) { + if (_scannerLocation == 756) { R2_GLOBALS._player.disableControl(); R2_GLOBALS._events.setCursor(CURSOR_USE); _sceneMode = 12; diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index bad946fbd6..bc30743aca 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -451,7 +451,7 @@ private: Common::String parseMessage(const Common::String &msg); public: int _field412, _iconFontNumber, _field416, _field418; - int _field41A, _field41C, _field41E, _field420; + int _field41A, _field41C, _field41E, _scannerLocation; int _soundCount, _soundIndex; int _soundQueue[10]; SpeakerQuinn _quinnSpeaker; @@ -459,7 +459,7 @@ public: SceneHotspot _background, _item2; SceneObject _object1, _object2, _object3, _object4, _object5; SceneObject _object6, _object7, _object8, _object9, _object10; - SceneObject _object11, _object12, _object13; + SceneObject _object11, _object12, _scannerTab; SceneObject _objList[4]; Icon _icon1, _icon2, _icon3, _icon4, _icon5, _icon6; ASoundExt _sound1; diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 8d165fba07..6ea53d0852 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -1062,7 +1062,7 @@ void Scene1100::signal() { setAction(&_sequenceManager1, this, 1105, &R2_GLOBALS._player, &_actor10, &_actor11, &_actor18, NULL); break; case 9: - _object1.proc27(); + _object1.copySceneToBackground(); _actor15.postInit(); _actor15.setup(1103, 2, 1); @@ -1076,7 +1076,7 @@ void Scene1100::signal() { _actor13.setAction(&_sequenceManager2, this, 1108, &_actor13, NULL); break; case 11: { - setAction(&_sequenceManager1, this, 1116, &_actor11, &_actor10, &_actor12, NULL); + setAction(&_sequenceManager1, this, 1106, &_actor11, &_actor10, &_actor12, NULL); R2_GLOBALS._player._effect = 5; R2_GLOBALS._player.setup(1102, 3, 2); R2_GLOBALS._player.setPosition(Common::Point(-50, 131)); diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index b8d593b90a..cd2ff669ff 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -76,7 +76,7 @@ void VisualSpeaker::signal() { if ((R2_GLOBALS._speechSubtitles & SPEECH_VOICE) && _soundId) { // TODO: Check global that is passed - setFrame2(/* word_55F90 */ 0); + setFrame2(/* word_55F90 */ 1); } } else if (_action && _object2) { _action->setDelay(1); diff --git a/engines/wintermute/base/base_engine.cpp b/engines/wintermute/base/base_engine.cpp index 67e3d80cc8..acb12bbe5f 100644 --- a/engines/wintermute/base/base_engine.cpp +++ b/engines/wintermute/base/base_engine.cpp @@ -44,6 +44,7 @@ BaseEngine::BaseEngine() { _classReg = nullptr; _rnd = nullptr; _gameId = ""; + _language = Common::UNK_LANG; } void BaseEngine::init() { diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h index 3d9afe7c97..702c0b28ba 100644 --- a/engines/wintermute/detection_tables.h +++ b/engines/wintermute/detection_tables.h @@ -141,6 +141,17 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Carol Reed 7 - Blue Madonna (Demo) + { + "carolreed7", + "Demo", + AD_ENTRY1s("data.dcp", "0372ad0c775266f6355e9e8ae397a2f1", 103719442), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE | + ADGF_DEMO, + GUIO0() + }, // Carol Reed 7 - Blue Madonna { "carolreed7", diff --git a/engines/wintermute/video/video_theora_player.cpp b/engines/wintermute/video/video_theora_player.cpp index 12884a76c3..ef4d6b4dd9 100644 --- a/engines/wintermute/video/video_theora_player.cpp +++ b/engines/wintermute/video/video_theora_player.cpp @@ -417,7 +417,7 @@ bool VideoTheoraPlayer::display(uint32 alpha) { bool VideoTheoraPlayer::setAlphaImage(const Common::String &filename) { delete _alphaImage; _alphaImage = new BaseImage(); - if (!_alphaImage || DID_FAIL(_alphaImage->loadFile(filename))) { + if (filename == "" || !_alphaImage || DID_FAIL(_alphaImage->loadFile(filename))) { delete _alphaImage; _alphaImage = nullptr; _alphaFilename = ""; |