diff options
Diffstat (limited to 'engines')
224 files changed, 1661 insertions, 1661 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index d9dce1e991..de2d9a8ab9 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -258,7 +258,7 @@ void AgiEngine::processEvents() { break; case Common::EVENT_KEYUP: - if (_egoHoldKey) + if (_egoHoldKey) _game.viewTable[0].direction = 0; default: diff --git a/engines/agi/op_test.cpp b/engines/agi/op_test.cpp index f810eb8503..71d307556b 100644 --- a/engines/agi/op_test.cpp +++ b/engines/agi/op_test.cpp @@ -195,7 +195,7 @@ static uint8 testSaid(uint8 nwords, uint8 *cc) { case 9999: // rest of line (empty string counts to...) nwords = 1; break; - case 1: // any word + case 1: // any word break; default: if (game.egoWords[c].id != z) diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp index 11c84aff12..b7e830dc53 100644 --- a/engines/agi/saveload.cpp +++ b/engines/agi/saveload.cpp @@ -342,7 +342,7 @@ int AgiEngine::loadGame(const char *fileName, bool checkId) { debug(0, "Your game is \"%s\" and save is \"%s\".", getGameMD5(), md5); } } - + for (i = 0; i < MAX_FLAGS; i++) _game.flags[i] = in->readByte(); for (i = 0; i < MAX_VARS; i++) diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp index 5b72b948f8..2072baee26 100644 --- a/engines/agos/animation.cpp +++ b/engines/agos/animation.cpp @@ -266,7 +266,7 @@ bool MoviePlayerDXA::load() { void MoviePlayerDXA::playVideo() { // Most of the videos included in the Amiga version, reduced the - // resoluton to 384 x 280, so require the screen to be cleared, + // resoluton to 384 x 280, so require the screen to be cleared, // before starting playing those videos. if (getWidth() == 384 && getHeight() == 280) { _vm->clearSurfaces(); diff --git a/engines/agos/icons.cpp b/engines/agos/icons.cpp index b28f5ea14f..fdc5d1707e 100644 --- a/engines/agos/icons.cpp +++ b/engines/agos/icons.cpp @@ -962,7 +962,7 @@ void AGOSEngine::drawArrow(uint16 x, uint16 y, int8 dir) { for (h = 0; h < 19; h++) { for (w = 0; w < 16; w++) { - if (src[w]) + if (src[w]) dst[w] = src[w] + 16; } diff --git a/engines/cine/cine.h b/engines/cine/cine.h index 06e1e07cf1..285565f48d 100644 --- a/engines/cine/cine.h +++ b/engines/cine/cine.h @@ -66,7 +66,7 @@ * French variant of the game which heared to be completable. * Later the work was renewed as part of GSoC'08, by Kari Salminen, but it has not * yet been finished. The game is not completable. - * + * * * Supported games: * diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp index e3ce658366..a680262b9d 100644 --- a/engines/cine/gfx.cpp +++ b/engines/cine/gfx.cpp @@ -714,7 +714,7 @@ void FWRenderer::savePalette(Common::OutSaveFile &fHandle) { byte buf[kLowPalNumBytes]; // Make sure the active palette has the correct format and color count - assert(_activePal.colorFormat() == kLowPalFormat); + assert(_activePal.colorFormat() == kLowPalFormat); assert(_activePal.colorCount() == kLowPalNumColors); // Make sure the backup palette has the correct format and color count diff --git a/engines/cine/pal.cpp b/engines/cine/pal.cpp index d793f06602..9210fae8ab 100644 --- a/engines/cine/pal.cpp +++ b/engines/cine/pal.cpp @@ -352,7 +352,7 @@ byte *Palette::save(byte *buf, const uint size, const Graphics::PixelFormat form const uint r = (_colors[i].r * rNewMax) / rOrigMax; const uint g = (_colors[i].g * gNewMax) / gOrigMax; const uint b = (_colors[i].b * bNewMax) / bOrigMax; - + buf[i * format.bytesPerPixel + rBytePos] |= r << (format.rShift % 8); buf[i * format.bytesPerPixel + gBytePos] |= g << (format.gShift % 8); buf[i * format.bytesPerPixel + bBytePos] |= b << (format.bShift % 8); diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp index b3f13dd09f..e7c7f9b938 100644 --- a/engines/cine/various.cpp +++ b/engines/cine/various.cpp @@ -1106,7 +1106,7 @@ uint16 executePlayerInput() { bgVar0 = var_5E; } - + if (g_cine->getGameType() == Cine::GType_OS || !(egoMovedWithKeyboard && allowPlayerInput)) { getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY); diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp index f61d8f023a..92d484e241 100644 --- a/engines/cruise/cruise_main.cpp +++ b/engines/cruise/cruise_main.cpp @@ -93,7 +93,7 @@ void MemoryFree(void *v) { memList.remove(p); free(p - 8 - 64); - } else + } else free(v); } @@ -1163,7 +1163,7 @@ void callSubRelation(menuElementSubStruct *pMenuElement, int nOvl, int nObj) { } else if (pHeader->type == RT_MSG) { if (pHeader->obj2Number >= 0) { - if ((pHeader->trackX !=-1) && (pHeader->trackY !=-1) && + if ((pHeader->trackX !=-1) && (pHeader->trackY !=-1) && (pHeader->trackX != 9999) && (pHeader->trackY != 9999)) { x = pHeader->trackX - 100; y = pHeader->trackY - 150; @@ -1192,7 +1192,7 @@ void callSubRelation(menuElementSubStruct *pMenuElement, int nOvl, int nObj) { userWait = 1; autoOvl = ovlIdx; autoMsg = pHeader->id; - + if ((narratorOvl > 0) && (pHeader->trackX != -1) && (pHeader->trackY != -1)) { actorStruct *pTrack = findActor(&actorHead, narratorOvl, narratorIdx, 0); @@ -1888,7 +1888,7 @@ void CruiseEngine::mainLoop() { // Disable any mouse click used to end the user wait currentMouseButton = 0; - } + } manageScripts(&relHead); manageScripts(&procHead); diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp index 2d61bed578..3d07abf441 100644 --- a/engines/cruise/function.cpp +++ b/engines/cruise/function.cpp @@ -256,7 +256,7 @@ int16 Op_FreqFX() { if ((sampleNum >= 0) && (sampleNum < NUM_FILE_ENTRIES) && (filesDatabase[sampleNum].subData.ptr)) { int freq = Period(freq2 * 1000); - + _vm->sound().startNote(channelNum, volume, freq); } @@ -1389,7 +1389,7 @@ int16 Op_SongSize() { if (_vm->sound().songLoaded()) { oldSize = _vm->sound().numOrders(); - + size = popVar(); if ((size >= 1) && (size < 128)) _vm->sound().setNumOrders(size); diff --git a/engines/cruise/gfxModule.cpp b/engines/cruise/gfxModule.cpp index fdf26337e3..dbc8160ac6 100644 --- a/engines/cruise/gfxModule.cpp +++ b/engines/cruise/gfxModule.cpp @@ -238,7 +238,7 @@ void gfxModuleData_flipScreen() { } void gfxModuleData_addDirtyRect(const Common::Rect &r) { - _dirtyRects.push_back(Common::Rect( MAX(r.left, (int16)0), MAX(r.top, (int16)0), + _dirtyRects.push_back(Common::Rect( MAX(r.left, (int16)0), MAX(r.top, (int16)0), MIN(r.right, (int16)320), MIN(r.bottom, (int16)200))); } @@ -319,7 +319,7 @@ void flip() { // Copy any modified areas for (dr = _dirtyRects.begin(); dr != _dirtyRects.end(); ++dr) { Common::Rect &r = *dr; - g_system->copyRectToScreen(globalScreen + 320 * r.top + r.left, 320, + g_system->copyRectToScreen(globalScreen + 320 * r.top + r.left, 320, r.left, r.top, r.width(), r.height()); } @@ -355,7 +355,7 @@ void switchBackground(const byte *newBg) { } /* For an optimisation, any changes are stored as a series of slices than have a height of a single - * line each. It is left up to the screen redraw code to automatically merge these together + * line each. It is left up to the screen redraw code to automatically merge these together */ for (int yp = 0; yp < 200; ++yp) { diff --git a/engines/cruise/mainDraw.cpp b/engines/cruise/mainDraw.cpp index ca7859f1e9..aaa6f987b6 100644 --- a/engines/cruise/mainDraw.cpp +++ b/engines/cruise/mainDraw.cpp @@ -208,7 +208,7 @@ int m_first_Y; int m_scaleValue; int m_color; -/* +/* FIXME: Whether intentional or not, the game often seems to use negative indexing of one or more of the arrays below and expects(?) to end up in the preceding one. This "worked" on many platforms so far, but on OSX apparently the buffers don't diff --git a/engines/cruise/overlay.cpp b/engines/cruise/overlay.cpp index f0611492bd..729734d261 100644 --- a/engines/cruise/overlay.cpp +++ b/engines/cruise/overlay.cpp @@ -115,7 +115,7 @@ int freeOverlay(int overlayIdx) { MemFree(ovlDataPtr->arrayNameObj); MemFree(ovlDataPtr->arrayRelocGlob); MemFree(ovlDataPtr->arrayNameRelocGlob); - + MemFree(ovlDataPtr); overlayTable[overlayIdx].ovlData = NULL; diff --git a/engines/cruise/saveload.cpp b/engines/cruise/saveload.cpp index 92cccc7026..af39ae1eb4 100644 --- a/engines/cruise/saveload.cpp +++ b/engines/cruise/saveload.cpp @@ -568,7 +568,7 @@ static void syncPerso(Common::Serializer &s, persoStruct &p) { s.syncAsSint16LE(p.solution[i][0]); s.syncAsSint16LE(p.solution[i][1]); } - + s.syncAsSint16LE(p.inc_jo1); s.syncAsSint16LE(p.inc_jo2); s.syncAsSint16LE(p.dir_perso); @@ -902,7 +902,7 @@ Common::Error loadSavegameData(int saveGameIdx) { ASSERT(0); //loadFileMode1(filesDatabase[j].subData.name,filesDatabase[j].subData.var4); } else */ - if (strlen(filesDatabase[i].subData.name) > 0) { + if (strlen(filesDatabase[i].subData.name) > 0) { loadFileRange(filesDatabase[i].subData.name, filesDatabase[i].subData.index, i, j - i); } else { filesDatabase[i].subData.ptr = NULL; diff --git a/engines/cruise/script.cpp b/engines/cruise/script.cpp index 3d0a0c1804..f2877a7730 100644 --- a/engines/cruise/script.cpp +++ b/engines/cruise/script.cpp @@ -628,8 +628,8 @@ int executeScripts(scriptInstanceStruct *ptr) { opcodeType = getByteFromScript(); debugC(5, kCruiseDebugScript, "Script %s/%d ip=%d opcode=%d", - overlayTable[currentScriptPtr->overlayNumber].overlayName, - currentScriptPtr->scriptNumber, + overlayTable[currentScriptPtr->overlayNumber].overlayName, + currentScriptPtr->scriptNumber, currentScriptPtr->scriptOffset, (opcodeType & 0xFB) >> 3); diff --git a/engines/cruise/sound.cpp b/engines/cruise/sound.cpp index 6288c41474..f97e373aa6 100644 --- a/engines/cruise/sound.cpp +++ b/engines/cruise/sound.cpp @@ -53,7 +53,7 @@ public: void setUpdateCallback(UpdateCallback upCb, void *ref); void resetChannel(int channel); void findNote(int freq, int *note, int *oct) const; - + protected: UpdateCallback _upCb; diff --git a/engines/cruise/sound.h b/engines/cruise/sound.h index 13a6b2ac5a..fdea5bed1b 100644 --- a/engines/cruise/sound.h +++ b/engines/cruise/sound.h @@ -59,7 +59,7 @@ public: virtual void playSound(const uint8 *data, int size, int volume); virtual void stopSound(int channel); - + void doSync(Common::Serializer &s); const char *musicName(); void stopChannel(int channel); diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index 0e6c5e7b90..d52c78061e 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -197,7 +197,7 @@ void Game::init() { _vm->_mouse->setCursorType(kHighlightedCursor); // anything different from kNormalCursor _objUnderCursor = NULL; - + // Set the inventory to empty initially memset(_inventory, 0, kInventorySlots * sizeof(GameItem *)); @@ -571,7 +571,7 @@ void Game::handleStatusChangeByMouse() { if (!wantsChange) { // Turn off the timer, but enable switching. _mouseChangeTick = kMouseEnableSwitching; - + // Otherwise the mouse signalizes that the mode should be changed. } else if (_mouseChangeTick == kMouseEnableSwitching) { // If the timer is currently disabled, this is the first time @@ -1181,7 +1181,7 @@ void Game::deleteObjectAnimations() { GameObject *obj = &_objects[i]; obj->deleteAnims(); } - + // WORKAROUND // // An absolutely horrible hack follows. The current memory management diff --git a/engines/draci/sound.cpp b/engines/draci/sound.cpp index ee19440139..0bf13af28f 100644 --- a/engines/draci/sound.cpp +++ b/engines/draci/sound.cpp @@ -197,7 +197,7 @@ void Sound::playSoundBuffer(Audio::SoundHandle *handle, const SoundSample &buffe byte flags = Audio::FLAG_UNSIGNED; - const Audio::Mixer::SoundType soundType = (handleType == kVoiceHandle) ? + const Audio::Mixer::SoundType soundType = (handleType == kVoiceHandle) ? Audio::Mixer::kSpeechSoundType : Audio::Mixer::kSFXSoundType; // Don't use DisposeAfterUse::YES, because our caching system deletes samples by itself. diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp index 74b9e131e3..719438d6fe 100644 --- a/engines/drascula/graphics.cpp +++ b/engines/drascula/graphics.cpp @@ -546,7 +546,7 @@ int DrasculaEngine::playFrameSSN() { mixVideo(screenBuffer, screenSurface); else memcpy(screenBuffer, screenSurface, 64000); - + _system->unlockScreen(); _system->updateScreen(); FrameSSN++; diff --git a/engines/engine.cpp b/engines/engine.cpp index dc4c746f6c..66f05b10e3 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -164,7 +164,7 @@ void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics: #ifdef USE_RGB_COLOR if (format) g_system->initSize(width, height, format); - else { + else { Graphics::PixelFormat bestFormat = g_system->getSupportedFormats().front(); g_system->initSize(width, height, &bestFormat); } @@ -406,7 +406,7 @@ void Engine::flipMute() { if (ConfMan.hasKey("mute")) { mute = !ConfMan.getBool("mute"); } - + ConfMan.setBool("mute", mute); syncSoundSettings(); diff --git a/engines/gob/draw.h b/engines/gob/draw.h index 9ed5ae03b5..52a0f37845 100644 --- a/engines/gob/draw.h +++ b/engines/gob/draw.h @@ -160,8 +160,8 @@ public: int16 _winVarArrayHeight; int16 _winVarArrayStatus; int16 _winVarArrayLimitsX; - int16 _winVarArrayLimitsY; - + int16 _winVarArrayLimitsY; + void invalidateRect(int16 left, int16 top, int16 right, int16 bottom); void blitInvalidated(); @@ -273,7 +273,7 @@ public: virtual ~Draw_Playtoons() {} virtual void spriteOperation(int16 operation); }; - + // Draw operations #define DRAW_BLITSURF 0 diff --git a/engines/gob/draw_fascin.cpp b/engines/gob/draw_fascin.cpp index 9d2ca16ea5..9d30faa972 100644 --- a/engines/gob/draw_fascin.cpp +++ b/engines/gob/draw_fascin.cpp @@ -72,7 +72,7 @@ void Draw_Fascination::spriteOperation(int16 operation) { if (_renderFlags & 0x20) { if (_destSurface == 21 || (operation == 0 && _sourceSurface == 21)) { winDraw(operation); - return; + return; } } diff --git a/engines/gob/draw_playtoons.cpp b/engines/gob/draw_playtoons.cpp index df246de281..862cdd33eb 100644 --- a/engines/gob/draw_playtoons.cpp +++ b/engines/gob/draw_playtoons.cpp @@ -170,13 +170,13 @@ void Draw_Playtoons::spriteOperation(int16 operation) { _destSpriteY - 1, _destSpriteX + 2, _destSpriteY + 2, _frontColor); break; - default: + default: _vm->_video->putPixel(_destSpriteX, _destSpriteY, _frontColor, *_spritesArray[_destSurface]); break; } dirtiedRect(_destSurface, _destSpriteX - (_pattern / 2), - _destSpriteY - (_pattern / 2), - _destSpriteX + (_pattern + 1) / 2, + _destSpriteY - (_pattern / 2), + _destSpriteX + (_pattern + 1) / 2, _destSpriteY + (_pattern + 1) / 2); break; case DRAW_FILLRECT: @@ -187,7 +187,7 @@ void Draw_Playtoons::spriteOperation(int16 operation) { case 4: warning("oPlaytoons_spriteOperation: operation DRAW_FILLRECT, pattern %d", _pattern & 0xFF); break; - case 0: + case 0: _vm->_video->fillRect(*_spritesArray[_destSurface], destSpriteX, _destSpriteY, _destSpriteX + _spriteRight - 1, _destSpriteY + _spriteBottom - 1, _backColor); @@ -195,7 +195,7 @@ void Draw_Playtoons::spriteOperation(int16 operation) { dirtiedRect(_destSurface, _destSpriteX, _destSpriteY, _destSpriteX + _spriteRight - 1, _destSpriteY + _spriteBottom - 1); break; - default: + default: warning("oPlaytoons_spriteOperation: operation DRAW_FILLRECT, unexpected pattern %d", _pattern & 0xFF); break; } @@ -218,17 +218,17 @@ void Draw_Playtoons::spriteOperation(int16 operation) { _spriteRight + 1, _spriteBottom + 1, _frontColor); } else { switch (_pattern & 0xFF) { - case 0: + case 0: _vm->_video->drawLine(*_spritesArray[_destSurface], _destSpriteX, _destSpriteY, _spriteRight, _spriteBottom, _frontColor); break; - default: + default: warning("oPlaytoons_spriteOperation: operation DRAW_DRAWLINE, draw %d lines", (_pattern & 0xFF) * (_pattern & 0xFF)); for (int16 i = 0; i <= _pattern ; i++) for (int16 j = 0; j <= _pattern ; j++) - _vm->_video->drawLine(*_spritesArray[_destSurface], + _vm->_video->drawLine(*_spritesArray[_destSurface], _destSpriteX - (_pattern / 2) + i, _destSpriteY - (_pattern / 2) + j, _spriteRight - (_pattern / 2) + i, @@ -237,14 +237,14 @@ void Draw_Playtoons::spriteOperation(int16 operation) { break; } } - dirtiedRect(_destSurface, MIN(_destSpriteX, _spriteRight) - _pattern, - MIN(_destSpriteY, _spriteBottom) - _pattern, - MAX(_destSpriteX, _spriteRight) + _pattern + 1, + dirtiedRect(_destSurface, MIN(_destSpriteX, _spriteRight) - _pattern, + MIN(_destSpriteY, _spriteBottom) - _pattern, + MAX(_destSpriteX, _spriteRight) + _pattern + 1, MAX(_destSpriteY, _spriteBottom) + _pattern + 1); break; case DRAW_INVALIDATE: - if ((_pattern & 0xFF) != 0) + if ((_pattern & 0xFF) != 0) warning("oPlaytoons_spriteOperation: operation DRAW_INVALIDATE, pattern %d", _pattern & 0xFF); _vm->_video->drawCircle(*_spritesArray[_destSurface], _destSpriteX, @@ -388,7 +388,7 @@ void Draw_Playtoons::spriteOperation(int16 operation) { dirtiedRect(_destSurface, _destSpriteX, _destSpriteY, _spriteRight, _spriteBottom); break; - default: + default: warning ("oPlaytoons_spriteOperation: Unhandled operation %d", operation); break; } diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index 004661244f..92211cbea2 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -155,8 +155,8 @@ bool Hotspots::Hotspot::isDisabled() const { } bool Hotspots::Hotspot::isIn(uint16 x, uint16 y) const { - // FIXME: the cast to int16 is a hack, to fix handling of Gob2 problems related to - // hotspots with negative offset (to temporary disable them). + // FIXME: the cast to int16 is a hack, to fix handling of Gob2 problems related to + // hotspots with negative offset (to temporary disable them). if ((int16) x < (int16) left) return false; if ((int16) x > (int16) right) @@ -523,23 +523,23 @@ void Hotspots::leave(uint16 index) { } int16 Hotspots::curWindow(int16 &dx, int16 &dy) const { - if ((_vm->_draw->_renderFlags & 0x80)==0) + if ((_vm->_draw->_renderFlags & 0x80)==0) return(0); for (int i = 0; i < 10; i++) if (_vm->_draw->_fascinWin[i].id != -1) - if (_vm->_global->_inter_mouseX >= _vm->_draw->_fascinWin[i].left && - _vm->_global->_inter_mouseX < _vm->_draw->_fascinWin[i].left + _vm->_draw->_fascinWin[i].width && - _vm->_global->_inter_mouseY >= _vm->_draw->_fascinWin[i].top && + if (_vm->_global->_inter_mouseX >= _vm->_draw->_fascinWin[i].left && + _vm->_global->_inter_mouseX < _vm->_draw->_fascinWin[i].left + _vm->_draw->_fascinWin[i].width && + _vm->_global->_inter_mouseY >= _vm->_draw->_fascinWin[i].top && _vm->_global->_inter_mouseY < _vm->_draw->_fascinWin[i].top + _vm->_draw->_fascinWin[i].height) if (_vm->_draw->_fascinWin[i].id == _vm->_draw->_winCount-1) { dx = _vm->_draw->_fascinWin[i].left; dy = _vm->_draw->_fascinWin[i].top; - if (_vm->_global->_inter_mouseX < _vm->_draw->_fascinWin[i].left + 12 && - _vm->_global->_inter_mouseY < _vm->_draw->_fascinWin[i].top + 12 && + if (_vm->_global->_inter_mouseX < _vm->_draw->_fascinWin[i].left + 12 && + _vm->_global->_inter_mouseY < _vm->_draw->_fascinWin[i].top + 12 && (VAR((_vm->_draw->_winVarArrayStatus / 4) + i) & 2)) return(5); - if (_vm->_global->_inter_mouseX >= _vm->_draw->_fascinWin[i].left + _vm->_draw->_fascinWin[i].width - 12 && - _vm->_global->_inter_mouseY < _vm->_draw->_fascinWin[i].top + 12 && + if (_vm->_global->_inter_mouseX >= _vm->_draw->_fascinWin[i].left + _vm->_draw->_fascinWin[i].width - 12 && + _vm->_global->_inter_mouseY < _vm->_draw->_fascinWin[i].top + 12 && (VAR((_vm->_draw->_winVarArrayStatus / 4) + i) & 4)) return(6); return(-i); @@ -785,9 +785,9 @@ uint16 Hotspots::check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index enter(_currentIndex); } else { WRITE_VAR(16, (int32) i); - if (id) + if (id) id=0; - if (index) + if (index) index=0; return(0); } @@ -1608,7 +1608,7 @@ int16 Hotspots::findCursor(uint16 x, uint16 y) const { int16 deltax = 0; int16 deltay = 0; - + if ( _vm->getGameType() == kGameTypeFascination ) { cursor = curWindow(deltax, deltay); } @@ -1647,9 +1647,9 @@ int16 Hotspots::findCursor(uint16 x, uint16 y) const { if (spot.isIn(x - deltax, y - deltay)) { if (spot.getType() < kTypeInput1NoLeave) cursor = 1; - else + else cursor = 3; - break; + break; } } } @@ -1682,17 +1682,17 @@ void Hotspots::oPlaytoons_F_1B() { var4 = _vm->_game->_script->readValExpr(); // this variable is always set to 0 in Playtoons -// var_4 += unk_var; +// var_4 += unk_var; for (int i = 0; i < kHotspotCount; i++) { if (_hotspots[i].isEnd()) { return; } - if ((_hotspots[i].id == 0xD000 + shortId) || (_hotspots[i].id == 0xB000 + shortId) || + if ((_hotspots[i].id == 0xD000 + shortId) || (_hotspots[i].id == 0xB000 + shortId) || (_hotspots[i].id == 0x4000 + shortId)) { longId = _hotspots[i].id; warning("oPlaytoons_F_1B: shortId %d, var2 %d fontIndex %d var4 %d - longId %d", shortId, var2, fontIndex, var4, longId); - + left = _hotspots[i].left; top = _hotspots[i].top; right = _hotspots[i].right; diff --git a/engines/gob/inter_fascin.cpp b/engines/gob/inter_fascin.cpp index 1b37060cd7..bf797dd316 100644 --- a/engines/gob/inter_fascin.cpp +++ b/engines/gob/inter_fascin.cpp @@ -212,7 +212,7 @@ void Inter_Fascination::oFascin_closeWin() { int16 id; _vm->_game->_script->evalExpr(&id); _vm->_draw->activeWin(id); - _vm->_draw->closeWin(id); + _vm->_draw->closeWin(id); } void Inter_Fascination::oFascin_activeWin() { diff --git a/engines/gob/inter_playtoons.cpp b/engines/gob/inter_playtoons.cpp index 9e7aa3484c..96bb61ea77 100644 --- a/engines/gob/inter_playtoons.cpp +++ b/engines/gob/inter_playtoons.cpp @@ -116,10 +116,10 @@ bool Inter_Playtoons::oPlaytoons_printText(OpFuncParams ¶ms) { _vm->_draw->_transparency = 1; } -// colMod is read from conf file (_off_=xxx). -// in Playtoons, it's not present in the conf file, thus always equal to the default value (0). +// colMod is read from conf file (_off_=xxx). +// in Playtoons, it's not present in the conf file, thus always equal to the default value (0). // Maybe used in ADIs... -// if (!_vm->_draw->_transparency) +// if (!_vm->_draw->_transparency) // _vm->_draw->_backColor += colMod; // _vm->_draw->_frontColor += colMod; @@ -173,7 +173,7 @@ bool Inter_Playtoons::oPlaytoons_printText(OpFuncParams ¶ms) { _vm->_draw->spriteOperation(DRAW_PRINTTEXT); _vm->_draw->_transparency = oldTransparency; i = 0; - } else + } else i = strlen(buf); } while (_vm->_game->_script->peekByte() != 200); @@ -231,9 +231,9 @@ bool Inter_Playtoons::oPlaytoons_checkData(OpFuncParams ¶ms) { char *file = _vm->_game->_script->getResultStr(); - // WORKAROUND: In Playtoons games, some files are read on CD (and only on CD). + // WORKAROUND: In Playtoons games, some files are read on CD (and only on CD). // In this case, "@:\" is replaced by the CD drive letter. - // As the files are copied on the HDD, those characters are skipped. + // As the files are copied on the HDD, those characters are skipped. if (strncmp(file, "@:\\", 3) == 0) { debugC(2, kDebugFileIO, "oPlaytoons_checkData: \"%s\" instead of \"%s\"", file + 3, file); file += 3; @@ -286,9 +286,9 @@ bool Inter_Playtoons::oPlaytoons_readData(OpFuncParams ¶ms) { char *file = _vm->_game->_script->getResultStr(); - // WORKAROUND: In Playtoons games, some files are read on CD (and only on CD). + // WORKAROUND: In Playtoons games, some files are read on CD (and only on CD). // In this case, "@:\" is replaced by the CD drive letter. - // As the files are copied on the HDD, those characters are skipped. + // As the files are copied on the HDD, those characters are skipped. if (strncmp(file, "@:\\", 3) == 0) { debugC(2, kDebugFileIO, "oPlaytoons_readData: \"%s\" instead of \"%s\"", file + 3, file); file += 3; @@ -442,7 +442,7 @@ void Inter_Playtoons::oPlaytoons_openItk() { } else _vm->_dataIO->openDataFile(fileName, true); // All the other checks are meant to verify (if not found at the first try) - // if the file is present on the CD or not. As everything is supposed to + // if the file is present on the CD or not. As everything is supposed to // be copied, those checks are skipped } diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp index c75b3cae9d..cd4dce9613 100644 --- a/engines/gob/inter_v6.cpp +++ b/engines/gob/inter_v6.cpp @@ -410,7 +410,7 @@ bool Inter_v6::o6_fillRect(OpFuncParams ¶ms) { _vm->_game->_script->evalExpr(0); _vm->_draw->_backColor = _vm->_game->_script->getResultInt() & 0xFFFF; - + _vm->_draw->_pattern = _vm->_game->_script->getResultInt() >> 16; if (_vm->_draw->_pattern != 0) diff --git a/engines/gob/map_v2.cpp b/engines/gob/map_v2.cpp index 56482287f7..0e4a00dc0c 100644 --- a/engines/gob/map_v2.cpp +++ b/engines/gob/map_v2.cpp @@ -71,7 +71,7 @@ void Map_v2::loadMapObjects(const char *avjFile) { _passMap[i] += READ_VARO_UINT8(var + i); break; case 65532: - for (int i = 0; i < _mapWidth * _mapHeight; i++) + for (int i = 0; i < _mapWidth * _mapHeight; i++) WRITE_VARO_UINT8(var + i, 0x00); break; case 65533: diff --git a/engines/gob/save/saveload.h b/engines/gob/save/saveload.h index 45ef122767..82988e9c23 100644 --- a/engines/gob/save/saveload.h +++ b/engines/gob/save/saveload.h @@ -533,7 +533,7 @@ public: static const uint32 kPropsSize = 3921; /** Index. kSlotCount * kSlotNameLength bytes. */ static const uint32 kIndexSize = kSlotCount * kSlotNameLength; - + SaveLoad_Playtoons(GobEngine *vm, const char *targetName); virtual ~SaveLoad_Playtoons(); diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp index 6077b1ebb5..2e15948080 100644 --- a/engines/gob/util.cpp +++ b/engines/gob/util.cpp @@ -142,9 +142,9 @@ void Util::processInput(bool scroll) { _vm->_util->setMousePos(x, y); _vm->_game->wantScroll(x, y); - + // WORKAROUND: - // Force a check of the mouse in order to fix the sofa bug. This apply only for Gob3, and only + // Force a check of the mouse in order to fix the sofa bug. This apply only for Gob3, and only // in the impacted TOT file so that the second screen animation is not broken. if ((_vm->getGameType() == kGameTypeGob3) && !strncmp(_vm->_game->_curTotFile, "EMAP1008.TOT", 12)) _vm->_game->evaluateScroll(); diff --git a/engines/groovie/cell.cpp b/engines/groovie/cell.cpp index 270df480e4..e59115cdf5 100644 --- a/engines/groovie/cell.cpp +++ b/engines/groovie/cell.cpp @@ -264,7 +264,7 @@ void CellGame::resetMove() { void CellGame::takeCells(uint16 whereTo, int8 color) { int cellN; - const int8 *str; + const int8 *str; str = possibleMoves[whereTo]; while (1) { @@ -304,7 +304,7 @@ void CellGame::countAllCells() { } int CellGame::countCellsOnTempBoard(int8 color) { - const int8 *str; + const int8 *str; int res = 0; int i; @@ -626,7 +626,7 @@ int8 CellGame::calcBestWeight(int8 color1, int8 color2, uint16 depth, int bestWe } else { canMove = canMoveFunc3(curColor); } - + if (!canMove) break; if (_flag1) { diff --git a/engines/groovie/cursor.cpp b/engines/groovie/cursor.cpp index ea2598ba6e..5812585a0c 100644 --- a/engines/groovie/cursor.cpp +++ b/engines/groovie/cursor.cpp @@ -374,9 +374,9 @@ void Cursor_v2::decodeFrame(byte *pal, byte *data, byte *dest) { ptr += 4; } } - - - + + + } void Cursor_v2::enable() { diff --git a/engines/groovie/groovie.h b/engines/groovie/groovie.h index 2fa86c7209..51159f7fc2 100644 --- a/engines/groovie/groovie.h +++ b/engines/groovie/groovie.h @@ -40,7 +40,7 @@ * This is the namespace of the Groovie engine. * * Status of this engine: This engine supports both versions of the Groovie - * game engine. The 7th Guest uses the first revision of Groovie, and is + * game engine. The 7th Guest uses the first revision of Groovie, and is * now fully completable. All remaining Groovie games use V2 of the engine, * which is under slow development. * diff --git a/engines/kyra/animator_tim.cpp b/engines/kyra/animator_tim.cpp index 3fbda7c45d..ef1c760d71 100644 --- a/engines/kyra/animator_tim.cpp +++ b/engines/kyra/animator_tim.cpp @@ -67,7 +67,7 @@ TimAnimator::~TimAnimator() { void TimAnimator::init(int animIndex, Movie *wsa, int x, int y, int wsaCopyParams, int frameDelay) { Animation *anim = &_animations[animIndex]; anim->wsa = wsa; - anim->x = x; + anim->x = x; anim->y = y; anim->wsaCopyParams = wsaCopyParams; anim->frameDelay = frameDelay; @@ -123,7 +123,7 @@ void TimAnimator::setupPart(int animIndex, int part, int firstFrame, int lastFra void TimAnimator::start(int animIndex, int part) { if (!_vm || !_system || !_screen) - return; + return; Animation *anim = &_animations[animIndex]; anim->curPart = part; diff --git a/engines/kyra/gui_lok.cpp b/engines/kyra/gui_lok.cpp index afc2c0bc47..1a822b01a5 100644 --- a/engines/kyra/gui_lok.cpp +++ b/engines/kyra/gui_lok.cpp @@ -688,7 +688,7 @@ int GUI_LoK::loadGameMenu(Button *button) { void GUI_LoK::redrawTextfield() { _screen->fillRect(38, 91, 287, 102, _vm->gameFlags().platform == Common::kPlatformAmiga ? 18 : 250); _text->printText(_savegameName, 38, 92, 253, 0, 0); - + _screen->_charWidth = -2; int width = _screen->getTextWidth(_savegameName); _screen->fillRect(39 + width, 93, 45 + width, 100, _vm->gameFlags().platform == Common::kPlatformAmiga ? 31 : 254); @@ -742,7 +742,7 @@ int GUI_LoK::saveGame(Button *button) { _cancelSubMenu = false; Screen::FontId cf = _screen->setFont(Screen::FID_8_FNT); - + if (_savegameOffset == 0 && _vm->_gameToLoad == 0) { _savegameName[0] = 0; } else { diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp index a96c40d1f8..ac6e1aaf27 100644 --- a/engines/kyra/gui_lol.cpp +++ b/engines/kyra/gui_lol.cpp @@ -212,7 +212,7 @@ void LoLEngine::gui_displayCharInventory(int charNum) { if (c && !b) b = 1; } - + if (_flags.use16ColorMode) gui_drawBarGraph(154, 66 + i * 8, 34, 5, b, e, 0x88, 0); else @@ -251,7 +251,7 @@ void LoLEngine::gui_printCharacterStats(int index, int redraw, int value) { col = 158; if (redraw) _screen->fprintString("%s", offs + 108, y, col, 0, 4, getLangString(0x4014 + index)); - } + } } else { //skills int s = index - 2; @@ -650,7 +650,7 @@ int LoLEngine::gui_enableControls() { int start = 74; int end = 83; - + if (_flags.isTalkie) { start = 76; end = 85; @@ -676,7 +676,7 @@ int LoLEngine::gui_disableControls(int controlMode) { int start = 74; int end = 83; int swtch = 76; - + if (_flags.isTalkie) { start = 76; end = 85; @@ -846,7 +846,7 @@ void LoLEngine::gui_triggerEvent(int eventType) { for (Common::HashMap<int, int16>::const_iterator c = _keyMap.begin(); c != _keyMap.end(); ++c) { if (c->_value == eventType) evt.kbd.keycode = (Common::KeyCode) c->_key; - } + } } removeInputTop(); @@ -2621,9 +2621,9 @@ void GUI_LoL::updateSavegameList() { KyraEngine_v1::SaveHeader header; Common::InSaveFile *in; - + _savegameList = new char*[_savegameListSize]; - + for (int i = 0; i < _savegameListSize; i++) { in = _vm->openSaveForReading(_vm->getSavegameFilename(i), header); if (in) { @@ -2790,7 +2790,7 @@ int GUI_LoL::clickedOptionsMenu(Button *button) { case 0xfff9: _vm->_configMusic ^= 1; _vm->sound()->enableMusic(_vm->_configMusic); - + if (_vm->_configMusic) _vm->snd_playTrack(_vm->_curMusicTheme); else diff --git a/engines/kyra/gui_v2.cpp b/engines/kyra/gui_v2.cpp index cf9ccfc0d3..e1016665a2 100644 --- a/engines/kyra/gui_v2.cpp +++ b/engines/kyra/gui_v2.cpp @@ -748,7 +748,7 @@ const char *GUI_v2::nameInputProcess(char *buffer, int x, int y, uint8 c1, uint8 int x2 = x, y2 = y; Screen::FontId of = _screen->setFont(Screen::FID_8_FNT); _text->printText(buffer, x, y, c1, c2, c2); - + for (int i = 0; i < curPos; ++i) x2 += getCharWidth(buffer[i]); diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp index 68e0eb66d5..7cfa7bd29e 100644 --- a/engines/kyra/kyra_lok.cpp +++ b/engines/kyra/kyra_lok.cpp @@ -339,7 +339,7 @@ Common::Error KyraEngine_LoK::go() { void KyraEngine_LoK::startup() { static const uint8 colorMap[] = { 0, 0, 0, 0, 12, 12, 12, 0, 0, 0, 0, 0 }; _screen->setTextColorMap(colorMap); - + _sound->setSoundList(&_soundData[kMusicIngame]); if (_flags.platform == Common::kPlatformPC98) _sound->loadSoundFile("SE.DAT"); diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp index ffb9050aba..451750ce14 100644 --- a/engines/kyra/kyra_v1.cpp +++ b/engines/kyra/kyra_v1.cpp @@ -363,7 +363,7 @@ void KyraEngine_v1::setupKeyMap() { static const int16 keyCodesDOS[] = { 61, 43, 96, 96, 102, 102, 98, 98, 97, 92, 92, 91, 91, 101, 101, 112, 113, 114, 25, 20, 55, 110}; static const int16 keyCodesPC98[] = { 53, 29, 68, 68, 73, 73, 76, 76, 72, 71, 71, 67, 67, 69, 69, 99, 100, 101, 25, 20, 55, 1 }; - + const int16 *keyCodes = _flags.platform == Common::kPlatformPC98 ? keyCodesPC98 : keyCodesDOS; _keyMap.clear(); diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h index e73a8b77b7..1ad13cd092 100644 --- a/engines/kyra/kyra_v1.h +++ b/engines/kyra/kyra_v1.h @@ -68,7 +68,7 @@ class KyraMetaEngine; * Kyrandia 1 Russian (no feature request) * Kyrandia 2 Russian (no feature request) * Kyrandia 3 Russian (feature request #2812792 "Kyrandia3 Russian") - * + * * The primary maintainer for the engine is LordHoto, although some parts are maintained by _athrxx. * If you have questions about parts of the code, the following rough description might help in * determining who you should ask: diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 41d017223b..be5a755200 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -1589,7 +1589,7 @@ void LoLEngine::initDialogueSequence(int controlMode, int pageNum) { } else { _screen->fillRect(0, 128, 319, 199, 1); gui_drawBox(0, 129, 320, 71, 136, 251, -1); - gui_drawBox(1, 130, 318, 69, 136, 251, 252); + gui_drawBox(1, 130, 318, 69, 136, 251, 252); } _screen->modifyScreenDim(5, 8, 131, 306, 66); @@ -1721,7 +1721,7 @@ void LoLEngine::generateBrightnessPalette(const Palette &src, Palette &dst, int modifier = 0; else if (modifier < 0 || modifier > 7 || !(_flagsTable[31] & 0x08)) modifier = 8; - + modifier >>= 1; if (modifier) modifier--; @@ -1780,7 +1780,7 @@ void LoLEngine::createTransparencyTables() { _res->loadFileToBuf("LOL.NOL", tpal, 48); for (int i = 15; i > -1; i--) { - int s = colTbl[i << 1] * 3; + int s = colTbl[i << 1] * 3; tpal[s] = tpal[i * 3]; tpal[s + 1] = tpal[i * 3 + 1]; tpal[s + 2] = tpal[i * 3 + 2]; @@ -2173,7 +2173,7 @@ int LoLEngine::processMagicHeal(int charNum, int spellLevel) { SWAP(dst[s + 2], dst[i + 2]); } } - + _screen->generateGrayOverlay(tpal, _healOverlay, 52, 22, 20, 0, 256, true); } @@ -2311,7 +2311,7 @@ int LoLEngine::processMagicIce(int charNum, int spellLevel) { _screen->loadPalette("LOLICE.NOL", swampCol); for (int i = 1; i < 16; i++) { uint16 v = (s[i * 3] + s[i * 3 + 1] + s[i * 3 + 2]) / 3; - tpal[i * 3] = 0; + tpal[i * 3] = 0; tpal[i * 3 + 1] = v; tpal[i * 3 + 2] = v << 1; @@ -2319,11 +2319,11 @@ int LoLEngine::processMagicIce(int charNum, int spellLevel) { tpal[i * 3 + 2] = 29; } - } else { + } else { _screen->loadPalette("SWAMPICE.COL", swampCol); tpal.copy(s, 128); swampCol.copy(s, 128); - + for (int i = 1; i < 128; i++) { tpal[i * 3] = 0; uint16 v = (s[i * 3] + s[i * 3 + 1] + s[i * 3 + 2]) / 3; @@ -2544,7 +2544,7 @@ int LoLEngine::processMagicFireball(int charNum, int spellLevel) { } else { if (_flags.use16ColorMode) _screen->drawShape(_screen->_curPage, shp, fX, fY, 0, 4, sW, sH); - else + else _screen->drawShape(_screen->_curPage, shp, fX, fY, 0, 0x1004, _transparencyTable1, _transparencyTable2, sW, sH); } @@ -2883,7 +2883,7 @@ int LoLEngine::processMagicVaelansCube() { tmpPal2[i * 3 + 2] = (a > 60) ? 60 : a; } } - + snd_playSoundEffect(146, -1); uint32 ctime = _system->getMillis(); @@ -4013,10 +4013,10 @@ void LoLEngine::displayAutomap() { static const uint8 ovlSrc[] = { 0x00, 0xEE, 0xCC, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0x22, 0x11, 0xDD, 0xEE, 0xCC }; memset(_mapOverlay, 0, 256); for (int i = 0; i < 16; i++) - _mapOverlay[(i << 4) | i] = ovlSrc[i]; + _mapOverlay[(i << 4) | i] = ovlSrc[i]; } else _screen->generateGrayOverlay(_screen->getPalette(3), _mapOverlay, 52, 0, 0, 0, 256, false); - + _screen->loadFont(Screen::FID_9_FNT, "FONT9PN.FNT"); _screen->loadFont(Screen::FID_6_FNT, "FONT6PN.FNT"); diff --git a/engines/kyra/resource_intern.cpp b/engines/kyra/resource_intern.cpp index dc1bcf90b7..49c2c85a32 100644 --- a/engines/kyra/resource_intern.cpp +++ b/engines/kyra/resource_intern.cpp @@ -877,7 +877,7 @@ public: ~CmpVocDecoder(); uint8 *process(uint8 *src, uint32 insize, uint32 *outsize, bool disposeInput = true); -private: +private: void decodeHelper(int p); int32 *_vtbl; @@ -1028,7 +1028,7 @@ Common::Archive *InstallerLoader::load(Resource *owner, const Common::String &fi newEntry.size = outsize; newEntry.name = entryStr; } - + fileList.push_back(newEntry); } pos++; @@ -1187,7 +1187,7 @@ CmpVocDecoder::~CmpVocDecoder() { uint8 *CmpVocDecoder::process(uint8 *src, uint32 insize, uint32 *outsize, bool disposeInput) { *outsize = 0; uint8 *outTemp = new uint8[insize]; - + uint8 *inPosH = src; uint8 *outPosH = outTemp; uint8 *outPosD = outTemp + READ_LE_UINT32(src); @@ -1221,7 +1221,7 @@ uint8 *CmpVocDecoder::process(uint8 *src, uint32 insize, uint32 *outsize, bool d uint8 *vocPtr = src + offset; uint32 vocLen = (vocPtr[27] | (vocPtr[28] << 8) | (vocPtr[29] << 16)) - 2; - + uint8 *vocOutEnd = outPosD + vocLen + 32; uint8 *vocInEnd = src + offset + fileSize; memcpy(outPosD, vocPtr, 32); @@ -1235,7 +1235,7 @@ uint8 *CmpVocDecoder::process(uint8 *src, uint32 insize, uint32 *outsize, bool d uint32 readSize = MIN<uint32>(8192, vocInEnd - vocPtr); memcpy(_sndArray, vocPtr, readSize); vocPtr += readSize; - + for (int i = -128; i < 128; i++) _stTbl[i + 128] = (int32)((float)i / t + 0.5f); @@ -1255,7 +1255,7 @@ uint8 *CmpVocDecoder::process(uint8 *src, uint32 insize, uint32 *outsize, bool d memcpy(dst, _sndArray, numBytesOut); dst += numBytesOut; } - + *dst++ = 0; memcpy(outPosH, spos, headerEntryLen); WRITE_LE_UINT32(outPosH, outPosD - outTemp); @@ -1287,7 +1287,7 @@ void CmpVocDecoder::decodeHelper(int p1) { int d = 3; int s = 1; - + while (s < p2) { fi2 = _floatArray[s]; fi1 = _floatArray[s + 1]; diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp index 3d4910fd68..60d4749774 100644 --- a/engines/kyra/scene_lol.cpp +++ b/engines/kyra/scene_lol.cpp @@ -99,7 +99,7 @@ void LoLEngine::loadLevel(int index) { setMouseCursorToItemInHand(); if (_flags.use16ColorMode) - _screen->fadeToPalette1(10); + _screen->fadeToPalette1(10); snd_playTrack(_curMusicTheme); } @@ -415,7 +415,7 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight } v += 384; - } + } if (_currentLevel == 11) { if (_flags.use16ColorMode) { diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 708a7f41f3..cec6f1970a 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -2146,7 +2146,7 @@ void Screen::decodeFrameDeltaPage(uint8 *dst, const uint8 *src, int pitch, bool } void Screen::convertAmigaGfx(uint8 *data, int w, int h, int depth, bool wsa, int bytesPerPlane) { - const int planeWidth = (bytesPerPlane == -1) ? (w + 7) / 8 : bytesPerPlane; + const int planeWidth = (bytesPerPlane == -1) ? (w + 7) / 8 : bytesPerPlane; const int planeSize = planeWidth * h; const uint imageSize = planeSize * depth; @@ -3365,7 +3365,7 @@ void SJISFont::drawChar(uint16 c, byte *dst, int pitch) const { if (_is16Color) { // PC98 16 color games specify a color value which is for the // PC98 text mode palette, thus we need to remap it. - color1 = ((_colorMap[1] >> 5) & 0x7) + 16; + color1 = ((_colorMap[1] >> 5) & 0x7) + 16; color2 = ((_colorMap[0] >> 5) & 0x7) + 16; } else { color1 = _colorMap[1]; diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp index f15c8dd612..6b94043005 100644 --- a/engines/kyra/screen_lol.cpp +++ b/engines/kyra/screen_lol.cpp @@ -191,7 +191,7 @@ uint8 *Screen_LoL::generateLevelOverlay(const Palette &srcPal, uint8 *ovl, int o weight = 255; const uint8 *srt = srcPal.getData(); - + uint16 r = srt[opColor * 3]; uint16 g = srt[opColor * 3 + 1]; uint16 b = srt[opColor * 3 + 2]; @@ -848,7 +848,7 @@ void Screen_LoL::fadeToPalette1(int delay) { void Screen_LoL::loadSpecialColors(Palette &dst) { if (_use16ColorMode) return; - + dst.copy(*_screenPalette, 192, 4); } @@ -941,9 +941,9 @@ bool Screen_LoL::fadePaletteStep(uint8 *pal1, uint8 *pal2, uint32 elapsedTime, u Palette **Screen_LoL::generateFadeTable(Palette **dst, Palette *src1, Palette *src2, int numTabs) { int len = _use16ColorMode ? 48 : 768; - if (!src1) + if (!src1) src1 = _screenPalette; - + uint8 *p1 = (*dst++)->getData(); uint8 *p2 = src1->getData(); uint8 *p3 = src2->getData(); diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index cf4f9ecdaf..810b36f94b 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -2151,7 +2151,7 @@ int LoLEngine::olol_paletteFlash(EMCState *script) { uint8 *d = p2.getData(); for (int i = 0; i < 16; i++) - d[i * 3] = 0x3f; + d[i * 3] = 0x3f; _screen->setScreenPalette(p2); _screen->updateScreen(); @@ -2164,7 +2164,7 @@ int LoLEngine::olol_paletteFlash(EMCState *script) { _screen->updateScreen(); - } else { + } else { Palette &p2 = _screen->getPalette(3); uint8 ovl[256]; @@ -2653,8 +2653,8 @@ int LoLEngine::tlol_fadeInPalette(const TIM *tim, const uint16 *param) { _screen->setScreenPalette(_screen->getPalette(0)); _screen->copyPage(2, 0); } - - _screen->fadePalette(pal, param[1]); + + _screen->fadePalette(pal, param[1]); return 1; } diff --git a/engines/kyra/seqplayer.cpp b/engines/kyra/seqplayer.cpp index d6409e49c1..511a7da21d 100644 --- a/engines/kyra/seqplayer.cpp +++ b/engines/kyra/seqplayer.cpp @@ -657,7 +657,7 @@ bool SeqPlayer::playSequence(const uint8 *seqData, bool skipSeq) { } delete[] _specialBuffer; _specialBuffer = 0; - + for (uint i = 0; i < ARRAYSIZE(_seqMovies); ++i) { delete _seqMovies[i].movie; _seqMovies[i].movie = 0; diff --git a/engines/kyra/sequences_hof.cpp b/engines/kyra/sequences_hof.cpp index 8d7cda79c1..bdba04bf9e 100644 --- a/engines/kyra/sequences_hof.cpp +++ b/engines/kyra/sequences_hof.cpp @@ -2796,7 +2796,7 @@ void KyraEngine_HoF::seq_init() { { 0xd8, 0xda, 0xd9, 0xd8 }, (_flags.lang == Common::JA_JPN) ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT, 240 }; - + _menu = new MainMenu(this); _menu->init(data, MainMenu::Animation()); } diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp index 236a559816..dc1a0f4d15 100644 --- a/engines/kyra/sequences_lol.cpp +++ b/engines/kyra/sequences_lol.cpp @@ -1160,7 +1160,7 @@ void LoLEngine::showCredits() { _outroShapeTable[i] = (i << 4) | i; else _outroShapeTable[255] = 0; - + _sound->haltTrack(); _sound->loadSoundFile("LOREFINL"); _sound->playTrack(4); @@ -1474,7 +1474,7 @@ void LoLEngine::processCredits(char *t, int dimState, int page, int delayTime) { curShapeFile = curShapeFile % 28; loadOutroShapes(curShapeFile, shapes); - + if (!_flags.use16ColorMode) { _screen->getPalette(0).copy(monsterPal, curShapeFile * 40, 40, 88); _screen->setScreenPalette(_screen->getPalette(0)); diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h index 9cba030a13..3b0fbbed0a 100644 --- a/engines/kyra/sound.h +++ b/engines/kyra/sound.h @@ -266,7 +266,7 @@ public: bool hasSoundFile(uint file) const { return _music->hasSoundFile(file) && _sfx->hasSoundFile(file); } void loadSoundFile(uint file) { _music->loadSoundFile(file); _sfx->loadSoundFile(file); } void loadSoundFile(Common::String file) { _music->loadSoundFile(file); _sfx->loadSoundFile(file); } - + void loadSfxFile(Common::String file) { _sfx->loadSoundFile(file); } void playTrack(uint8 track) { _music->playTrack(track); } diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp index ce7658ee63..7b4a15dc4a 100644 --- a/engines/kyra/sound_towns.cpp +++ b/engines/kyra/sound_towns.cpp @@ -3562,7 +3562,7 @@ void TownsPC98_OpnDriver::loadSoundEffectData(uint8 *data, uint8 trackNum) { void TownsPC98_OpnDriver::reset() { Common::StackLock lock(_mutex); - + _musicPlaying = false; _sfxPlaying = false; _fading = false; diff --git a/engines/kyra/sprites_lol.cpp b/engines/kyra/sprites_lol.cpp index a943853867..ce14489e3e 100644 --- a/engines/kyra/sprites_lol.cpp +++ b/engines/kyra/sprites_lol.cpp @@ -1026,7 +1026,7 @@ uint8 *LoLEngine::drawItemOrMonster(uint8 *shape, uint8 *monsterPalette, int x, if (_flags.use16ColorMode) { if (_currentLevel != 22) flg &= 0xdfff; - + } else { if (_currentLevel == 22) { if (brightnessOverlay) diff --git a/engines/kyra/text_lol.cpp b/engines/kyra/text_lol.cpp index 8f6b04afb9..d5264be483 100644 --- a/engines/kyra/text_lol.cpp +++ b/engines/kyra/text_lol.cpp @@ -128,8 +128,8 @@ void TextDisplayer_LoL::expandField() { h = 4; stepH = 1; } - - _screen->copyRegion(83, y, 0, 0, 235, h, 0, 2, Screen::CR_NO_P_CHECK); + + _screen->copyRegion(83, y, 0, 0, 235, h, 0, 2, Screen::CR_NO_P_CHECK); for (int i = 140; i < 177; i++) { uint32 endTime = _vm->_system->getMillis() + _vm->_tickLength; @@ -360,7 +360,7 @@ void TextDisplayer_LoL::preprocessString(char *str, EMCState *script, const uint void TextDisplayer_LoL::displayText(char *str, ...) { const bool isPc98 = (_vm->gameFlags().platform == Common::kPlatformPC98); - + _printFlag = false; _lineWidth = 0; @@ -382,7 +382,7 @@ void TextDisplayer_LoL::displayText(char *str, ...) { const ScreenDim *sd = _screen->_curDim; int sdx = _screen->curDimIndex(); - bool pc98PrintFlag = (isPc98 && (sdx == 3 || sdx == 4 || sdx == 5 || sdx == 15)) ? true : false; + bool pc98PrintFlag = (isPc98 && (sdx == 3 || sdx == 4 || sdx == 5 || sdx == 15)) ? true : false; uint16 charsPerLine = (sd->w << 3) / (_screen->getFontWidth() + _screen->_charWidth); while (c) { @@ -587,7 +587,7 @@ void TextDisplayer_LoL::printLine(char *str) { w -= _textDimData[sdx].column; int n2 = 0; - int n1 = (w / 4) - 1; + int n1 = (w / 4) - 1; do { c = str[n2]; @@ -612,7 +612,7 @@ void TextDisplayer_LoL::printLine(char *str) { while (n1 > 0) { //cut off line after last space c = str[n1]; - + lw -= _screen->getCharWidth((uint8)c); if (!n2 && lw <= w) @@ -623,7 +623,7 @@ void TextDisplayer_LoL::printLine(char *str) { _printFlag = false; break; } - n1--; + n1--; } if (!n1) { @@ -641,7 +641,7 @@ void TextDisplayer_LoL::printLine(char *str) { str[s] = 0; uint8 col = _textDimData[sdx].color1; - if (isPc98 && (sdx == 2 || sdx == 3 || sdx == 4 || sdx == 5 || sdx == 15)) { + if (isPc98 && (sdx == 2 || sdx == 3 || sdx == 4 || sdx == 5 || sdx == 15)) { switch (_textDimData[sdx].color1) { case 0x88: col = 0x41; @@ -739,12 +739,12 @@ void TextDisplayer_LoL::textPageBreak() { char *txt = _vm->getLangString(0x4073); if (_vm->gameFlags().use16ColorMode) { - _vm->gui_drawBox(x + 8, (y & ~7) - 1, 66, 10, 0xee, 0xcc, -1); + _vm->gui_drawBox(x + 8, (y & ~7) - 1, 66, 10, 0xee, 0xcc, -1); _vm->_screen->printText(txt, (x + 37 - (strlen(txt) << 1) + 4) & ~3, (y + 2) & ~7, 0xc1, 0); } else { - _vm->gui_drawBox(x, y, 74, 9, 136, 251, -1); + _vm->gui_drawBox(x, y, 74, 9, 136, 251, -1); _vm->_screen->printText(txt, x + 37 - (_vm->_screen->getTextWidth(txt) >> 1), y + 2, 144, 0); - } + } _vm->removeInputTop(); @@ -784,7 +784,7 @@ void TextDisplayer_LoL::textPageBreak() { } while (loop); - if (_vm->gameFlags().use16ColorMode) + if (_vm->gameFlags().use16ColorMode) _screen->fillRect(x + 8, y, x + 57, y + 9, _textDimData[_screen->curDimIndex()].color2); else _screen->fillRect(x, y, x + 73, y + 8, _textDimData[_screen->curDimIndex()].color2); @@ -815,7 +815,7 @@ void TextDisplayer_LoL::clearCurDim() { _screen->fillRect(tmp->sx << 3, tmp->sy, ((tmp->sx + tmp->w) << 3) - 2, (tmp->sy + tmp->h) - 2, _textDimData[d].color2); } else _screen->fillRect(tmp->sx << 3, tmp->sy, ((tmp->sx + tmp->w) << 3) - 1, (tmp->sy + tmp->h) - 1, _textDimData[d].color2); - + _lineCount = 0; _textDimData[d].column = _textDimData[d].line = 0; } diff --git a/engines/m4/dialogs.cpp b/engines/m4/dialogs.cpp index 9adf6c42e5..5e85c6a8df 100644 --- a/engines/m4/dialogs.cpp +++ b/engines/m4/dialogs.cpp @@ -65,7 +65,7 @@ void Dialog::incLine() { _lineX = 0; _widthX = 0; - _lines.push_back(*new DialogLine()); + _lines.push_back(*new DialogLine()); assert(_lines.size() <= 20); } @@ -227,7 +227,7 @@ bool Dialog::handleNounSuffix(char *destP, int nounNum, const char *srcP) { if (*srcP != '\0') ++srcP; - // + // char var_FC[40]; char tempLine[40]; strcpy(var_FC, srcP); @@ -236,7 +236,7 @@ bool Dialog::handleNounSuffix(char *destP, int nounNum, const char *srcP) { uint16 _vocabIds[2] = {1, 1}; // FIXME/TODO: Proper vocab ids getVocab(_vocabIds[nounNum], &tmpP); - + if ((*(tmpP - 1) != 'S') && (*(tmpP - 1) != 's')) { // Singular object tmpP = &var_FC[0]; @@ -452,7 +452,7 @@ void Dialog::draw() { // Ask position //int askY = (_vm->_font->getHeight() + 1) * _askPosition.y + 3; - // Set up the dialog + // Set up the dialog fillRect(Common::Rect(0, 0, width(), height()), 3); setColour(2); hLine(1, width() - 1, height() - 2); // Bottom edge @@ -471,7 +471,7 @@ void Dialog::draw() { seed += 0x181D; v = ROR16(v, 9); seed = (seed ^ v) + ROR16(v, 3); - + *destP++ = ((seed & 0x10) != 0) ? 1 : 0; } } @@ -495,7 +495,7 @@ void Dialog::draw() { if (_lines[lineCtr].underline) // Underline needed - hLine(pt.x, pt.x + _vm->_font->getWidth(_lines[lineCtr].data, DIALOG_SPACING), + hLine(pt.x, pt.x + _vm->_font->getWidth(_lines[lineCtr].data, DIALOG_SPACING), pt.y + _vm->_font->getHeight()); } } diff --git a/engines/m4/events.cpp b/engines/m4/events.cpp index 099aa6b48d..2c8dd20708 100644 --- a/engines/m4/events.cpp +++ b/engines/m4/events.cpp @@ -68,7 +68,7 @@ M4EventType Events::handleEvents() { // if it's the first key pressed after the Ctrl key is held down if ((_event.kbd.keycode == Common::KEYCODE_LCTRL) || (_event.kbd.keycode == Common::KEYCODE_RCTRL)) _ctrlFlag = true; - + else if (_event.kbd.flags == Common::KBD_CTRL) { if ((_event.kbd.keycode == Common::KEYCODE_d) && _ctrlFlag) { _console->attach(); @@ -77,7 +77,7 @@ M4EventType Events::handleEvents() { _ctrlFlag = false; } _keyCode = (int32)_event.kbd.keycode | (_event.kbd.flags << 24); - + break; case Common::EVENT_LBUTTONDOWN: diff --git a/engines/m4/font.h b/engines/m4/font.h index 121c179562..5e4f8b8644 100644 --- a/engines/m4/font.h +++ b/engines/m4/font.h @@ -65,7 +65,7 @@ public: void setColor(uint8 color); void setColors(uint8 alt1, uint8 alt2, uint8 foreground); void setColour(uint8 colour) { setColor(colour); } - void setColours(uint8 alt1, uint8 alt2, uint8 foreground) { setColors(alt1, alt2, foreground); } + void setColours(uint8 alt1, uint8 alt2, uint8 foreground) { setColors(alt1, alt2, foreground); } int32 getWidth(const char *text, int spaceWidth = -1); int32 getHeight() const { return _maxHeight; } diff --git a/engines/m4/globals.h b/engines/m4/globals.h index 324ad13182..5a1d108658 100644 --- a/engines/m4/globals.h +++ b/engines/m4/globals.h @@ -212,10 +212,10 @@ public: void loadMadsVocab(); uint32 getVocabSize() { return _madsVocab.size(); } - const char *getVocab(uint32 index) { + const char *getVocab(uint32 index) { // Vocab list is 1-based, so always subtract one from index provided assert((index > 0) && (index <= _madsVocab.size())); - return _madsVocab[index - 1]; + return _madsVocab[index - 1]; } void loadMadsQuotes(); diff --git a/engines/m4/graphics.cpp b/engines/m4/graphics.cpp index 9b6a841164..b8e0761031 100644 --- a/engines/m4/graphics.cpp +++ b/engines/m4/graphics.cpp @@ -61,7 +61,7 @@ RGBList::~RGBList() { void RGBList::setRange(int start, int count, const RGB8 *src) { assert((start + count) <= _size); - + Common::copy(&src[0], &src[count], &_data[start]); } diff --git a/engines/m4/m4.h b/engines/m4/m4.h index c7bbfcdd87..1709ffeca2 100644 --- a/engines/m4/m4.h +++ b/engines/m4/m4.h @@ -51,18 +51,18 @@ /** * This is the namespace of the M4 engine. * - * Status of this engine: + * Status of this engine: * This engine is eventually intended to compromise two evolutions of the same engine: 'MADS' for the * first generation of the engine, and 'M4' for the second generation. This engine is called M4 overall * simply because work first began on the M4 side (focusing on the game 'Orion Burger'). * - * MADS Status: The current game being focused on is 'Rex Nebular' by DreamMaster, who is implementing + * MADS Status: The current game being focused on is 'Rex Nebular' by DreamMaster, who is implementing * functionality as he disassembles the games original executables. Currently the engine has no particular - * game logic implemented, although it does have the title screen implemented, and displays the initial + * game logic implemented, although it does have the title screen implemented, and displays the initial * game screen and some game interface elements * * M4 Status: Work on this engine began with the game 'Orion Burger'. Some of the user interface - * functionality has been implemented. No further work has been done on this for some time, so progress + * functionality has been implemented. No further work has been done on this for some time, so progress * on this part of the engine can be considered frozen. * * Games this engine will support: diff --git a/engines/m4/mads_anim.cpp b/engines/m4/mads_anim.cpp index ffa3b4bc9c..6984308784 100644 --- a/engines/m4/mads_anim.cpp +++ b/engines/m4/mads_anim.cpp @@ -522,7 +522,7 @@ void AnimviewView::updateState() { scriptDone(); return; } - + readNextCommand(); // FIXME: Replace flag with proper animation end check @@ -553,7 +553,7 @@ void AnimviewView::readNextCommand() { cStart = strchr(_currentLine, '-'); } - + // If there's something left, presume it's a resource name to process if (_currentLine[0]) break; @@ -579,10 +579,10 @@ void AnimviewView::readNextCommand() { buffer[0] = 'A'; // A for AdLib resource /*Common::SeekableReadStream *stream = */_vm->_resourceManager->get(buffer); - + _vm->_resourceManager->toss(buffer); } - + char artFile[80]; sprintf(artFile, "rm%d.art", aaFile.roomNumber); diff --git a/engines/m4/midi.cpp b/engines/m4/midi.cpp index 2696bf566a..e54fc19f46 100644 --- a/engines/m4/midi.cpp +++ b/engines/m4/midi.cpp @@ -181,7 +181,7 @@ void MidiPlayer::stopMusic() { if (_parser) { _parser->unloadMusic(); } - + if (_midiData) { free(_midiData); _midiData = NULL; diff --git a/engines/m4/scene.cpp b/engines/m4/scene.cpp index f61a2e88ce..7b5080e0bc 100644 --- a/engines/m4/scene.cpp +++ b/engines/m4/scene.cpp @@ -113,7 +113,7 @@ void Scene::loadScene(int sceneNumber) { } else { // Set system palette entries _vm->_palette->blockRange(0, 7); - RGB8 sysColors[3] = { {0x1f<<2, 0x2d<<2, 0x31<<2, 0}, {0x24<<2, 0x37<<2, 0x3a<<2, 0}, + RGB8 sysColors[3] = { {0x1f<<2, 0x2d<<2, 0x31<<2, 0}, {0x24<<2, 0x37<<2, 0x3a<<2, 0}, {0x00<<2, 0x10<<2, 0x16<<2, 0}}; _vm->_palette->setPalette(&sysColors[0], 4, 3); @@ -701,7 +701,7 @@ void Scene::setAction(int action, int objectId) { // Set up the new action strcpy(statusText, _vm->_globals->getVocab(action)); statusText[0] = toupper(statusText[0]); // capitalize first letter - + if (objectId != -1) { MadsObject *obj = _vm->_globals->getObject(objectId); sprintf(statusText + strlen(statusText), " %s", _vm->_globals->getVocab(obj->descId)); @@ -735,7 +735,7 @@ MadsInterfaceView::MadsInterfaceView(M4Engine *vm): View(vm, Common::Rect(0, MAD for (int i = 0; i < 10; ++i) _screenObjects.addRect((i / 5) * 32 + 1, (i % 5) * 8 + MADS_SURFACE_HEIGHT + 2, ((i / 5) + 1) * 32 + 3, ((i % 5) + 1) * 8 + MADS_SURFACE_HEIGHT + 2); - + // Scroller elements (up arrow, scroller, down arrow) _screenObjects.addRect(73, 160, 82, 167); _screenObjects.addRect(73, 168, 82, 190); @@ -744,7 +744,7 @@ MadsInterfaceView::MadsInterfaceView(M4Engine *vm): View(vm, Common::Rect(0, MAD // Inventory object names for (int i = 0; i < 5; ++i) _screenObjects.addRect(89, 158 + i * 8, 160, 166 + i * 8); - + // Full rectangle area for all vocab actions for (int i = 0; i < 5; ++i) _screenObjects.addRect(239, 158 + i * 8, 320, 166 + i * 8); @@ -805,7 +805,7 @@ void MadsInterfaceView::setSelectedObject(int objectNumber) { _topIndex = idx; else if (idx >= (_topIndex + 5)) _topIndex = MAX(0, idx - 4); - + _selectedObject = objectNumber; sprintf(resName, "*OB%.3dI.SS", objectNumber); @@ -843,7 +843,7 @@ void MadsInterfaceView::onRefresh(RectList *rects, M4Surface *destSurface) { for (int y = 0; y < 5; ++y, ++actionIndex) { // Determine the font colour depending on whether an item is selected. Note that the first action, // 'Look', is always 'selected', even when another action is clicked on - setFontMode((_highlightedElement == actionIndex) ? ITEM_HIGHLIGHTED : + setFontMode((_highlightedElement == actionIndex) ? ITEM_HIGHLIGHTED : ((actionIndex == 0) ? ITEM_SELECTED : ITEM_NORMAL)); // Get the verb action and capitalise it @@ -864,7 +864,7 @@ void MadsInterfaceView::onRefresh(RectList *rects, M4Surface *destSurface) { destSurface->frameRect(r, 5); } - // Draw the horizontal line in the scroller representing the current top selected + // Draw the horizontal line in the scroller representing the current top selected const Common::Rect scroller(_screenObjects[SCROLL_SCROLLER]); int yP = (_inventoryList.size() < 2) ? 0 : (scroller.height() - 5) * _topIndex / (_inventoryList.size() - 1); destSurface->setColor(4); @@ -881,7 +881,7 @@ void MadsInterfaceView::onRefresh(RectList *rects, M4Surface *destSurface) { if ((buffer[0] >= 'a') && (buffer[0] <= 'z')) buffer[0] -= 'a' - 'A'; const Common::Rect r(_screenObjects[INVLIST_START + i]); - + // Set the highlighting of the inventory item if (_highlightedElement == (int)(INVLIST_START + i)) setFontMode(ITEM_HIGHLIGHTED); else if (_selectedObject == _inventoryList[_topIndex + i]) setFontMode(ITEM_SELECTED); @@ -915,7 +915,7 @@ void MadsInterfaceView::onRefresh(RectList *rects, M4Surface *destSurface) { const char *descStr = _vm->_globals->getVocab(obj->vocabList[i].vocabId); strcpy(buffer, descStr); if ((buffer[0] >= 'a') && (buffer[0] <= 'z')) buffer[0] -= 'a' - 'A'; - + // Set the highlighting and display the entry setFontMode((i == yIndex) ? ITEM_HIGHLIGHTED : ITEM_NORMAL); _vm->_font->writeString(destSurface, buffer, r.left, r.top, r.width(), 0); @@ -942,7 +942,7 @@ bool MadsInterfaceView::onEvent(M4EventType eventType, int32 param1, int x, int _highlightedElement = _screenObjects.find(Common::Point(x, y)); return true; - + case MEVENT_LEFT_CLICK: // Left mouse click // Check if an inventory object was selected @@ -1017,7 +1017,7 @@ bool MadsInterfaceView::handleCheatKey(int32 keycode) { { // Teleport to room //Scene *sceneView = (Scene *)vm->_viewManager->getView(VIEWID_SCENE); - + return true; } diff --git a/engines/m4/scene.h b/engines/m4/scene.h index 593bbddc07..8896a8f5df 100644 --- a/engines/m4/scene.h +++ b/engines/m4/scene.h @@ -137,7 +137,7 @@ class IntegerList: public Common::Array<int> { public: int indexOf(int v) { for (uint i = 0; i < size(); ++i) - if (operator [](i) == v) + if (operator [](i) == v) return i; return -1; } @@ -151,7 +151,7 @@ private: int _topIndex; uint32 _nextScrollerTicks; int _cheatKeyCtr; - + // Object display fields int _selectedObject; SpriteAsset *_objectSprites; diff --git a/engines/m4/viewmgr.cpp b/engines/m4/viewmgr.cpp index 78ebbbad96..a259939617 100644 --- a/engines/m4/viewmgr.cpp +++ b/engines/m4/viewmgr.cpp @@ -63,7 +63,7 @@ int RectList::find(const Common::Point &pt) { if (this->operator [](idx).contains(pt.x, pt.y)) return idx; } - return -1; + return -1; } //-------------------------------------------------------------------------- diff --git a/engines/made/resource.cpp b/engines/made/resource.cpp index 26662d4fb5..b5f7b48fcd 100644 --- a/engines/made/resource.cpp +++ b/engines/made/resource.cpp @@ -531,7 +531,7 @@ bool ResourceReader::loadResource(ResourceSlot *slot, byte *&buffer, uint32 &siz ResourceSlot *ResourceReader::getResourceSlot(uint32 resType, uint index) { ResourceSlots *slots = _resSlots[resType]; - + if (!slots) return NULL; @@ -577,7 +577,7 @@ void ResourceReader::purgeCache() { slot->res = NULL; slot->refCount = 0; _cacheCount--; - } + } } } } diff --git a/engines/made/screen.cpp b/engines/made/screen.cpp index 1c2ead8621..81c18ef64b 100644 --- a/engines/made/screen.cpp +++ b/engines/made/screen.cpp @@ -177,7 +177,7 @@ void Screen::drawSurface(Graphics::Surface *sourceSurface, int x, int y, int16 f if (y + clipHeight > clipInfo.clipRect.bottom) { clipHeight = clipInfo.clipRect.bottom - y; } - + source = (byte*)sourceSurface->getBasePtr(0, startY); dest = (byte*)clipInfo.destSurface->getBasePtr(x, y); if (_vm->getGameID() != GID_RTZ) diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp index e17b285b68..349fc23468 100644 --- a/engines/made/scriptfuncs.cpp +++ b/engines/made/scriptfuncs.cpp @@ -571,7 +571,7 @@ void ScriptFunctions::stopSound() { _vm->_res->freeResource(_soundResource); _soundStarted = false; } - + } diff --git a/engines/mohawk/bitmap.cpp b/engines/mohawk/bitmap.cpp index cdf7c73d4c..b622b3efbf 100644 --- a/engines/mohawk/bitmap.cpp +++ b/engines/mohawk/bitmap.cpp @@ -34,17 +34,17 @@ namespace Mohawk { #define PACK_COMPRESSION (_header.format & kPackMASK) #define DRAW_COMPRESSION (_header.format & kDrawMASK) - + MohawkBitmap::MohawkBitmap() { } - + MohawkBitmap::~MohawkBitmap() { } ImageData *MohawkBitmap::decodeImage(Common::SeekableReadStream *stream) { _data = stream; _header.colorTable.palette = NULL; - + // NOTE: Only the bottom 12 bits of width/height/bytesPerRow are // considered valid and bytesPerRow has to be an even number. _header.width = _data->readUint16BE() & 0x3FFF; @@ -56,7 +56,7 @@ ImageData *MohawkBitmap::decodeImage(Common::SeekableReadStream *stream) { if (getBitsPerPixel() != 8) error ("Unhandled bpp %d", getBitsPerPixel()); - + // Read in the palette if it's here. if (_header.format & kBitmapHasCLUT || (PACK_COMPRESSION == kPackRiven && getBitsPerPixel() == 8)) { _header.colorTable.tableSize = _data->readUint16BE(); @@ -74,7 +74,7 @@ ImageData *MohawkBitmap::decodeImage(Common::SeekableReadStream *stream) { _surface = new Graphics::Surface(); _surface->create(_header.width, _header.height, getBitsPerPixel() >> 3); - + unpackImage(); drawImage(); delete _data; @@ -97,7 +97,7 @@ byte MohawkBitmap::getBitsPerPixel() { default: error ("Unknown bits per pixel"); } - + return 0; } @@ -113,12 +113,12 @@ static const CompressionInfo packTable[] = { { kPackLZ1, "LZ1", &MohawkBitmap::unpackLZ1 }, { kPackRiven, "Riven", &MohawkBitmap::unpackRiven } }; - + const char *MohawkBitmap::getPackName() { for (uint32 i = 0; i < ARRAYSIZE(packTable); i++) if (PACK_COMPRESSION == packTable[i].flag) return packTable[i].name; - + return "Unknown"; } @@ -128,7 +128,7 @@ void MohawkBitmap::unpackImage() { (this->*packTable[i].func)(); return; } - + warning("Unknown Pack Compression"); } @@ -142,7 +142,7 @@ const char *MohawkBitmap::getDrawName() { for (uint32 i = 0; i < ARRAYSIZE(drawTable); i++) if (DRAW_COMPRESSION == drawTable[i].flag) return drawTable[i].name; - + return "Unknown"; } @@ -152,7 +152,7 @@ void MohawkBitmap::drawImage() { (this->*drawTable[i].func)(); return; } - + warning("Unknown Draw Compression"); } @@ -254,11 +254,11 @@ void MohawkBitmap::unpackLZ() { uint32 uncompressedSize = _data->readUint32BE(); /* uint32 compressedSize = */ _data->readUint32BE(); uint16 dictSize = _data->readUint16BE(); - + // We only support the buffer size of 0x400 if (dictSize != CBUFFERSIZE) error("Unsupported dictionary size of %04x", dictSize); - + // Now go and decompress the data Common::SeekableReadStream *decompressedData = decompressLZ(_data, uncompressedSize); delete _data; @@ -278,8 +278,8 @@ void MohawkBitmap::unpackLZ1() { ////////////////////////////////////////// void MohawkBitmap::unpackRiven() { - _data->readUint32BE(); // Unknown, the number is close to bytesPerRow * height. Could be bufSize. - + _data->readUint32BE(); // Unknown, the number is close to bytesPerRow * height. Could be bufSize. + byte *uncompressedData = (byte *)malloc(_header.bytesPerRow * _header.height); byte *dst = uncompressedData; @@ -468,9 +468,9 @@ void MohawkBitmap::handleRivenSubcommandStream(byte count, byte *&dst) { byte pattern = _data->readByte(); B_LASTDUPLET_MINUS(pattern >> 4); B_LASTDUPLET_MINUS(getLastFourBits(pattern)); - + // Repeat operations - // Repeat n duplets from relative position -m (given in pixels, not duplets). + // Repeat n duplets from relative position -m (given in pixels, not duplets). // If r is 0, another byte follows and the last pixel is set to that value } else if (cmd >= 0xa4 && cmd <= 0xa7) { B_NDUPLETS(3); @@ -541,24 +541,24 @@ void MohawkBitmap::drawRaw() { void MohawkBitmap::drawRLE8() { // A very simple RLE8 scheme is used as a secondary compression on // most images in non-Riven tBMP's. - + for (uint16 i = 0; i < _header.height; i++) { uint16 rowByteCount = _data->readUint16BE(); int32 startPos = _data->pos(); byte *dst = (byte *)_surface->pixels + i * _header.width; int16 remaining = _header.width; - + // HACK: It seems only the bottom 9 bits are valid for images // TODO: Verify if this is still needed after the buffer clearing fix. rowByteCount &= 0x1ff; - + while (remaining > 0) { byte code = _data->readByte(); uint16 runLen = (code & 0x7F) + 1; - + if (runLen > remaining) runLen = remaining; - + if (code & 0x80) { byte val = _data->readByte(); for (uint16 j = 0; j < runLen; j++) @@ -567,10 +567,10 @@ void MohawkBitmap::drawRLE8() { for (uint16 j = 0; j < runLen; j++) *dst++ = _data->readByte(); } - + remaining -= runLen; } - + _data->seek(startPos + rowByteCount); } } @@ -591,7 +591,7 @@ ImageData* MystBitmap::decodeImage(Common::SeekableReadStream* stream) { uint32 uncompressedSize = stream->readUint32LE(); Common::SeekableReadStream* bmpStream = decompressLZ(stream, uncompressedSize); delete stream; - + _header.type = bmpStream->readUint16BE(); if (_header.type != 'BM') @@ -602,7 +602,7 @@ ImageData* MystBitmap::decodeImage(Common::SeekableReadStream* stream) { _header.res1 = bmpStream->readUint16LE(); _header.res2 = bmpStream->readUint16LE(); _header.imageOffset = bmpStream->readUint32LE(); - + _info.size = bmpStream->readUint32LE(); if (_info.size != 40) @@ -618,34 +618,34 @@ ImageData* MystBitmap::decodeImage(Common::SeekableReadStream* stream) { _info.pixelsPerMeterY = bmpStream->readUint32LE(); _info.colorsUsed = bmpStream->readUint32LE(); _info.colorsImportant = bmpStream->readUint32LE(); - + if (_info.compression != 0) error("Unhandled BMP compression %d", _info.compression); - + if (_info.colorsUsed == 0) _info.colorsUsed = 256; - + if (_info.bitsPerPixel != 8 && _info.bitsPerPixel != 24) error("%dbpp Bitmaps not supported", _info.bitsPerPixel); - + byte *palData = NULL; - + if (_info.bitsPerPixel == 8) { palData = (byte *)malloc(256 * 4); - for (uint16 i = 0; i < _info.colorsUsed; i++) { + for (uint16 i = 0; i < _info.colorsUsed; i++) { palData[i * 4 + 2] = bmpStream->readByte(); palData[i * 4 + 1] = bmpStream->readByte(); - palData[i * 4] = bmpStream->readByte(); + palData[i * 4] = bmpStream->readByte(); palData[i * 4 + 3] = bmpStream->readByte(); } } - + bmpStream->seek(_header.imageOffset); - + Graphics::Surface *surface = new Graphics::Surface(); int srcPitch = _info.width * (_info.bitsPerPixel >> 3); const int extraDataLength = (srcPitch % 4) ? 4 - (srcPitch % 4) : 0; - + if (_info.bitsPerPixel == 8) { surface->create(_info.width, _info.height, 1); byte *dst = (byte *)surface->pixels; @@ -657,30 +657,30 @@ ImageData* MystBitmap::decodeImage(Common::SeekableReadStream* stream) { } else { Graphics::PixelFormat pixelFormat = g_system->getScreenFormat(); surface->create(_info.width, _info.height, pixelFormat.bytesPerPixel); - + byte *dst = (byte *)surface->pixels + (surface->h - 1) * surface->pitch; - + for (uint32 i = 0; i < _info.height; i++) { for (uint32 j = 0; j < _info.width; j++) { byte b = bmpStream->readByte(); byte g = bmpStream->readByte(); byte r = bmpStream->readByte(); - + if (pixelFormat.bytesPerPixel == 2) *((uint16 *)dst) = pixelFormat.RGBToColor(r, g, b); - else + else *((uint32 *)dst) = pixelFormat.RGBToColor(r, g, b); - + dst += pixelFormat.bytesPerPixel; } - + bmpStream->skip(extraDataLength); dst -= surface->pitch * 2; } } - + delete bmpStream; - + return new ImageData(surface, palData); } @@ -695,7 +695,7 @@ ImageData *OldMohawkBitmap::decodeImage(Common::SeekableReadStream *stream) { _header.format = endianStream->readUint16(); debug(2, "Decoding Old Mohawk Bitmap (%dx%d, %04x Format)", _header.width, _header.height, _header.format); - + warning("Unhandled old Mohawk Bitmap decoding"); delete stream; diff --git a/engines/mohawk/bitmap.h b/engines/mohawk/bitmap.h index 18c51bc478..f1fde92f33 100644 --- a/engines/mohawk/bitmap.h +++ b/engines/mohawk/bitmap.h @@ -91,7 +91,7 @@ public: void drawRaw(); void drawRLE8(); void drawRLE(); - + protected: BitmapHeader _header; byte getBitsPerPixel(); @@ -122,7 +122,7 @@ public: ImageData *decodeImage(Common::SeekableReadStream *stream); -private: +private: struct BitmapHeader { uint16 type; uint32 size; diff --git a/engines/mohawk/console.cpp b/engines/mohawk/console.cpp index 5a7cc3b18c..80ba710a47 100644 --- a/engines/mohawk/console.cpp +++ b/engines/mohawk/console.cpp @@ -71,7 +71,7 @@ bool MystConsole::Cmd_ChangeCard(int argc, const char **argv) { return false; } - + bool MystConsole::Cmd_CurCard(int argc, const char **argv) { DebugPrintf("Current Card: %d\n", _vm->getCurCard()); return true; @@ -82,12 +82,12 @@ bool MystConsole::Cmd_Var(int argc, const char **argv) { DebugPrintf("Usage: var <var> (<value>)\n"); return true; } - + if (argc > 2) _vm->_varStore->setVar((uint16)atoi(argv[1]), (uint32)atoi(argv[2])); DebugPrintf("%d = %d\n", (uint16)atoi(argv[1]), _vm->_varStore->getVar((uint16)atoi(argv[1]))); - + return true; } @@ -135,10 +135,10 @@ bool MystConsole::Cmd_ChangeStack(int argc, const char **argv) { DebugPrintf(" %s\n", mystStackNames[i]); DebugPrintf("\n"); - + return true; } - + byte stackNum = 0; for (byte i = 1; i <= ARRAYSIZE(mystStackNames); i++) @@ -151,7 +151,7 @@ bool MystConsole::Cmd_ChangeStack(int argc, const char **argv) { DebugPrintf("\'%s\' is not a stack name!\n", argv[1]); return true; } - + // We need to stop any playing sound when we change the stack // as the next card could continue playing it if it. _vm->_sound->stopSound(); @@ -178,7 +178,7 @@ bool MystConsole::Cmd_DrawImage(int argc, const char **argv) { rect = Common::Rect(0, 0, 544, 333); else rect = Common::Rect((uint16)atoi(argv[2]), (uint16)atoi(argv[3]), (uint16)atoi(argv[4]), (uint16)atoi(argv[5])); - + _vm->_gfx->copyImageToScreen((uint16)atoi(argv[1]), rect); return false; } @@ -230,7 +230,7 @@ bool MystConsole::Cmd_PlayMovie(int argc, const char **argv) { DebugPrintf("NOTE: The movie will play *once* in the background.\n"); return true; } - + int8 stackNum = 0; if (argc == 3 || argc > 4) { @@ -312,26 +312,26 @@ bool RivenConsole::Cmd_ChangeCard(int argc, const char **argv) { return false; } - + bool RivenConsole::Cmd_CurCard(int argc, const char **argv) { DebugPrintf("Current Card: %d\n", _vm->getCurCard()); return true; } - + bool RivenConsole::Cmd_Var(int argc, const char **argv) { if (argc == 1) { DebugPrintf("Usage: var <var name> (<value>)\n"); return true; } - + uint32 *globalVar = _vm->matchVarToString(argv[1]); - + if (!globalVar) { DebugPrintf("Unknown variable \'%s\'\n", argv[1]); return true; } - + if (argc > 2) *globalVar = (uint32)atoi(argv[2]); @@ -350,9 +350,9 @@ bool RivenConsole::Cmd_PlaySound(int argc, const char **argv) { _vm->_sound->stopSound(); _vm->_sound->stopAllSLST(); - + bool mainSoundFile = (argc < 3) || (scumm_stricmp(argv[2], "false") != 0); - + _vm->_sound->playSound((uint16)atoi(argv[1]), mainSoundFile); return false; @@ -367,12 +367,12 @@ bool RivenConsole::Cmd_PlaySLST(int argc, const char **argv) { _vm->_sound->stopSound(); _vm->_sound->stopAllSLST(); - + uint16 card = _vm->getCurCard(); - + if (argc == 3) card = (uint16)atoi(argv[2]); - + _vm->_sound->playSLST((uint16)atoi(argv[1]), card); return false; @@ -404,10 +404,10 @@ bool RivenConsole::Cmd_ChangeStack(int argc, const char **argv) { DebugPrintf(" %s\n", _vm->getStackName(i).c_str()); DebugPrintf("\n"); - + return true; } - + byte stackNum = 0; for (i = 1; i <= tspit + 1; i++) @@ -445,9 +445,9 @@ bool RivenConsole::Cmd_Hotspots(int argc, const char **argv) { DebugPrintf("enabled)\n"); else DebugPrintf("disabled)\n"); - + DebugPrintf(" Name = %s\n", _vm->getHotspotName(i).c_str()); - } + } return true; } @@ -467,9 +467,9 @@ bool RivenConsole::Cmd_DumpScript(int argc, const char **argv) { DebugPrintf("Usage: dumpScript <stack> <CARD or HSPT> <card>\n"); return true; } - + uint16 oldStack = _vm->getCurStack(); - + byte newStack = 0; for (byte i = 1; i <= tspit + 1; i++) @@ -482,52 +482,52 @@ bool RivenConsole::Cmd_DumpScript(int argc, const char **argv) { DebugPrintf("\'%s\' is not a stack name!\n", argv[1]); return true; } - + newStack--; _vm->changeToStack(newStack); - + // Load in Variable Names Common::SeekableReadStream *nameStream = _vm->getRawData(ID_NAME, VariableNames); Common::StringList varNames; - + uint16 namesCount = nameStream->readUint16BE(); uint16 *stringOffsets = new uint16[namesCount]; for (uint16 i = 0; i < namesCount; i++) stringOffsets[i] = nameStream->readUint16BE(); nameStream->seek(namesCount * 2, SEEK_CUR); int32 curNamesPos = nameStream->pos(); - + for (uint32 i = 0; i < namesCount; i++) { nameStream->seek(curNamesPos + stringOffsets[i]); - + Common::String name; for (char c = nameStream->readByte(); c; c = nameStream->readByte()) name += c; varNames.push_back(name); } delete nameStream; - + // Load in External Command Names nameStream = _vm->getRawData(ID_NAME, ExternalCommandNames); Common::StringList xNames; - + namesCount = nameStream->readUint16BE(); stringOffsets = new uint16[namesCount]; for (uint16 i = 0; i < namesCount; i++) stringOffsets[i] = nameStream->readUint16BE(); nameStream->seek(namesCount * 2, SEEK_CUR); curNamesPos = nameStream->pos(); - + for (uint32 i = 0; i < namesCount; i++) { nameStream->seek(curNamesPos + stringOffsets[i]); - + Common::String name; for (char c = nameStream->readByte(); c; c = nameStream->readByte()) name += c; xNames.push_back(name); } delete nameStream; - + // Get CARD/HSPT data and dump their scripts if (!scumm_stricmp(argv[2], "CARD")) { printf ("\n\nDumping scripts for %s\'s card %d!\n", argv[1], (uint16)atoi(argv[3])); @@ -541,11 +541,11 @@ bool RivenConsole::Cmd_DumpScript(int argc, const char **argv) { } else if (!scumm_stricmp(argv[2], "HSPT")) { printf ("\n\nDumping scripts for %s\'s card %d hotspots!\n", argv[1], (uint16)atoi(argv[3])); printf ("===========================================\n\n"); - + Common::SeekableReadStream *hsptStream = _vm->getRawData(MKID_BE('HSPT'), (uint16)atoi(argv[3])); - + uint16 hotspotCount = hsptStream->readUint16BE(); - + for (uint16 i = 0; i < hotspotCount; i++) { printf ("Hotspot %d:\n", i); hsptStream->seek(22, SEEK_CUR); // Skip non-script related stuff @@ -553,18 +553,18 @@ bool RivenConsole::Cmd_DumpScript(int argc, const char **argv) { for (uint32 j = 0; j < scriptList.size(); j++) scriptList[j]->dumpScript(varNames, xNames, 1); } - + delete hsptStream; } else { DebugPrintf("%s doesn't have any scripts!\n", argv[2]); } - + printf("\n\n"); - + _vm->changeToStack(oldStack); - + DebugPrintf("Script dump complete.\n"); - + return true; } @@ -576,7 +576,7 @@ bool RivenConsole::Cmd_ListZipCards(int argc, const char **argv) { for (uint32 i = 0; i < _vm->_zipModeData.size(); i++) DebugPrintf("ID = %d, Name = %s\n", _vm->_zipModeData[i].id, _vm->_zipModeData[i].name.c_str()); } - + return true; } diff --git a/engines/mohawk/console.h b/engines/mohawk/console.h index bd699bc8b7..e79f151894 100644 --- a/engines/mohawk/console.h +++ b/engines/mohawk/console.h @@ -38,14 +38,14 @@ class MystConsole : public GUI::Debugger { public: MystConsole(MohawkEngine_Myst *vm); virtual ~MystConsole(void); - + protected: virtual void preEnter(); virtual void postEnter(); - + private: MohawkEngine_Myst *_vm; - + bool Cmd_ChangeCard(int argc, const char **argv); bool Cmd_CurCard(int argc, const char **argv); bool Cmd_Var(int argc, const char **argv); @@ -71,7 +71,7 @@ protected: private: MohawkEngine_Riven *_vm; - + bool Cmd_ChangeCard(int argc, const char **argv); bool Cmd_CurCard(int argc, const char **argv); bool Cmd_Var(int argc, const char **argv); diff --git a/engines/mohawk/detection.cpp b/engines/mohawk/detection.cpp index b00b312892..65353b61e7 100644 --- a/engines/mohawk/detection.cpp +++ b/engines/mohawk/detection.cpp @@ -81,14 +81,14 @@ bool MohawkEngine::hasFeature(EngineFeature f) const { } bool MohawkEngine_Myst::hasFeature(EngineFeature f) const { - return + return MohawkEngine::hasFeature(f) || (f == kSupportsLoadingDuringRuntime) || (f == kSupportsSavingDuringRuntime); } bool MohawkEngine_Riven::hasFeature(EngineFeature f) const { - return + return MohawkEngine::hasFeature(f) || (f == kSupportsLoadingDuringRuntime) || (f == kSupportsSavingDuringRuntime); @@ -142,7 +142,7 @@ static const MohawkGameDescription gameDescriptions[] = { 0, 0, }, - + // Myst Demo // English Windows 3.11 // From CD-ROM Today July, 1994 @@ -178,7 +178,7 @@ static const MohawkGameDescription gameDescriptions[] = { 0, 0, }, - + // Myst // German Windows 3.11 // From LordHoto @@ -196,7 +196,7 @@ static const MohawkGameDescription gameDescriptions[] = { 0, 0, }, - + // Myst // Spanish Windows ? // From jvprat @@ -214,7 +214,7 @@ static const MohawkGameDescription gameDescriptions[] = { 0, 0, }, - + // Myst // Japanese Windows 3.11 // From clone2727 @@ -268,7 +268,7 @@ static const MohawkGameDescription gameDescriptions[] = { 0, 0, }, - + // Making of Myst // Japanese Windows 3.11 // From clone2727 @@ -304,7 +304,7 @@ static const MohawkGameDescription gameDescriptions[] = { GF_ME, 0, }, - + // Myst Masterpiece Edition // English Windows // From clone2727 @@ -322,7 +322,7 @@ static const MohawkGameDescription gameDescriptions[] = { GF_ME, 0, }, - + // Myst Masterpiece Edition // German Windows // From DrMcCoy (Included in "Myst: Die Trilogie") @@ -358,7 +358,7 @@ static const MohawkGameDescription gameDescriptions[] = { 0, 0, }, - + // Riven: The Sequel to Myst // Version 1.03 (5CD) // From ST @@ -397,7 +397,7 @@ static const MohawkGameDescription gameDescriptions[] = { // Riven: The Sequel to Myst // Version 1.? (DVD, From "Myst 10th Anniversary Edition") - // From Clone2727 + // From Clone2727 { { "riven", @@ -412,7 +412,7 @@ static const MohawkGameDescription gameDescriptions[] = { GF_DVD, 0, }, - + // Riven: The Sequel to Myst // Version 1.0 (DVD, From "Myst: Die Trilogie") // From DrMcCoy @@ -448,7 +448,7 @@ static const MohawkGameDescription gameDescriptions[] = { GF_DEMO, 0, }, - + #ifdef DETECT_BRODERBUND_TITLES { { @@ -464,7 +464,7 @@ static const MohawkGameDescription gameDescriptions[] = { GF_HASMIDI, 0 }, - + { { "csworld", @@ -479,7 +479,7 @@ static const MohawkGameDescription gameDescriptions[] = { 0, 0 }, - + { { "csworld", @@ -494,7 +494,7 @@ static const MohawkGameDescription gameDescriptions[] = { 0, 0 }, - + { { "csamtrak", @@ -509,7 +509,7 @@ static const MohawkGameDescription gameDescriptions[] = { 0, 0 }, - + { { "maggiess", @@ -524,7 +524,7 @@ static const MohawkGameDescription gameDescriptions[] = { 0, 0 }, - + { { "jamesmath", @@ -539,7 +539,7 @@ static const MohawkGameDescription gameDescriptions[] = { GF_HASMIDI, 0 }, - + // This is in the NEWDATA folder, so I assume it's a newer version ;) { { @@ -570,7 +570,7 @@ static const MohawkGameDescription gameDescriptions[] = { GF_HASMIDI, 0 }, - + { { "greeneggs", @@ -585,7 +585,7 @@ static const MohawkGameDescription gameDescriptions[] = { 0, 0 }, - + // 32-bit version of the previous entry { { @@ -601,7 +601,7 @@ static const MohawkGameDescription gameDescriptions[] = { 0, 0 }, - + { { "1stdegree", @@ -664,7 +664,7 @@ static const MohawkGameDescription gameDescriptions[] = { GF_DEMO, 0 }, - + { { "tortoise", @@ -679,7 +679,7 @@ static const MohawkGameDescription gameDescriptions[] = { GF_DEMO, 0 }, - + { { "arthur", @@ -694,7 +694,7 @@ static const MohawkGameDescription gameDescriptions[] = { 0, 0 }, - + { { "arthur", @@ -709,7 +709,7 @@ static const MohawkGameDescription gameDescriptions[] = { GF_DEMO, 0 }, - + { { "arthur", @@ -724,7 +724,7 @@ static const MohawkGameDescription gameDescriptions[] = { GF_DEMO, 0 }, - + { { "grandma", @@ -739,7 +739,7 @@ static const MohawkGameDescription gameDescriptions[] = { GF_DEMO, 0 }, - + { { "grandma", @@ -754,7 +754,7 @@ static const MohawkGameDescription gameDescriptions[] = { GF_DEMO, 0 }, - + { { "grandma", @@ -769,7 +769,7 @@ static const MohawkGameDescription gameDescriptions[] = { GF_DEMO, 0 }, - + { { "ruff", @@ -784,7 +784,7 @@ static const MohawkGameDescription gameDescriptions[] = { GF_DEMO, 0 }, - + { { "ruff", @@ -799,7 +799,7 @@ static const MohawkGameDescription gameDescriptions[] = { GF_DEMO, 0 }, - + { { "newkid", @@ -814,7 +814,7 @@ static const MohawkGameDescription gameDescriptions[] = { GF_DEMO, 0 }, - + { { "newkid", @@ -829,7 +829,7 @@ static const MohawkGameDescription gameDescriptions[] = { GF_DEMO, 0 }, - + { { "arthurrace", @@ -844,7 +844,7 @@ static const MohawkGameDescription gameDescriptions[] = { 0, 0 }, - + // 32-bit version of the previous entry { { @@ -998,7 +998,7 @@ public: }; bool MohawkMetaEngine::hasFeature(MetaEngineFeature f) const { - return + return (f == kSupportsListSaves) || (f == kSupportsLoadingDuringStartup) || (f == kSupportsDeleteSave); @@ -1011,16 +1011,16 @@ SaveStateList MohawkMetaEngine::listSaves(const char *target) const { // Loading games is only supported in Myst/Riven currently. if (strstr(target, "myst")) { filenames = g_system->getSavefileManager()->listSavefiles("*.mys"); - + for (uint32 i = 0; i < filenames.size(); i++) saveList.push_back(SaveStateDescriptor(i, filenames[i])); } else if (strstr(target, "riven")) { filenames = g_system->getSavefileManager()->listSavefiles("*.rvn"); - + for (uint32 i = 0; i < filenames.size(); i++) saveList.push_back(SaveStateDescriptor(i, filenames[i])); - } - + } + return saveList; } @@ -1037,7 +1037,7 @@ void MohawkMetaEngine::removeSaveState(const char *target, int slot) const { bool MohawkMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { const Mohawk::MohawkGameDescription *gd = (const Mohawk::MohawkGameDescription *)desc; - + if (gd) { switch (gd->gameType) { case Mohawk::GType_MYST: diff --git a/engines/mohawk/dialogs.cpp b/engines/mohawk/dialogs.cpp index f63fb44c45..a1264f5f2e 100644 --- a/engines/mohawk/dialogs.cpp +++ b/engines/mohawk/dialogs.cpp @@ -36,7 +36,7 @@ namespace Mohawk { // This used to have GUI::Dialog("MohawkDummyDialog"), but that doesn't work with the gui branch merge :P (Sorry, Tanoku!) InfoDialog::InfoDialog(MohawkEngine *vm, Common::String message) : _vm(vm), GUI::Dialog(0, 0, 1, 1), _message(message) { _backgroundType = GUI::ThemeEngine::kDialogBackgroundSpecial; - + _text = new GUI::StaticTextWidget(this, 4, 4, 10, 10, _message, Graphics::kTextAlignCenter); } @@ -48,15 +48,15 @@ void InfoDialog::setInfoText(Common::String message) { void InfoDialog::reflowLayout() { const int screenW = g_system->getOverlayWidth(); const int screenH = g_system->getOverlayHeight(); - + int width = g_gui.getStringWidth(_message) + 16; int height = g_gui.getFontHeight() + 8; - + _w = width; _h = height; _x = (screenW - width) / 2; _y = (screenH - height) / 2; - + _text->setSize(_w - 8, _h); } @@ -77,7 +77,7 @@ enum { kWaterCmd = 'WATR' }; -MystOptionsDialog::MystOptionsDialog(MohawkEngine_Myst* vm) : GUI::OptionsDialog("", 120, 120, 360, 200), _vm(vm) { +MystOptionsDialog::MystOptionsDialog(MohawkEngine_Myst* vm) : GUI::OptionsDialog("", 120, 120, 360, 200), _vm(vm) { _zipModeCheckbox = new GUI::CheckboxWidget(this, 15, 10, 300, 15, "Zip Mode Activated", kZipCmd, 'Z'); _transistionsCheckbox = new GUI::CheckboxWidget(this, 15, 30, 300, 15, "Transistions Enabled", kTransCmd, 'T'); @@ -111,7 +111,7 @@ void MystOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, ui } } -RivenOptionsDialog::RivenOptionsDialog(MohawkEngine_Riven* vm) : GUI::OptionsDialog("", 120, 120, 360, 200), _vm(vm) { +RivenOptionsDialog::RivenOptionsDialog(MohawkEngine_Riven* vm) : GUI::OptionsDialog("", 120, 120, 360, 200), _vm(vm) { _zipModeCheckbox = new GUI::CheckboxWidget(this, 15, 10, 300, 15, "Zip Mode Activated", kZipCmd, 'Z'); _waterEffectCheckbox = new GUI::CheckboxWidget(this, 15, 30, 300, 15, "Water Effect Enabled", kWaterCmd, 'W'); diff --git a/engines/mohawk/dialogs.h b/engines/mohawk/dialogs.h index 5b46158eac..ab8be647aa 100644 --- a/engines/mohawk/dialogs.h +++ b/engines/mohawk/dialogs.h @@ -49,19 +49,19 @@ protected: public: InfoDialog(MohawkEngine *vm, Common::String message); - + void setInfoText(Common::String message); - + virtual void handleMouseDown(int x, int y, int button, int clickCount) { setResult(0); close(); } - + virtual void handleKeyDown(Common::KeyState state) { setResult(state.ascii); close(); } - + virtual void reflowLayout(); }; @@ -76,7 +76,7 @@ public: MystOptionsDialog(MohawkEngine_Myst *vm); ~MystOptionsDialog(); void open(); - + virtual void handleCommand(GUI::CommandSender*, uint32, uint32); private: MohawkEngine_Myst *_vm; @@ -89,7 +89,7 @@ public: RivenOptionsDialog(MohawkEngine_Riven *vm); ~RivenOptionsDialog(); void open(); - + virtual void handleCommand(GUI::CommandSender*, uint32, uint32); private: MohawkEngine_Riven *_vm; diff --git a/engines/mohawk/graphics.cpp b/engines/mohawk/graphics.cpp index 21dda00018..fc29c7de83 100644 --- a/engines/mohawk/graphics.cpp +++ b/engines/mohawk/graphics.cpp @@ -39,7 +39,7 @@ Graphics::Surface *ImageData::getSurface() { Graphics::PixelFormat pixelFormat = g_system->getScreenFormat(); Graphics::Surface *surface = new Graphics::Surface(); surface->create(_surface->w, _surface->h, pixelFormat.bytesPerPixel); - + if (_surface->bytesPerPixel == 1) { assert(_palette); @@ -57,32 +57,32 @@ Graphics::Surface *ImageData::getSurface() { } } else memcpy(surface->pixels, _surface->pixels, _surface->w * _surface->h * _surface->bytesPerPixel); - + return surface; } MystGraphics::MystGraphics(MohawkEngine_Myst* vm) : _vm(vm) { _bmpDecoder = new MystBitmap(); - + // The original version of Myst could run in 8bpp color too. // However, it dithered videos to 8bpp and they looked considerably // worse (than they already did :P). So we're not even going to // support 8bpp mode in Myst (Myst ME required >8bpp anyway). initGraphics(544, 333, true, NULL); // What an odd screen size! - + _pixelFormat = _vm->_system->getScreenFormat(); - + if (_pixelFormat.bytesPerPixel == 1) error("Myst requires greater than 256 colors to run"); - - if (_vm->getFeatures() & GF_ME) { + + if (_vm->getFeatures() & GF_ME) { _jpegDecoder = new MystJPEG(); _pictDecoder = new MystPICT(_jpegDecoder); } else { _jpegDecoder = NULL; _pictDecoder = NULL; } - + _pictureFile.entries = NULL; } @@ -107,20 +107,20 @@ static const char* picFileNames[] = { void MystGraphics::loadExternalPictureFile(uint16 stack) { if (_vm->getPlatform() != Common::kPlatformMacintosh) return; - + if (_pictureFile.picFile.isOpen()) _pictureFile.picFile.close(); delete[] _pictureFile.entries; - + if (!scumm_stricmp(picFileNames[stack], "")) return; - + if (!_pictureFile.picFile.open(picFileNames[stack])) error ("Could not open external picture file \'%s\'", picFileNames[stack]); - + _pictureFile.pictureCount = _pictureFile.picFile.readUint32BE(); _pictureFile.entries = new PictureFile::PictureEntry[_pictureFile.pictureCount]; - + for (uint32 i = 0; i < _pictureFile.pictureCount; i++) { _pictureFile.entries[i].offset = _pictureFile.picFile.readUint32BE(); _pictureFile.entries[i].size = _pictureFile.picFile.readUint32BE(); @@ -138,7 +138,7 @@ void MystGraphics::copyImageSectionToScreen(uint16 image, Common::Rect src, Comm dest.right = CLIP<int>(dest.right, 0, _vm->_system->getWidth()); dest.bottom = CLIP<int>(dest.bottom, 0, _vm->_system->getHeight()); - + Graphics::Surface *surface = NULL; @@ -190,15 +190,15 @@ void MystGraphics::copyImageSectionToScreen(uint16 image, Common::Rect src, Comm delete imageData; } } - + debug(3, "Image Blit:"); - debug(3, "src.x: %d", src.left); + debug(3, "src.x: %d", src.left); debug(3, "src.y: %d", src.top); debug(3, "dest.x: %d", dest.left); debug(3, "dest.y: %d", dest.top); debug(3, "width: %d", src.width()); debug(3, "height: %d", src.height()); - + if (surface) { uint16 width = MIN<int>(surface->w, dest.width()); uint16 height = MIN<int>(surface->h, dest.height()); @@ -206,7 +206,7 @@ void MystGraphics::copyImageSectionToScreen(uint16 image, Common::Rect src, Comm surface->free(); delete surface; } - + // FIXME: Remove this and update only at certain points _vm->_system->updateScreen(); } @@ -254,7 +254,7 @@ void MystGraphics::drawRect(Common::Rect rect, bool active) { screen->frameRect(rect, _pixelFormat.RGBToColor(0, 255, 0)); else screen->frameRect(rect, _pixelFormat.RGBToColor(255, 0, 0)); - + _vm->_system->unlockScreen(); } @@ -264,15 +264,15 @@ RivenGraphics::RivenGraphics(MohawkEngine_Riven* vm) : _vm(vm) { // Give me the best you've got! initGraphics(608, 436, true, NULL); _pixelFormat = _vm->_system->getScreenFormat(); - + if (_pixelFormat.bytesPerPixel == 1) error("Riven requires greater than 256 colors to run"); - + // The actual game graphics only take up the first 392 rows. The inventory // occupies the rest of the screen and we don't use the buffer to hold that. _mainScreen = new Graphics::Surface(); _mainScreen->create(608, 392, _pixelFormat.bytesPerPixel); - + _updatesEnabled = true; _scheduledTransition = -1; // no transition _dirtyScreen = false; @@ -290,17 +290,17 @@ void RivenGraphics::copyImageToScreen(uint16 image, uint32 left, uint32 top, uin ImageData *imageData = _bitmapDecoder->decodeImage(_vm->getRawData(ID_TBMP, image)); Graphics::Surface *surface = imageData->getSurface(); delete imageData; - + // Clip the width to fit on the screen. Fixes some images. if (left + surface->w > 608) surface->w = 608 - left; - + for (uint16 i = 0; i < surface->h; i++) memcpy(_mainScreen->getBasePtr(left, i + top), surface->getBasePtr(0, i), surface->w * surface->bytesPerPixel); - + surface->free(); delete surface; - + _dirtyScreen = true; } @@ -308,7 +308,7 @@ void RivenGraphics::drawPLST(uint16 x) { Common::SeekableReadStream* plst = _vm->getRawData(ID_PLST, _vm->getCurCard()); uint16 index, id, left, top, right, bottom; uint16 recordCount = plst->readUint16BE(); - + for (uint16 i = 0; i < recordCount; i++) { index = plst->readUint16BE(); id = plst->readUint16BE(); @@ -336,16 +336,16 @@ void RivenGraphics::drawPLST(uint16 x) { void RivenGraphics::updateScreen() { if (_updatesEnabled) { _vm->runUpdateScreenScript(); - + if (_dirtyScreen) { _activatedPLSTs.clear(); - + // Copy to screen if there's no transition. Otherwise transition. ;) if (_scheduledTransition < 0) _vm->_system->copyRectToScreen((byte *)_mainScreen->pixels, _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h); else runScheduledTransition(); - + // Finally, update the screen. _vm->_system->updateScreen(); _dirtyScreen = false; @@ -358,7 +358,7 @@ void RivenGraphics::scheduleWaterEffect(uint16 sfxeID) { if (sfxeStream->readUint16BE() != 'SL') error ("Unknown sfxe tag"); - + // Read in header info SFXERecord sfxeRecord; sfxeRecord.frameCount = sfxeStream->readUint16BE(); @@ -369,22 +369,22 @@ void RivenGraphics::scheduleWaterEffect(uint16 sfxeID) { sfxeRecord.rect.bottom = sfxeStream->readUint16BE(); sfxeRecord.speed = sfxeStream->readUint16BE(); // Skip the rest of the fields... - + // Read in offsets sfxeStream->seek(offsetTablePosition); uint32 *frameOffsets = new uint32[sfxeRecord.frameCount]; for (uint16 i = 0; i < sfxeRecord.frameCount; i++) frameOffsets[i] = sfxeStream->readUint32BE(); sfxeStream->seek(frameOffsets[0]); - + // Read in the scripts - for (uint16 i = 0; i < sfxeRecord.frameCount; i++) + for (uint16 i = 0; i < sfxeRecord.frameCount; i++) sfxeRecord.frameScripts.push_back(sfxeStream->readStream((i == sfxeRecord.frameCount - 1) ? sfxeStream->size() - frameOffsets[i] : frameOffsets[i + 1] - frameOffsets[i])); - + // Set it to the first frame sfxeRecord.curFrame = 0; sfxeRecord.lastFrameTime = 0; - + delete[] frameOffsets; delete sfxeStream; _waterEffects.push_back(sfxeRecord); @@ -400,18 +400,18 @@ bool RivenGraphics::runScheduledWaterEffects() { return false; Graphics::Surface *screen = NULL; - + for (uint16 i = 0; i < _waterEffects.size(); i++) { if (_vm->_system->getMillis() > _waterEffects[i].lastFrameTime + 1000 / _waterEffects[i].speed) { // Lock the screen! if (!screen) screen = _vm->_system->lockScreen(); - + // Make sure the script is at the starting point Common::SeekableReadStream *script = _waterEffects[i].frameScripts[_waterEffects[i].curFrame]; if (script->pos() != 0) script->seek(0); - + // Run script uint16 curRow = 0; for (uint16 op = script->readUint16BE(); op != 4; op = script->readUint16BE()) { @@ -427,23 +427,23 @@ bool RivenGraphics::runScheduledWaterEffects() { error ("Unknown SFXE opcode %d", op); } } - + // Increment frame _waterEffects[i].curFrame++; if (_waterEffects[i].curFrame == _waterEffects[i].frameCount) _waterEffects[i].curFrame = 0; - + // Set the new time _waterEffects[i].lastFrameTime = _vm->_system->getMillis(); } } - + // Unlock the screen if it has been locked and return true to update the screen if (screen) { _vm->_system->unlockScreen(); return true; } - + return false; } @@ -455,9 +455,9 @@ void RivenGraphics::scheduleTransition(uint16 id, Common::Rect rect) { void RivenGraphics::runScheduledTransition() { if (_scheduledTransition < 0) // No transition is scheduled return; - + // TODO: There's a lot to be done here... - + // Note: Transitions 0-11 are actual transitions, but none are used in-game. // There's no point in implementing them if they're not used. These extra // transitions were found by hacking scripts. @@ -485,7 +485,7 @@ void RivenGraphics::runScheduledTransition() { else error ("Found unknown transition %d", _scheduledTransition); } - + // For now, just copy the image to screen without doing any transition. _vm->_system->copyRectToScreen((byte *)_mainScreen->pixels, _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h); _vm->_system->updateScreen(); @@ -583,34 +583,34 @@ void RivenGraphics::changeCursor(uint16 num) { default: error ("Cursor %d does not exist!", num); } - + if (num != 9000) // Show Cursor CursorMan.showMouse(true); - + // Should help in cases where we need to hide the cursor immediately. _vm->_system->updateScreen(); } - + void RivenGraphics::showInventory() { // Don't redraw the inventory if (_inventoryDrawn) return; - + // Clear the inventory area clearInventoryArea(); - + // The demo doesn't have the inventory system and we don't want // to show the inventory on setup screens or in other journals. if (_vm->getFeatures() & GF_DEMO || _vm->getCurStack() == aspit) return; - + // There are three books and three vars. However, there's only // a possible two combinations. Either you have only Atrus' // journal or you have all three books. // bool hasAtrusBook = *_vm->matchVarToString("aatrusbook") != 0; bool hasCathBook = *_vm->matchVarToString("acathbook") != 0; // bool hasTrapBook = *_vm->matchVarToString("atrapbook") != 0; - + if (!hasCathBook) { drawInventoryImage(101, atrusJournalRectSolo); } else { @@ -618,19 +618,19 @@ void RivenGraphics::showInventory() { drawInventoryImage(102, cathJournalRect); drawInventoryImage(100, trapBookRect); } - + _vm->_system->updateScreen(); _inventoryDrawn = true; } - + void RivenGraphics::hideInventory() { // Don't hide the inventory twice if (!_inventoryDrawn) return; - + // Clear the area clearInventoryArea(); - + _inventoryDrawn = false; } @@ -643,7 +643,7 @@ void RivenGraphics::clearInventoryArea() { // Fill the inventory area with black screen->fillRect(inventoryRect, _pixelFormat.RGBToColor(0, 0, 0)); - + _vm->_system->unlockScreen(); } @@ -661,12 +661,12 @@ void RivenGraphics::drawInventoryImage(uint16 id, Common::Rect rect) { void RivenGraphics::drawRect(Common::Rect rect, bool active) { // Useful with debugging. Shows where hotspots are on the screen and whether or not they're active. Graphics::Surface *screen = _vm->_system->lockScreen(); - + if (active) screen->frameRect(rect, _pixelFormat.RGBToColor(0, 255, 0)); else screen->frameRect(rect, _pixelFormat.RGBToColor(255, 0, 0)); - + _vm->_system->unlockScreen(); } @@ -692,13 +692,13 @@ void LBGraphics::copyImageToScreen(uint16 image, uint16 left, uint16 right) { Graphics::Surface *surface = imageData->getSurface(); imageData->_palette = NULL; // Unset the palette so it doesn't get deleted delete imageData; - + uint16 width = MIN<int>(surface->w, 640); uint16 height = MIN<int>(surface->h, 480); _vm->_system->copyRectToScreen((byte *)surface->pixels, surface->pitch, left, right, width, height); surface->free(); delete surface; - + // FIXME: Remove this and update only at certain points _vm->_system->updateScreen(); } @@ -711,14 +711,14 @@ void LBGraphics::setPalette(uint16 id) { if (_vm->getGameType() == GType_LIVINGBOOKSV1) { Common::SeekableSubReadStreamEndian *ctblStream = _vm->wrapStreamEndian(ID_CTBL, id); uint16 colorCount = ctblStream->readUint16(); - + for (uint16 i = 0; i < colorCount; i++) { _palette[i * 4] = ctblStream->readByte(); _palette[i * 4 + 1] = ctblStream->readByte(); _palette[i * 4 + 2] = ctblStream->readByte(); _palette[i * 4 + 3] = ctblStream->readByte(); } - + delete ctblStream; } else { Common::SeekableReadStream *tpalStream = _vm->getRawData(ID_TPAL, id); @@ -731,7 +731,7 @@ void LBGraphics::setPalette(uint16 id) { _palette[i * 4 + 2] = tpalStream->readByte(); _palette[i * 4 + 3] = tpalStream->readByte(); } - + delete tpalStream; } } diff --git a/engines/mohawk/graphics.h b/engines/mohawk/graphics.h index be3a951148..16d515ac08 100644 --- a/engines/mohawk/graphics.h +++ b/engines/mohawk/graphics.h @@ -91,14 +91,14 @@ class MystGraphics { public: MystGraphics(MohawkEngine_Myst*); ~MystGraphics(); - + void loadExternalPictureFile(uint16 stack); void copyImageSectionToScreen(uint16 image, Common::Rect src, Common::Rect dest); void copyImageToScreen(uint16 image, Common::Rect dest); void showCursor(void); void hideCursor(void); void changeCursor(uint16); - + void drawRect(Common::Rect rect, bool active); private: MohawkEngine_Myst *_vm; @@ -106,7 +106,7 @@ private: MystPICT *_pictDecoder; MystJPEG *_jpegDecoder; Graphics::PixelFormat _pixelFormat; - + struct PictureFile { uint32 pictureCount; struct PictureEntry { @@ -128,7 +128,7 @@ struct SFXERecord { Common::Rect rect; uint16 speed; Common::Array<Common::SeekableReadStream*> frameScripts; - + // Cur frame uint16 curFrame; uint32 lastFrameTime; @@ -138,7 +138,7 @@ class RivenGraphics { public: RivenGraphics(MohawkEngine_Riven *vm); ~RivenGraphics(); - + void copyImageToScreen(uint16, uint32, uint32, uint32, uint32); void updateScreen(); bool _updatesEnabled; @@ -151,11 +151,11 @@ public: void scheduleWaterEffect(uint16); void clearWaterEffects(); bool runScheduledWaterEffects(); - + // Transitions void scheduleTransition(uint16 id, Common::Rect rect = Common::Rect(0, 0, 608, 392)); void runScheduledTransition(); - + // Inventory void showInventory(); void hideInventory(); @@ -166,16 +166,16 @@ private: // Water Effects Common::Array<SFXERecord> _waterEffects; - + // Transitions int16 _scheduledTransition; Common::Rect _transitionRect; - + // Inventory void clearInventoryArea(); void drawInventoryImage(uint16 id, Common::Rect rect); bool _inventoryDrawn; - + // Screen Related Graphics::Surface *_mainScreen; bool _dirtyScreen; diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp index ccb9de1fa1..f0648fa114 100644 --- a/engines/mohawk/livingbooks.cpp +++ b/engines/mohawk/livingbooks.cpp @@ -66,7 +66,7 @@ Common::Error MohawkEngine_LivingBooks::run() { loadIntro(); debug(1, "Stack Version: %d", getResourceVersion()); - + _gfx->setPalette(1000); loadSHP(1000); loadANI(1000); @@ -129,7 +129,7 @@ void MohawkEngine_LivingBooks::loadBookInfo(Common::String filename) { _screenWidth = getIntFromConfig("BookInfo", "xRes"); _screenHeight = getIntFromConfig("BookInfo", "yRes"); // nColors is here too, but it's always 256 anyway... - + // The later Living Books games add some more options: // - fNeedPalette (always true?) // - fUse254ColorPalette (always true?) @@ -154,10 +154,10 @@ void MohawkEngine_LivingBooks::loadIntro() { } filename = getFileNameFromConfig("Intro", "Page2"); - + if (filename.empty()) filename = getFileNameFromConfig("Intro", "Page2.r"); - + if (!filename.empty() && Common::File::exists(filename)) { MohawkArchive *coverArchive = createMohawkArchive(); coverArchive->open(filename); diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h index 7cf73d4a02..6bd0729bbf 100644 --- a/engines/mohawk/livingbooks.h +++ b/engines/mohawk/livingbooks.h @@ -78,12 +78,12 @@ private: Common::String removeQuotesFromString(Common::String string); Common::String convertMacFileName(Common::String string); Common::String convertWinFileName(Common::String string); - + // Configuration File Functions Common::String getStringFromConfig(Common::String section, Common::String key); int getIntFromConfig(Common::String section, Common::String key); Common::String getFileNameFromConfig(Common::String section, Common::String key); - + // Platform/Version functions bool isBigEndian() const { return getGameType() == GType_LIVINGBOOKSV3 || getPlatform() == Common::kPlatformMacintosh; } MohawkArchive *createMohawkArchive() const; diff --git a/engines/mohawk/mohawk.cpp b/engines/mohawk/mohawk.cpp index 08b7b82e02..a4eba550d9 100644 --- a/engines/mohawk/mohawk.cpp +++ b/engines/mohawk/mohawk.cpp @@ -92,12 +92,12 @@ Common::SeekableReadStream *MohawkEngine::getRawData(uint32 tag, uint16 id) { error ("Could not find a \'%s\' resource with ID %04x", tag2str(tag), id); return 0; } - + bool MohawkEngine::hasResource(uint32 tag, uint16 id) { for (uint32 i = 0; i < _mhk.size(); i++) if (_mhk[i]->hasResource(tag, id)) return true; - + return false; } @@ -105,7 +105,7 @@ uint32 MohawkEngine::getResourceOffset(uint32 tag, uint16 id) { for (uint32 i = 0; i < _mhk.size(); i++) if (_mhk[i]->hasResource(tag, id)) return _mhk[i]->getOffset(tag, id); - + error ("Could not find a \'%s\' resource with ID %04x", tag2str(tag), id); return 0; } diff --git a/engines/mohawk/mohawk.h b/engines/mohawk/mohawk.h index 5d4588f09a..280995d070 100644 --- a/engines/mohawk/mohawk.h +++ b/engines/mohawk/mohawk.h @@ -80,7 +80,7 @@ public: Common::Platform getPlatform() const; uint8 getGameType() const; Common::Language getLanguage() const; - + bool hasFeature(EngineFeature f) const; Sound *_sound; diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp index 8c610d9574..647e6d4c42 100644 --- a/engines/mohawk/myst.cpp +++ b/engines/mohawk/myst.cpp @@ -59,10 +59,10 @@ MohawkEngine_Myst::MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription _curCard = 0; _needsUpdate = false; _curResource = -1; - + _cursorHintCount = 0; _cursorHints = NULL; - + _view.conditionalImageCount = 0; _view.conditionalImages = NULL; _view.soundList = NULL; @@ -123,7 +123,7 @@ Common::String MohawkEngine_Myst::wrapMovieFilename(Common::String movieName, ui return Common::String("CD Data/m/") + movieName + ".mov"; const char* prefix; - + switch (stack) { case kIntroStack: prefix = "intro/"; @@ -267,7 +267,7 @@ Common::Error MohawkEngine_Myst::run() { debug(2, "Sending mouse up event to resource %d\n", _curResource); _resources[_curResource]->handleMouseDown(); } - break; + break; case Common::EVENT_KEYDOWN: switch (event.kbd.keycode) { case Common::KEYCODE_d: @@ -326,7 +326,7 @@ void MohawkEngine_Myst::changeToStack(uint16 stack) { if (getPlatform() == Common::kPlatformMacintosh) _gfx->loadExternalPictureFile(_curStack); - + _runExitScript = false; } @@ -334,7 +334,7 @@ void MohawkEngine_Myst::changeToCard(uint16 card) { debug(2, "changeToCard(%d)", card); _scriptParser->disableInitOpcodes(); - + _video->stopVideos(); // Run exit script from last card (if present) @@ -342,7 +342,7 @@ void MohawkEngine_Myst::changeToCard(uint16 card) { runExitScript(); _runExitScript = true; - + unloadCard(); _curCard = card; @@ -379,11 +379,11 @@ void MohawkEngine_Myst::changeToCard(uint16 card) { soundAction = _view.sound; soundActionVolume = _view.soundVolume; } - - // NOTE: Mixer only has 8-bit channel volume granularity, + + // NOTE: Mixer only has 8-bit channel volume granularity, // Myst uses 16-bit? Or is part of this balance? soundActionVolume = (byte)(soundActionVolume / 255); - + if (soundAction == kMystSoundActionContinue) debug(2, "Continuing with current sound"); else if (soundAction == kMystSoundActionChangeVolume) { @@ -409,7 +409,7 @@ void MohawkEngine_Myst::changeToCard(uint16 card) { // Run the entrance script (if present) runInitScript(); - + // Make sure we have the right cursor showing _curResource = -1; checkCurrentResource(); @@ -697,7 +697,7 @@ void MohawkEngine_Myst::runExitScript() { delete exitStream; _scriptParser->runScript(scriptCount, scripts); - + for (uint16 i = 0; i < scriptCount; i++) delete[] scripts[i].values; delete[] scripts; @@ -707,7 +707,7 @@ void MohawkEngine_Myst::loadHelp(uint16 id) { // The original version did not have the help system if (!(getFeatures() & GF_ME)) return; - + // TODO: Help File contains 5 cards i.e. VIEW, RLST, etc. // in addition to HELP resources. // These are Ids 9930 to 9934 @@ -722,14 +722,14 @@ void MohawkEngine_Myst::loadHelp(uint16 id) { uint16 count = helpStream->readUint16LE(); uint16 *u0 = new uint16[count]; Common::String helpText; - + debugC(kDebugHelp, "\tcount: %d", count); - + for (uint16 i = 0; i < count; i++) { u0[i] = helpStream->readUint16LE(); debugC(kDebugHelp, "\tu0[%d]: %d", i, u0[i]); } - + // TODO: Previous values i.e. u0[0] to u0[count - 2] // appear to be resource ids in the help.dat file.. if (u0[count - 1] != count) @@ -896,7 +896,7 @@ void MohawkEngine_Myst::loadResources() { MystResource::MystResource(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystResource *parent) { _vm = vm; _parent = parent; - + if (parent == NULL) { _flags = rlstStream->readUint16LE(); _rect.left = rlstStream->readSint16LE(); @@ -925,7 +925,7 @@ MystResource::MystResource(MohawkEngine_Myst *vm, Common::SeekableReadStream *rl debugC(kDebugResource, "\tright: %d", _rect.right); debugC(kDebugResource, "\tbottom: %d", _rect.bottom); debugC(kDebugResource, "\tdest: %d", _dest); - + // Default Enable based on flags... if (_vm->_zipMode) _enabled = (_flags & kMystZipModeEnableFlag) != 0 || @@ -992,7 +992,7 @@ Common::String MystResourceType6::convertMystVideoName(Common::String name) { MystResourceType6::MystResourceType6(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystResource *parent) : MystResourceType5(vm, rlstStream, parent) { char c = 0; - + do { c = rlstStream->readByte(); _videoFile += c; @@ -1265,7 +1265,7 @@ void MystResourceType8::drawDataToScreen() { if (_subImages[subImageId].rect.left == -1) _vm->_gfx->copyImageSectionToScreen(imageToDraw, _rect, _rect); //vm->_gfx->copyImageToScreen(imageToDraw, Common::Rect(0, 0, 544, 333)); - // TODO: Think this is the case when the image is full screen.. need to modify graphics to add functions for returning size of image. + // TODO: Think this is the case when the image is full screen.. need to modify graphics to add functions for returning size of image. // This is not right either... //else if (_rect.width() != _subImages[draw_subimage_id].rect.width() || _rect.height() != _subImages[draw_subimage_id].rect.height()) // HACK: Hardcode cases of this until general rule can be ascertained @@ -1518,7 +1518,7 @@ void MystResourceType13::handleMouseLeave() { void MystResourceType13::handleMouseUp() { // Type 13 Resources do nothing on Mouse Clicks. - // This is required to override the inherited default + // This is required to override the inherited default // i.e. MystResource::handleMouseUp } @@ -1538,9 +1538,9 @@ Common::Error MohawkEngine_Myst::loadGameState(int slot) { Common::Error MohawkEngine_Myst::saveGameState(int slot, const char *desc) { Common::StringList saveList = _saveLoad->generateSaveGameList(); - if ((uint)slot < saveList.size()) + if ((uint)slot < saveList.size()) _saveLoad->deleteSave(saveList[slot]); - + return _saveLoad->saveGame(Common::String(desc)) ? Common::kNoError : Common::kUnknownError; } diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h index 5a90de33ed..60231260dd 100644 --- a/engines/mohawk/myst.h +++ b/engines/mohawk/myst.h @@ -167,7 +167,7 @@ public: void setEnabled(bool enabled) { _enabled = enabled; } uint16 getDest() { return _dest; } virtual uint16 getType8Var() { return 0xFFFF; } - + // Mouse interface virtual void handleMouseUp(); virtual void handleMouseDown() {} @@ -370,7 +370,7 @@ public: void setResourceEnabled(uint16 resourceId, bool enable); GUI::Debugger *getDebugger() { return _console; } - + bool canLoadGameStateCurrently() { return !(getFeatures() & GF_DEMO); } bool canSaveGameStateCurrently() { return !(getFeatures() & GF_DEMO); } Common::Error loadGameState(int slot); diff --git a/engines/mohawk/myst_jpeg.cpp b/engines/mohawk/myst_jpeg.cpp index c6d0a00ea3..e131347a11 100644 --- a/engines/mohawk/myst_jpeg.cpp +++ b/engines/mohawk/myst_jpeg.cpp @@ -29,11 +29,11 @@ #include "mohawk/myst_jpeg.h" namespace Mohawk { - + MystJPEG::MystJPEG() { _jpeg = new Graphics::JPEG(); _pixelFormat = g_system->getScreenFormat(); - + // We're going to have to dither if we're running in 8bpp. // We'll take RGBA8888 for best color performance in this case. if (_pixelFormat.bytesPerPixel == 1) @@ -45,10 +45,10 @@ Graphics::Surface *MystJPEG::decodeImage(Common::SeekableReadStream* stream) { Graphics::Surface *ySurface = _jpeg->getComponent(1); Graphics::Surface *uSurface = _jpeg->getComponent(2); Graphics::Surface *vSurface = _jpeg->getComponent(3); - + Graphics::Surface *finalSurface = new Graphics::Surface(); finalSurface->create(ySurface->w, ySurface->h, _pixelFormat.bytesPerPixel); - + for (uint16 i = 0; i < finalSurface->h; i++) { for (uint16 j = 0; j < finalSurface->w; j++) { byte r = 0, g = 0, b = 0; @@ -59,7 +59,7 @@ Graphics::Surface *MystJPEG::decodeImage(Common::SeekableReadStream* stream) { *((uint32 *)finalSurface->getBasePtr(j, i)) = _pixelFormat.RGBToColor(r, g, b); } } - + return finalSurface; } diff --git a/engines/mohawk/myst_jpeg.h b/engines/mohawk/myst_jpeg.h index 9d1305371d..ae51dccf7a 100644 --- a/engines/mohawk/myst_jpeg.h +++ b/engines/mohawk/myst_jpeg.h @@ -41,9 +41,9 @@ class MystJPEG { public: MystJPEG(); ~MystJPEG() { delete _jpeg; } - + Graphics::Surface *decodeImage(Common::SeekableReadStream *stream); - + private: Graphics::PixelFormat _pixelFormat; Graphics::JPEG *_jpeg; diff --git a/engines/mohawk/myst_pict.cpp b/engines/mohawk/myst_pict.cpp index 117c5ec9cc..765f5b206a 100644 --- a/engines/mohawk/myst_pict.cpp +++ b/engines/mohawk/myst_pict.cpp @@ -28,7 +28,7 @@ #include "mohawk/myst_pict.h" namespace Mohawk { - + // The PICT code is based off of the QuickDraw specs: // http://developer.apple.com/documentation/mac/QuickDraw/QuickDraw-461.html @@ -43,16 +43,16 @@ Graphics::Surface *MystPICT::decodeImage(Common::SeekableReadStream *stream) { // Read in the first part of the header /* uint16 fileSize = */ stream->readUint16BE(); - + _imageRect.top = stream->readUint16BE(); _imageRect.left = stream->readUint16BE(); _imageRect.bottom = stream->readUint16BE(); _imageRect.right = stream->readUint16BE(); _imageRect.debugPrint(0, "PICT Rect:"); - + Graphics::Surface *image = new Graphics::Surface(); image->create(_imageRect.width(), _imageRect.height(), _pixelFormat.bytesPerPixel); - + // NOTE: This is only a subset of the full PICT format. // - Only V2 Images Supported // - JPEG Chunks are Supported @@ -60,12 +60,12 @@ Graphics::Surface *MystPICT::decodeImage(Common::SeekableReadStream *stream) { for (uint32 opNum = 0; !stream->eos() && !stream->err() && stream->pos() < stream->size(); opNum++) { uint16 opcode = stream->readUint16BE(); debug(2, "Found PICT opcode %04x", opcode); - + if (opNum == 0 && opcode != 0x0011) error ("Cannot find PICT version opcode"); else if (opNum == 1 && opcode != 0x0C00) error ("Cannot find PICT header opcode"); - + if (opcode == 0x0001) { // Clip // Ignore uint16 clipSize = stream->readUint16BE(); @@ -107,7 +107,7 @@ Graphics::Surface *MystPICT::decodeImage(Common::SeekableReadStream *stream) { error ("Unknown PICT opcode %04x", opcode); } } - + return image; } @@ -142,7 +142,7 @@ void MystPICT::decodeDirectBitsRect(Common::SeekableReadStream *stream, Graphics buffer.create(image->w, image->h, 2); DirectBitsRectData directBitsData; - + directBitsData.pixMap.baseAddr = stream->readUint32BE(); directBitsData.pixMap.rowBytes = stream->readUint16BE(); directBitsData.pixMap.bounds.top = stream->readUint16BE(); @@ -170,10 +170,10 @@ void MystPICT::decodeDirectBitsRect(Common::SeekableReadStream *stream, Graphics directBitsData.dstRect.bottom = stream->readUint16BE(); directBitsData.dstRect.right = stream->readUint16BE(); directBitsData.mode = stream->readUint16BE(); - + if (directBitsData.pixMap.pixelSize != 16) error("Unhandled directBitsRect bitsPerPixel %d", directBitsData.pixMap.pixelSize); - + // Read in amount of data per row for (uint16 i = 0; i < directBitsData.pixMap.bounds.height(); i++) { if (directBitsData.pixMap.packType == 1 || directBitsData.pixMap.rowBytes < 8) { // Unpacked, Pad-Byte @@ -187,7 +187,7 @@ void MystPICT::decodeDirectBitsRect(Common::SeekableReadStream *stream, Graphics decodeDirectBitsLine((byte *)buffer.getBasePtr(0, i), directBitsData.pixMap.rowBytes, stream->readStream(byteCount)); } } - + // Convert from 16-bit to whatever surface we need for (uint16 y = 0; y < buffer.h; y++) { for (uint16 x = 0; x < buffer.w; x++) { @@ -203,7 +203,7 @@ void MystPICT::decodeDirectBitsLine(byte *out, uint32 length, Common::SeekableRe uint32 dataDecoded = 0; while (data->pos() < data->size() && dataDecoded < length) { byte op = data->readByte(); - + if (op & 0x80) { uint32 runSize = (op ^ 255) + 2; byte value1 = data->readByte(); @@ -220,13 +220,13 @@ void MystPICT::decodeDirectBitsLine(byte *out, uint32 length, Common::SeekableRe dataDecoded += runSize; } } - + if (length != dataDecoded) warning("Mismatched DirectBits read"); delete data; } - -// Compressed QuickTime details can be found here: + +// Compressed QuickTime details can be found here: // http://developer.apple.com/documentation/QuickTime/Rm/CompressDecompress/ImageComprMgr/B-Chapter/2TheImageCompression.html // http://developer.apple.com/documentation/QuickTime/Rm/CompressDecompress/ImageComprMgr/F-Chapter/6WorkingwiththeImage.html // I'm just ignoring that because Myst ME uses none of that extra stuff. The offset is always the same. @@ -234,12 +234,12 @@ void MystPICT::decodeDirectBitsLine(byte *out, uint32 length, Common::SeekableRe void MystPICT::decodeCompressedQuickTime(Common::SeekableReadStream *stream, Graphics::Surface *image) { uint32 dataSize = stream->readUint32BE(); uint32 startPos = stream->pos(); - + Graphics::Surface *jpegImage = _jpegDecoder->decodeImage(new Common::SeekableSubReadStream(stream, stream->pos() + 156, stream->pos() + dataSize)); stream->seek(startPos + dataSize); - + image->copyFrom(*jpegImage); - + jpegImage->free(); delete jpegImage; } diff --git a/engines/mohawk/myst_pict.h b/engines/mohawk/myst_pict.h index 2d763ca616..6b56a521b3 100644 --- a/engines/mohawk/myst_pict.h +++ b/engines/mohawk/myst_pict.h @@ -41,7 +41,7 @@ public: MystPICT(MystJPEG *jpegDecoder); ~MystPICT() {} Graphics::Surface *decodeImage(Common::SeekableReadStream *stream); - + private: MystJPEG *_jpegDecoder; Common::Rect _imageRect; diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp index dc49e72d75..4d6e00d76f 100644 --- a/engines/mohawk/myst_scripts.cpp +++ b/engines/mohawk/myst_scripts.cpp @@ -63,10 +63,10 @@ MystScriptParser::MystScriptParser(MohawkEngine_Myst *vm) : _vm(vm) { setupOpcodes(); _invokingResource = NULL; } - + MystScriptParser::~MystScriptParser() { } - + void MystScriptParser::setupOpcodes() { // "invalid" opcodes do not exist or have not been observed // "unknown" opcodes exist, but their meaning is unknown @@ -172,7 +172,7 @@ void MystScriptParser::setupOpcodes() { OPCODE(197, opcode_197), // Demo only OPCODE(198, opcode_198), OPCODE(199, opcode_199), - + // "Init" Opcodes OPCODE(200, opcode_200), OPCODE(201, opcode_201), @@ -200,7 +200,7 @@ void MystScriptParser::setupOpcodes() { // TODO: Opcodes 223 to 297 Not Present OPCODE(298, opcode_298), // Demo only OPCODE(299, opcode_299), // Demo only - + // "Exit" Opcodes OPCODE(300, opcode_300), OPCODE(301, opcode_301), @@ -218,7 +218,7 @@ void MystScriptParser::setupOpcodes() { OPCODE(0xFFFF, NOP) }; - + _opcodes = myst_opcodes; _opcodeCount = ARRAYSIZE(myst_opcodes); } @@ -263,14 +263,14 @@ void MystScriptParser::runScript(uint16 scriptCount, MystScriptEntry *scripts, M void MystScriptParser::runOpcode(uint16 op, uint16 var, uint16 argc, uint16 *argv) { bool ranOpcode = false; - + for (uint16 i = 0; i < _opcodeCount; i++) if (_opcodes[i].op == op) { (this->*(_opcodes[i].proc)) (op, var, argc, argv); ranOpcode = true; break; } - + if (!ranOpcode) error ("Trying to run invalid opcode %d", op); } @@ -284,7 +284,7 @@ const char *MystScriptParser::getOpcodeDesc(uint16 op) { return ""; } -// NOTE: Check to be used on Opcodes where var is thought +// NOTE: Check to be used on Opcodes where var is thought // not to be used. This emits a warning if var is nonzero. // It is possible that the opcode does use var 0 in this case, // but this will catch the majority of missed cases. @@ -346,7 +346,7 @@ void MystScriptParser::altDest(uint16 op, uint16 var, uint16 argc, uint16 *argv) _vm->changeToCard(_invokingResource->getDest()); else warning("Missing invokingResource in altDest call"); - } else + } else unknown(op, var, argc, argv); } @@ -406,7 +406,7 @@ void MystScriptParser::opcode_6(uint16 op, uint16 var, uint16 argc, uint16 *argv _vm->changeToCard(_invokingResource->getDest()); else warning("Opcode %d: Missing invokingResource", op); - } else + } else unknown(op, var, argc, argv); } @@ -422,7 +422,7 @@ void MystScriptParser::opcode_7(uint16 op, uint16 var, uint16 argc, uint16 *argv _vm->changeToCard(_invokingResource->getDest()); else warning("Opcode %d: Missing invokingResource", op); - } else + } else unknown(op, var, argc, argv); } @@ -437,7 +437,7 @@ void MystScriptParser::opcode_8(uint16 op, uint16 var, uint16 argc, uint16 *argv _vm->changeToCard(_invokingResource->getDest()); else warning("Opcode %d: Missing invokingResource", op); - } else + } else unknown(op, var, argc, argv); } @@ -457,8 +457,8 @@ void MystScriptParser::opcode_9(uint16 op, uint16 var, uint16 argc, uint16 *argv // more... if (!((_vm->getCurStack() == kStoneshipStack && _vm->getCurCard() == 2197) || (_vm->getCurStack() == kStoneshipStack && _vm->getCurCard() == 2138))) - warning("TODO: Opcode 9 on this card - Check function is consistent"); - } else + warning("TODO: Opcode 9 on this card - Check function is consistent"); + } else unknown(op, var, argc, argv); } @@ -471,7 +471,7 @@ void MystScriptParser::opcode_14(uint16 op, uint16 var, uint16 argc, uint16 *arg // Function looks like it changes the Var8 of the invoking resource to argument value.. // Most calls seem to have var = 0, but used in Myst Card 4500 (Execute Button) // with Var 105.. - } else + } else unknown(op, var, argc, argv); } @@ -499,7 +499,7 @@ void MystScriptParser::opcode_16(uint16 op, uint16 var, uint16 argc, uint16 *arg debugC(kDebugScript, "\tcardId: %d", cardId); debugC(kDebugScript, "\tu0: %d", u0); - // TODO: Finish Implementation... + // TODO: Finish Implementation... _vm->changeToCard(cardId); } else unknown(op, var, argc, argv); @@ -606,12 +606,12 @@ void MystScriptParser::opcode_21(uint16 op, uint16 var, uint16 argc, uint16 *arg Common::Rect rect1 = Common::Rect(argv[0], argv[1], argv[2], argv[3]); uint16 u0 = argv[4]; uint16 u1 = argv[5]; - + debugC(kDebugScript, "\trect1.left: %d", rect1.left); debugC(kDebugScript, "\trect1.top: %d", rect1.top); debugC(kDebugScript, "\trect1.right: %d", rect1.right); debugC(kDebugScript, "\trect1.bottom: %d", rect1.bottom); - + debugC(kDebugScript, "\tu0: %d", u0); debugC(kDebugScript, "\tu1: %d", u1); @@ -828,7 +828,7 @@ void MystScriptParser::opcode_30(uint16 op, uint16 var, uint16 argc, uint16 *arg debugC(kDebugScript, "\tcondVar: %d = %d", condVar, condVarValue); debugC(kDebugScript, "\tcondCount: %d", condCount); - + soundList = new int16[condCount]; soundListVolume = new uint16[condCount]; @@ -850,7 +850,7 @@ void MystScriptParser::opcode_30(uint16 op, uint16 var, uint16 argc, uint16 *arg } } - // NOTE: Mixer only has 8-bit channel volume granularity, + // NOTE: Mixer only has 8-bit channel volume granularity, // Myst uses 16-bit? Or is part of this balance? soundVolume = (byte)(soundVolume / 255); @@ -958,7 +958,7 @@ void MystScriptParser::opcode_35(uint16 op, uint16 var, uint16 argc, uint16 *arg _vm->_gfx->copyImageToScreen(imageId, Common::Rect(0, 0, 544, 333)); _vm->_system->updateScreen(); _vm->_system->delayMillis(delay * 100); - _vm->changeToCard(cardId); + _vm->changeToCard(cardId); } else unknown(op, var, argc, argv); } @@ -969,7 +969,7 @@ void MystScriptParser::changeCursor(uint16 op, uint16 var, uint16 argc, uint16 * if (argc == 1) { debugC(kDebugScript, "Opcode %d: Change Cursor", op); debugC(kDebugScript, "Cursor: %d", argv[0]); - + // TODO: Not sure if this needs to change mainCursor or similar... _vm->_gfx->changeCursor(argv[0]); } else @@ -1108,7 +1108,7 @@ void MystScriptParser::opcode_41(uint16 op, uint16 var, uint16 argc, uint16 *arg debugC(kDebugScript, "\tregion.right: %d", region.right); debugC(kDebugScript, "\tregion.bottom: %d", region.bottom); debugCN(kDebugScript, "\tupdateDirection: %d = ", updateDirection); - + switch (updateDirection) { case 0: debugC(kDebugScript, "Left to Right"); @@ -1126,7 +1126,7 @@ void MystScriptParser::opcode_41(uint16 op, uint16 var, uint16 argc, uint16 *arg warning("Unknown Update Direction"); break; } - + debugC(kDebugScript, "\tu2: %d", u2); // TODO: Speed / Delay of Update? // 10 Argument version Used in: @@ -1142,7 +1142,7 @@ void MystScriptParser::opcode_41(uint16 op, uint16 var, uint16 argc, uint16 *arg debugC(kDebugScript, "\tregion2.right: %d", region2.right); debugC(kDebugScript, "\tregion2.bottom: %d", region2.bottom); debugCN(kDebugScript, "\tupdateDirection2: %d = ", updateDirection2); - + switch (updateDirection2) { case 0: debugC(kDebugScript, "Left to Right"); @@ -1160,7 +1160,7 @@ void MystScriptParser::opcode_41(uint16 op, uint16 var, uint16 argc, uint16 *arg warning("Unknown Update Direction"); break; } - + debugC(kDebugScript, "\tu3: %d", u3); // TODO: Speed / Delay of Update? } @@ -1205,7 +1205,7 @@ void MystScriptParser::opcode_42(uint16 op, uint16 var, uint16 argc, uint16 *arg debugC(kDebugScript, "\tregion.right: %d", region.right); debugC(kDebugScript, "\tregion.bottom: %d", region.bottom); debugCN(kDebugScript, "\tupdateDirection: %d = ", updateDirection); - + switch (updateDirection) { case 0: debugC(kDebugScript, "Left to Right"); @@ -1223,7 +1223,7 @@ void MystScriptParser::opcode_42(uint16 op, uint16 var, uint16 argc, uint16 *arg warning("Unknown Update Direction"); break; } - + debugC(kDebugScript, "\tu2: %d", u2); // TODO: Speed / Delay of Update? // 9 Argument version Used in: @@ -1239,7 +1239,7 @@ void MystScriptParser::opcode_42(uint16 op, uint16 var, uint16 argc, uint16 *arg debugC(kDebugScript, "\tregion2.right: %d", region2.right); debugC(kDebugScript, "\tregion2.bottom: %d", region2.bottom); debugCN(kDebugScript, "\tupdateDirection2: %d = ", updateDirection2); - + switch (updateDirection2) { case 0: debugC(kDebugScript, "Left to Right"); @@ -1257,7 +1257,7 @@ void MystScriptParser::opcode_42(uint16 op, uint16 var, uint16 argc, uint16 *arg warning("Unknown Update Direction"); break; } - + debugC(kDebugScript, "\tu3: %d", u3); // TODO: Speed / Delay of Update? } @@ -1324,7 +1324,7 @@ void MystScriptParser::opcode_100(uint16 op, uint16 var, uint16 argc, uint16 *ar debugC(kDebugScript, "Opcode %d: ChangeStack", op); debugC(kDebugScript, "\tvar: %d", var); - // TODO: Merge with changeStack (Opcode 40) Implementation? + // TODO: Merge with changeStack (Opcode 40) Implementation? if (_vm->_varStore->getVar(var) == 5 || _vm->_varStore->getVar(var) > 7) { // TODO: Dead Book i.e. Released Sirrus/Achenar } else { @@ -1687,7 +1687,7 @@ void MystScriptParser::opcode_104(uint16 op, uint16 var, uint16 argc, uint16 *ar Common::Rect rect = _invokingResource->getRect(); // TODO: Need to load the image ids from Script Resources structure of VIEW - for (uint16 imageId = 3595; imageId <= 3601; imageId++) { + for (uint16 imageId = 3595; imageId <= 3601; imageId++) { _vm->_gfx->copyImageToScreen(imageId, rect); _vm->_system->delayMillis(50); } @@ -1934,7 +1934,7 @@ void MystScriptParser::opcode_111(uint16 op, uint16 var, uint16 argc, uint16 *ar // Used by Drawers Hotspots... debugC(kDebugScript, "Opcode %d: Unknown Function", op); - + uint16 u0 = argv[0]; debugC(kDebugScript, "\tu0: %d", u0); @@ -1955,11 +1955,11 @@ void MystScriptParser::opcode_112(uint16 op, uint16 var, uint16 argc, uint16 *ar // Used for Card 2013 (Achenar's Rose-Skull Hologram) if (argc == 3) { debugC(kDebugScript, "Opcode %d: Rose-Skull Hologram Playback", op); - + uint16 varValue = _vm->_varStore->getVar(var); debugC(kDebugScript, "\tVar: %d = %d", var, varValue); - + uint16 startPoint = argv[0]; uint16 endPoint = argv[1]; uint16 u0 = argv[2]; @@ -1986,7 +1986,7 @@ void MystScriptParser::opcode_113(uint16 op, uint16 var, uint16 argc, uint16 *ar // Used on Myst 4143 (Dock near Marker Switch) if (argc == 9) { uint16 soundId = argv[0]; - + uint16 u0 = argv[1]; uint16 u1 = argv[2]; @@ -1994,7 +1994,7 @@ void MystScriptParser::opcode_113(uint16 op, uint16 var, uint16 argc, uint16 *ar uint16 updateDirection = argv[7]; uint16 u2 = argv[8]; - + debugC(kDebugScript, "Opcode %d: Vault Open Logic", op); debugC(kDebugScript, "\tsoundId: %d", soundId); debugC(kDebugScript, "\tu0: %d", u0); @@ -2039,7 +2039,7 @@ void MystScriptParser::opcode_114(uint16 op, uint16 var, uint16 argc, uint16 *ar // Used on Myst 4143 (Dock near Marker Switch) if (argc == 9) { uint16 soundId = argv[0]; - + uint16 u0 = argv[1]; uint16 u1 = argv[2]; @@ -2047,7 +2047,7 @@ void MystScriptParser::opcode_114(uint16 op, uint16 var, uint16 argc, uint16 *ar uint16 updateDirection = argv[7]; uint16 u2 = argv[8]; - + debugC(kDebugScript, "Opcode %d: Vault Close Logic", op); debugC(kDebugScript, "\tsoundId: %d", soundId); debugC(kDebugScript, "\tu0: %d", u0); @@ -2154,7 +2154,7 @@ void MystScriptParser::opcode_115(uint16 op, uint16 var, uint16 argc, uint16 *ar _vm->changeToCard(cardIdLose); } else _vm->changeToCard(cardIdBookCover); - + // TODO: Is this logic here? // i.e. If was holding page, wait then auto open and play book... } else @@ -2211,7 +2211,7 @@ void MystScriptParser::opcode_116(uint16 op, uint16 var, uint16 argc, uint16 *ar // TODO: Play only 1st half of movie i.e. gears rise up _vm->_video->playMovie(_vm->wrapMovieFilename("gears", kMystStack), 305, 36); - + bridgeState = 1; _vm->_varStore->setVar(12, bridgeState); } else if (bridgeState && currentTime != correctTime) { @@ -2449,7 +2449,7 @@ void MystScriptParser::opcode_120(uint16 op, uint16 var, uint16 argc, uint16 *ar // Used for Card 4297 (Generator Puzzle Buttons) debugC(kDebugScript, "Opcode %d: Toggle Var8 of Invoking Resource", op); _top = _invokingResource; - + while(_top->_parent != NULL) _top = _top->_parent; @@ -2472,7 +2472,7 @@ void MystScriptParser::opcode_121(uint16 op, uint16 var, uint16 argc, uint16 *ar switch (_vm->getCurStack()) { case kMystStack: // Used on Card 4100 (Cabin Safe Buttons) - // Correct Solution (724) -> Var 67=2, 68=7, 69=5 + // Correct Solution (724) -> Var 67=2, 68=7, 69=5 // Jump to Card 4103 when solution correct and handle pulled... if (argc == 0) { uint16 varValue = _vm->_varStore->getVar(var); @@ -2779,7 +2779,7 @@ void MystScriptParser::opcode_133(uint16 op, uint16 var, uint16 argc, uint16 *ar // TODO: Function to change variables controlling telescope view // etc. - + // TODO: Sound seems to be stuck looping? _vm->_sound->playSound(soundId); } else @@ -3011,7 +3011,7 @@ void MystScriptParser::opcode_199(uint16 op, uint16 var, uint16 argc, uint16 *ar case kMystStack: if (argc == 0) { debugC(kDebugScript, "Opcode %d: Myst Imager Control Execute Button Logic", op); - + uint16 numericSelection = (_vm->_varStore->getVar(36) + 1) % 10; numericSelection += ((_vm->_varStore->getVar(35) + 1) % 10) * 10; @@ -3157,7 +3157,7 @@ void MystScriptParser::opcode_200_run() { break; case kCreditsStack: curImageIndex = _vm->_varStore->getVar(g_opcode200Parameters.var); - + if (_vm->_system->getMillis() - g_opcode200Parameters.lastCardTime >= 7 * 1000) { // After the 6th image has shown, it's time to quit if (curImageIndex == 7) @@ -3175,7 +3175,7 @@ void MystScriptParser::opcode_200_run() { // g_opcode200Parameters.var == 0 for Achenar // g_opcode200Parameters.var == 1 for Sirrus - // TODO: Fill in Function... + // TODO: Fill in Function... // Variable indicates that this is related to Secret Panel State break; case kDemoStack: @@ -3201,7 +3201,7 @@ void MystScriptParser::opcode_200_disable() { g_opcode200Parameters.soundIncrement = 0; } -void MystScriptParser::opcode_200(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::opcode_200(uint16 op, uint16 var, uint16 argc, uint16 *argv) { switch (_vm->getCurStack()) { case kIntroStack: varUnusedCheck(op, var); @@ -3280,7 +3280,7 @@ void MystScriptParser::opcode_200(uint16 op, uint16 var, uint16 argc, uint16 *ar g_opcode200Parameters.lastCardTime = _vm->_system->getMillis(); g_opcode200Parameters.enabled = true; - _vm->_varStore->setVar(var, 1); + _vm->_varStore->setVar(var, 1); } else unknown(op, var, argc, argv); break; @@ -3586,7 +3586,7 @@ void MystScriptParser::opcode_202_run(void) { _vm->_varStore->setVar(7, 1); } else { // No water into Valve - _vm->_varStore->setVar(31, 1); // Background + _vm->_varStore->setVar(31, 1); // Background _vm->_varStore->setVar(7, 0); } @@ -3604,7 +3604,7 @@ void MystScriptParser::opcode_202_run(void) { _vm->_varStore->setVar(4, 1); } else { // No water into Valve - _vm->_varStore->setVar(32, 1); // Background + _vm->_varStore->setVar(32, 1); // Background _vm->_varStore->setVar(4, 0); } break; @@ -3829,10 +3829,10 @@ void MystScriptParser::opcode_204(uint16 op, uint16 var, uint16 argc, uint16 *ar if (false) { // Card 4134 _vm->_video->playMovie(_vm->wrapMovieFilename("birds1", kMystStack), 416, 0); - + // Card 4149 _vm->_video->playMovie(_vm->wrapMovieFilename("birds2", kMystStack), 433, 0); - + // Unsure... _vm->_video->playMovie(_vm->wrapMovieFilename("birds3", kMystStack), 0, 0); } @@ -4087,7 +4087,7 @@ static struct { void MystScriptParser::opcode_209_run(void) { static bool enabledLast; - + if (g_opcode209Parameters.enabled) { switch (_vm->getCurStack()) { case kStoneshipStack: @@ -4226,7 +4226,7 @@ void MystScriptParser::opcode_210_run(void) { else { // Blow Generator Room Breaker... _vm->_varStore->setVar(93, 1); - // TODO: I think Logic For Blowing Other Breaker etc. + // TODO: I think Logic For Blowing Other Breaker etc. // is done in process on Breaker Cards. rocketPowerVoltage = 0; @@ -4626,7 +4626,7 @@ void MystScriptParser::opcode_298(uint16 op, uint16 var, uint16 argc, uint16 *ar // TODO: Fill in logic. // Start Voice Over... which controls book opening _vm->_sound->playSound(3001); - + // then link to Myst - Trigger of Hotspot? then opcode 199/196/197 for voice over continue? // TODO: Sync Voice and Actions to Original // TODO: Flash Library Red @@ -4670,7 +4670,7 @@ void MystScriptParser::opcode_300(uint16 op, uint16 var, uint16 argc, uint16 *ar break; case kDemoPreviewStack: case kMystStack: - // Used in Card 4371 (Blue Book) Var = 101 + // Used in Card 4371 (Blue Book) Var = 101 // and Card 4363 (Red Book) Var = 100 // TODO: Fill in Logic debugC(kDebugScript, "Opcode %d: Book Exit Function...", op); diff --git a/engines/mohawk/myst_scripts.h b/engines/mohawk/myst_scripts.h index 16b9a900d3..a996421289 100644 --- a/engines/mohawk/myst_scripts.h +++ b/engines/mohawk/myst_scripts.h @@ -40,19 +40,19 @@ class MystScriptParser { public: MystScriptParser(MohawkEngine_Myst *vm); ~MystScriptParser(); - + void runScript(uint16 scriptCount, MystScriptEntry *scripts, MystResource* invokingResource = NULL); void runOpcode(uint16 op, uint16 var = 0, uint16 argc = 0, uint16 *argv = NULL); const char *getOpcodeDesc(uint16 op); - + void disableInitOpcodes(); void runPersistentOpcodes(); private: MohawkEngine_Myst *_vm; - + typedef void (MystScriptParser::*OpcodeProcMyst)(uint16 op, uint16 var, uint16 argc, uint16* argv); - + struct MystOpcode { uint16 op; OpcodeProcMyst proc; diff --git a/engines/mohawk/myst_vars.cpp b/engines/mohawk/myst_vars.cpp index f496b52487..edb5295809 100644 --- a/engines/mohawk/myst_vars.cpp +++ b/engines/mohawk/myst_vars.cpp @@ -50,12 +50,12 @@ MystVarEntry introVars[] = { MystVarEntry seleniticVars[] = { { 0, 0, "Sound Pickup At Windy Tunnel" }, // 0 to 1 // TODO: Multiple Uses of Var 0? - { 1, 0, "Sound Pickup At Volcanic Crack" }, // 0 to 1 - { 2, 0, "Sound Pickup At Clock" }, // 0 to 1 - { 3, 0, "Sound Pickup At Water Pool" }, // 0 to 1 - { 4, 0, "Sound Pickup At Crystal Rocks" }, // 0 to 1 - { 5, 0, "Sound Receiver Doors" }, // 0 to 1 - { 6, 0, "Windy Tunnel Lights" }, // 0 to 1 + { 1, 0, "Sound Pickup At Volcanic Crack" }, // 0 to 1 + { 2, 0, "Sound Pickup At Clock" }, // 0 to 1 + { 3, 0, "Sound Pickup At Water Pool" }, // 0 to 1 + { 4, 0, "Sound Pickup At Crystal Rocks" }, // 0 to 1 + { 5, 0, "Sound Receiver Doors" }, // 0 to 1 + { 6, 0, "Windy Tunnel Lights" }, // 0 to 1 { 7, 0, "Maze Runner Porthole View" }, // 0 to 3 { 8, 0, "Sound Receiver Screen (Control Variable?)" }, { 9, 0, "Sound Receiver Water Pool Button Selected" }, @@ -309,8 +309,8 @@ MystVarEntry channelwoodVars[] = { { 5, 0, "Lower Walkway to Upper Walkway Spiral Stair Lower Door Open" }, // 0 to 1 { 6, 0, "Pipe Bridge Extended" }, // 0 to 1 { 7, 0, "Bridge Pump Running" }, // 0 to 1 - { 8, 0, "Water Tank Valve State" }, // 0 to 1 - { 9, 0, "First Water Valve State" }, // 0 to 1 + { 8, 0, "Water Tank Valve State" }, // 0 to 1 + { 9, 0, "First Water Valve State" }, // 0 to 1 { 10, 0, "Second (L) Water Valve State" }, // 0 to 1 { 11, 0, "Third (L, R) Water Valve State" }, // 0 to 1 { 12, 0, "Fourth (L, R, R) Water Valve State" }, // 0 to 1 @@ -365,7 +365,7 @@ uint16 MystVar::saveGetVar(uint16 stack, uint16 v) { MystVarEntry unknownVar = { v, 0, "Unknown" }; const char *desc = NULL; uint16 i; - + switch (stack) { case kIntroStack: for (i = 0; i < ARRAYSIZE(introVars); i++) { @@ -443,7 +443,7 @@ uint16 MystVar::saveGetVar(uint16 stack, uint16 v) { default: break; } - + if (desc == NULL) { for (i = 0; i < _unknown.size(); i++) { if (_unknown[i].refNum == v) { @@ -454,7 +454,7 @@ uint16 MystVar::saveGetVar(uint16 stack, uint16 v) { } if (desc == NULL) { - warning("MystVar::getVar(%d): Unknown variable reference", v); + warning("MystVar::getVar(%d): Unknown variable reference", v); _unknown.push_back(unknownVar); desc = _unknown.back().description; } @@ -469,7 +469,7 @@ void MystVar::loadSetVar(uint16 stack, uint16 v, uint16 value) { const char *desc = NULL; MystVarEntry unknownVar = { v, value, "Unknown" }; uint16 i; - + switch (stack) { case kIntroStack: for (i = 0; i < ARRAYSIZE(introVars); i++) { diff --git a/engines/mohawk/resource.cpp b/engines/mohawk/resource.cpp index 8ee8310e9c..63f632de5f 100644 --- a/engines/mohawk/resource.cpp +++ b/engines/mohawk/resource.cpp @@ -41,15 +41,15 @@ void MohawkArchive::open(Common::String filename) { error ("Could not open file \'%s\'", filename.c_str()); _curFile = filename; - + open(file); } void MohawkArchive::close() { - delete _mhk; _mhk = NULL; + delete _mhk; _mhk = NULL; delete[] _types; _types = NULL; delete[] _fileTable; _fileTable = NULL; - + _curFile.clear(); } @@ -76,7 +76,7 @@ void MohawkArchive::open(Common::SeekableReadStream *stream) { ///////////////////////////////// //Resource Dir - ///////////////////////////////// + ///////////////////////////////// // Type Table _mhk->seek(_rsrc.abs_offset); @@ -110,7 +110,7 @@ void MohawkArchive::open(Common::SeekableReadStream *stream) { _types[i].resTable.entries[j].id = _mhk->readUint16BE(); _types[i].resTable.entries[j].index = _mhk->readUint16BE(); - debug (4, "Entry[%02x]: ID = %04x (%d) Index = %04x", j, _types[i].resTable.entries[j].id, _types[i].resTable.entries[j].id, _types[i].resTable.entries[j].index); + debug (4, "Entry[%02x]: ID = %04x (%d) Index = %04x", j, _types[i].resTable.entries[j].id, _types[i].resTable.entries[j].id, _types[i].resTable.entries[j].index); } // Name Table @@ -158,7 +158,7 @@ void MohawkArchive::open(Common::SeekableReadStream *stream) { _fileTable[i].dataSize += _mhk->readByte() << 16; // Get bits 15-24 of dataSize too _fileTable[i].flags = _mhk->readByte(); _fileTable[i].unk = _mhk->readUint16BE(); - + // Add in another 3 bits for file size from the flags. // The flags are useless to us except for doing this ;) _fileTable[i].dataSize += (_fileTable[i].flags & 7) << 24; @@ -187,7 +187,7 @@ uint32 MohawkArchive::getOffset(uint32 tag, uint16 id) { int16 idIndex = getIdIndex(typeIndex, id); assert(idIndex >= 0); - + return _fileTable[_types[typeIndex].resTable.entries[idIndex].index - 1].offset; } @@ -207,7 +207,7 @@ Common::SeekableReadStream *MohawkArchive::getRawData(uint32 tag, uint16 id) { // Note: the fileTableIndex is based off 1, not 0. So, subtract 1 uint16 fileTableIndex = _types[typeIndex].resTable.entries[idIndex].index - 1; - + // WORKAROUND: tMOV resources pretty much ignore the size part of the file table, // as the original just passed the full Mohawk file to QuickTime and the offset. // We need to do this because of the way Mohawk is set up (this is much more "proper" @@ -218,55 +218,55 @@ Common::SeekableReadStream *MohawkArchive::getRawData(uint32 tag, uint16 id) { else return new Common::SeekableSubReadStream(_mhk, _fileTable[fileTableIndex].offset, _fileTable[fileTableIndex + 1].offset); } - + return new Common::SeekableSubReadStream(_mhk, _fileTable[fileTableIndex].offset, _fileTable[fileTableIndex].offset + _fileTable[fileTableIndex].dataSize); } void LivingBooksArchive_v1::open(Common::SeekableReadStream *stream) { close(); _mhk = stream; - + // This is for the "old" Mohawk resource format used in some older // Living Books. It is very similar, just missing the MHWK tag and // some other minor differences, especially with the file table // being merged into the resource table. - + uint32 headerSize = _mhk->readUint32BE(); - + // NOTE: There are differences besides endianness! (Subtle changes, // but different). - + if (headerSize == 6) { // We're in Big Endian mode (Macintosh) _mhk->readUint16BE(); // Resource Table Size _typeTable.resource_types = _mhk->readUint16BE(); _types = new OldType[_typeTable.resource_types]; - + debug (0, "Old Mohawk File (Macintosh): Number of Resource Types = %04x", _typeTable.resource_types); - + for (uint16 i = 0; i < _typeTable.resource_types; i++) { _types[i].tag = _mhk->readUint32BE(); _types[i].resource_table_offset = (uint16)_mhk->readUint32BE() + 6; _mhk->readUint32BE(); // Unknown (always 0?) - + debug (3, "Type[%02d]: Tag = \'%s\' ResTable Offset = %04x", i, tag2str(_types[i].tag), _types[i].resource_table_offset); uint32 oldPos = _mhk->pos(); - + // Resource Table/File Table _mhk->seek(_types[i].resource_table_offset); _types[i].resTable.resources = _mhk->readUint16BE(); _types[i].resTable.entries = new OldType::ResourceTable::Entries[_types[i].resTable.resources]; - + for (uint16 j = 0; j < _types[i].resTable.resources; j++) { _types[i].resTable.entries[j].id = _mhk->readUint16BE(); _types[i].resTable.entries[j].offset = _mhk->readUint32BE(); _types[i].resTable.entries[j].size = _mhk->readByte() << 16; _types[i].resTable.entries[j].size += _mhk->readUint16BE(); _mhk->skip(5); // Unknown (always 0?) - + debug (4, "Entry[%02x]: ID = %04x (%d)\tOffset = %08x, Size = %08x", j, _types[i].resTable.entries[j].id, _types[i].resTable.entries[j].id, _types[i].resTable.entries[j].offset, _types[i].resTable.entries[j].size); } - + _mhk->seek(oldPos); debug (3, "\n"); } @@ -274,32 +274,32 @@ void LivingBooksArchive_v1::open(Common::SeekableReadStream *stream) { _mhk->readUint16LE(); // Resource Table Size _typeTable.resource_types = _mhk->readUint16LE(); _types = new OldType[_typeTable.resource_types]; - + debug (0, "Old Mohawk File (Windows): Number of Resource Types = %04x", _typeTable.resource_types); - + for (uint16 i = 0; i < _typeTable.resource_types; i++) { _types[i].tag = _mhk->readUint32LE(); _types[i].resource_table_offset = _mhk->readUint16LE() + 6; _mhk->readUint16LE(); // Unknown (always 0?) - + debug (3, "Type[%02d]: Tag = \'%s\' ResTable Offset = %04x", i, tag2str(_types[i].tag), _types[i].resource_table_offset); - + uint32 oldPos = _mhk->pos(); - + // Resource Table/File Table _mhk->seek(_types[i].resource_table_offset); _types[i].resTable.resources = _mhk->readUint16LE(); _types[i].resTable.entries = new OldType::ResourceTable::Entries[_types[i].resTable.resources]; - + for (uint16 j = 0; j < _types[i].resTable.resources; j++) { _types[i].resTable.entries[j].id = _mhk->readUint16LE(); _types[i].resTable.entries[j].offset = _mhk->readUint32LE(); _types[i].resTable.entries[j].size = _mhk->readUint16LE(); _mhk->readUint32LE(); // Unknown (always 0?) - - debug (4, "Entry[%02x]: ID = %04x (%d)\tOffset = %08x, Size = %08x", j, _types[i].resTable.entries[j].id, _types[i].resTable.entries[j].id, _types[i].resTable.entries[j].offset, _types[i].resTable.entries[j].size); + + debug (4, "Entry[%02x]: ID = %04x (%d)\tOffset = %08x, Size = %08x", j, _types[i].resTable.entries[j].id, _types[i].resTable.entries[j].id, _types[i].resTable.entries[j].offset, _types[i].resTable.entries[j].size); } - + _mhk->seek(oldPos); debug (3, "\n"); } @@ -316,7 +316,7 @@ uint32 LivingBooksArchive_v1::getOffset(uint32 tag, uint16 id) { int16 idIndex = getIdIndex(typeIndex, id); assert(idIndex >= 0); - + return _types[typeIndex].resTable.entries[idIndex].offset; } diff --git a/engines/mohawk/resource.h b/engines/mohawk/resource.h index 1bb47ef1fd..6b32a32b8e 100644 --- a/engines/mohawk/resource.h +++ b/engines/mohawk/resource.h @@ -140,7 +140,7 @@ struct Type { uint32 tag; uint16 resource_table_offset; uint16 name_table_offset; - + struct ResourceTable { uint16 resources; struct Entries { @@ -148,7 +148,7 @@ struct Type { uint16 index; } *entries; } resTable; - + struct NameTable { uint16 num; struct Entries { @@ -177,11 +177,11 @@ class MohawkArchive { public: MohawkArchive(); virtual ~MohawkArchive() { close(); } - + void open(Common::String filename); virtual void open(Common::SeekableReadStream *stream); void close(); - + bool hasResource(uint32 tag, uint16 id); virtual Common::SeekableReadStream *getRawData(uint32 tag, uint16 id); virtual uint32 getOffset(uint32 tag, uint16 id); @@ -190,7 +190,7 @@ protected: Common::SeekableReadStream *_mhk; TypeTable _typeTable; Common::String _curFile; - + private: bool _hasData; uint32 _fileSize; @@ -220,11 +220,11 @@ class LivingBooksArchive_v1 : public MohawkArchive { public: LivingBooksArchive_v1() : MohawkArchive() {} ~LivingBooksArchive_v1() {} - + void open(Common::SeekableReadStream *stream); Common::SeekableReadStream *getRawData(uint32 tag, uint16 id); uint32 getOffset(uint32 tag, uint16 id); - + private: struct OldType { uint32 tag; @@ -238,14 +238,14 @@ private: } *entries; } resTable; } *_types; - + int16 getTypeIndex(uint32 tag) { for (uint16 i = 0; i < _typeTable.resource_types; i++) if (_types[i].tag == tag) return i; return -1; // not found } - + int16 getIdIndex(int16 typeIndex, uint16 id) { for (uint16 i = 0; i < _types[typeIndex].resTable.resources; i++) if (_types[typeIndex].resTable.entries[i].id == id) diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index 7b6565c58e..292d2d740a 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -22,10 +22,10 @@ * $Id$ * */ - + #include "common/config-manager.h" #include "common/events.h" -#include "common/keyboard.h" +#include "common/keyboard.h" #include "mohawk/graphics.h" #include "mohawk/riven.h" @@ -114,13 +114,13 @@ Common::Error MohawkEngine_Riven::run() { case Common::EVENT_MOUSEMOVE: _mousePos = event.mouse; checkHotspotChange(); - + // Check to show the inventory if (_mousePos.y >= 392) _gfx->showInventory(); else _gfx->hideInventory(); - + needsUpdate = true; break; case Common::EVENT_LBUTTONDOWN: @@ -189,7 +189,7 @@ Common::Error MohawkEngine_Riven::run() { changeToCard(12); _eventMan->resetRTL(); continue; - } + } return Common::kNoError; } @@ -215,7 +215,7 @@ void MohawkEngine_Riven::changeToStack(uint16 n) { // Don't change stack to the current stack (if the files are loaded) if (_curStack == n && !_mhk.empty()) return; - + _curStack = n; // Clear the old stack files out @@ -225,7 +225,7 @@ void MohawkEngine_Riven::changeToStack(uint16 n) { // Get the prefix character for the destination stack char prefix = getStackName(_curStack)[0]; - + // Load any file that fits the patterns for (int i = 0; i < ARRAYSIZE(endings); i++) { Common::String filename = Common::String(prefix) + endings[i]; @@ -235,11 +235,11 @@ void MohawkEngine_Riven::changeToStack(uint16 n) { _mhk.push_back(mhk); } } - + // Make sure we have loaded files if (_mhk.empty()) error("Could not load stack %s", getStackName(_curStack).c_str()); - + // Stop any currently playing sounds and load the new sound file too _sound->stopAllSLST(); _sound->loadRivenSounds(_curStack); @@ -289,30 +289,30 @@ void MohawkEngine_Riven::changeToCard(uint16 n) { loadCard(_curCard); } - + // We need to reload hotspots when refreshing, however loadHotspots(_curCard); - + _gfx->_updatesEnabled = true; _gfx->clearWaterEffects(); _gfx->_activatedPLSTs.clear(); _video->_mlstRecords.clear(); _gfx->drawPLST(1); _activatedSLST = false; - + runCardScript(kCardLoadScript); _gfx->updateScreen(); runCardScript(kCardOpenScript); - + // Activate the first sound list if none have been activated if (!_activatedSLST) _sound->playSLST(1, _curCard); - + if (_showHotspots) { for (uint16 i = 0; i < _hotspotCount; i++) _gfx->drawRect(_hotspots[i].rect, _hotspots[i].enabled); } - + // Now we need to redraw the cursor if necessary and handle mouse over scripts _curHotspot = -1; checkHotspotChange(); @@ -356,12 +356,12 @@ void MohawkEngine_Riven::loadHotspots(uint16 id) { _hotspots[i].blstID = inStream->readUint16BE(); _hotspots[i].name_resource = inStream->readSint16BE(); - + int16 left = inStream->readSint16BE(); int16 top = inStream->readSint16BE(); int16 right = inStream->readSint16BE(); int16 bottom = inStream->readSint16BE(); - + // Riven has some weird hotspots, disable them here if (left >= right || top >= bottom) { left = top = right = bottom = 0; @@ -369,7 +369,7 @@ void MohawkEngine_Riven::loadHotspots(uint16 id) { } _hotspots[i].rect = Common::Rect(left, top, right, bottom); - + _hotspots[i].u0 = inStream->readUint16BE(); if (_hotspots[i].u0 != 0) @@ -383,7 +383,7 @@ void MohawkEngine_Riven::loadHotspots(uint16 id) { warning("Hotspot %d u1 not -1", i); _hotspots[i].zipModeHotspot = inStream->readUint16BE(); - + // Read in the scripts now _hotspots[i].scripts = RivenScript::readScripts(this, inStream); } @@ -425,7 +425,7 @@ void MohawkEngine_Riven::checkHotspotChange() { foundHotspot = true; hotspotIndex = i; } - + if (foundHotspot) { if (_curHotspot != hotspotIndex) { _curHotspot = hotspotIndex; @@ -439,7 +439,7 @@ void MohawkEngine_Riven::checkHotspotChange() { Common::String MohawkEngine_Riven::getHotspotName(uint16 hotspot) { assert(hotspot < _hotspotCount); - + if (_hotspots[hotspot].name_resource < 0) return Common::String(); @@ -450,19 +450,19 @@ void MohawkEngine_Riven::checkInventoryClick() { // Don't even bother. We're not in the inventory portion of the screen. if (_mousePos.y < 392) return; - + // No inventory in the demo or opening screens. if (getFeatures() & GF_DEMO || _curStack == aspit) return; - + // Set the return stack/card id's. *matchVarToString("returnstackid") = _curStack; *matchVarToString("returncardid") = _curCard; - + // See RivenGraphics::showInventory() for an explanation // of why only this variable is used. bool hasCathBook = *matchVarToString("acathbook") != 0; - + // Go to the book if a hotspot contains the mouse if (!hasCathBook) { if (atrusJournalRectSolo.contains(_mousePos)) { @@ -503,7 +503,7 @@ Common::String MohawkEngine_Riven::getName(uint16 nameResource, uint16 nameID) { stringOffsets[i] = nameStream->readUint16BE(); for (uint16 i = 0; i < fieldCount; i++) nameStream->readUint16BE(); // Skip unknown values - + nameStream->seek(stringOffsets[nameID], SEEK_CUR); c = (char)nameStream->readByte(); @@ -573,9 +573,9 @@ Common::Error MohawkEngine_Riven::loadGameState(int slot) { Common::Error MohawkEngine_Riven::saveGameState(int slot, const char *desc) { Common::StringList saveList = _saveLoad->generateSaveGameList(); - if ((uint)slot < saveList.size()) + if ((uint)slot < saveList.size()) _saveLoad->deleteSave(saveList[slot]); - + return _saveLoad->saveGame(Common::String(desc)) ? Common::kNoError : Common::kUnknownError; } diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h index 9a98b05ebc..9cb43ebe9d 100644 --- a/engines/mohawk/riven.h +++ b/engines/mohawk/riven.h @@ -22,7 +22,7 @@ * $Id$ * */ - + #ifndef MOHAWK_RIVEN_H #define MOHAWK_RIVEN_H @@ -80,7 +80,7 @@ struct RivenHotspot { int16 u1; int16 zipModeHotspot; RivenScriptList scripts; - + bool enabled; }; @@ -96,7 +96,7 @@ struct ZipMode { uint16 id; bool operator== (const ZipMode& z) const; }; - + class MohawkEngine_Riven : public MohawkEngine { protected: Common::Error run(); @@ -104,15 +104,15 @@ protected: public: MohawkEngine_Riven(OSystem *syst, const MohawkGameDescription *gamedesc); virtual ~MohawkEngine_Riven(); - + RivenGraphics *_gfx; RivenExternal *_externalScriptHandler; Card _cardData; bool _gameOver; - + GUI::Debugger *getDebugger(); - + bool canLoadGameStateCurrently() { return true; } bool canSaveGameStateCurrently() { return true; } Common::Error loadGameState(int slot); @@ -138,7 +138,7 @@ private: void checkInventoryClick(); bool _showHotspots; void updateZipMode(); - + // Variables uint32 *_vars; uint32 _varCount; @@ -147,7 +147,7 @@ public: Common::SeekableReadStream *getExtrasResource(uint32 tag, uint16 id); bool _activatedSLST; void runLoadDialog(); - + void changeToCard(uint16 = 0); void changeToStack(uint16); Common::String getName(uint16 nameResource, uint16 nameID); @@ -167,7 +167,7 @@ public: void runHotspotScript(uint16 hotspot, uint16 scriptType); int32 getCurHotspot() { return _curHotspot; } Common::String getHotspotName(uint16 hotspot); - + void initVars(); uint32 getVarCount() { return _varCount; } uint32 getGlobalVar(uint32 index); diff --git a/engines/mohawk/riven_cursors.h b/engines/mohawk/riven_cursors.h index 4120aca41b..7deaf9c33c 100644 --- a/engines/mohawk/riven_cursors.h +++ b/engines/mohawk/riven_cursors.h @@ -120,7 +120,7 @@ static const byte grabbingHandCursor[] = { 0, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 1, 0, 0, 0, 1, 2, 2, 2, 2, 2, 4, 3, 1, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 4, 3, 1, 0, 0, - 0, 0, 0, 1, 2, 2, 2, 2, 4, 3, 1, 0, 0 + 0, 0, 0, 1, 2, 2, 2, 2, 4, 3, 1, 0, 0 }; @@ -177,7 +177,7 @@ static const byte pointingLeftCursor[] = { 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 1, 4, 2, 4, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 4, 4, 1, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 1, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0 }; diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp index da8040dc67..4ee1c19f9a 100644 --- a/engines/mohawk/riven_external.cpp +++ b/engines/mohawk/riven_external.cpp @@ -22,7 +22,7 @@ * $Id$ * */ - + #include "mohawk/graphics.h" #include "mohawk/riven.h" #include "mohawk/riven_external.h" @@ -31,7 +31,7 @@ #include "common/EventRecorder.h" #include "gui/message.h" - + namespace Mohawk { RivenExternal::RivenExternal(MohawkEngine_Riven *vm) : _vm(vm) { @@ -42,10 +42,10 @@ RivenExternal::RivenExternal(MohawkEngine_Riven *vm) : _vm(vm) { RivenExternal::~RivenExternal() { delete _rnd; - + for (uint32 i = 0; i < _externalCommands.size(); i++) delete _externalCommands[i]; - + _externalCommands.clear(); } @@ -150,7 +150,7 @@ void RivenExternal::setupCommands() { COMMAND(xogehnbookprevpage); COMMAND(xogehnbooknextpage); COMMAND(xgwatch); - + // pspit (Prison Island) external commands COMMAND(xpisland990_elevcombo); COMMAND(xpscpbtn); @@ -185,21 +185,21 @@ void RivenExternal::setupCommands() { COMMAND(xtisland5056_slidermd); COMMAND(xtisland5056_slidermw); COMMAND(xtatboundary); - + // Common external commands COMMAND(xflies); } void RivenExternal::runCommand(uint16 argc, uint16 *argv) { Common::String externalCommandName = _vm->getName(ExternalCommandNames, argv[0]); - + for (uint16 i = 0; i < _externalCommands.size(); i++) if (externalCommandName == _externalCommands[i]->desc) { debug(0, "Running Riven External Command \'%s\'", externalCommandName.c_str()); (this->*(_externalCommands[i]->proc)) (argv[1], argv[1] ? argv + 2 : NULL); return; } - + error("Unknown external command \'%s\'", externalCommandName.c_str()); } @@ -212,7 +212,7 @@ void RivenExternal::runDemoBoundaryDialog() { void RivenExternal::runEndGame(uint16 video) { _vm->_sound->stopAllSLST(); _vm->_video->playMovieBlocking(video); - + // TODO: Play until the last frame and then run the credits _vm->_gameOver = true; } @@ -234,7 +234,7 @@ void RivenExternal::xasetupcomplete(uint16 argc, uint16 *argv) { void RivenExternal::xaatrusopenbook(uint16 argc, uint16 *argv) { // Get the variable uint32 page = *_vm->matchVarToString("aatruspage"); - + // Set hotspots depending on the page if (page == 1) { _vm->_hotspots[1].enabled = false; @@ -245,7 +245,7 @@ void RivenExternal::xaatrusopenbook(uint16 argc, uint16 *argv) { _vm->_hotspots[2].enabled = true; _vm->_hotspots[3].enabled = false; } - + // Draw the image of the page _vm->_gfx->drawPLST(page); } @@ -259,14 +259,14 @@ void RivenExternal::xaatrusbookback(uint16 argc, uint16 *argv) { void RivenExternal::xaatrusbookprevpage(uint16 argc, uint16 *argv) { // Get the page variable uint32 *page = _vm->matchVarToString("aatruspage"); - + // Decrement the page if it's not the first page if (*page == 1) return; (*page)--; - + // TODO: Play the page turning sound - + // Now update the screen :) _vm->_gfx->updateScreen(); } @@ -274,14 +274,14 @@ void RivenExternal::xaatrusbookprevpage(uint16 argc, uint16 *argv) { void RivenExternal::xaatrusbooknextpage(uint16 argc, uint16 *argv) { // Get the page variable uint32 *page = _vm->matchVarToString("aatruspage"); - + // Increment the page if it's not the last page if (((_vm->getFeatures() & GF_DEMO) && *page == 6) || *page == 10) return; (*page)++; - + // TODO: Play the page turning sound - + // Now update the screen :) _vm->_gfx->updateScreen(); } @@ -300,16 +300,16 @@ void RivenExternal::xacathopenbook(uint16 argc, uint16 *argv) { _vm->_hotspots[2].enabled = true; _vm->_hotspots[3].enabled = false; } - + // Draw the image of the page _vm->_gfx->drawPLST(page); - + // Draw the white page edges if (page > 1 && page < 5) _vm->_gfx->drawPLST(50); else if (page > 5) _vm->_gfx->drawPLST(51); - + if (page == 28) { // TODO: Draw telescope combination } @@ -324,12 +324,12 @@ void RivenExternal::xacathbookback(uint16 argc, uint16 *argv) { void RivenExternal::xacathbookprevpage(uint16 argc, uint16 *argv) { // Get the variable uint32 *page = _vm->matchVarToString("acathpage"); - + // Increment the page if it's not the first page if (*page == 1) return; (*page)--; - + // TODO: Play the page turning sound // Now update the screen :) @@ -339,14 +339,14 @@ void RivenExternal::xacathbookprevpage(uint16 argc, uint16 *argv) { void RivenExternal::xacathbooknextpage(uint16 argc, uint16 *argv) { // Get the variable uint32 *page = _vm->matchVarToString("acathpage"); - + // Increment the page if it's not the last page if (*page == 49) return; (*page)++; - + // TODO: Play the page turning sound - + // Now update the screen :) _vm->_gfx->updateScreen(); } @@ -410,7 +410,7 @@ void RivenExternal::xblabopenbook(uint16 argc, uint16 *argv) { // Draw the image of the page based on the blabbook variable _vm->_gfx->drawPLST(page); - + // TODO: Draw the dome combo if (page == 14) { warning ("Need to draw dome combo"); @@ -420,12 +420,12 @@ void RivenExternal::xblabopenbook(uint16 argc, uint16 *argv) { void RivenExternal::xblabbookprevpage(uint16 argc, uint16 *argv) { // Get the page variable uint32 *page = _vm->matchVarToString("blabbook"); - + // Decrement the page if it's not the first page if (*page == 1) return; (*page)--; - + // Now update the screen :) _vm->_gfx->updateScreen(); } @@ -433,12 +433,12 @@ void RivenExternal::xblabbookprevpage(uint16 argc, uint16 *argv) { void RivenExternal::xblabbooknextpage(uint16 argc, uint16 *argv) { // Get the page variable uint32 *page = _vm->matchVarToString("blabbook"); - + // Increment the page if it's not the last page if (*page == 22) return; (*page)++; - + // Now update the screen :) _vm->_gfx->updateScreen(); } @@ -446,7 +446,7 @@ void RivenExternal::xblabbooknextpage(uint16 argc, uint16 *argv) { void RivenExternal::xsoundplug(uint16 argc, uint16 *argv) { uint32 heat = *_vm->matchVarToString("bheat"); uint32 boilerInactive = *_vm->matchVarToString("bcratergg"); - + if (heat != 0) _vm->_sound->playSLST(1, _vm->getCurCard()); else if (boilerInactive != 0) @@ -492,7 +492,7 @@ void RivenExternal::xbchangeboiler(uint16 argc, uint16 *argv) { } else if (argv[0] == 3) { if (platform == 0) { if (water == 0) { - _vm->_video->activateMLST(11, _vm->getCurCard()); + _vm->_video->activateMLST(11, _vm->getCurCard()); } else { if (heat == 0) _vm->_video->activateMLST(17, _vm->getCurCard()); @@ -501,7 +501,7 @@ void RivenExternal::xbchangeboiler(uint16 argc, uint16 *argv) { } } else { if (water == 0) { - _vm->_video->activateMLST(9, _vm->getCurCard()); + _vm->_video->activateMLST(9, _vm->getCurCard()); } else { if (heat == 0) _vm->_video->activateMLST(14, _vm->getCurCard()); @@ -510,19 +510,19 @@ void RivenExternal::xbchangeboiler(uint16 argc, uint16 *argv) { } } } - + if (argc > 1) _vm->_sound->playSLST(argv[1], _vm->getCurCard()); else if (argv[0] == 2) _vm->_sound->playSLST(1, _vm->getCurCard()); - + _vm->_video->playMovie(11); } void RivenExternal::xbupdateboiler(uint16 argc, uint16 *argv) { uint32 heat = *_vm->matchVarToString("bheat"); uint32 platform = *_vm->matchVarToString("bblrgrt"); - + if (heat) { if (platform == 0) { _vm->_video->activateMLST(7, _vm->getCurCard()); @@ -534,7 +534,7 @@ void RivenExternal::xbupdateboiler(uint16 argc, uint16 *argv) { } else { // TODO: Stop MLST's 7 and 8 } - + _vm->changeToCard(); } @@ -546,10 +546,10 @@ void RivenExternal::xbcheckcatch(uint16 argc, uint16 *argv) { // TODO: Check if we've caught a Ytram } -void RivenExternal::xbait(uint16 argc, uint16 *argv) { +void RivenExternal::xbait(uint16 argc, uint16 *argv) { // Set the cursor to the pellet _vm->_gfx->changeCursor(kRivenPelletCursor); - + // Loop until the player lets go (or quits) Common::Event event; bool mouseDown = true; @@ -562,13 +562,13 @@ void RivenExternal::xbait(uint16 argc, uint16 *argv) { else if (event.type == Common::EVENT_QUIT || event.type == Common::EVENT_RTL) return; } - + _vm->_system->delayMillis(10); // Take it easy on the CPU } - + // Set back the cursor _vm->_gfx->changeCursor(kRivenMainCursor); - + // Set the bait if we put it on the plate if (_vm->_hotspots[9].rect.contains(_vm->_system->getEventManager()->getMousePos())) { *_vm->matchVarToString("bbait") = 1; @@ -588,7 +588,7 @@ void RivenExternal::xbaitplate(uint16 argc, uint16 *argv) { _vm->_gfx->drawPLST(3); _vm->_gfx->updateScreen(); _vm->_gfx->changeCursor(kRivenPelletCursor); - + // Loop until the player lets go (or quits) Common::Event event; bool mouseDown = true; @@ -601,13 +601,13 @@ void RivenExternal::xbaitplate(uint16 argc, uint16 *argv) { else if (event.type == Common::EVENT_QUIT || event.type == Common::EVENT_RTL) return; } - + _vm->_system->delayMillis(10); // Take it easy on the CPU } - + // Set back the cursor _vm->_gfx->changeCursor(kRivenMainCursor); - + // Set the bait if we put it on the plate, remove otherwise if (_vm->_hotspots[9].rect.contains(_vm->_system->getEventManager()->getMousePos())) { *_vm->matchVarToString("bbait") = 1; @@ -649,15 +649,15 @@ void RivenExternal::xbisland_domecheck(uint16 argc, uint16 *argv) { void RivenExternal::xvalvecontrol(uint16 argc, uint16 *argv) { // Get the variable for the valve uint32 *valve = _vm->matchVarToString("bvalve"); - + Common::Event event; int changeX = 0; int changeY = 0; - + // Set the cursor to the closed position _vm->_gfx->changeCursor(2004); _vm->_system->updateScreen(); - + for (;;) { while (_vm->_system->getEventManager()->pollEvent(event)) { switch (event.type) { @@ -814,7 +814,7 @@ static byte countDepressedIcons(uint32 iconOrderVar) { else if (iconOrderVar >= (1 << 1)) return 1; else - return 0; + return 0; } void RivenExternal::xicon(uint16 argc, uint16 *argv) { @@ -843,7 +843,7 @@ void RivenExternal::xtoggleicon(uint16 argc, uint16 *argv) { // Get the variables uint32 *iconsDepressed = _vm->matchVarToString("jicons"); uint32 *iconOrderVar = _vm->matchVarToString("jiconorder"); - + if (*iconsDepressed & (1 << (argv[0] - 1))) { // The icon is depressed, now unpress it *iconsDepressed &= ~(1 << (argv[0] - 1)); @@ -853,7 +853,7 @@ void RivenExternal::xtoggleicon(uint16 argc, uint16 *argv) { *iconsDepressed |= 1 << (argv[0] - 1); *iconOrderVar = (*iconOrderVar << 5) + argv[0]; } - + // Check if the puzzle is complete now and assign 1 to jrbook if the puzzle is complete. if (*iconOrderVar == *_vm->matchVarToString("jiconcorrectorder")) *_vm->matchVarToString("jrbook") = 1; @@ -862,7 +862,7 @@ void RivenExternal::xtoggleicon(uint16 argc, uint16 *argv) { void RivenExternal::xjtunnel103_pictfix(uint16 argc, uint16 *argv) { // Get the jicons variable which contains which of the stones are depressed in the rebel tunnel puzzle uint32 iconsDepressed = *_vm->matchVarToString("jicons"); - + // Now, draw which icons are depressed based on the bits of the variable if (iconsDepressed & (1 << 0)) _vm->_gfx->drawPLST(2); @@ -883,7 +883,7 @@ void RivenExternal::xjtunnel103_pictfix(uint16 argc, uint16 *argv) { void RivenExternal::xjtunnel104_pictfix(uint16 argc, uint16 *argv) { // Get the jicons variable which contains which of the stones are depressed in the rebel tunnel puzzle uint32 iconsDepressed = *_vm->matchVarToString("jicons"); - + // Now, draw which icons are depressed based on the bits of the variable if (iconsDepressed & (1 << 9)) _vm->_gfx->drawPLST(2); @@ -906,7 +906,7 @@ void RivenExternal::xjtunnel104_pictfix(uint16 argc, uint16 *argv) { void RivenExternal::xjtunnel105_pictfix(uint16 argc, uint16 *argv) { // Get the jicons variable which contains which of the stones are depressed in the rebel tunnel puzzle uint32 iconsDepressed = *_vm->matchVarToString("jicons"); - + // Now, draw which icons are depressed based on the bits of the variable if (iconsDepressed & (1 << 3)) _vm->_gfx->drawPLST(2); @@ -927,7 +927,7 @@ void RivenExternal::xjtunnel105_pictfix(uint16 argc, uint16 *argv) { void RivenExternal::xjtunnel106_pictfix(uint16 argc, uint16 *argv) { // Get the jicons variable which contains which of the stones are depressed in the rebel tunnel puzzle uint32 iconsDepressed = *_vm->matchVarToString("jicons"); - + // Now, draw which icons are depressed based on the bits of the variable if (iconsDepressed & (1 << 16)) _vm->_gfx->drawPLST(2); @@ -949,7 +949,7 @@ void RivenExternal::xjtunnel106_pictfix(uint16 argc, uint16 *argv) { void RivenExternal::xvga1300_carriage(uint16 argc, uint16 *argv) { // TODO: This function is supposed to do a lot more, something like this (pseudocode): - + // Show level pull movie // Set transition up // Change to up card @@ -970,8 +970,8 @@ void RivenExternal::xvga1300_carriage(uint16 argc, uint16 *argv) { // show movie of carriage ascending only // else // show movie of carriage ascending only - - + + // For now, if the gallows base is closed, assume ascension and move to that card. if (*_vm->matchVarToString("jgallows") == 0) _vm->changeToCard(_vm->matchRMAPToCard(0x17167)); @@ -1000,7 +1000,7 @@ void RivenExternal::xjisland3500_domecheck(uint16 argc, uint16 *argv) { int RivenExternal::jspitElevatorLoop() { Common::Event event; int changeLevel = 0; - + _vm->_gfx->changeCursor(2004); _vm->_system->updateScreen(); for (;;) { @@ -1025,21 +1025,21 @@ int RivenExternal::jspitElevatorLoop() { } } _vm->_system->delayMillis(10); - } + } } -void RivenExternal::xhandlecontrolup(uint16 argc, uint16 *argv) { +void RivenExternal::xhandlecontrolup(uint16 argc, uint16 *argv) { int changeLevel = jspitElevatorLoop(); - + if (changeLevel == -1) { // TODO: Run movie _vm->changeToCard(_vm->matchRMAPToCard(0x1e374)); } } -void RivenExternal::xhandlecontroldown(uint16 argc, uint16 *argv) { +void RivenExternal::xhandlecontroldown(uint16 argc, uint16 *argv) { int changeLevel = jspitElevatorLoop(); - + if (changeLevel == 1) { // TODO: Run movie _vm->changeToCard(_vm->matchRMAPToCard(0x1e374)); @@ -1048,7 +1048,7 @@ void RivenExternal::xhandlecontroldown(uint16 argc, uint16 *argv) { void RivenExternal::xhandlecontrolmid(uint16 argc, uint16 *argv) { int changeLevel = jspitElevatorLoop(); - + if (changeLevel == 1) { // TODO: Run movie _vm->changeToCard(_vm->matchRMAPToCard(0x1e597)); @@ -1126,7 +1126,7 @@ void RivenExternal::xorollcredittime(uint16 argc, uint16 *argv) { // You used the trap book... why? What were you thinking? uint32 *gehnState = _vm->matchVarToString("agehn"); - + if (*gehnState == 0) // Gehn who? runEndGame(1); else if (*gehnState == 4) // You freed him? Are you kidding me? @@ -1178,14 +1178,14 @@ void RivenExternal::xogehnopenbook(uint16 argc, uint16 *argv) { void RivenExternal::xogehnbookprevpage(uint16 argc, uint16 *argv) { // Get the page variable uint32 *page = _vm->matchVarToString("ogehnpage"); - + // Decrement the page if it's not the first page if (*page == 1) return; (*page)--; - + // TODO: Play the page turning sound - + // Now update the screen :) _vm->_gfx->updateScreen(); } @@ -1193,14 +1193,14 @@ void RivenExternal::xogehnbookprevpage(uint16 argc, uint16 *argv) { void RivenExternal::xogehnbooknextpage(uint16 argc, uint16 *argv) { // Get the page variable uint32 *page = _vm->matchVarToString("ogehnpage"); - + // Increment the page if it's not the last page if (*page == 13) return; (*page)++; - + // TODO: Play the page turning sound - + // Now update the screen :) _vm->_gfx->updateScreen(); } @@ -1249,7 +1249,7 @@ void RivenExternal::xpisland25_slidermw(uint16 argc, uint16 *argv) { void RivenExternal::xrcredittime(uint16 argc, uint16 *argv) { // Nice going, you used the trap book on Tay. - + // The game chooses what ending based on agehn for us, // so we just have to play the video and credits. // For the record, when agehn == 4, Gehn will thank you for @@ -1326,9 +1326,9 @@ void RivenExternal::xtexterior300_telescopedown(uint16 argc, uint16 *argv) { } } else { // We're not at the bottom, and we can move down again - + // TODO: Down movie, it involves playing a chunk of a movie - + // Now move the telescope down a position and refresh *telescopePos -= 1; _vm->changeToCard(); @@ -1352,7 +1352,7 @@ void RivenExternal::xtexterior300_telescopeup(uint16 argc, uint16 *argv) { } // TODO: Up movie, it involves playing a chunk of a movie - + // Now move the telescope up a position and refresh *telescopePos += 1; _vm->changeToCard(); @@ -1361,16 +1361,16 @@ void RivenExternal::xtexterior300_telescopeup(uint16 argc, uint16 *argv) { void RivenExternal::xtisland390_covercombo(uint16 argc, uint16 *argv) { // Called when clicking the telescope cover buttons. button is the button number (1...5). uint32 *pressedButtons = _vm->matchVarToString("tcovercombo"); - + // We pressed a button! Yay! Add it to the queue. *pressedButtons *= 10; *pressedButtons += argv[0]; - + if (*pressedButtons == *_vm->matchVarToString("tcorrectorder")) { _vm->_hotspots[9].enabled = true; } else { _vm->_hotspots[9].enabled = false; - + // Set the buttons to the last one pressed if we've // pressed more than 5 buttons. if (*pressedButtons > 55555) @@ -1383,14 +1383,14 @@ void RivenExternal::xtatrusgivesbooks(uint16 argc, uint16 *argv) { // Give the player Atrus' Journal and the Trap book *_vm->matchVarToString("aatrusbook") = 1; *_vm->matchVarToString("atrapbook") = 1; - + // Randomize the telescope combination uint32 *teleCombo = _vm->matchVarToString("tcorrectorder"); for (byte i = 0; i < 5; i++) { *teleCombo *= 10; *teleCombo += _rnd->getRandomNumberRng(1, 5); } - + // TODO: Randomize Dome Combination } @@ -1410,7 +1410,7 @@ void RivenExternal::xt7500_checkmarbles(uint16 argc, uint16 *argv) { // TODO: Lots of stuff to do here, eventually we have to check each individual // marble position and set apower based on that. The game handles the video playing // so we don't have to. For the purposes of making the game progress further, we'll - // just turn the power on for now. + // just turn the power on for now. *_vm->matchVarToString("apower") = 1; } diff --git a/engines/mohawk/riven_external.h b/engines/mohawk/riven_external.h index b3b9025d74..2b8a90f8fd 100644 --- a/engines/mohawk/riven_external.h +++ b/engines/mohawk/riven_external.h @@ -22,7 +22,7 @@ * $Id$ * */ - + #ifndef RIVEN_EXTERNAL_H #define RIVEN_EXTERNAL_H @@ -36,9 +36,9 @@ class RivenExternal { public: RivenExternal(MohawkEngine_Riven *vm); ~RivenExternal(); - + void runCommand(uint16 argc, uint16 *argv); - + private: MohawkEngine_Riven *_vm; Common::RandomSource *_rnd; @@ -50,10 +50,10 @@ private: const char *desc; ExternalCmd proc; }; - + Common::Array<RivenExternalCmd*> _externalCommands; void setupCommands(); - + // Supplementary Functions int jspitElevatorLoop(); void runDemoBoundaryDialog(); @@ -77,7 +77,7 @@ private: // Trap Book void xtrapbookback(uint16 argc, uint16 *argv); void xatrapbookclose(uint16 argc, uint16 *argv); - void xatrapbookopen(uint16 argc, uint16 *argv); + void xatrapbookopen(uint16 argc, uint16 *argv); // aspit DVD-specific commands void xarestoregame(uint16 argc, uint16 *argv); // aspit Demo-specific commands @@ -103,15 +103,15 @@ private: void xbaitplate(uint16 argc, uint16 *argv); // Dome void xbisland190_opencard(uint16 argc, uint16 *argv); - void xbisland190_resetsliders(uint16 argc, uint16 *argv); + void xbisland190_resetsliders(uint16 argc, uint16 *argv); void xbisland190_slidermd(uint16 argc, uint16 *argv); - void xbisland190_slidermw(uint16 argc, uint16 *argv); + void xbisland190_slidermw(uint16 argc, uint16 *argv); void xbscpbtn(uint16 argc, uint16 *argv); - void xbisland_domecheck(uint16 argc, uint16 *argv); + void xbisland_domecheck(uint16 argc, uint16 *argv); // Water Control void xvalvecontrol(uint16 argc, uint16 *argv); // Run the Wood Chipper - void xbchipper(uint16 argc, uint16 *argv); + void xbchipper(uint16 argc, uint16 *argv); // ----------------------------------------------------- // gspit (Garden Island) external commands @@ -200,12 +200,12 @@ private: // Prison Elevator void xpisland990_elevcombo(uint16 argc, uint16 *argv); // Param1: button // Dome - void xpscpbtn(uint16 argc, uint16 *argv); - void xpisland290_domecheck(uint16 argc, uint16 *argv); - void xpisland25_opencard(uint16 argc, uint16 *argv); - void xpisland25_resetsliders(uint16 argc, uint16 *argv); - void xpisland25_slidermd(uint16 argc, uint16 *argv); - void xpisland25_slidermw(uint16 argc, uint16 *argv); + void xpscpbtn(uint16 argc, uint16 *argv); + void xpisland290_domecheck(uint16 argc, uint16 *argv); + void xpisland25_opencard(uint16 argc, uint16 *argv); + void xpisland25_resetsliders(uint16 argc, uint16 *argv); + void xpisland25_slidermd(uint16 argc, uint16 *argv); + void xpisland25_slidermw(uint16 argc, uint16 *argv); // ----------------------------------------------------- // rspit (Rebel Age / Tay) external commands @@ -241,12 +241,12 @@ private: void xtisland5056_slidermw(uint16 argc, uint16 *argv); // tspit Demo-specific commands void xtatboundary(uint16 argc, uint16 *argv); - + // ----------------------------------------------------- // Common external commands void xflies(uint16 argc, uint16 *argv); // Start the "flies" realtime effect. u0 seems always 0, u1 is a small number (< 10). }; - + } // End of namespace Mohawk #endif diff --git a/engines/mohawk/riven_saveload.cpp b/engines/mohawk/riven_saveload.cpp index 6c82f63783..74a40a179e 100644 --- a/engines/mohawk/riven_saveload.cpp +++ b/engines/mohawk/riven_saveload.cpp @@ -29,7 +29,7 @@ #include "common/util.h" namespace Mohawk { - + RivenSaveLoad::RivenSaveLoad(MohawkEngine_Riven *vm, Common::SaveFileManager *saveFileMan) : _vm(vm), _saveFileMan(saveFileMan) { _loadFile = new MohawkArchive(); } @@ -138,11 +138,11 @@ bool RivenSaveLoad::loadGame(Common::String filename) { uint16 stackID = 0; uint16 cardID = 0; - + for (uint32 i = 0; i < rawVariables.size() && i < namesCount && !names->eos(); i++) { names->seek(curNamesPos); names->seek(stringOffsets[i], SEEK_CUR); - + Common::String name; char c = (char)names->readByte(); @@ -150,11 +150,11 @@ bool RivenSaveLoad::loadGame(Common::String filename) { name += c; c = (char)names->readByte(); } - + uint32 *var = _vm->matchVarToString(name); - + *var = rawVariables[i]; - + if (!scumm_stricmp(name.c_str(), "CurrentStackID")) stackID = mapOldStackIDToNew(rawVariables[i]); else if (!scumm_stricmp(name.c_str(), "CurrentCardID")) @@ -162,16 +162,16 @@ bool RivenSaveLoad::loadGame(Common::String filename) { else if (!scumm_stricmp(name.c_str(), "ReturnStackID")) *var = mapOldStackIDToNew(rawVariables[i]); } - + _vm->changeToStack(stackID); _vm->changeToCard(cardID); delete names; delete[] stringOffsets; - + // Reset zip mode data _vm->_zipModeData.clear(); - + // Finally, we load in zip mode data. Common::SeekableReadStream *zips = _loadFile->getRawData(ID_ZIPS, 1); uint16 zipsRecordCount = zips->readUint16BE(); @@ -184,12 +184,12 @@ bool RivenSaveLoad::loadGame(Common::String filename) { _vm->_zipModeData.push_back(zip); } delete zips; - + delete _loadFile; _loadFile = NULL; return true; } - + Common::MemoryWriteStreamDynamic *RivenSaveLoad::genVERSSection() { Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic(); if (_vm->getFeatures() & GF_DVD) @@ -198,10 +198,10 @@ Common::MemoryWriteStreamDynamic *RivenSaveLoad::genVERSSection() { stream->writeUint32BE(kCDSaveGameVersion); return stream; } - + Common::MemoryWriteStreamDynamic *RivenSaveLoad::genVARSSection() { Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic(); - + for (uint32 i = 0; i < _vm->getVarCount(); i++) { stream->writeUint32BE(0); // Unknown stream->writeUint32BE(0); // Unknown @@ -210,55 +210,55 @@ Common::MemoryWriteStreamDynamic *RivenSaveLoad::genVARSSection() { return stream; } - + Common::MemoryWriteStreamDynamic *RivenSaveLoad::genNAMESection() { Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic(); - + stream->writeUint16BE((uint16)_vm->getVarCount()); - + uint16 curPos = 0; for (uint16 i = 0; i < _vm->getVarCount(); i++) { stream->writeUint16BE(curPos); curPos += _vm->getGlobalVarName(i).size() + 1; } - + for (uint16 i = 0; i < _vm->getVarCount(); i++) stream->writeUint16BE(i); - + for (uint16 i = 0; i < _vm->getVarCount(); i++) { stream->write(_vm->getGlobalVarName(i).c_str(), _vm->getGlobalVarName(i).size()); stream->writeByte(0); } - + return stream; } - + Common::MemoryWriteStreamDynamic *RivenSaveLoad::genZIPSSection() { Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic(); - + stream->writeUint16BE(_vm->_zipModeData.size()); - + for (uint16 i = 0; i < _vm->_zipModeData.size(); i++) { stream->writeUint16BE(_vm->_zipModeData[i].name.size()); stream->write(_vm->_zipModeData[i].name.c_str(), _vm->_zipModeData[i].name.size()); stream->writeUint16BE(_vm->_zipModeData[i].id); } - + return stream; } bool RivenSaveLoad::saveGame(Common::String filename) { // Note, this code is still WIP. It works quite well for now. - + // Make sure we have the right extension if (!filename.hasSuffix(".rvn") && !filename.hasSuffix(".RVN")) filename += ".rvn"; - + // Convert class variables to variable numbers *_vm->matchVarToString("currentstackid") = mapNewStackIDToOld(_vm->getCurStack()); *_vm->matchVarToString("currentcardid") = _vm->getCurCard(); *_vm->matchVarToString("returnstackid") = mapNewStackIDToOld(*_vm->matchVarToString("returnstackid")); - + Common::OutSaveFile *saveFile; if (!(saveFile = _saveFileMan->openForSaving(filename.c_str()))) return false; @@ -279,7 +279,7 @@ bool RivenSaveLoad::saveGame(Common::String filename) { fileSize += 4; // Type Table Header fileSize += 4 * 8; // Type Table Entries fileSize += 2; // Pseudo-Name entries - + // IFF Header saveFile->writeUint32BE(ID_MHWK); saveFile->writeUint32BE(fileSize); @@ -291,7 +291,7 @@ bool RivenSaveLoad::saveGame(Common::String filename) { saveFile->writeUint32BE(28); // IFF + RSRC saveFile->writeUint16BE(62); // File Table Offset saveFile->writeUint16BE(44); // 4 + 4 * 10 - + //Type Table saveFile->writeUint16BE(36); // After the Type Table Entries saveFile->writeUint16BE(4); // 4 Type Table Entries diff --git a/engines/mohawk/riven_saveload.h b/engines/mohawk/riven_saveload.h index a699878599..cef2bfb7eb 100644 --- a/engines/mohawk/riven_saveload.h +++ b/engines/mohawk/riven_saveload.h @@ -54,7 +54,7 @@ private: MohawkEngine_Riven *_vm; Common::SaveFileManager *_saveFileMan; MohawkArchive *_loadFile; - + Common::MemoryWriteStreamDynamic *genVERSSection(); Common::MemoryWriteStreamDynamic *genNAMESection(); Common::MemoryWriteStreamDynamic *genVARSSection(); diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp index 512354427a..3761ee5308 100644 --- a/engines/mohawk/riven_scripts.cpp +++ b/engines/mohawk/riven_scripts.cpp @@ -46,14 +46,14 @@ RivenScript::~RivenScript() { RivenScriptList RivenScript::readScripts(MohawkEngine_Riven *vm, Common::SeekableReadStream *stream) { RivenScriptList scriptList; - + uint16 scriptCount = stream->readUint16BE(); for (uint16 i = 0; i < scriptCount; i++) { uint16 scriptType = stream->readUint16BE(); uint32 scriptSize = calculateScriptSize(stream); scriptList.push_back(Common::SharedPtr<RivenScript>(new RivenScript(vm, stream->readStream(scriptSize), scriptType))); } - + return scriptList; } @@ -66,7 +66,7 @@ uint32 RivenScript::calculateCommandSize(Common::SeekableReadStream* script) { script->readUint16BE(); // variable to check against uint16 logicBlockCount = script->readUint16BE(); // number of logic blocks commandSize += 6; // 2 + variable + logicBlocks - + for (uint16 i = 0; i < logicBlockCount; i++) { script->readUint16BE(); // Block variable uint16 logicBlockLength = script->readUint16BE(); @@ -82,7 +82,7 @@ uint32 RivenScript::calculateCommandSize(Common::SeekableReadStream* script) { commandSize += 2; } } - + return commandSize; } @@ -90,10 +90,10 @@ uint32 RivenScript::calculateScriptSize(Common::SeekableReadStream* script) { uint32 oldPos = script->pos(); uint16 commandCount = script->readUint16BE(); uint16 scriptSize = 2; // 2 for command count - + for (uint16 i = 0; i < commandCount; i++) scriptSize += calculateCommandSize(script); - + script->seek(oldPos); return scriptSize; } @@ -175,17 +175,17 @@ static void printTabs(byte tabs) { void RivenScript::dumpScript(Common::StringList varNames, Common::StringList xNames, byte tabs) { if (_stream->pos() != 0) _stream->seek(0); - + printTabs(tabs); printf ("Stream Type %d:\n", _scriptType); dumpCommands(varNames, xNames, tabs + 1); } void RivenScript::dumpCommands(Common::StringList varNames, Common::StringList xNames, byte tabs) { uint16 commandCount = _stream->readUint16BE(); - + for (uint16 i = 0; i < commandCount; i++) { uint16 command = _stream->readUint16BE(); - + if (command == 8) { // "Switch" Statement if (_stream->readUint16BE() != 2) warning ("if-then-else unknown value is not 2"); @@ -194,7 +194,7 @@ void RivenScript::dumpCommands(Common::StringList varNames, Common::StringList x uint16 logicBlockCount = _stream->readUint16BE(); for (uint16 j = 0; j < logicBlockCount; j++) { uint16 varCheck = _stream->readUint16BE(); - printTabs(tabs + 1); + printTabs(tabs + 1); if (varCheck == 0xFFFF) printf("default:\n"); else @@ -269,7 +269,7 @@ void RivenScript::processCommands(bool runCommands) { // And don't run it if another block has already evaluated to true (needed for the default case) runBlock = (*_vm->getLocalVar(var) == checkValue || checkValue == 0xffff) && runCommands && !anotherBlockEvaluated; processCommands(runBlock); - + if (runBlock) anotherBlockEvaluated = true; } @@ -305,7 +305,7 @@ void RivenScript::drawBitmap(uint16 op, uint16 argc, uint16 *argv) { // Copy the image to a certain part of the screen _vm->_gfx->copyImageToScreen(argv[0], argv[1], argv[2], argv[3], argv[4]); } - + // Now, update the screen _vm->_gfx->updateScreen(); } @@ -330,9 +330,9 @@ void RivenScript::playScriptSLST(uint16 op, uint16 argc, uint16 *argv) { slstRecord.sound_ids[j] = argv[offset++]; slstRecord.fade_flags = argv[offset++]; slstRecord.loop = argv[offset++]; - slstRecord.global_volume = argv[offset++]; - slstRecord.u0 = argv[offset++]; - slstRecord.u1 = argv[offset++]; + slstRecord.global_volume = argv[offset++]; + slstRecord.u0 = argv[offset++]; + slstRecord.u1 = argv[offset++]; slstRecord.volumes = new uint16[slstRecord.sound_count]; slstRecord.balances = new int16[slstRecord.sound_count]; @@ -454,7 +454,7 @@ void RivenScript::incrementVariable(uint16 op, uint16 argc, uint16 *argv) { void RivenScript::changeStack(uint16 op, uint16 argc, uint16 *argv) { Common::String stackName = _vm->getName(StackNames, argv[0]); int8 index = -1; - + for (byte i = 0; i < 8; i++) if (!scumm_stricmp(_vm->getStackName(i).c_str(), stackName.c_str())) { index = i; @@ -463,7 +463,7 @@ void RivenScript::changeStack(uint16 op, uint16 argc, uint16 *argv) { if (index == -1) error ("\'%s\' is not a stack name!", stackName.c_str()); - + _vm->changeToStack(index); uint32 rmapCode = (argv[1] << 16) + argv[2]; uint16 cardID = _vm->matchRMAPToCard(rmapCode); @@ -512,7 +512,7 @@ void RivenScript::unk_36(uint16 op, uint16 argc, uint16 *argv) { // Command 37: fade ambient sounds void RivenScript::fadeAmbientSounds(uint16 op, uint16 argc, uint16 *argv) { - warning("STUB: fadeAmbientSounds()"); + warning("STUB: fadeAmbientSounds()"); } // Command 38: Play a movie with extra parameters (movie id, delay high, delay low, record type, record id) @@ -532,7 +532,7 @@ void RivenScript::complexPlayMovie(uint16 op, uint16 argc, uint16 *argv) { // Command 39: activate PLST record (card picture lists) void RivenScript::activatePLST(uint16 op, uint16 argc, uint16 *argv) { _vm->_gfx->drawPLST(argv[0]); - + // An update is automatically sent here as long as it's not a load or update script and updates are enabled. if (_scriptType != kCardLoadScript && _scriptType != kCardUpdateScript) _vm->_gfx->updateScreen(); @@ -560,18 +560,18 @@ void RivenScript::activateMLSTAndPlay(uint16 op, uint16 argc, uint16 *argv) { void RivenScript::activateBLST(uint16 op, uint16 argc, uint16 *argv) { Common::SeekableReadStream* blst = _vm->getRawData(ID_BLST, _vm->getCurCard()); uint16 recordCount = blst->readUint16BE(); - + for (uint16 i = 0; i < recordCount; i++) { uint16 index = blst->readUint16BE(); // record index uint16 enabled = blst->readUint16BE(); uint16 hotspotID = blst->readUint16BE(); - + if (argv[0] == index) for (uint16 j = 0; j < _vm->getHotspotCount(); j++) if (_vm->_hotspots[j].blstID == hotspotID) _vm->_hotspots[j].enabled = (enabled == 1); } - + delete blst; } @@ -579,13 +579,13 @@ void RivenScript::activateBLST(uint16 op, uint16 argc, uint16 *argv) { void RivenScript::activateFLST(uint16 op, uint16 argc, uint16 *argv) { Common::SeekableReadStream* flst = _vm->getRawData(ID_FLST, _vm->getCurCard()); uint16 recordCount = flst->readUint16BE(); - + for (uint16 i = 0; i < recordCount; i++) { uint16 index = flst->readUint16BE(); uint16 sfxeID = flst->readUint16BE(); if(flst->readUint16BE() != 0) warning("FLST u0 non-zero"); - + if (index == argv[0]) { _vm->_gfx->scheduleWaterEffect(sfxeID); break; @@ -599,7 +599,7 @@ void RivenScript::activateFLST(uint16 op, uint16 argc, uint16 *argv) { void RivenScript::zipMode(uint16 op, uint16 argc, uint16 *argv) { // Check the ZIPS records to see if we have a match to the hotspot name Common::String hotspotName = _vm->getHotspotName(_vm->getCurHotspot()); - + for (uint16 i = 0; i < _vm->_zipModeData.size(); i++) if (_vm->_zipModeData[i].name == hotspotName) { _vm->changeToCard(_vm->_zipModeData[i].id); diff --git a/engines/mohawk/riven_scripts.h b/engines/mohawk/riven_scripts.h index 36fce259f0..2879fa014d 100644 --- a/engines/mohawk/riven_scripts.h +++ b/engines/mohawk/riven_scripts.h @@ -53,14 +53,14 @@ class RivenScript { public: RivenScript(MohawkEngine_Riven *vm, Common::SeekableReadStream *stream, uint16 scriptType); ~RivenScript(); - + void runScript(); void dumpScript(Common::StringList varNames, Common::StringList xNames, byte tabs); uint16 getScriptType() { return _scriptType; } - + // Read in an array of script objects from a stream static RivenScriptList readScripts(MohawkEngine_Riven *vm, Common::SeekableReadStream *stream); - + private: typedef void (RivenScript::*OpcodeProcRiven)(uint16 op, uint16 argc, uint16 *argv); struct RivenOpcode { @@ -69,17 +69,17 @@ private: }; const RivenOpcode* _opcodes; void setupOpcodes(); - + MohawkEngine_Riven *_vm; Common::SeekableReadStream *_stream; uint16 _scriptType; - + void dumpCommands(Common::StringList varNames, Common::StringList xNames, byte tabs); void processCommands(bool runCommands); - + static uint32 calculateCommandSize(Common::SeekableReadStream* script); static uint32 calculateScriptSize(Common::SeekableReadStream* script); - + DECLARE_OPCODE(empty) { warning ("Unknown Opcode %04x", op); } //Opcodes diff --git a/engines/mohawk/riven_vars.cpp b/engines/mohawk/riven_vars.cpp index 263ace2b78..ed540cd82e 100644 --- a/engines/mohawk/riven_vars.cpp +++ b/engines/mohawk/riven_vars.cpp @@ -29,7 +29,7 @@ namespace Mohawk { -// The Riven variable system is complex. The scripts of each stack give a number, but the number has to be matched +// The Riven variable system is complex. The scripts of each stack give a number, but the number has to be matched // to a variable name defined in NAME resource 4. static const char *variableNames[] = { @@ -51,7 +51,7 @@ static const char *variableNames[] = { "atrapbook", "auservolume", "azip", - + // bspit "bbacklock", "bbait", @@ -94,7 +94,7 @@ static const char *variableNames[] = { "bytramtime", "bytrap", "bytrapped", - + // gspit "gbook", "gcathtime", @@ -126,7 +126,7 @@ static const char *variableNames[] = { "gupmoov", "gwhark", "gwharktime", - + // jspit "jwmagcar", "jbeetle", @@ -175,7 +175,7 @@ static const char *variableNames[] = { "jwmouth", "jwmagcar", "jymagcar", - + // ospit "oambient", "obutton", @@ -185,7 +185,7 @@ static const char *variableNames[] = { "omusicplayer", "ostanddrawer", "ostove", - + // pspit "pbook", "pcage", @@ -200,13 +200,13 @@ static const char *variableNames[] = { "prightpos", "ptemp", "pwharkpos", - + // rspit "rrebel", "rrebelview", "rrichard", "rvillagetime", - + // tspit "tbars", "tbeetle", @@ -248,7 +248,7 @@ static const char *variableNames[] = { "twabrvalve", "twaffle", "tyellow", - + // Miscellaneous "elevbtn1", "elevbtn2", @@ -298,11 +298,11 @@ void MohawkEngine_Riven::initVars() { _varCount = ARRAYSIZE(variableNames); _vars = new uint32[_varCount]; - + // Temporary: for (uint32 i = 0; i < _varCount; i++) _vars[i] = 0; - + // Init Variables to their correct starting state. *matchVarToString("ttelescope") = 5; *matchVarToString("tgatestate") = 1; diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp index 30d084108d..9d7dc3ae49 100644 --- a/engines/mohawk/sound.cpp +++ b/engines/mohawk/sound.cpp @@ -39,12 +39,12 @@ Sound::Sound(MohawkEngine* vm) : _vm(vm) { _rivenSoundFile = NULL; _midiDriver = NULL; _midiParser = NULL; - + for (uint32 i = 0; i < _handles.size(); i++) { _handles[i].handle = Audio::SoundHandle(); _handles[i].type = kFreeHandle; } - + initMidi(); } @@ -52,12 +52,12 @@ Sound::~Sound() { stopSound(); stopAllSLST(); delete _rivenSoundFile; - + if (_midiDriver) { _midiDriver->close(); delete _midiDriver; } - + if (_midiParser) { _midiParser->unloadMusic(); delete _midiParser; @@ -69,18 +69,18 @@ void Sound::loadRivenSounds(uint16 stack) { if (!_rivenSoundFile) _rivenSoundFile = new MohawkArchive(); - + _rivenSoundFile->open(Common::String(prefixes[stack]) + "_Sounds.mhk"); } void Sound::initMidi() { if (!(_vm->getFeatures() & GF_HASMIDI)) return; - + // Let's get our MIDI parser/driver _midiParser = MidiParser::createParser_SMF(); _midiDriver = MidiDriver::createMidi(MidiDriver::detectMusicDriver(MDT_ADLIB|MDT_MIDI)); - + // Set up everything! _midiDriver->open(); _midiParser->setMidiDriver(_midiDriver); @@ -89,10 +89,10 @@ void Sound::initMidi() { Audio::SoundHandle *Sound::playSound(uint16 id, bool mainSoundFile, byte volume, bool loop) { debug (0, "Playing sound %d", id); - + SndHandle *handle = getHandle(); handle->type = kUsedHandle; - + Audio::AudioStream *audStream = NULL; switch (_vm->getGameType()) { @@ -108,7 +108,7 @@ Audio::SoundHandle *Sound::playSound(uint16 id, bool mainSoundFile, byte volume, id = mjmpStream->readUint16LE(); delete mjmpStream; } - + audStream = Audio::makeWAVStream(_vm->getRawData(ID_MSND, id), DisposeAfterUse::YES); } else audStream = makeMohawkWaveStream(_vm->getRawData(ID_MSND, id)); @@ -134,16 +134,16 @@ Audio::SoundHandle *Sound::playSound(uint16 id, bool mainSoundFile, byte volume, default: audStream = makeMohawkWaveStream(_vm->getRawData(ID_TWAV, id)); } - + if (audStream) { // Set the stream to loop here if it's requested if (loop) audStream = Audio::makeLoopingAudioStream((Audio::RewindableAudioStream *)audStream, 0); - + _vm->_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &handle->handle, audStream, -1, volume); return &handle->handle; } - + return NULL; } @@ -155,36 +155,36 @@ void Sound::playMidi(uint16 id) { } assert(_midiDriver && _midiParser); - + _midiParser->unloadMusic(); Common::SeekableReadStream *midi = _vm->getRawData(ID_TMID, id); - + idTag = midi->readUint32BE(); assert(idTag == ID_MHWK); midi->readUint32BE(); // Skip size idTag = midi->readUint32BE(); assert(idTag == ID_MIDI); - + byte *midiData = (byte *)malloc(midi->size() - 12); // Enough to cover MThd/Prg#/MTrk - + // Read the MThd Data midi->read(midiData, 14); - + // TODO: Load patches from the Prg# section... skip it for now. idTag = midi->readUint32BE(); assert(idTag == ID_PRG); midi->skip(midi->readUint32BE()); - + // Read the MTrk Data uint32 mtrkSize = midi->size() - midi->pos(); midi->read(midiData + 14, mtrkSize); - + delete midi; // Now, play it :) if (!_midiParser->loadMusic(midiData, 14 + mtrkSize)) error ("Could not play MIDI music from tMID %04x\n", id); - + _midiDriver->setTimerCallback(_midiParser, MidiParser::timerCallback); } @@ -192,7 +192,7 @@ void Sound::playSLST(uint16 index, uint16 card) { Common::SeekableReadStream *slstStream = _vm->getRawData(ID_SLST, card); SLSTRecord slstRecord; uint16 recordCount = slstStream->readUint16BE(); - + for (uint16 i = 0; i < recordCount; i++) { slstRecord.index = slstStream->readUint16BE(); slstRecord.sound_count = slstStream->readUint16BE(); @@ -236,13 +236,13 @@ void Sound::playSLST(uint16 index, uint16 card) { delete slstStream; return; } - + delete[] slstRecord.sound_ids; delete[] slstRecord.volumes; delete[] slstRecord.balances; delete[] slstRecord.u2; } - + delete slstStream; // No matching records, assume we need to stop all SLST's stopAllSLST(); @@ -258,7 +258,7 @@ void Sound::playSLST(SLSTRecord slstRecord) { if (noLongerPlay) stopSLSTSound(i, (slstRecord.fade_flags & 1) != 0); } - + // Start new sounds for (uint16 i = 0; i < slstRecord.sound_count; i++) { bool alreadyPlaying = false; @@ -295,24 +295,24 @@ void Sound::playSLSTSound(uint16 id, bool fade, bool loop, uint16 volume, int16 sndHandle.handle = new Audio::SoundHandle(); sndHandle.id = id; _currentSLSTSounds.push_back(sndHandle); - + Audio::AudioStream *audStream = makeMohawkWaveStream(_rivenSoundFile->getRawData(ID_TWAV, id)); - + // Loop here if necessary if (loop) audStream = Audio::makeLoopingAudioStream((Audio::RewindableAudioStream *)audStream, 0); - + // The max mixer volume is 255 and the max Riven volume is 256. Just change it to 255. if (volume == 256) volume = 255; - + // TODO: Handle fading, possibly just raise the volume of the channel in increments? - + _vm->_mixer->playInputStream(Audio::Mixer::kPlainSoundType, sndHandle.handle, audStream, -1, volume, convertBalance(balance)); } void Sound::stopSLSTSound(uint16 index, bool fade) { - // TODO: Fade out, mixer needs to be extended to get volume on a handle + // TODO: Fade out, mixer needs to be extended to get volume on a handle _vm->_mixer->stopHandle(*_currentSLSTSounds[index].handle); _currentSLSTSounds.remove_at(index); } @@ -371,7 +371,7 @@ Audio::AudioStream *Sound::makeMohawkWaveStream(Common::SeekableReadStream *stre adpc.itemCount = stream->readUint16BE(); adpc.channels = stream->readUint16BE(); adpc.statusItems = new ADPC_Chunk::StatusItem[adpc.itemCount]; - + assert(adpc.channels <= 2); for (uint16 i = 0; i < adpc.itemCount; i++) { @@ -380,7 +380,7 @@ Audio::AudioStream *Sound::makeMohawkWaveStream(Common::SeekableReadStream *stre for (uint16 j = 0; j < adpc.channels; j++) adpc.statusItems[i].channelStatus[j] = stream->readUint32BE(); } - + delete[] adpc.statusItems; break; case ID_CUE: @@ -398,7 +398,7 @@ Audio::AudioStream *Sound::makeMohawkWaveStream(Common::SeekableReadStream *stre // chunk are for looping. Since it was only used in Myst, it was // always 10 0's, Tito just thought it was useless. I'm still not // sure what purpose this has. - + cue.size = stream->readUint32BE(); cue.point_count = stream->readUint16BE(); @@ -446,7 +446,7 @@ Audio::AudioStream *Sound::makeMohawkWaveStream(Common::SeekableReadStream *stre error ("Unknown tag found in 'tWAV' chunk -- \'%s\'", tag2str(tag)); } } - + // makeMohawkWaveStream always takes control of the original stream delete stream; @@ -482,7 +482,7 @@ Audio::AudioStream *Sound::makeOldMohawkWaveStream(Common::SeekableReadStream *s uint16 header = stream->readUint16BE(); uint16 rate = 0; uint32 size = 0; - + if (header == 'Wv') { // Big Endian rate = stream->readUint16BE(); stream->skip(10); // Loop chunk, like the newer format? @@ -493,12 +493,12 @@ Audio::AudioStream *Sound::makeOldMohawkWaveStream(Common::SeekableReadStream *s size = stream->readUint32LE(); } else error("Could not find Old Mohawk Sound header"); - + assert(size); byte *data = (byte *)malloc(size); stream->read(data, size); delete stream; - + return Audio::makeRawMemoryStream(data, size, rate, Audio::FLAG_UNSIGNED); } diff --git a/engines/mohawk/sound.h b/engines/mohawk/sound.h index eb545a4752..9757f15095 100644 --- a/engines/mohawk/sound.h +++ b/engines/mohawk/sound.h @@ -76,7 +76,7 @@ struct ADPC_Chunk { // Holds ADPCM status data, but is irrelevant for uint32 size; uint16 itemCount; uint16 channels; - + struct StatusItem { uint32 sampleFrame; uint32 channelStatus[MAX_CHANNELS]; @@ -118,7 +118,7 @@ class Sound { public: Sound(MohawkEngine*); ~Sound(); - + void loadRivenSounds(uint16 stack); Audio::SoundHandle *playSound(uint16 id, bool mainSoundFile = true, byte volume = Audio::Mixer::kMaxChannelVolume, bool loop = false); void playMidi(uint16 id); @@ -144,7 +144,7 @@ private: Common::Array<SndHandle> _handles; SndHandle *getHandle(); - + // Riven specific void playSLSTSound(uint16 index, bool fade, bool loop, uint16 volume, int16 balance); void stopSLSTSound(uint16 id, bool fade); diff --git a/engines/mohawk/video/cinepak.cpp b/engines/mohawk/video/cinepak.cpp index c5289806cf..48883ceab9 100644 --- a/engines/mohawk/video/cinepak.cpp +++ b/engines/mohawk/video/cinepak.cpp @@ -31,7 +31,7 @@ // Code here partially based off of ffmpeg ;) namespace Mohawk { - + #define PUT_PIXEL(offset, lum, u, v) \ Graphics::CPYUV2RGB(lum, u, v, r, g, b); \ if (_pixelFormat.bytesPerPixel == 2) \ @@ -68,7 +68,7 @@ Graphics::Surface *CinepakDecoder::decodeImage(Common::SeekableReadStream *strea _curFrame.strips = new CinepakStrip[_curFrame.stripCount]; debug (4, "Cinepak Frame: Width = %d, Height = %d, Strip Count = %d", _curFrame.width, _curFrame.height, _curFrame.stripCount); - + #if 0 // Borrowed from FFMPEG. This should cut out the extra data Cinepak for Sega has (which is useless). // The theory behind this is that this is here to confuse standard Cinepak decoders. But, we won't let that happen! ;) @@ -146,7 +146,7 @@ Graphics::Surface *CinepakDecoder::decodeImage(Common::SeekableReadStream *strea _y = _curFrame.strips[i].rect.bottom; } - + return _curFrame.surface; } diff --git a/engines/mohawk/video/cinepak.h b/engines/mohawk/video/cinepak.h index a94d879bdb..43cc22bfc9 100644 --- a/engines/mohawk/video/cinepak.h +++ b/engines/mohawk/video/cinepak.h @@ -55,7 +55,7 @@ struct CinepakFrame { uint16 height; uint16 stripCount; CinepakStrip *strips; - + Graphics::Surface *surface; }; @@ -70,7 +70,7 @@ private: CinepakFrame _curFrame; int32 _y; Graphics::PixelFormat _pixelFormat; - + void loadCodebook(Common::SeekableReadStream *stream, uint16 strip, byte codebookType, byte chunkID, uint32 chunkSize); void decodeVectors(Common::SeekableReadStream *stream, uint16 strip, byte chunkID, uint32 chunkSize); }; diff --git a/engines/mohawk/video/qdm2.cpp b/engines/mohawk/video/qdm2.cpp index f5d4af8aed..b91440f00d 100644 --- a/engines/mohawk/video/qdm2.cpp +++ b/engines/mohawk/video/qdm2.cpp @@ -147,9 +147,9 @@ static inline void skipBits(GetBitContext *s, int n) { static int splitRadixPermutation(int i, int n, int inverse) { if (n <= 2) return i & 1; - + int m = n >> 1; - + if(!(i & m)) return splitRadixPermutation(i, m, inverse) * 2; @@ -547,10 +547,10 @@ int fftInit(FFTContext *s, int nbits, int inverse) { // compute bit reverse table for (i = 0; i < n; i++) { m = 0; - + for (j = 0; j < nbits; j++) m |= ((i >> j) & 1) << (nbits - j - 1); - + s->revtab[i] = m; } } @@ -616,7 +616,7 @@ void rdftCalc(RDFTContext *s, float *data) { ev.re = data[0]; data[0] = ev.re + data[1]; data[1] = ev.re - data[1]; - + int i; for (i = 1; i < n >> 2; i++) { @@ -843,7 +843,7 @@ static void dct32(int32 *out, int32 *tab) { // pass 1 BF( 7, 24, COS0_7 , 1); BF( 8, 23, COS0_8 , 1); - // pass 2 + // pass 2 BF( 7, 8, COS1_7 , 4); BF(23, 24,-COS1_7 , 4); // pass 3 @@ -854,7 +854,7 @@ static void dct32(int32 *out, int32 *tab) { // pass 1 BF( 3, 28, COS0_3 , 1); BF(12, 19, COS0_12, 2); - // pass 2 + // pass 2 BF( 3, 12, COS1_3 , 1); BF(19, 28,-COS1_3 , 1); // pass 1 @@ -1537,12 +1537,12 @@ QDM2Stream::QDM2Stream(Common::SeekableReadStream *stream, Common::SeekableReadS warning("QDM2Stream::QDM2Stream() extraSize mismatch - Expected %d", (extraData->size() - extraData->pos()) / 4 + 1); if (tmp_s < 12) error("QDM2Stream::QDM2Stream() Insufficient extraData"); - + tmp = extraData->readUint32BE(); debug(1, "QDM2Stream::QDM2Stream() extraTag: %d", tmp); if (tmp != MKID_BE('frma')) warning("QDM2Stream::QDM2Stream() extraTag mismatch"); - + tmp = extraData->readUint32BE(); debug(1, "QDM2Stream::QDM2Stream() extraType: %d", tmp); if (tmp == MKID_BE('QDMC')) @@ -2609,7 +2609,7 @@ void QDM2Stream::qdm2_decode_super_block(void) { // **************************************************************** } -void QDM2Stream::qdm2_fft_init_coefficient(int sub_packet, int offset, int duration, +void QDM2Stream::qdm2_fft_init_coefficient(int sub_packet, int offset, int duration, int channel, int exp, int phase) { if (_fftCoefsMinIndex[duration] < 0) _fftCoefsMinIndex[duration] = _fftCoefsIndex; @@ -2904,7 +2904,7 @@ void QDM2Stream::qdm2_calculate_fft(int channel) { //debug(1, "QDM2Stream::qdm2_calculate_fft _fft.complex[channel][0].im: %lf", _fft.complex[channel][0].im); rdftCalc(&_rdftCtx, (float *)_fft.complex[channel]); - + // add samples to output buffer for (i = 0; i < ((_fftFrameSize + 15) & ~15); i++) _outputBuffer[_channels * i + channel] += ((float *) _fft.complex[channel])[i] * gain; diff --git a/engines/mohawk/video/qdm2.h b/engines/mohawk/video/qdm2.h index 1a08064b0b..a2f55a10ac 100644 --- a/engines/mohawk/video/qdm2.h +++ b/engines/mohawk/video/qdm2.h @@ -224,7 +224,7 @@ private: uint8 _subPacket; // 0 to 15 int _noiseIdx; // index for dithering noise table - + byte _emptyBuffer[FF_INPUT_BUFFER_PADDING_SIZE]; VLC _vlcTabLevel; @@ -253,7 +253,7 @@ private: float _noiseSamples[128]; void initNoiseSamples(void); - + RDFTContext _rdftCtx; void average_quantized_coeffs(void); @@ -272,7 +272,7 @@ private: void process_subpacket_12(QDM2SubPNode *node, int length); void process_synthesis_subpackets(QDM2SubPNode *list); void qdm2_decode_super_block(void); - void qdm2_fft_init_coefficient(int sub_packet, int offset, int duration, + void qdm2_fft_init_coefficient(int sub_packet, int offset, int duration, int channel, int exp, int phase); void qdm2_fft_decode_tones(int duration, GetBitContext *gb, int b); void qdm2_decode_fft_packets(void); diff --git a/engines/mohawk/video/qt_player.cpp b/engines/mohawk/video/qt_player.cpp index b35f43ca2d..cddecbae9e 100644 --- a/engines/mohawk/video/qt_player.cpp +++ b/engines/mohawk/video/qt_player.cpp @@ -52,7 +52,7 @@ namespace Mohawk { //////////////////////////////////////////// -// QTPlayer +// QTPlayer //////////////////////////////////////////// QTPlayer::QTPlayer() { @@ -73,35 +73,35 @@ QTPlayer::~QTPlayer() { uint16 QTPlayer::getWidth() { if (_videoStreamIndex < 0) return 0; - + return _streams[_videoStreamIndex]->width; } uint16 QTPlayer::getHeight() { if (_videoStreamIndex < 0) return 0; - + return _streams[_videoStreamIndex]->height; } uint32 QTPlayer::getFrameCount() { if (_videoStreamIndex < 0) return 0; - + return _streams[_videoStreamIndex]->nb_frames; } byte QTPlayer::getBitsPerPixel() { if (_videoStreamIndex < 0) return 0; - + return _streams[_videoStreamIndex]->bits_per_sample & 0x1F; } uint32 QTPlayer::getCodecTag() { if (_videoStreamIndex < 0) return 0; - + return _streams[_videoStreamIndex]->codec_tag; } @@ -115,7 +115,7 @@ ScaleMode QTPlayer::getScaleMode() { uint32 QTPlayer::getFrameDuration() { if (_videoStreamIndex < 0) return 0; - + uint32 curFrameIndex = 0; for (int32 i = 0; i < _streams[_videoStreamIndex]->stts_count; i++) { curFrameIndex += _streams[_videoStreamIndex]->stts_data[i].count; @@ -124,7 +124,7 @@ uint32 QTPlayer::getFrameDuration() { return _streams[_videoStreamIndex]->stts_data[i].duration * 1000 * 100 / _streams[_videoStreamIndex]->time_scale; } } - + // This should never occur error ("Cannot find duration for frame %d", _curFrame); return 0; @@ -132,10 +132,10 @@ uint32 QTPlayer::getFrameDuration() { void QTPlayer::stop() { stopAudio(); - + if (!_noCodecFound) delete _videoCodec; - + closeFile(); } @@ -182,14 +182,14 @@ Graphics::Codec *QTPlayer::createCodec(uint32 codecTag, byte bitsPerPixel) { } else { warning ("Unsupported codec \'%s\'", tag2str(codecTag)); } - + return NULL; } void QTPlayer::startAudio() { if (!_audStream) // No audio/audio not supported return; - + g_system->getMixer()->playInputStream(Audio::Mixer::kPlainSoundType, &_audHandle, _audStream); } @@ -205,19 +205,19 @@ void QTPlayer::stopAudio() { g_system->getMixer()->stopHandle(_audHandle); } -Graphics::Surface *QTPlayer::getNextFrame() { +Graphics::Surface *QTPlayer::getNextFrame() { if (_noCodecFound || _curFrame >= (int32)getFrameCount() - 1) return NULL; - + if (_nextFrameStart == 0) _nextFrameStart = g_system->getMillis() * 100; - + _lastFrameStart = _nextFrameStart; _curFrame++; _nextFrameStart = getFrameDuration() + _lastFrameStart; - + Common::SeekableReadStream *frameData = getNextFramePacket(); - + if (!_videoCodec) { _videoCodec = createCodec(getCodecTag(), getBitsPerPixel()); // If we don't get it still, the codec is unsupported ;) @@ -261,7 +261,7 @@ bool QTPlayer::loadFile(Common::SeekableReadStream *stream) { MOVatom atom = { 0, 0, 0xffffffff }; - if (readDefault(atom) < 0 || (!_foundMOOV && !_foundMDAT)) + if (readDefault(atom) < 0 || (!_foundMOOV && !_foundMDAT)) return false; debug(0, "on_parse_exit_offset=%d", _fd->pos()); @@ -297,22 +297,22 @@ bool QTPlayer::loadFile(Common::SeekableReadStream *stream) { sc->ffindex = i; sc->is_ff_stream = 1; - + if (sc->codec_type == CODEC_TYPE_VIDEO && _videoStreamIndex < 0) _videoStreamIndex = i; else if (sc->codec_type == CODEC_TYPE_AUDIO && _audioStreamIndex < 0) _audioStreamIndex = i; } - + if (_audioStreamIndex >= 0 && checkAudioCodecSupport(_streams[_audioStreamIndex]->codec_tag)) { _audStream = Audio::makeQueuingAudioStream(_streams[_audioStreamIndex]->sample_rate, _streams[_audioStreamIndex]->channels == 2); _curAudioChunk = 0; - + // Make sure the bits per sample transfers to the sample size if (_streams[_audioStreamIndex]->codec_tag == MKID_BE('raw ') || _streams[_audioStreamIndex]->codec_tag == MKID_BE('twos')) _streams[_audioStreamIndex]->sample_size = (_streams[_audioStreamIndex]->bits_per_sample / 8) * _streams[_audioStreamIndex]->channels; } - + return true; } @@ -359,29 +359,29 @@ int QTPlayer::readDefault(MOVatom atom) { while(((total_size + 8) < atom.size) && !_fd->eos() && !err) { a.size = atom.size; a.type = 0; - + if (atom.size >= 8) { a.size = _fd->readUint32BE(); a.type = _fd->readUint32BE(); } - + total_size += 8; a.offset += 8; debug(4, "type: %08x %.4s sz: %x %x %x", a.type, tag2str(a.type), a.size, atom.size, total_size); - + if (a.size == 1) { // 64 bit extended size warning("64 bit extended size is not supported in QuickTime"); return -1; } - + if (a.size == 0) { a.size = atom.size - total_size; if (a.size <= 8) break; } - + uint32 i = 0; - + for (; _parseTable[i].type != 0 && _parseTable[i].type != a.type; i++) // empty; @@ -397,9 +397,9 @@ int QTPlayer::readDefault(MOVatom atom) { } else { uint32 start_pos = _fd->pos(); err = (this->*_parseTable[i].func)(a); - + uint32 left = a.size - _fd->pos() + start_pos; - + if (left > 0) // skip garbage at atom end _fd->seek(left, SEEK_CUR); } @@ -445,40 +445,40 @@ int QTPlayer::readCMOV(MOVatom atom) { warning("Unknown cmov compression type"); return -1; } - + // Read in the cmvd atom uint32 compressedSize = _fd->readUint32BE() - 12; if (_fd->readUint32BE() != MKID_BE('cmvd')) return -1; uint32 uncompressedSize = _fd->readUint32BE(); - + // Read in data byte *compressedData = (byte *)malloc(compressedSize); _fd->read(compressedData, compressedSize); - + // Create uncompressed stream byte *uncompressedData = (byte *)malloc(uncompressedSize); - + // Uncompress the data unsigned long dstLen = uncompressedSize; if (!Common::uncompress(uncompressedData, &dstLen, compressedData, compressedSize)) { warning ("Could not uncompress cmov chunk"); return -1; } - + // Load data into a new MemoryReadStream and assign _fd to be that Common::SeekableReadStream *oldStream = _fd; _fd = new Common::MemoryReadStream(uncompressedData, uncompressedSize, DisposeAfterUse::YES); - + // Read the contents of the uncompressed data MOVatom a = { MKID_BE('moov'), 0, uncompressedSize }; int err = readDefault(a); - + // Assign the file handle back to the original handle free(compressedData); delete _fd; _fd = oldStream; - + return err; #else warning ("zlib not found, cannot read QuickTime cmov atom"); @@ -498,7 +498,7 @@ int QTPlayer::readMVHD(MOVatom atom) { _fd->readUint32BE(); // creation time _fd->readUint32BE(); // modification time } - + _timeScale = _fd->readUint32BE(); // time scale debug(0, "time scale = %i\n", _timeScale); @@ -593,7 +593,7 @@ int QTPlayer::readTKHD(MOVatom atom) { _fd->readUint32BE(); // creation time _fd->readUint32BE(); // modification time } - + /* st->id = */_fd->readUint32BE(); // track id (NOT 0 !) _fd->readUint32BE(); // reserved //st->start_time = 0; // check @@ -605,7 +605,7 @@ int QTPlayer::readTKHD(MOVatom atom) { _fd->readUint16BE(); // alternate group _fd->readUint16BE(); // volume _fd->readUint16BE(); // reserved - + // We only need the two values from the displacement matrix for a track. // See readMVHD() for more information. uint32 xMod = _fd->readUint32BE(); @@ -643,9 +643,9 @@ int QTPlayer::readELST(MOVatom atom) { _fd->readUint32BE(); // Media time _fd->readUint32BE(); // Media rate } - + debug(0, "track[%i].edit_count = %i", _numStreams - 1, _streams[_numStreams - 1]->edit_count); - + if (editCount != 1) warning("Multiple edit list entries. Things may go awry"); @@ -743,7 +743,7 @@ int QTPlayer::readSTSD(MOVatom atom) { if (st->codec_type == CODEC_TYPE_VIDEO) { debug(0, "Video Codec FourCC: \'%s\'", tag2str(format)); - + _fd->readUint16BE(); // version _fd->readUint16BE(); // revision level _fd->readUint32BE(); // vendor @@ -804,7 +804,7 @@ int QTPlayer::readSTSD(MOVatom atom) { #if 0 byte *color_table; byte r, g, b; - + if (colorDepth == 2) color_table = ff_qt_default_palette_4; else if (colorDepth == 4) @@ -846,7 +846,7 @@ int QTPlayer::readSTSD(MOVatom atom) { st->palettized = false; } else if (st->codec_type == CODEC_TYPE_AUDIO) { debug(0, "Audio Codec FourCC: \'%s\'", tag2str(format)); - + st->stsd_version = _fd->readUint16BE(); _fd->readUint16BE(); // revision level _fd->readUint32BE(); // vendor @@ -877,7 +877,7 @@ int QTPlayer::readSTSD(MOVatom atom) { warning("Unsupported QuickTime STSD audio version %d", st->stsd_version); return 1; } - + // Version 0 videos (such as the Riven ones) don't have this set, // but we need it later on. Add it in here. if (format == MKID_BE('ima4')) { @@ -888,7 +888,7 @@ int QTPlayer::readSTSD(MOVatom atom) { // other codec type, just skip (rtp, mp4s, tmcd ...) _fd->seek(size - (_fd->pos() - start_pos), SEEK_CUR); } - + // this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) a.size = size - (_fd->pos() - start_pos); if (a.size > 8) @@ -924,7 +924,7 @@ int QTPlayer::readSTSC(MOVatom atom) { st->sample_to_chunk[i].id = _fd->readUint32BE(); //printf ("Sample to Chunk[%d]: First = %d, Count = %d\n", i, st->sample_to_chunk[i].first, st->sample_to_chunk[i].count); } - + return 0; } @@ -974,7 +974,7 @@ int QTPlayer::readSTSZ(MOVatom atom) { st->sample_sizes[i] = _fd->readUint32BE(); debug(6, "sample_sizes[%d] = %d", i, st->sample_sizes[i]); } - + return 0; } @@ -990,7 +990,7 @@ int QTPlayer::readSTTS(MOVatom atom) { _fd->readByte(); // version _fd->readByte(); _fd->readByte(); _fd->readByte(); // flags - + st->stts_count = _fd->readUint32BE(); st->stts_data = new MOVstts[st->stts_count]; @@ -1031,7 +1031,7 @@ int QTPlayer::readSTCO(MOVatom atom) { st->chunk_count = _fd->readUint32BE(); st->chunk_offsets = new uint32[st->chunk_count]; - + if (!st->chunk_offsets) return -1; @@ -1053,7 +1053,7 @@ int QTPlayer::readSTCO(MOVatom atom) { _ni = 1; } } - + return 0; } @@ -1062,7 +1062,7 @@ int QTPlayer::readWAVE(MOVatom atom) { return 0; MOVStreamContext *st = _streams[_numStreams - 1]; - + if (atom.size > (1 << 30)) return -1; @@ -1079,50 +1079,50 @@ int QTPlayer::readWAVE(MOVatom atom) { void QTPlayer::closeFile() { for (uint32 i = 0; i < _numStreams; i++) delete _streams[i]; - + delete _fd; - + // The audio stream is deleted automatically _audStream = NULL; } void QTPlayer::resetInternal() { - + } Common::SeekableReadStream *QTPlayer::getNextFramePacket() { if (_videoStreamIndex < 0) return NULL; - + // First, we have to track down which chunk holds the sample and which sample in the chunk contains the frame we are looking for. int32 totalSampleCount = 0; int32 sampleInChunk = 0; int32 actualChunk = -1; - + for (uint32 i = 0; i < _streams[_videoStreamIndex]->chunk_count; i++) { int32 sampleToChunkIndex = -1; - + for (uint32 j = 0; j < _streams[_videoStreamIndex]->sample_to_chunk_sz; j++) if (i >= _streams[_videoStreamIndex]->sample_to_chunk[j].first - 1) sampleToChunkIndex = j; - + if (sampleToChunkIndex < 0) error("This chunk (%d) is imaginary", sampleToChunkIndex); - + totalSampleCount += _streams[_videoStreamIndex]->sample_to_chunk[sampleToChunkIndex].count; - + if (totalSampleCount > getCurFrame()) { actualChunk = i; sampleInChunk = _streams[_videoStreamIndex]->sample_to_chunk[sampleToChunkIndex].count - totalSampleCount + getCurFrame(); break; } } - + if (actualChunk < 0) { warning ("Could not find data for frame %d", getCurFrame()); return NULL; } - + // Next seek to that frame _fd->seek(_streams[_videoStreamIndex]->chunk_offsets[actualChunk]); @@ -1136,10 +1136,10 @@ Common::SeekableReadStream *QTPlayer::getNextFramePacket() { // Finally, read in the raw data for the frame //printf ("Frame Data[%d]: Offset = %d, Size = %d\n", getCurFrame(), _fd->pos(), _streams[_videoStreamIndex]->sample_sizes[getCurFrame()]); - + if (_streams[_videoStreamIndex]->sample_size != 0) return _fd->readStream(_streams[_videoStreamIndex]->sample_size); - + return _fd->readStream(_streams[_videoStreamIndex]->sample_sizes[getCurFrame()]); } @@ -1156,7 +1156,7 @@ bool QTPlayer::checkAudioCodecSupport(uint32 tag) { Audio::AudioStream *QTPlayer::createAudioStream(Common::SeekableReadStream *stream) { if (!stream || _audioStreamIndex < 0) return NULL; - + if (_streams[_audioStreamIndex]->codec_tag == MKID_BE('twos') || _streams[_audioStreamIndex]->codec_tag == MKID_BE('raw ')) { // Fortunately, most of the audio used in Myst videos is raw... uint16 flags = 0; @@ -1178,9 +1178,9 @@ Audio::AudioStream *QTPlayer::createAudioStream(Common::SeekableReadStream *stre // Several Myst ME videos use this codec return new QDM2Stream(stream, _streams[_audioStreamIndex]->extradata); } - + error("Unsupported audio codec"); - + return NULL; } @@ -1191,20 +1191,20 @@ void QTPlayer::updateAudioBuffer() { // Keep two streams in buffer so that when the first ends, it goes right into the next for (; _audStream->numQueuedStreams() < 2 && _curAudioChunk < _streams[_audioStreamIndex]->chunk_count; _curAudioChunk++) { Common::MemoryWriteStreamDynamic *wStream = new Common::MemoryWriteStreamDynamic(); - + _fd->seek(_streams[_audioStreamIndex]->chunk_offsets[_curAudioChunk]); - + // First, we have to get the sample count uint32 sampleCount = 0; for (uint32 j = 0; j < _streams[_audioStreamIndex]->sample_to_chunk_sz; j++) if (_curAudioChunk >= (_streams[_audioStreamIndex]->sample_to_chunk[j].first - 1)) sampleCount = _streams[_audioStreamIndex]->sample_to_chunk[j].count; assert(sampleCount); - + // Then calculate the right sizes while (sampleCount > 0) { uint32 samples = 0, size = 0; - + if (_streams[_audioStreamIndex]->samples_per_frame >= 160) { samples = _streams[_audioStreamIndex]->samples_per_frame; size = _streams[_audioStreamIndex]->bytes_per_frame; @@ -1215,7 +1215,7 @@ void QTPlayer::updateAudioBuffer() { samples = MIN<uint32>(1024, sampleCount); size = samples * _streams[_audioStreamIndex]->sample_size; } - + // Now, we read in the data for this data and output it byte *data = (byte *)malloc(size); _fd->read(data, size); @@ -1223,7 +1223,7 @@ void QTPlayer::updateAudioBuffer() { free(data); sampleCount -= samples; } - + // Now queue the buffer _audStream->queueAudioStream(createAudioStream(new Common::MemoryReadStream(wStream->getData(), wStream->size(), DisposeAfterUse::YES))); delete wStream; diff --git a/engines/mohawk/video/qt_player.h b/engines/mohawk/video/qt_player.h index 2d8f87f479..bad3a542c1 100644 --- a/engines/mohawk/video/qt_player.h +++ b/engines/mohawk/video/qt_player.h @@ -74,13 +74,13 @@ public: * @return the amount of frames in the video */ uint32 getFrameCount(); - + /** * Returns the bits per pixel of the video * @return the bits per pixel of the video */ byte getBitsPerPixel(); - + /** * Returns the codec tag of the video * @return the codec tag of the video @@ -97,26 +97,26 @@ public: * Close a QuickTime encoded video file */ void closeFile(); - + /** * Returns the downscale mode of the video * @return the downscale mode of the video */ ScaleMode getScaleMode(); - + /** * Returns the palette of the video * @return the palette of the video */ byte *getPalette() { return _palette; } - + /** * Set the beginning offset of the video so we can modify the offsets in the stco * atom of videos inside the Mohawk archives * @param the beginning offset of the video */ void setChunkBeginOffset(uint32 offset) { _beginOffset = offset; } - + int32 getCurFrame() { return _curFrame; } void addPauseTime(uint32 p) { _lastFrameStart += p; _nextFrameStart += p; } Graphics::Surface *getNextFrame(); @@ -251,7 +251,7 @@ protected: int8 _audioStreamIndex; uint _curAudioChunk; uint32 _beginOffset; - + Graphics::Codec *createCodec(uint32 codecTag, byte bitsPerPixel); Graphics::Codec *_videoCodec; bool _noCodecFound; diff --git a/engines/mohawk/video/qtrle.cpp b/engines/mohawk/video/qtrle.cpp index 1ad9f99838..c06dbefcb3 100644 --- a/engines/mohawk/video/qtrle.cpp +++ b/engines/mohawk/video/qtrle.cpp @@ -25,15 +25,15 @@ // QuickTime RLE Decoder // Based off ffmpeg's QuickTime RLE decoder (written by Mike Melanson) - + #include "mohawk/video/qtrle.h" - + #include "common/scummsys.h" #include "common/stream.h" #include "common/system.h" #include "graphics/colormasks.h" #include "graphics/surface.h" - + namespace Mohawk { QTRLEDecoder::QTRLEDecoder(uint16 width, uint16 height, byte bitsPerPixel) : Graphics::Codec() { @@ -83,7 +83,7 @@ void QTRLEDecoder::decode1(Common::SeekableReadStream *stream, uint32 rowPtr, ui pixelPtr += 2 * skip; if (rleCode < 0) { - // decode the run length code + // decode the run length code rleCode = -rleCode; // get the next 2 bytes from the stream, treat them as groups of 8 pixels, and output them rleCode times */ CHECK_STREAM_PTR(2); @@ -287,7 +287,7 @@ void QTRLEDecoder::decode24(Common::SeekableReadStream *stream, uint32 rowPtr, u CHECK_PIXEL_PTR(rleCode); - while (rleCode--) + while (rleCode--) rgb[pixelPtr++] = _pixelFormat.RGBToColor(r, g, b); } else { CHECK_STREAM_PTR(rleCode * 3); @@ -333,7 +333,7 @@ void QTRLEDecoder::decode32(Common::SeekableReadStream *stream, uint32 rowPtr, u CHECK_PIXEL_PTR(rleCode); - while (rleCode--) + while (rleCode--) rgb[pixelPtr++] = _pixelFormat.ARGBToColor(a, r, g, b); } else { CHECK_STREAM_PTR(rleCode * 4); diff --git a/engines/mohawk/video/qtrle.h b/engines/mohawk/video/qtrle.h index 60796b3803..fdccf626a6 100644 --- a/engines/mohawk/video/qtrle.h +++ b/engines/mohawk/video/qtrle.h @@ -22,7 +22,7 @@ * $Id$ * */ - + #ifndef MOHAWK_QTRLE_H #define MOHAWK_QTRLE_H @@ -40,10 +40,10 @@ public: private: byte _bitsPerPixel; - + Graphics::Surface *_surface; Graphics::PixelFormat _pixelFormat; - + void decode1(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange); void decode2_4(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange, byte bpp); void decode8(Common::SeekableReadStream *stream, uint32 rowPtr, uint32 linesToChange); diff --git a/engines/mohawk/video/rpza.cpp b/engines/mohawk/video/rpza.cpp index ae003fa491..f48c055ae2 100644 --- a/engines/mohawk/video/rpza.cpp +++ b/engines/mohawk/video/rpza.cpp @@ -22,7 +22,7 @@ * $Id$ * */ - + // Based off ffmpeg's RPZA decoder #include "mohawk/video/rpza.h" @@ -43,7 +43,7 @@ RPZADecoder::RPZADecoder(uint16 width, uint16 height) : Graphics::Codec() { debug(2, "RPZA corrected width: %d", width); _surface = new Graphics::Surface(); - _surface->create(width, height, _pixelFormat.bytesPerPixel); + _surface->create(width, height, _pixelFormat.bytesPerPixel); } #define ADVANCE_BLOCK() \ diff --git a/engines/mohawk/video/rpza.h b/engines/mohawk/video/rpza.h index 4aa5a5d990..b9522ec2e3 100644 --- a/engines/mohawk/video/rpza.h +++ b/engines/mohawk/video/rpza.h @@ -38,7 +38,7 @@ public: Graphics::Surface *decodeImage(Common::SeekableReadStream *stream); -private: +private: Graphics::Surface *_surface; Graphics::PixelFormat _pixelFormat; }; diff --git a/engines/mohawk/video/smc.cpp b/engines/mohawk/video/smc.cpp index c196d97e1e..4a0d16dfcc 100644 --- a/engines/mohawk/video/smc.cpp +++ b/engines/mohawk/video/smc.cpp @@ -22,7 +22,7 @@ * $Id$ * */ - + // Based off ffmpeg's SMC decoder #include "mohawk/video/smc.h" @@ -357,7 +357,7 @@ Graphics::Surface *SMCDecoder::decodeImage(Common::SeekableReadStream *stream) { } break; - // 16-color block encoding (every pixel is a different color) + // 16-color block encoding (every pixel is a different color) case 0xE0: numBlocks = (opcode & 0x0F) + 1; diff --git a/engines/mohawk/video/smc.h b/engines/mohawk/video/smc.h index f5895f7dbd..331fddb9a5 100644 --- a/engines/mohawk/video/smc.h +++ b/engines/mohawk/video/smc.h @@ -44,7 +44,7 @@ public: Graphics::Surface *decodeImage(Common::SeekableReadStream *stream); -private: +private: Graphics::Surface *_surface; // SMC color tables diff --git a/engines/mohawk/video/video.cpp b/engines/mohawk/video/video.cpp index 9e61e2361c..1aa51cf237 100644 --- a/engines/mohawk/video/video.cpp +++ b/engines/mohawk/video/video.cpp @@ -30,11 +30,11 @@ #include "common/events.h" namespace Mohawk { - + VideoManager::VideoManager(MohawkEngine* vm) : _vm(vm) { _pauseStart = 0; } - + VideoManager::~VideoManager() { _mlstRecords.clear(); stopVideos(); @@ -51,7 +51,7 @@ void VideoManager::resumeVideos() { _videoStreams[i]->addPauseTime(_vm->_system->getMillis() * 100 - _pauseStart); _videoStreams[i]->resumeAudio(); } - + _pauseStart = 0; } @@ -110,18 +110,18 @@ void VideoManager::playMovieCentered(Common::String filename, bool clearScreen) entry.loop = false; playMovie(entry); } - + void VideoManager::playMovie(VideoEntry videoEntry) { // Add video to the list _videoStreams.push_back(videoEntry); - + bool continuePlaying = true; videoEntry->startAudio(); - + while (!videoEntry->endOfVideo() && !_vm->shouldQuit() && continuePlaying) { if (updateBackgroundMovies()) _vm->_system->updateScreen(); - + Common::Event event; while (_vm->_system->getEventManager()->pollEvent(event)) { switch (event.type) { @@ -144,11 +144,11 @@ void VideoManager::playMovie(VideoEntry videoEntry) { break; } } - + // Cut down on CPU usage _vm->_system->delayMillis(10); } - + videoEntry->stop(); _videoStreams.clear(); @@ -161,24 +161,24 @@ void VideoManager::playBackgroundMovie(Common::String filename, int16 x, int16 y VideoEntry entry; entry.video = new QTPlayer(); - + if (!entry.video) return; - + entry->loadFile(file); - + // Center x if requested if (x < 0) x = (_vm->_system->getWidth() - entry->getWidth()) / 2; - + // Center y if requested if (y < 0) y = (_vm->_system->getHeight() - entry->getHeight()) / 2; - + entry.x = x; entry.y = y; entry.loop = loop; - + entry->startAudio(); _videoStreams.push_back(entry); } @@ -204,16 +204,16 @@ bool VideoManager::updateBackgroundMovies() { Graphics::Surface *frame = _videoStreams[i]->getNextFrame(); bool deleteFrame = false; - if (frame) { + if (frame) { // Convert from 8bpp to the current screen format if necessary if (frame->bytesPerPixel == 1) { Graphics::Surface *newFrame = new Graphics::Surface(); Graphics::PixelFormat pixelFormat = _vm->_system->getScreenFormat(); byte *palette = _videoStreams[i]->getPalette(); assert(palette); - + newFrame->create(frame->w, frame->h, pixelFormat.bytesPerPixel); - + for (uint16 j = 0; j < frame->h; j++) { for (uint16 k = 0; k < frame->w; k++) { byte palIndex = *((byte *)frame->getBasePtr(k, j)); @@ -226,12 +226,12 @@ bool VideoManager::updateBackgroundMovies() { *((uint32 *)newFrame->getBasePtr(k, j)) = pixelFormat.RGBToColor(r, g, b); } } - + frame = newFrame; deleteFrame = true; } - // Check if we're drawing at a 2x or 4x resolution (because of + // Check if we're drawing at a 2x or 4x resolution (because of // evil QuickTime scaling it first). if (_videoStreams[i]->getScaleMode() == kScaleHalf || _videoStreams[i]->getScaleMode() == kScaleQuarter) { byte scaleFactor = (_videoStreams[i]->getScaleMode() == kScaleHalf) ? 2 : 4; @@ -254,7 +254,7 @@ bool VideoManager::updateBackgroundMovies() { // We've drawn something to the screen, make sure we update it updateScreen = true; - + // Delete the frame if we're using the buffer from the 8bpp conversion if (deleteFrame) { frame->free(); @@ -289,7 +289,7 @@ void VideoManager::activateMLST(uint16 mlstId, uint16 card) { if (mlstStream->readUint16BE() != 0xFFFF) warning("u0[2] in MLST not 0xFFFF"); - + mlstRecord.loop = mlstStream->readUint16BE(); mlstRecord.volume = mlstStream->readUint16BE(); mlstRecord.u1 = mlstStream->readUint16BE(); @@ -305,7 +305,7 @@ void VideoManager::activateMLST(uint16 mlstId, uint16 card) { break; } } - + delete mlstStream; } @@ -336,7 +336,7 @@ void VideoManager::playMovieBlocking(uint16 id) { for (uint16 i = 0; i < _mlstRecords.size(); i++) if (_mlstRecords[i].code == id) { warning("STUB: Play tMOV %d (blocking) at (%d, %d)", _mlstRecords[i].movieID, _mlstRecords[i].left, _mlstRecords[i].top); - + // TODO: See if a non-blocking movie has been activated with the same id, // and if so, block input until that movie is finished. QTPlayer *qtPlayer = new QTPlayer(); diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp index f5fbb50bf6..da9dfbe1d9 100644 --- a/engines/parallaction/dialogue.cpp +++ b/engines/parallaction/dialogue.cpp @@ -480,7 +480,7 @@ void Parallaction::exitDialogueMode() { /* Since the current instance of _dialogueMan must be destroyed before the zone commands are executed, as they may create a new instance of _dialogueMan that would overwrite the current, we need to save the references to the command lists. - */ + */ CommandList *_cmdList = _dialogueMan->_cmdList; ZonePtr z = _dialogueMan->_z; diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp index e351a5ab2f..ec9f846459 100644 --- a/engines/parallaction/exec_br.cpp +++ b/engines/parallaction/exec_br.cpp @@ -274,9 +274,9 @@ DECLARE_COMMAND_OPCODE(swap) { DECLARE_COMMAND_OPCODE(give) { - warning("Parallaction_br::cmdOp_give not yet implemented"); + warning("Parallaction_br::cmdOp_give not yet implemented"); - /* NOTE: the following code is disabled until I deal with _inventory and + /* NOTE: the following code is disabled until I deal with _inventory and * _charInventories not being public */ /* int item = ctxt._cmd->_object; diff --git a/engines/parallaction/saveload.cpp b/engines/parallaction/saveload.cpp index bb9ac1503e..cb0dccbcee 100644 --- a/engines/parallaction/saveload.cpp +++ b/engines/parallaction/saveload.cpp @@ -342,13 +342,13 @@ void SaveLoad_ns::renameOldSavefiles() { oldName = oldFilenames[i]; int e = sscanf(oldName.c_str(), "game.%u", &id); if (e != 1) { - // this wasn't a savefile, so adjust numOldSaves accordingly + // this wasn't a savefile, so adjust numOldSaves accordingly --numOldSaves; continue; } if (!rename) { - rename = askRenameOldSavefiles(); + rename = askRenameOldSavefiles(); } if (!rename) { // return immediately if the user doesn't want to rename the files diff --git a/engines/queen/journal.cpp b/engines/queen/journal.cpp index b782328f83..60bf5ac8cd 100644 --- a/engines/queen/journal.cpp +++ b/engines/queen/journal.cpp @@ -387,32 +387,32 @@ static void removeLeadingAndTrailingSpaces(char *dst, size_t dstSize, const char dst[0] = '\0'; return; } - + size_t firstNonSpaceIndex; for (firstNonSpaceIndex = 0; firstNonSpaceIndex < srcLen; ++firstNonSpaceIndex) { if (src[firstNonSpaceIndex] != ' ') - break; + break; } if (firstNonSpaceIndex == srcLen) { dst[0] = '\0'; return; } - + size_t lastNonSpaceIndex = srcLen - 1; while (src[lastNonSpaceIndex] == ' ') --lastNonSpaceIndex; - + size_t newLen = lastNonSpaceIndex - firstNonSpaceIndex + 1; assert(newLen < dstSize); for (size_t i = 0; i < newLen; ++i) { dst[i] = src[firstNonSpaceIndex + i]; } - dst[newLen] = '\0'; + dst[newLen] = '\0'; } void Journal::drawPanelText(int y, const char *text) { debug(7, "Journal::drawPanelText(%d, '%s')", y, text); - + char s[128]; removeLeadingAndTrailingSpaces(s, 128, text); // necessary for spanish version diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp index 38a18671b8..afe4fb2a3b 100644 --- a/engines/saga/music.cpp +++ b/engines/saga/music.cpp @@ -300,11 +300,11 @@ void Music::play(uint32 resourceId, MusicFlags flags) { Common::File *musicFile = _digitalMusicContext->getFile(resData); int offs = (_digitalMusicContext->isCompressed()) ? 9 : 0; - Common::SeekableSubReadStream *musicStream = new Common::SeekableSubReadStream(musicFile, + Common::SeekableSubReadStream *musicStream = new Common::SeekableSubReadStream(musicFile, (uint32)resData->offset + offs, (uint32)resData->offset + resData->size - offs); if (!_digitalMusicContext->isCompressed()) { - byte musicFlags = Audio::FLAG_STEREO | + byte musicFlags = Audio::FLAG_STEREO | Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN; Audio::RawDiskStreamAudioBlock audioBlocks[1]; audioBlocks[0].pos = 0; diff --git a/engines/saga/sound.cpp b/engines/saga/sound.cpp index d87c025719..642b07eb07 100644 --- a/engines/saga/sound.cpp +++ b/engines/saga/sound.cpp @@ -69,7 +69,7 @@ void Sound::playSoundBuffer(Audio::SoundHandle *handle, const SoundBuffer &buffe Audio::RewindableAudioStream *stream = 0; - Audio::Mixer::SoundType soundType = (handleType == kVoiceHandle) ? + Audio::Mixer::SoundType soundType = (handleType == kVoiceHandle) ? Audio::Mixer::kSpeechSoundType : Audio::Mixer::kSFXSoundType; if (!buffer.isCompressed) { diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 8c25561391..7c45365a19 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -1394,7 +1394,7 @@ bool Console::cmdSongInfo(int argc, const char **argv) { } reg_t addr; - + if (parse_reg_t(_vm->_gamestate, argv[1], &addr, false)) { DebugPrintf("Invalid address passed.\n"); DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); @@ -1437,7 +1437,7 @@ bool Console::cmdToggleSound(int argc, const char **argv) { } reg_t id; - + if (parse_reg_t(_vm->_gamestate, argv[1], &id, false)) { DebugPrintf("Invalid address passed.\n"); DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); @@ -1538,7 +1538,7 @@ bool Console::cmdIsSample(int argc, const char **argv) { return true; } - DebugPrintf("Sample size: %d, sample rate: %d, channels: %d, digital channel number: %d\n", + DebugPrintf("Sample size: %d, sample rate: %d, channels: %d, digital channel number: %d\n", track->digitalSampleSize, track->digitalSampleRate, track->channelCount, track->digitalChannelNr); #endif @@ -1578,7 +1578,7 @@ bool Console::cmdGCShowReachable(int argc, const char **argv) { } reg_t addr; - + if (parse_reg_t(_vm->_gamestate, argv[1], &addr, false)) { DebugPrintf("Invalid address passed.\n"); DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); @@ -1607,7 +1607,7 @@ bool Console::cmdGCShowFreeable(int argc, const char **argv) { } reg_t addr; - + if (parse_reg_t(_vm->_gamestate, argv[1], &addr, false)) { DebugPrintf("Invalid address passed.\n"); DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); @@ -1637,7 +1637,7 @@ bool Console::cmdGCNormalize(int argc, const char **argv) { } reg_t addr; - + if (parse_reg_t(_vm->_gamestate, argv[1], &addr, false)) { DebugPrintf("Invalid address passed.\n"); DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); @@ -1760,7 +1760,7 @@ bool Console::cmdValueType(int argc, const char **argv) { } reg_t val; - + if (parse_reg_t(_vm->_gamestate, argv[1], &val, false)) { DebugPrintf("Invalid address passed.\n"); DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); @@ -1798,7 +1798,7 @@ bool Console::cmdViewListNode(int argc, const char **argv) { } reg_t addr; - + if (parse_reg_t(_vm->_gamestate, argv[1], &addr, false)) { DebugPrintf("Invalid address passed.\n"); DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); @@ -1928,7 +1928,7 @@ bool Console::cmdViewObject(int argc, const char **argv) { } reg_t addr; - + if (parse_reg_t(_vm->_gamestate, argv[1], &addr, false)) { DebugPrintf("Invalid address passed.\n"); DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); @@ -1969,7 +1969,7 @@ bool Console::cmdSetAccumulator(int argc, const char **argv) { } reg_t val; - + if (parse_reg_t(_vm->_gamestate, argv[1], &val, false)) { DebugPrintf("Invalid address passed.\n"); DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); @@ -2219,13 +2219,13 @@ bool Console::cmdSend(int argc, const char **argv) { } reg_t object; - + if (parse_reg_t(_vm->_gamestate, argv[1], &object, false)) { DebugPrintf("Invalid address \"%s\" passed.\n", argv[1]); DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } - + const char *selector_name = argv[2]; int selector_id = _vm->getKernel()->findSelector(selector_name); diff --git a/engines/sci/console.h b/engines/sci/console.h index c42603273c..5917d64e02 100644 --- a/engines/sci/console.h +++ b/engines/sci/console.h @@ -61,7 +61,7 @@ private: bool cmdSuffixes(int argc, const char **argv); bool cmdParseGrammar(int argc, const char **argv); bool cmdParserNodes(int argc, const char **argv); - bool cmdParserWords(int argc, const char **argv); + bool cmdParserWords(int argc, const char **argv); bool cmdSentenceFragments(int argc, const char **argv); bool cmdParse(int argc, const char **argv); bool cmdSetParseNodes(int argc, const char **argv); diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index c313a5d237..780e744f9b 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -256,7 +256,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl // The existence of 7.pat indicates a Mac game if (filename.contains("7.pat")) s_fallbackDesc.platform = Common::kPlatformMacintosh; - + // The data files for Atari ST versions are the same as their DOS counterparts } @@ -317,7 +317,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl // Where XXXX is the English string, #Y a separator indicating the language // (e.g. #G for German) and ZZZZ is the translated text // NOTE: This doesn't work for games which use message instead of text resources - // (like, for example, Eco Quest 1 and all SCI1.1 games and newer, e.g. Freddy Pharkas). + // (like, for example, Eco Quest 1 and all SCI1.1 games and newer, e.g. Freddy Pharkas). // As far as we know, these games store the messages of each language in separate // resources, and it's not possible to detect that easily // Also look for "%J" which is used in japanese games diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h index bc2d8e6b8c..7f16054271 100644 --- a/engines/sci/detection_tables.h +++ b/engines/sci/detection_tables.h @@ -1018,7 +1018,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {"resource.000", 0, "233394a5f33b475ae5975e7e9a420865", 8376352}, {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NONE }, - + // King's Quest 6 - English Windows CD (from the King's Quest Collection) // Executable scanning reports "1.cfs.158", VERSION file reports "1.034 9/11/94 - KQ6 version 1.000.00G" // SCI interpreter version 1.001.054 @@ -1039,7 +1039,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NONE }, #ifdef ENABLE_SCI32 - + // King's Quest 7 - English Windows (from abevi) // VERSION 1.65c @@ -2225,7 +2225,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { {NULL, 0, NULL, 0}}, Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH }, - + // Quest for Glory 3 - English DOS Non-Interactive Demo (from FRG) // Executable scanning reports "1.001.021", VERSION file reports "1.000, 0.001.059, 6.12.92" {"qfg3", "Demo", { diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index d524901952..0a543eec56 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -332,7 +332,7 @@ SciKernelFunction kfunct_mappers[] = { DEFUN("TextColors", kTextColors, ".*"), DEFUN("TextFonts", kTextFonts, ".*"), DEFUN("Portrait", kPortrait, ".*"), - + #ifdef ENABLE_SCI32 // SCI2 Kernel Functions DEFUN("IsHiRes", kIsHiRes, ""), @@ -436,7 +436,7 @@ void Kernel::loadSelectorNames() { // Check if we have a table for this game // Some demos do not have a selector table Common::StringList staticSelectorTable = checkStaticSelectorNames(); - + if (staticSelectorTable.empty()) error("Kernel: Could not retrieve selector names"); else @@ -447,7 +447,7 @@ void Kernel::loadSelectorNames() { if (oldScriptHeader) _selectorNames.push_back(staticSelectorTable[i]); } - + return; } @@ -627,7 +627,7 @@ void Kernel::mapFunctions() { } } // for all functions requesting to be mapped - debugC(2, kDebugLevelVM, "Handled %d/%d kernel functions, mapping %d and ignoring %d.\n", + debugC(2, kDebugLevelVM, "Handled %d/%d kernel functions, mapping %d and ignoring %d.\n", mapped + ignored, _kernelNames.size(), mapped, ignored); return; @@ -648,7 +648,7 @@ int determine_reg_type(SegManager *segMan, reg_t reg) { switch (mobj->getType()) { case SEG_TYPE_SCRIPT: - if (reg.offset <= (*(Script *)mobj)._bufSize && + if (reg.offset <= (*(Script *)mobj)._bufSize && reg.offset >= -SCRIPT_OBJECT_MAGIC_OFFSET && RAW_IS_OBJECT((*(Script *)mobj)._buf + reg.offset)) { return ((Script *)mobj)->getObject(reg.offset) ? KSIG_OBJECT : KSIG_REF; @@ -779,7 +779,7 @@ void Kernel::setDefaultKernelNames(Common::String gameId) { bool Kernel::loadKernelNames(Common::String gameId) { _kernelNames.clear(); - + #ifdef ENABLE_SCI32 if (getSciVersion() >= SCI_VERSION_2_1) setKernelNamesSci21(gameId); diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index 9ba33aff97..aa71dfcdc7 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -102,13 +102,13 @@ private: * Sets the default kernel function names, based on the SCI version used */ void setDefaultKernelNames(Common::String gameId); - + #ifdef ENABLE_SCI32 /** * Sets the default kernel function names to the SCI2 kernel functions */ void setKernelNamesSci2(); - + /** * Sets the default kernel function names to the SCI2.1 kernel functions */ @@ -119,7 +119,7 @@ private: * Loads the kernel selector names. */ void loadSelectorNames(); - + /** * Check for any hardcoded selector table we might have that can be used * if a game is missing the selector names. @@ -229,7 +229,7 @@ int _find_view_priority(EngineState *s, int y); * Determines the now-seen rectangle of a view object * @param s The state to use * @param object The object to check - * @param clip Flag to determine wheter priority band clipping + * @param clip Flag to determine wheter priority band clipping * should be performed * @return The absolute rectangle describing the now-seen area. */ @@ -240,7 +240,7 @@ extern Common::Rect get_nsrect(EngineState *s, reg_t object, byte clip); /******************** Misc functions ********************/ /** - * Get all sound events, apply their changes to the heap + * Get all sound events, apply their changes to the heap */ void process_sound_events(EngineState *s); diff --git a/engines/sci/engine/kernel32.cpp b/engines/sci/engine/kernel32.cpp index e3cc938b1b..5bbf0db814 100644 --- a/engines/sci/engine/kernel32.cpp +++ b/engines/sci/engine/kernel32.cpp @@ -77,7 +77,7 @@ static const char *sci2_default_knames[] = { /*0x27*/ "TextColors", /*0x28*/ "TextFonts", /*0x29*/ "Dummy", - /*0x2a*/ "SetQuitStr", + /*0x2a*/ "SetQuitStr", /*0x2b*/ "EditText", /*0x2c*/ "InputText", /*0x2d*/ "CreateTextBitmap", @@ -174,7 +174,7 @@ static const char *sci2_default_knames[] = { /*0x88*/ "MarkMemory", /*0x89*/ "TextWidth", /*0x8a*/ "PointSize", - + // GK2 Demo only kernel functions /*0x8b*/ "AddLine", /*0x8c*/ "DeleteLine", @@ -491,16 +491,16 @@ reg_t kArray(EngineState *s, int argc, reg_t *argv) { case 9: // Getdata if (!s->_segMan->isHeapObject(argv[1])) return argv[1]; - + return GET_SEL32(s->_segMan, argv[1], data); default: error("Unknown kArray subop %d", argv[0].toUint16()); } - + return NULL_REG; } -reg_t kString(EngineState *s, int argc, reg_t *argv) { +reg_t kString(EngineState *s, int argc, reg_t *argv) { switch (argv[0].toUint16()) { case 0: { // New reg_t stringHandle; @@ -580,7 +580,7 @@ reg_t kString(EngineState *s, int argc, reg_t *argv) { case 7: { // Cmp Common::String string1 = argv[1].isNull() ? "" : s->_segMan->getString(argv[1]); Common::String string2 = argv[2].isNull() ? "" : s->_segMan->getString(argv[2]); - + if (argc == 4) // Strncmp return make_reg(0, strncmp(string1.c_str(), string2.c_str(), argv[3].toUint16())); else // Strcmp @@ -591,10 +591,10 @@ reg_t kString(EngineState *s, int argc, reg_t *argv) { reg_t stringHandle; SciString *dupString = s->_segMan->allocateString(&stringHandle); dupString->setSize(string.size() + 1); - + for (uint32 i = 0; i < string.size(); i++) dupString->setValue(i, string.c_str()[i]); - + dupString->setValue(dupString->getSize() - 1, 0); return stringHandle; @@ -602,7 +602,7 @@ reg_t kString(EngineState *s, int argc, reg_t *argv) { case 9: // Getdata if (!s->_segMan->isHeapObject(argv[1])) return argv[1]; - + return GET_SEL32(s->_segMan, argv[1], data); case 10: // Stringlen return make_reg(0, s->_segMan->strlen(argv[1])); @@ -655,7 +655,7 @@ reg_t kDeleteScreenItem(EngineState *s, int argc, reg_t *argv) { reg_t viewObj = argv[0]; s->_gui->deleteScreenItem(viewObj); - + /* reg_t viewObj = argv[0]; uint16 viewId = GET_SEL32V(s->_segMan, viewObj, view); @@ -706,7 +706,7 @@ reg_t kRepaintPlane(EngineState *s, int argc, reg_t *argv) { } reg_t kFrameOut(EngineState *s, int argc, reg_t *argv) { - // This kernel call likely seems to be doing the screen updates, + // This kernel call likely seems to be doing the screen updates, // as its called right after a view is updated // TODO diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp index 5bc0f1105f..3bf30681d4 100644 --- a/engines/sci/engine/kevent.cpp +++ b/engines/sci/engine/kevent.cpp @@ -88,7 +88,7 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) { // track left buttton clicks, if requested if (curEvent.type == SCI_EVENT_MOUSE_PRESS && curEvent.data == 1 && g_debug_track_mouse_clicks) { - ((SciEngine *)g_engine)->getSciDebugger()->DebugPrintf("Mouse clicked at %d, %d\n", + ((SciEngine *)g_engine)->getSciDebugger()->DebugPrintf("Mouse clicked at %d, %d\n", mousePos.x, mousePos.y); } diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index 21674cc94f..2cd6a75575 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -409,7 +409,7 @@ reg_t kDeviceInfo(EngineState *s, int argc, reg_t *argv) { reg_t kGetSaveDir(EngineState *s, int argc, reg_t *argv) { #ifdef ENABLE_SCI32 // TODO: SCI32 uses a parameter here. - if (argc > 0) + if (argc > 0) warning("kGetSaveDir called with %d parameter(s): %04x:%04x", argc, PRINT_REG(argv[0])); #endif @@ -891,7 +891,7 @@ reg_t kFileIO(EngineState *s, int argc, reg_t *argv) { // We just return -1 for all versions. if (g_engine->getSaveFileManager()->renameSavefile(oldName, newName)) return NULL_REG; - else + else return SIGNAL_REG; } #ifdef ENABLE_SCI32 diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index 7cc0d88ab6..b982628bc0 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -71,7 +71,7 @@ reg_t kGameIsRestarting(EngineState *s, int argc, reg_t *argv) { // s->_throttleCounter++; // return s->r_acc; //} - + uint32 curTime = g_system->getMillis(); uint32 duration = curTime - s->_throttleLastTime; uint32 neededSleep = 30; @@ -268,7 +268,7 @@ reg_t kPlatform(EngineState *s, int argc, reg_t *argv) { if (argc == 0 && getSciVersion() < SCI_VERSION_2) { // This is called in KQ5CD with no parameters, where it seems to do some graphics // driver check. This kernel function didn't have subfunctions then. If 0 is - // returned, the game functions normally, otherwise all the animations show up + // returned, the game functions normally, otherwise all the animations show up // like a slideshow (e.g. in the intro). So we return 0. However, the behavior // changed for kPlatform with no parameters in SCI32. return NULL_REG; diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp index d9758e259e..cfe3cb38a3 100644 --- a/engines/sci/engine/kpathing.cpp +++ b/engines/sci/engine/kpathing.cpp @@ -1806,7 +1806,7 @@ reg_t kAvoidPath(EngineState *s, int argc, reg_t *argv) { return retval; } case 6 : - case 7 : + case 7 : case 8 : { Common::Point end = Common::Point(argv[2].toSint16(), argv[3].toSint16()); reg_t poly_list, output; diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp index 16ef002e66..18a677c67f 100644 --- a/engines/sci/engine/kscripts.cpp +++ b/engines/sci/engine/kscripts.cpp @@ -167,7 +167,7 @@ reg_t kDisposeClone(EngineState *s, int argc, reg_t *argv) { #endif victim_obj->markAsFreed(); - + return s->r_acc; } diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index 3881e234ba..e4efc4d1f9 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -55,10 +55,10 @@ reg_t kDoCdAudio(EngineState *s, int argc, reg_t *argv) { } case kSciAudioStop: s->_audio->audioCdStop(); - + if (getSciVersion() == SCI_VERSION_1_1) return make_reg(0, 1); - + break; case kSciAudioPause: warning("Can't pause CD Audio"); @@ -178,7 +178,7 @@ reg_t kDoSync(EngineState *s, int argc, reg_t *argv) { s->_audio->setSoundSync(id, argv[1], segMan); break; } - case kSciAudioSyncNext: + case kSciAudioSyncNext: s->_audio->doSoundSync(argv[1], segMan); break; case kSciAudioSyncStop: diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp index 5e124e84e0..ee1e39047f 100644 --- a/engines/sci/engine/kstring.cpp +++ b/engines/sci/engine/kstring.cpp @@ -389,7 +389,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) { *target = 0; /* Terminate string */ - s->_segMan->strcpy(dest, targetbuf); + s->_segMan->strcpy(dest, targetbuf); return dest; /* Return target addr */ } @@ -448,7 +448,7 @@ reg_t kGetMessage(EngineState *s, int argc, reg_t *argv) { reg_t kMessage(EngineState *s, int argc, reg_t *argv) { uint func = argv[0].toUint16(); - + #ifdef ENABLE_SCI32 if (getSciVersion() >= SCI_VERSION_2) { // In complete weirdness, SCI32 bumps up subops 3-8 to 4-9 and stubs off subop 3. diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp index 70b638a43f..6b411c687f 100644 --- a/engines/sci/engine/script.cpp +++ b/engines/sci/engine/script.cpp @@ -120,7 +120,7 @@ void script_adjust_opcode_formats(EngineState *s) { // a vocab.997 resource, by dumping the selector table from other similar versions or games #define FIND_SELECTOR(_slc_) _selectorCache._slc_ = findSelector(#_slc_); \ printf("\t{ \"%s\", %d },\n", #_slc_, _selectorCache._slc_) - + #define FIND_SELECTOR2(_slc_, _slcstr_) _selectorCache._slc_ = findSelector(_slcstr_); \ printf("\t{ \"%s\", %d },\n", _slcstr_, _selectorCache._slc_) diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp index d68853a593..f995991aa2 100644 --- a/engines/sci/engine/seg_manager.cpp +++ b/engines/sci/engine/seg_manager.cpp @@ -53,7 +53,7 @@ SegManager::SegManager(ResourceManager *resMan) { Lists_seg_id = 0; Nodes_seg_id = 0; Hunks_seg_id = 0; - + #ifdef ENABLE_SCI32 Arrays_seg_id = 0; String_seg_id = 0; diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h index 4d385e0d32..12fb323646 100644 --- a/engines/sci/engine/seg_manager.h +++ b/engines/sci/engine/seg_manager.h @@ -87,12 +87,12 @@ public: void reconstructScripts(EngineState *s); /** - * Validate whether the specified public function is exported by + * Validate whether the specified public function is exported by * the script in the specified segment. * @param pubfunct Index of the function to validate - * @param seg Segment ID of the script the check is to + * @param seg Segment ID of the script the check is to * be performed for - * @return NULL if the public function is invalid, its + * @return NULL if the public function is invalid, its * offset into the script's segment otherwise */ uint16 validateExportFunc(int pubfunct, SegmentId seg); @@ -124,7 +124,7 @@ public: /** * Return a pointer to the specified script. - * If the id is invalid, does not refer to a script or the script is + * If the id is invalid, does not refer to a script or the script is * not loaded, this will invoke error(). * @param seg ID of the script segment to check for * @return A pointer to the Script object @@ -134,7 +134,7 @@ public: /** * Return a pointer to the specified script. - * If the id is invalid, does not refer to a script, or + * If the id is invalid, does not refer to a script, or * the script is not loaded, this will return NULL * @param seg ID of the script segment to check for * @return A pointer to the Script object, or NULL @@ -200,7 +200,7 @@ public: * See also sys_string_acquire(); * @param[in] segid Segment ID of the stack * @returns The physical stack - */ + */ SystemStrings *allocateSysStrings(SegmentId *segid); @@ -242,7 +242,7 @@ public: /** * Allocate a fresh chunk of the hunk * @param[in] size Number of bytes to allocate for the hunk entry - * @param[in] hunk_type A descriptive string for the hunk entry, for + * @param[in] hunk_type A descriptive string for the hunk entry, for * debugging purposes * @param[out] addr The offset of the freshly allocated hunk entry * @return Reference to the memory allocated for the hunk @@ -264,7 +264,7 @@ public: * @param[in] size Number of bytes to allocate * @param[in] description A descriptive string for debugging purposes * @param[out] addr The offset of the freshly allocated X - * @return Raw pointer into the allocated dynamic + * @return Raw pointer into the allocated dynamic * memory */ byte *allocDynmem(int size, const char *description, reg_t *addr); @@ -440,7 +440,7 @@ public: public: // TODO: make private Common::Array<SegmentObj *> _heap; Common::Array<Class> _classtable; /**< Table of all classes */ - + #ifdef ENABLE_SCI32 SciArray<reg_t> *allocateArray(reg_t *addr); SciArray<reg_t> *lookupArray(reg_t addr); diff --git a/engines/sci/engine/segment.cpp b/engines/sci/engine/segment.cpp index 6df4e1bac7..a76644c718 100644 --- a/engines/sci/engine/segment.cpp +++ b/engines/sci/engine/segment.cpp @@ -507,7 +507,7 @@ void SciString::fromString(Common::String string) { if (string.size() > _size) setSize(string.size()); - + for (uint32 i = 0; i < string.size(); i++) _data[i] = string[i]; } diff --git a/engines/sci/engine/segment.h b/engines/sci/engine/segment.h index a1967f6bb8..4d9d07c302 100644 --- a/engines/sci/engine/segment.h +++ b/engines/sci/engine/segment.h @@ -63,7 +63,7 @@ enum SegmentType { SEG_TYPE_HUNK = 8, SEG_TYPE_DYNMEM = 9, SEG_TYPE_STRING_FRAG = 10, // obsolete, we keep it to be able to load old saves - + #ifdef ENABLE_SCI32 SEG_TYPE_ARRAY = 11, SEG_TYPE_STRING = 12, @@ -681,7 +681,7 @@ public: _size = 0; _actualSize = 0; } - + SciArray(const SciArray<T> &array) { _type = array._type; _size = array._size; @@ -689,8 +689,8 @@ public: _data = new T[_actualSize]; assert(_data); memcpy(_data, array._data, _size * sizeof(T)); - } - + } + SciArray<T>& operator=(const SciArray<T> &array) { if (this == &array) return *this; @@ -709,7 +709,7 @@ public: virtual ~SciArray() { destroy(); } - + virtual void destroy() { delete[] _data; _data = NULL; @@ -723,7 +723,7 @@ public: _type = type; } - + void setSize(uint32 size) { if (_type < 0) error("SciArray::setSize(): No type set"); @@ -757,21 +757,21 @@ public: _data = newArray; _size = _actualSize = size; } - + T getValue(uint16 index) { if (index >= _size) error("SciArray::getValue(): %d is out of bounds (%d)", index, _size); return _data[index]; } - + void setValue(uint16 index, T value) { if (index >= _size) error("SciArray::setValue(): %d is out of bounds (%d)", index, _size); _data[index] = value; } - + byte getType() { return _type; } uint32 getSize() { return _size; } T *getRawData() { return _data; } @@ -786,10 +786,10 @@ protected: class SciString : public SciArray<char> { public: SciString() : SciArray<char>() { setType(3); } - + // We overload destroy to ensure the string type is 3 after destroying void destroy() { _type = 3; } - + Common::String toString(); void fromString(Common::String string); }; diff --git a/engines/sci/engine/selector.cpp b/engines/sci/engine/selector.cpp index 78d1d3eeb1..5893d3c295 100644 --- a/engines/sci/engine/selector.cpp +++ b/engines/sci/engine/selector.cpp @@ -53,7 +53,7 @@ void write_selector(SegManager *segMan, reg_t object, Selector selector_id, reg_ *address.getPointer(segMan) = value; } -int invoke_selector(EngineState *s, reg_t object, int selector_id, SelectorInvocation noinvalid, +int invoke_selector(EngineState *s, reg_t object, int selector_id, SelectorInvocation noinvalid, StackPtr k_argp, int k_argc, int argc, ...) { va_list argp; int i; @@ -75,7 +75,7 @@ int invoke_selector(EngineState *s, reg_t object, int selector_id, SelectorInvoc return 1; } if (slc_type == kSelectorVariable) { - warning("Attempting to invoke variable selector %s of object %04x:%04x", + warning("Attempting to invoke variable selector %s of object %04x:%04x", s->_kernel->getSelectorName(selector_id).c_str(), PRINT_REG(object)); return 0; } @@ -136,7 +136,7 @@ SelectorType lookup_selector(SegManager *segMan, reg_t obj_location, Selector se selector_id &= ~1; if (!obj) { - error("lookup_selector(): Attempt to send to non-object or invalid script. Address was %04x:%04x", + error("lookup_selector(): Attempt to send to non-object or invalid script. Address was %04x:%04x", PRINT_REG(obj_location)); } diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp index 2e85bd3356..d21109c57d 100644 --- a/engines/sci/engine/state.cpp +++ b/engines/sci/engine/state.cpp @@ -78,7 +78,7 @@ EngineState::EngineState(ResourceManager *res, Kernel *kernel, Vocabulary *voc, _lofsType = SCI_VERSION_NONE; _gfxFunctionsType = SCI_VERSION_NONE; _moveCountType = kMoveCountUninitialized; - + _usesCdTrack = Common::File::exists("cdaudio.map"); _soundCmd = 0; @@ -221,7 +221,7 @@ bool EngineState::autoDetectFeature(FeatureDetection featureDetection, int metho objName = "Rm"; objAddr = _segMan->findObjectByName(objName); slc = _kernel->_selectorCache.overlay; - break; + break; case kDetectMoveCountType: objName = "Motion"; objAddr = _segMan->findObjectByName(objName); @@ -580,7 +580,7 @@ SciVersion EngineState::detectGfxFunctionsType() { if (_kernel->_selectorCache.overlay == -1) { // No overlay selector found, check if any method of the Rm object // is calling kDrawPic, as the overlay selector might be missing in demos - + Object *obj = _segMan->getObject(_segMan->findObjectByName("Rm")); for (uint m = 0; m < obj->getMethodCount(); m++) { found = autoDetectFeature(kDetectGfxFunctions, m); diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index c006c0e851..6bd6fed78f 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -205,7 +205,7 @@ public: /** * Autodetects the DoSound type - * @return DoSound type, SCI_VERSION_0_EARLY / SCI_VERSION_0_LATE / + * @return DoSound type, SCI_VERSION_0_EARLY / SCI_VERSION_0_LATE / * SCI_VERSION_1_EARLY / SCI_VERSION_1_LATE */ SciVersion detectDoSoundType(); @@ -244,7 +244,7 @@ public: MoveCountType detectMoveCountType(); bool handleMoveCount() { return detectMoveCountType() == kIncrementMoveCount; } - + bool usesCdTrack() { return _usesCdTrack; } /* Debugger data: */ diff --git a/engines/sci/engine/static_selectors.cpp b/engines/sci/engine/static_selectors.cpp index 4a783a0fa3..d679b04572 100644 --- a/engines/sci/engine/static_selectors.cpp +++ b/engines/sci/engine/static_selectors.cpp @@ -29,7 +29,7 @@ #include "sci/engine/kernel.h" namespace Sci { - + struct SelectorRemap { SciVersion minVersion; SciVersion maxVersion; @@ -113,5 +113,5 @@ Common::StringList Kernel::checkStaticSelectorNames() { return names; } - + } // End of namespace Sci diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index 0bddd34eb6..974109237c 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -68,7 +68,7 @@ static reg_t &validate_property(Object *obj, int index) { } if (index < 0 || (uint)index >= obj->getVarCount()) { - debugC(2, kDebugLevelVM, "[VM] Invalid property #%d (out of [0..%d]) requested!\n", + debugC(2, kDebugLevelVM, "[VM] Invalid property #%d (out of [0..%d]) requested!\n", index, obj->getVarCount()); return dummyReg; } @@ -80,7 +80,7 @@ static StackPtr validate_stack_addr(EngineState *s, StackPtr sp) { if (sp >= s->stack_base && sp < s->stack_top) return sp; - error("[VM] Stack index %d out of valid range [%d..%d]", + error("[VM] Stack index %d out of valid range [%d..%d]", (int)(sp - s->stack_base), 0, (int)(s->stack_top - s->stack_base - 1)); return 0; } @@ -111,7 +111,7 @@ static bool validate_variable(reg_t *r, reg_t *stack_base, int type, int max, in if (index < 0 || index >= max) { Common::String txt = Common::String::printf( - "[VM] Attempt to use invalid %s variable %04x ", + "[VM] Attempt to use invalid %s variable %04x ", names[type], index); if (max == 0) txt += "(variable type invalid)"; @@ -398,7 +398,7 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt call.type = EXEC_STACK_TYPE_VARSELECTOR; // Register as a varselector sendCalls.push(call); } - + break; case kSelectorMethod: @@ -941,7 +941,7 @@ void run_vm(EngineState *s, int restoring) { xs_new = add_exec_stack_entry(s, make_reg(scriptState.xs->addr.pc.segment, scriptState.xs->addr.pc.offset + opparams[0]), - scriptState.xs->sp, scriptState.xs->objp, + scriptState.xs->sp, scriptState.xs->objp, (validate_arithmetic(*call_base)) + scriptState.restAdjust, call_base, NULL_SELECTOR, scriptState.xs->objp, s->_executionStack.size()-1, scriptState.xs->local_segment); @@ -1012,9 +1012,9 @@ void run_vm(EngineState *s, int restoring) { // Remove callk stack frame again s->_executionStack.pop_back(); } else { - Common::String warningMsg = "Dummy function " + kfun.orig_name + + Common::String warningMsg = "Dummy function " + kfun.orig_name + Common::String::printf("[0x%x]", opparams[0]) + - " invoked - ignoring. Params: " + + " invoked - ignoring. Params: " + Common::String::printf("%d", argc) + " ("; for (int i = 0; i < argc; i++) { diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h index 2928ff4daa..759d36d825 100644 --- a/engines/sci/engine/vm.h +++ b/engines/sci/engine/vm.h @@ -196,7 +196,7 @@ struct SelectorCache { // Used for auto detection purposes Selector overlay; ///< Used to determine if a game is using old gfx functions or not Selector setCursor; ///< For cursor semantics autodetection - + #ifdef ENABLE_SCI32 Selector data; // Used by Array() Selector picture; // Used to hold the picture ID for SCI32 pictures @@ -295,7 +295,7 @@ struct Breakpoint { }; /** - * Set this to 1 to abort script execution immediately. Aborting will + * Set this to 1 to abort script execution immediately. Aborting will * leave the debug exec stack intact. * Set it to 2 to force a replay afterwards. */ @@ -326,7 +326,7 @@ extern int script_step_counter; * @param[in] argp Pointer to the first supplied argument * @return A pointer to the new exec stack TOS entry */ -ExecStack *execute_method(EngineState *s, uint16 script, uint16 pubfunct, +ExecStack *execute_method(EngineState *s, uint16 script, uint16 pubfunct, StackPtr sp, reg_t calling_obj, uint16 argc, StackPtr argp); @@ -336,13 +336,13 @@ ExecStack *execute_method(EngineState *s, uint16 script, uint16 pubfunct, * @param[in] send_obj Heap address of the object to send to * @param[in] work_obj Heap address of the object initiating the send * @param[in] sp Stack pointer position - * @param[in] framesize Size of the send as determined by the "send" + * @param[in] framesize Size of the send as determined by the "send" * operation - * @param[in] argp Pointer to the beginning of the heap block - * containing the data to be sent. This area is a - * succession of one or more sequences of + * @param[in] argp Pointer to the beginning of the heap block + * containing the data to be sent. This area is a + * succession of one or more sequences of * [selector_number][argument_counter] and then - * "argument_counter" word entries with the + * "argument_counter" word entries with the * parameter values. * @return A pointer to the new execution stack TOS entry */ @@ -363,17 +363,17 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, * @param[in] argp Heap pointer to the first parameter * @param[in] selector The selector by which it was called or * NULL_SELECTOR if n.a. For debugging. - * @param[in] sendp Pointer to the object which the message was + * @param[in] sendp Pointer to the object which the message was * sent to. Equal to objp for anything but super. * @param[in] origin Number of the execution stack element this - * entry was created by (usually the current TOS + * entry was created by (usually the current TOS * number, except for multiple sends). * @param[in] local_segment The segment to use for local variables, * or SCI_XS_CALLEE_LOCALS to use obj's segment. * @return A pointer to the new exec stack TOS entry */ -ExecStack *add_exec_stack_entry(EngineState *s, reg_t pc, StackPtr sp, - reg_t objp, int argc, StackPtr argp, Selector selector, +ExecStack *add_exec_stack_entry(EngineState *s, reg_t pc, StackPtr sp, + reg_t objp, int argc, StackPtr argp, Selector selector, reg_t sendp, int origin, SegmentId local_segment); @@ -390,12 +390,12 @@ ExecStack *add_exec_stack_entry(EngineState *s, reg_t pc, StackPtr sp, * @return Pointer to the new exec-TOS element */ ExecStack *add_exec_stack_varselector(EngineState *s, reg_t objp, int argc, - StackPtr argp, Selector selector, const ObjVarRef& address, + StackPtr argp, Selector selector, const ObjVarRef& address, int origin); /** * This function executes SCI bytecode - * It executes the code on s->heap[pc] until it hits a 'ret' operation + * It executes the code on s->heap[pc] until it hits a 'ret' operation * while (stack_base == stack_pos). Requires s to be set up correctly. * @param[in] s The state to use * @param[in] restoring 1 if s has just been restored, 0 otherwise @@ -430,7 +430,7 @@ int script_init_engine(EngineState *); * fptr is written to iff it is non-NULL and the * selector indicates a member function of that * object. - * @return kSelectorNone if the selector was not found in + * @return kSelectorNone if the selector was not found in * the object or its superclasses. * kSelectorVariable if the selector represents an * object-relative variable. @@ -442,9 +442,9 @@ SelectorType lookup_selector(SegManager *segMan, reg_t obj, Selector selectorid, /** * Makes sure that a script and its superclasses get loaded to the heap. - * If the script already has been loaded, only the number of lockers is + * If the script already has been loaded, only the number of lockers is * increased. All scripts containing superclasses of this script are loaded - * recursively as well, unless 'recursive' is set to zero. The + * recursively as well, unless 'recursive' is set to zero. The * complementary function is "script_uninstantiate()" below. * @param[in] resMan The resource manager * @param[in] segMan The segment manager @@ -455,8 +455,8 @@ int script_instantiate(ResourceManager *resMan, SegManager *segMan, int script_n /** * Decreases the numer of lockers of a script and unloads it if that number - * reaches zero. - * This function will recursively unload scripts containing its + * reaches zero. + * This function will recursively unload scripts containing its * superclasses, if those aren't locked by other scripts as well. * @param[in] segMan The segment manager * @param[in] version The SCI version to use diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp index f6f2697abc..0e6206627e 100644 --- a/engines/sci/event.cpp +++ b/engines/sci/event.cpp @@ -279,7 +279,7 @@ sciEvent SciEvent::getFromScummVM() { case Common::KEYCODE_KP3: // pagedown if (!(_modifierStates & SCI_KEYMOD_NUMLOCK)) input.data = SCI_KEY_PGDOWN; - break; + break; default: input.type = SCI_EVENT_NONE; break; diff --git a/engines/sci/event.h b/engines/sci/event.h index 610fd566fc..a4f8fbaf27 100644 --- a/engines/sci/event.h +++ b/engines/sci/event.h @@ -76,7 +76,7 @@ struct sciEvent { #define SCI_KEY_UP (72 << 8) // 8 #define SCI_KEY_PGUP (73 << 8) // 9 // -#define SCI_KEY_LEFT (75 << 8) // 4 +#define SCI_KEY_LEFT (75 << 8) // 4 #define SCI_KEY_CENTER (76 << 8) // 5 #define SCI_KEY_RIGHT (77 << 8) // 6 // diff --git a/engines/sci/graphics/animate.cpp b/engines/sci/graphics/animate.cpp index 6c1e350e36..dc008314de 100644 --- a/engines/sci/graphics/animate.cpp +++ b/engines/sci/graphics/animate.cpp @@ -211,7 +211,7 @@ void SciGuiAnimate::fill(byte &old_picNotValid) { // Get the corresponding view view = _gfx->getView(listEntry->viewId); - + // adjust loop and cel, if any of those is invalid if (listEntry->loopNo >= view->getLoopCount()) { listEntry->loopNo = 0; @@ -240,7 +240,7 @@ void SciGuiAnimate::fill(byte &old_picNotValid) { listEntry->priority = _gfx->CoordinateToPriority(listEntry->y); PUT_SEL32V(_s->_segMan, curObject, priority, listEntry->priority); } - + if (signal & kSignalNoUpdate) { if (signal & (kSignalForceUpdate | kSignalViewUpdated) || (signal & kSignalHidden && !(signal & kSignalRemoveView)) @@ -311,7 +311,7 @@ void SciGuiAnimate::update() { signal &= 0xFFFF ^ (kSignalStopUpdate | kSignalViewUpdated | kSignalNoUpdate | kSignalForceUpdate); if ((signal & kSignalIgnoreActor) == 0) { rect = listEntry->celRect; - rect.top = CLIP<int16>(_gfx->PriorityToCoordinate(listEntry->priority) - 1, rect.top, rect.bottom - 1); + rect.top = CLIP<int16>(_gfx->PriorityToCoordinate(listEntry->priority) - 1, rect.top, rect.bottom - 1); _gfx->FillRect(rect, SCI_SCREEN_MASK_CONTROL, 0, 0, 15); } listEntry->signal = signal; @@ -356,7 +356,7 @@ void SciGuiAnimate::update() { if ((signal & kSignalIgnoreActor) == 0) { rect = listEntry->celRect; - rect.top = CLIP<int16>(_gfx->PriorityToCoordinate(listEntry->priority) - 1, rect.top, rect.bottom - 1); + rect.top = CLIP<int16>(_gfx->PriorityToCoordinate(listEntry->priority) - 1, rect.top, rect.bottom - 1); _gfx->FillRect(rect, SCI_SCREEN_MASK_CONTROL, 0, 0, 15); } } diff --git a/engines/sci/graphics/controls.cpp b/engines/sci/graphics/controls.cpp index 7b930ba19f..a3c729d84d 100644 --- a/engines/sci/graphics/controls.cpp +++ b/engines/sci/graphics/controls.cpp @@ -192,7 +192,7 @@ void Controls::TexteditChange(reg_t controlObject, reg_t eventObject) { if (eventKey > 31 && eventKey < 256 && textSize < maxChars) { // insert pressed character // we check, if there is space left for this character - + text.insertChar(eventKey, cursorPos++); textChanged = true; } diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp index 785c235e42..e0e5a8893e 100644 --- a/engines/sci/graphics/cursor.cpp +++ b/engines/sci/graphics/cursor.cpp @@ -91,7 +91,7 @@ void Cursor::setShape(GuiResourceId resourceId) { delete[] rawBitmap; return; } - + // Load cursor resource... resource = _resMan->findResource(ResourceId(kResourceTypeCursor, resourceId), false); if (!resource) @@ -112,7 +112,7 @@ void Cursor::setShape(GuiResourceId resourceId) { colorMapping[1] = _screen->getColorWhite(); // White is also hardcoded colorMapping[2] = SCI_CURSOR_SCI0_TRANSPARENCYCOLOR; colorMapping[3] = _palette->matchColor(&_palette->_sysPalette, 170, 170, 170); // Grey - + // Seek to actual data resourceData += 4; @@ -190,7 +190,7 @@ void Cursor::setPosition(Common::Point pos) { Common::Point Cursor::getPosition() { Common::Point mousePos = g_system->getEventManager()->getMousePos(); - + if (_upscaledHires) { mousePos.x /= 2; mousePos.y /= 2; diff --git a/engines/sci/graphics/gfx.cpp b/engines/sci/graphics/gfx.cpp index c230371b42..018ec1fad9 100644 --- a/engines/sci/graphics/gfx.cpp +++ b/engines/sci/graphics/gfx.cpp @@ -352,7 +352,7 @@ void Gfx::drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredF void Gfx::drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY) { View *view = getView(viewId); Common::Rect celRect; - + if (view) { celRect.left = leftPos; celRect.top = topPos; @@ -400,7 +400,7 @@ void Gfx::drawHiresCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, u Common::Rect celRect, curPortRect, clipRect, clipRectTranslated; Common::Point curPortPos; bool upscaledHiresHack = false; - + if (view) { if ((leftPos == 0) && (topPos == 0)) { // HACK: in kq6, we get leftPos&topPos == 0 SOMETIMES, that's why we need to get coordinates from upscaledHiresHandle @@ -542,7 +542,7 @@ void Gfx::PriorityBandsRecall() { } byte Gfx::CoordinateToPriority(int16 y) { - if (y < _priorityTop) + if (y < _priorityTop) return _priorityBands[_priorityTop]; if (y > _priorityBottom) return _priorityBands[_priorityBottom]; diff --git a/engines/sci/graphics/gui.cpp b/engines/sci/graphics/gui.cpp index 38e30ff150..2f8b278534 100644 --- a/engines/sci/graphics/gui.cpp +++ b/engines/sci/graphics/gui.cpp @@ -829,7 +829,7 @@ Common::Point SciGui::getCursorPos() { void SciGui::moveCursor(Common::Point pos) { pos.y += _windowMgr->_picWind->rect.top; pos.x += _windowMgr->_picWind->rect.left; - + pos.y = CLIP<int16>(pos.y, _windowMgr->_picWind->rect.top, _windowMgr->_picWind->rect.bottom - 1); pos.x = CLIP<int16>(pos.x, _windowMgr->_picWind->rect.left, _windowMgr->_picWind->rect.right - 1); @@ -963,7 +963,7 @@ void SciGui::frameOut() { if (priority == -1) continue; - + // FIXME: This code doesn't currently work properly because of the way we set up the // view port. We are starting at 10 pixels from the top automatically. The offset should // be based on the plane's top in SCI32 instead. Here we would be adding 10 to 10 and @@ -989,16 +989,16 @@ void SciGui::frameOut() { //topPos += planeTop; // Theoretically, leftPos and topPos should be sane - // Apparently, sometimes they're not, therefore I'm adding some sanity checks here so that + // Apparently, sometimes they're not, therefore I'm adding some sanity checks here so that // the hack underneath does not try and draw cels outside the screen coordinates if (leftPos >= _screen->getWidth()) { continue; } - + if (topPos >= _screen->getHeight()) { continue; } - + if (viewId != 0xffff) drawCel(viewId, loopNo, celNo, leftPos, topPos, priority, 0); } diff --git a/engines/sci/graphics/portrait.cpp b/engines/sci/graphics/portrait.cpp index 0d591c3fa1..81e4dfa15a 100644 --- a/engines/sci/graphics/portrait.cpp +++ b/engines/sci/graphics/portrait.cpp @@ -68,7 +68,7 @@ void Portrait::init() { // height * width bitmap data // another animation count times bitmap header and data int32 fileSize = 0; - Common::SeekableReadStream *file = + Common::SeekableReadStream *file = SearchMan.createReadStreamForMember("actors/" + _resourceName + ".bin"); if (!file) { file = SearchMan.createReadStreamForMember(_resourceName + ".bin"); diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp index c1cdf82139..07ee3c4639 100644 --- a/engines/sci/graphics/screen.cpp +++ b/engines/sci/graphics/screen.cpp @@ -33,7 +33,7 @@ namespace Sci { -Screen::Screen(ResourceManager *resMan, int16 width, int16 height, bool upscaledHires) : +Screen::Screen(ResourceManager *resMan, int16 width, int16 height, bool upscaledHires) : _resMan(resMan), _width(width), _height(height), _upscaledHires(upscaledHires) { _pixels = _width * _height; diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp index 7552b11e96..aab44df0d3 100644 --- a/engines/sci/graphics/view.cpp +++ b/engines/sci/graphics/view.cpp @@ -86,7 +86,7 @@ void View::initData(GuiResourceId resourceId) { case kViewAmiga: // View-format Amiga (32 colors) case kViewVga: // View-format SCI1 // LoopCount:WORD MirrorMask:WORD Version:WORD PaletteOffset:WORD LoopOffset0:WORD LoopOffset1:WORD... - + _loopCount = _resourceData[0]; // bit 0x8000 of _resourceData[1] means palette is set if (_resourceData[1] & 0x40) diff --git a/engines/sci/graphics/windowmgr.cpp b/engines/sci/graphics/windowmgr.cpp index 08dfdffc39..374efb2b30 100644 --- a/engines/sci/graphics/windowmgr.cpp +++ b/engines/sci/graphics/windowmgr.cpp @@ -143,17 +143,17 @@ Window *WindowMgr::NewWindow(const Common::Rect &dims, const Common::Rect *resto pwnd->rect = dims; if (restoreRect) pwnd->restoreRect = *restoreRect; - + pwnd->wndStyle = style; pwnd->hSaved1 = pwnd->hSaved2 = NULL_REG; pwnd->bDrawn = false; if ((style & SCI_WINDOWMGR_STYLE_TRANSPARENT) == 0) pwnd->saveScreenMask = (priority == -1 ? SCI_SCREEN_MASK_VISUAL : SCI_SCREEN_MASK_VISUAL | SCI_SCREEN_MASK_PRIORITY); - + if (title && (style & SCI_WINDOWMGR_STYLE_TITLE)) { pwnd->title = title; } - + r = dims; if ((style != SCI_WINDOWMGR_STYLE_USER) && !(style & SCI_WINDOWMGR_STYLE_NOFRAME)) { r.grow(1); @@ -165,23 +165,23 @@ Window *WindowMgr::NewWindow(const Common::Rect &dims, const Common::Rect *resto // FIXME: it seems as if shadows may result in the window getting moved one upwards // so that the shadow is visible (lsl5) - + pwnd->dims = r; const Common::Rect *wmprect = &_wmgrPort->rect; int16 oldtop = pwnd->dims.top; int16 oldleft = pwnd->dims.left; if (wmprect->top > pwnd->dims.top) pwnd->dims.moveTo(pwnd->dims.left, wmprect->top); - + if (wmprect->bottom < pwnd->dims.bottom) pwnd->dims.moveTo(pwnd->dims.left, wmprect->bottom - pwnd->dims.bottom + pwnd->dims.top); - + if (wmprect->right < pwnd->dims.right) pwnd->dims.moveTo(wmprect->right + pwnd->dims.left - pwnd->dims.right, pwnd->dims.top); - + if (wmprect->left > pwnd->dims.left) pwnd->dims.moveTo(wmprect->left, pwnd->dims.top); - + pwnd->rect.moveTo(pwnd->rect.left + pwnd->dims.left - oldleft, pwnd->rect.top + pwnd->dims.top - oldtop); if (restoreRect == 0) pwnd->restoreRect = pwnd->dims; @@ -192,7 +192,7 @@ Window *WindowMgr::NewWindow(const Common::Rect &dims, const Common::Rect *resto pwnd->restoreRect.bottom++; pwnd->restoreRect.right++; } - + if (draw) DrawWindow(pwnd); _gfx->SetPort((Port *)pwnd); @@ -218,7 +218,7 @@ void WindowMgr::DrawWindow(Window *pWnd) { _gfx->FillRect(pWnd->restoreRect, SCI_SCREEN_MASK_PRIORITY, 0, 15); } } - + // drawing frame,shadow and title if (!(wndStyle & SCI_WINDOWMGR_STYLE_USER)) { r = pWnd->dims; @@ -241,14 +241,14 @@ void WindowMgr::DrawWindow(Window *pWnd) { _text->Box(pWnd->title.c_str(), 1, r, SCI_TEXT_ALIGNMENT_CENTER, 0); _gfx->PenColor(oldcolor); } - + r = pWnd->dims; r.top += 9; } - + r.grow(-1); } - + if (!(wndStyle & SCI_WINDOWMGR_STYLE_TRANSPARENT)) _gfx->FillRect(r, SCI_SCREEN_MASK_VISUAL, pWnd->backClr); diff --git a/engines/sci/parser/vocabulary.cpp b/engines/sci/parser/vocabulary.cpp index 0e84a34cfd..2cf47f00c3 100644 --- a/engines/sci/parser/vocabulary.cpp +++ b/engines/sci/parser/vocabulary.cpp @@ -126,7 +126,7 @@ bool Vocabulary::loadParserWords() { // First try to load the SCI0 vocab resource. Resource *resource = _resMan->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_MAIN_VOCAB), 0); - + if (!resource) { warning("SCI0: Could not find a main vocabulary, trying SCI01"); resource = _resMan->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_MAIN_VOCAB), 0); @@ -206,7 +206,7 @@ const char *Vocabulary::getAnyWordFromGroup(int group) { bool Vocabulary::loadSuffixes() { // Determine if we can find a SCI1 suffix vocabulary first Resource* resource = NULL; - + if (_vocabVersion == kVocabularySCI0) resource = _resMan->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_SUFFIX_VOCAB), 1); else @@ -245,12 +245,12 @@ bool Vocabulary::loadSuffixes() { void Vocabulary::freeSuffixes() { Resource* resource = NULL; - + if (_vocabVersion == kVocabularySCI0) resource = _resMan->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_SUFFIX_VOCAB), 0); else resource = _resMan->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_SUFFIX_VOCAB), 0); - + if (resource) _resMan->unlockResource(resource); diff --git a/engines/sci/parser/vocabulary.h b/engines/sci/parser/vocabulary.h index d624ccc3fb..5121a684a2 100644 --- a/engines/sci/parser/vocabulary.h +++ b/engines/sci/parser/vocabulary.h @@ -251,13 +251,13 @@ public: * Adds a new synonym to the list */ void addSynonym(synonym_t syn) { _synonyms.push_back(syn); } - + /** * Clears the list of synonyms */ void clearSynonyms() { _synonyms.clear(); } - - /** + + /** * Synonymizes a token list * Parameters: (ResultWordList &) words: The word list to synonymize */ diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index e4cd9b7d70..f67cfc878d 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -240,7 +240,7 @@ bool ResourceManager::loadFromWaveFile(Resource *res, Common::File &file) { error("Read %d bytes from %s but expected %d", really_read, res->id.toString().c_str(), res->size); res->status = kResStatusAllocated; - return true; + return true; } bool ResourceManager::loadFromAudioVolumeSCI11(Resource *res, Common::File &file) { @@ -341,7 +341,7 @@ void ResourceManager::loadResource(Resource *res) { return; } file->seek(res->file_offset, SEEK_SET); - + if (res->source->source_type == kSourceWave && loadFromWaveFile(res, *file)) return; @@ -1061,7 +1061,7 @@ void ResourceManager::readResourcePatches(ResourceSource *source) { } } } - + void ResourceManager::readWaveAudioPatches() { // Here we do check for SCI1.1+ so we can patch wav files in as audio resources Common::ArchiveMemberList files; diff --git a/engines/sci/resource.h b/engines/sci/resource.h index b20279ff3e..8c676c4b5c 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -274,7 +274,7 @@ public: ViewType getViewType() const { return _viewType; } const char *getMapVersionDesc() const { return versionDescription(_mapVersion); } const char *getVolVersionDesc() const { return versionDescription(_volVersion); } - + /** * Adds the appropriate GM patch from the Sierra MIDI utility as 4.pat, without * requiring the user to rename the file to 4.pat. Thus, the original Sierra @@ -326,7 +326,7 @@ protected: ResourceSource *addSource(ResourceSource *map, ResSourceType type, const char *filename, int number); - ResourceSource *addSource(ResourceSource *map, ResSourceType type, + ResourceSource *addSource(ResourceSource *map, ResSourceType type, const Common::FSNode *resFile, int number); /** @@ -418,7 +418,7 @@ protected: */ void readResourcePatches(ResourceSource *source); void processPatch(ResourceSource *source, ResourceType restype, int resnumber); - + /** * Process wave files as patches for Audio resources */ diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 37cb20acd3..7b6147c28c 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -109,7 +109,7 @@ Common::Error SciEngine::run() { } // Scale the screen, if needed - bool upscaledHires = (!strcmp(getGameID(), "kq6") + bool upscaledHires = (!strcmp(getGameID(), "kq6") #ifdef ENABLE_SCI32 || getSciVersion() == SCI_VERSION_2 #endif @@ -121,7 +121,7 @@ Common::Error SciEngine::run() { // Initialize graphics-related parts Screen *screen = 0; - + #ifdef ENABLE_SCI32 if (getSciVersion() >= SCI_VERSION_2_1) screen = new Screen(_resMan, 640, 480, false); // invokes initGraphics() diff --git a/engines/sci/sound/audio.cpp b/engines/sci/sound/audio.cpp index e350e3dba2..306cb0df46 100644 --- a/engines/sci/sound/audio.cpp +++ b/engines/sci/sound/audio.cpp @@ -296,7 +296,7 @@ int AudioPlayer::audioCdPlay(int track, int start, int duration) { if (getSciVersion() == SCI_VERSION_1_1) { // King's Quest VI CD Audio format _audioCdStart = g_system->getMillis(); - + // Subtract one from track. KQ6 starts at track 1, while ScummVM // ignores the data track and considers track 2 to be track 1. AudioCD.play(track - 1, 1, start, duration); @@ -306,11 +306,11 @@ int AudioPlayer::audioCdPlay(int track, int start, int duration) { uint32 length = 0; audioCdStop(); - + Common::File audioMap; if(!audioMap.open("cdaudio.map")) error("Could not open cdaudio.map"); - + while (audioMap.pos() < audioMap.size()) { uint16 res = audioMap.readUint16LE(); uint32 startFrame = audioMap.readUint16LE(); @@ -327,7 +327,7 @@ int AudioPlayer::audioCdPlay(int track, int start, int duration) { break; } } - + audioMap.close(); return length * 60 / 75; // return sample length in ticks @@ -347,7 +347,7 @@ int AudioPlayer::audioCdPosition() { // Return -1 if the sample is done playing. Converting to frames to compare. if (((g_system->getMillis() - _audioCdStart) * 75 / 1000) >= (uint32)AudioCD.getStatus().duration) return -1; - + // Return the position otherwise (in ticks). return (g_system->getMillis() - _audioCdStart) * 60 / 1000; } diff --git a/engines/sci/sound/audio.h b/engines/sci/sound/audio.h index bfd268e30f..bab7dbb969 100644 --- a/engines/sci/sound/audio.h +++ b/engines/sci/sound/audio.h @@ -62,7 +62,7 @@ class AudioPlayer { public: AudioPlayer(ResourceManager *resMan); ~AudioPlayer(); - + void setAudioRate(uint16 rate) { _audioRate = rate; } Audio::SoundHandle *getAudioHandle() { return &_audioHandle; } Audio::RewindableAudioStream *getAudioStream(uint32 number, uint32 volume, int *sampleLen); diff --git a/engines/sci/sound/iterator/core.cpp b/engines/sci/sound/iterator/core.cpp index c2c110a121..95fc713ba1 100644 --- a/engines/sci/sound/iterator/core.cpp +++ b/engines/sci/sound/iterator/core.cpp @@ -529,7 +529,7 @@ void SfxState::updateSingleSong() { } debugC(2, kDebugLevelSound, "%s", debugMessage.c_str()); - + _song = newsong; thawTime(); /* Recover song delay time */ @@ -556,7 +556,7 @@ void SfxState::updateMultiSong() { // WORKAROUND: sometimes, newsong can be NULL (e.g. in SQ4). // Handle this here, so that we avoid a crash - if (!newsong) { + if (!newsong) { // Iterators should get freed when there's only one song left playing if(oldfirst && oldfirst->_status == SOUND_STATUS_STOPPED) { debugC(2, kDebugLevelSound, "[SFX] Stopping song %lx\n", oldfirst->_handle); @@ -579,7 +579,7 @@ void SfxState::updateMultiSong() { oldseeker->_nextStopping = oldseeker->_nextPlaying; oldseeker->_nextPlaying = ¬_playing_anymore; - if (oldseeker == oldseeker->_nextPlaying) { + if (oldseeker == oldseeker->_nextPlaying) { error("updateMultiSong() failed. Breakpoint in %s, line %d", __FILE__, __LINE__); } } @@ -588,7 +588,7 @@ void SfxState::updateMultiSong() { for (newseeker = newsong; newseeker; newseeker = newseeker->_nextPlaying) { newseeker->_nextPlaying = _songlib.findNextActive(newseeker); - if (newseeker == newseeker->_nextPlaying) { + if (newseeker == newseeker->_nextPlaying) { error("updateMultiSong() failed. Breakpoint in %s, line %d", __FILE__, __LINE__); } } diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp index 6af0597027..3e806f06b1 100644 --- a/engines/sci/sound/music.cpp +++ b/engines/sci/sound/music.cpp @@ -229,7 +229,7 @@ void SciMusic::soundPlay(MusicEntry *pSnd) { _playList.push_back(pSnd); sortPlayList(); } - + _mutex.unlock(); // unlock to perform mixer-related calls if (pSnd->pStreamAud && !_pMixer->isSoundHandleActive(pSnd->hCurrentAud)) { @@ -371,7 +371,7 @@ void SciMusic::printPlayList(Console *con) { for (uint32 i = 0; i < _playList.size(); i++) { MusicEntry *song = _playList[i]; - con->DebugPrintf("%d: %04x:%04x, resource id: %d, status: %s, %s type\n", i, + con->DebugPrintf("%d: %04x:%04x, resource id: %d, status: %s, %s type\n", i, PRINT_REG(song->soundObj), song->resnum, musicStatus[song->status], song->pMidiParser ? "MIDI" : "digital audio"); } @@ -405,7 +405,7 @@ void SciMusic::printSongInfo(reg_t obj, Console *con) { con->DebugPrintf("Sound resource information:\n"); SoundResource::Track *track = song->soundRes->getTrackByType(_pMidiDrv->getPlayId(_soundVersion)); if (track && track->digitalChannelNr != -1) { - con->DebugPrintf("Sample size: %d, sample rate: %d, channels: %d, digital channel number: %d\n", + con->DebugPrintf("Sample size: %d, sample rate: %d, channels: %d, digital channel number: %d\n", track->digitalSampleSize, track->digitalSampleRate, track->channelCount, track->digitalChannelNr); } } diff --git a/engines/sci/sound/music.h b/engines/sci/sound/music.h index 39b6ad0d74..79eb72fc81 100644 --- a/engines/sci/sound/music.h +++ b/engines/sci/sound/music.h @@ -126,7 +126,7 @@ public: typedef Common::Array<MusicEntry *> MusicList; -class SciMusic +class SciMusic #ifndef USE_OLD_MUSIC_FUNCTIONS : public Common::Serializable #endif diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp index dcf4b33553..74b44953fb 100644 --- a/engines/sci/sound/soundcmd.cpp +++ b/engines/sci/sound/soundcmd.cpp @@ -126,7 +126,7 @@ void process_sound_events(EngineState *s) { /* Get all sound events, apply their } #endif -SoundCommandParser::SoundCommandParser(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, AudioPlayer *audio, SciVersion soundVersion) : +SoundCommandParser::SoundCommandParser(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, AudioPlayer *audio, SciVersion soundVersion) : _resMan(resMan), _segMan(segMan), _kernel(kernel), _audio(audio), _soundVersion(soundVersion) { #ifdef USE_OLD_MUSIC_FUNCTIONS @@ -223,7 +223,7 @@ reg_t SoundCommandParser::parseCommand(int argc, reg_t *argv, reg_t acc) { if (argc == 6) { // cmdSendMidi byte channel = argv[2].toUint16() & 0xf; byte midiCmd = argv[3].toUint16() & 0xff; - + uint16 controller = argv[4].toUint16(); uint16 param = argv[5].toUint16(); @@ -531,7 +531,7 @@ void SoundCommandParser::cmdPauseSound(reg_t obj, int16 value) { #else if (!obj.segment) { // pause the whole playlist - // Pausing/Resuming the whole playlist was introduced + // Pausing/Resuming the whole playlist was introduced // in the SCI1 late sound scheme if (_soundVersion <= SCI_VERSION_1_EARLY) return; @@ -659,7 +659,7 @@ void SoundCommandParser::cmdFadeSound(reg_t obj, int16 value) { break; case 5: // SCI01+ - case 6: // SCI1+ (SCI1 late sound scheme), with fade and continue + case 6: // SCI1+ (SCI1 late sound scheme), with fade and continue musicSlot->fadeTo = CLIP<uint16>(_argv[2].toUint16(), 0, MUSIC_VOLUME_MAX); musicSlot->fadeStep = volume > _argv[2].toUint16() ? -_argv[4].toUint16() : _argv[4].toUint16(); musicSlot->fadeTickerStep = _argv[3].toUint16() * 16667 / _music->soundGetTempo(); @@ -917,7 +917,7 @@ void SoundCommandParser::cmdSetSoundVolume(reg_t obj, int16 value) { #ifndef USE_OLD_MUSIC_FUNCTIONS MusicEntry *musicSlot = _music->getSlot(obj); if (!musicSlot) { - // Do not throw a warning if the sound can't be found, as in some games + // Do not throw a warning if the sound can't be found, as in some games // this is called before the actual sound is loaded (e.g. SQ4CD, with the // drum sounds of the energizer bunny at the beginning), so this is normal // behavior diff --git a/engines/sci/video/seq_decoder.cpp b/engines/sci/video/seq_decoder.cpp index 9a14a6b408..ef2622704d 100644 --- a/engines/sci/video/seq_decoder.cpp +++ b/engines/sci/video/seq_decoder.cpp @@ -134,7 +134,7 @@ bool SeqDecoder::decodeNextFrame() { if (frameType == kSeqFrameFull) { byte *dst = _videoFrameBuffer + frameTop * SCREEN_WIDTH + frameLeft; - + byte *linebuf = new byte[frameWidth]; do { diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index 0ebe378996..bb3617f8b2 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -528,11 +528,11 @@ void Actor_v2::walkActor() { new_dir = updateActorDirection(false); // FIXME: is this correct? if (_facing != new_dir) { - + // Actor never stops walking when an object has been selected without this if (_vm->_game.version ==0) _moving = 0; - + setDirection(new_dir); } else @@ -572,9 +572,9 @@ void Actor_v2::walkActor() { _walkdata.curbox = next_box; - // WORKAROUND: The route of the meteor landing in the introduction isn't correct. + // WORKAROUND: The route of the meteor landing in the introduction isn't correct. // MM V0 in contrast to MM V2 uses two walkboxes instead of just one. Hence a route - // from walkbox 1 to 0 is calculated first. This causes the meteor to fly on a + // from walkbox 1 to 0 is calculated first. This causes the meteor to fly on a // horizontal line to walkbox 0 then vertically to the ground. // To fix this problem, the box-to-box routing has been disabled in room 33. if (_vm->_game.version == 0 && _vm->_currentRoom == 33) { @@ -1444,7 +1444,7 @@ void ScummEngine::processActors() { Actor** end = _sortedActors + numactors; for (Actor** ac = _sortedActors; ac != end; ++ac) { Actor* a = *ac; - + // V0 MM: 0x057B if (_game.version == 0) { ActorC64 *A = (ActorC64*) a; diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp index f4e2f74c43..cf1c18b4f1 100644 --- a/engines/scumm/charset.cpp +++ b/engines/scumm/charset.cpp @@ -76,7 +76,7 @@ void ScummEngine::loadCJKFont() { } else { _useCJKMode = true; debug(2, "Loading PC-Engine System Card"); - + // A 0x200 byte header can be present at the beginning of the syscard. Seek past it too. fp.seek((fp.size() & 0x200) ? 0x30200 : 0x30000); diff --git a/engines/scumm/costume.cpp b/engines/scumm/costume.cpp index 9bf4ee0cdc..caa348460f 100644 --- a/engines/scumm/costume.cpp +++ b/engines/scumm/costume.cpp @@ -652,8 +652,8 @@ void ClassicCostumeRenderer::procPCEngine(Codec1 &v1) { maskbit = revBitMask((v1.x + xPos) % 8); pcolor = block[row][col]; - masked = (v1.y + yPos < 0 || v1.y + yPos >= _out.h) || - (v1.x + xPos < 0 || v1.x + xPos >= _out.w) || + masked = (v1.y + yPos < 0 || v1.y + yPos >= _out.h) || + (v1.x + xPos < 0 || v1.x + xPos >= _out.w) || (v1.mask_ptr && (mask[0] & maskbit)); if (pcolor && !masked) { @@ -1178,7 +1178,7 @@ byte C64CostumeRenderer::drawLimb(const Actor *a, int limb) { _draw_top = 200; _draw_bottom = 0; } - + bool flipped = (a->_cost.start[limb] & 0x80) != 0; byte frameStart = _loaded._frameOffsets[a->_cost.frame[limb]]; byte frame = _loaded._frameOffsets[frameStart + a->_cost.curpos[limb]]; @@ -1297,7 +1297,7 @@ void C64CostumeLoader::frameUpdate(ActorC64 *a, int cmd ) { for (int limb = 0, pos = 0; limb < 8; ++limb, pos = 0) { // get a limb frames ptr from the costume command limbFrames = ((_animCmds + cmd)[limb]); - + // Dont change limb if entry is invalid if (limbFrames == 0xFF) continue; @@ -1320,13 +1320,13 @@ void C64CostumeLoader::frameUpdate(ActorC64 *a, int cmd ) { // Each animation-frame until we find end if (frame == 0xFF) break; - + byte ptrLow = _baseptr[frame]; byte ptrHigh = ptrLow + _dataOffsets[4]; int frameOffset = (_baseptr[ptrHigh] << 8) + _baseptr[ptrLow + 2]; // 0x23EF / 0x2400 const byte *data = _baseptr + frameOffset; - + if (data[3] > _maxHeight) _maxHeight = data[3] + 1; @@ -1367,8 +1367,8 @@ void C64CostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) { ActorC64 *A = (ActorC64 *)a; int dir = newDirToOldDir(a->getFacing()); int command = dir; - - loadCostume(a->_costume); + + loadCostume(a->_costume); // Enable/Disable speaking flag if (frame == a->_talkStartFrame) { @@ -1382,7 +1382,7 @@ void C64CostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) { // Different command for stand frame if (frame == a->_standFrame) - command = dirToDirStop(dir); + command = dirToDirStop(dir); // Update the limb frames frameUpdate(A, command); @@ -1403,7 +1403,7 @@ void C64CostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) { byte C64CostumeLoader::increaseAnims(Actor *a) { ActorC64 *A = (ActorC64 *)a; - + // check if the actor speak flag has changed since last frame increase if (A->_speaking != A->_speakingPrev) { int cmd = A->_costCommand; diff --git a/engines/scumm/costume.h b/engines/scumm/costume.h index c9f2586087..b72ac6d282 100644 --- a/engines/scumm/costume.h +++ b/engines/scumm/costume.h @@ -84,7 +84,7 @@ protected: void actorSpeak(ActorC64 *a, int &cmd); int dirToDirStop(int oldDir); void frameUpdate(ActorC64 *A, int cmd); - + }; class ClassicCostumeRenderer : public BaseCostumeRenderer { diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp index fd8aac42e7..5b210f9af6 100644 --- a/engines/scumm/cursor.cpp +++ b/engines/scumm/cursor.cpp @@ -179,7 +179,7 @@ void ScummEngine_v70he::setDefaultCursor() { static const byte palette[] = {0, 0, 0, 0, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0}; - + if (_bytesPerPixel == 2) { for (i = 0; i < 1024; i++) WRITE_UINT16(_grabbedCursor + i * 2, 5); diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp index cc3614805b..0adc05d662 100644 --- a/engines/scumm/debugger.cpp +++ b/engines/scumm/debugger.cpp @@ -858,17 +858,17 @@ bool ScummDebugger::Cmd_Passcode(int argc, const char **argv) { int args[16]; memset(args, 0, sizeof(args)); args[0] = _vm->_bootParam; - + _vm->runScript(61, 0, 0, args); - + if (_vm->_bootParam != _vm->_scummVars[411]){ DebugPrintf("Invalid Passcode\n"); return true; } - - _vm->_bootParam = 0; + + _vm->_bootParam = 0; _detach_now = true; - + } else { DebugPrintf("Use 'passcode <SEGA CD Passcode>'\n"); return true; diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 8a6a831258..3e49fd0afe 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -731,7 +731,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i // HACK: In this way we won't get a screen with dirty side strips when // loading a narrow room in a full screen room. - if (width == 224 && height == 240 && x == 16) { + if (width == 224 && height == 240 && x == 16) { char blackbuf[16 * 240]; memset(blackbuf, 0, 16 * 240); // Prepare a buffer 16px wide and 240px high, to fit on a lateral strip @@ -2645,7 +2645,7 @@ void readOffsetTable(const byte *ptr, uint16 **table, int *count) { for (int i = 0; i < *count; i++) { (*table)[i] = READ_LE_UINT16(ptr + pos) + pos + 2; pos += 2; - } + } } void decodeTileColor(byte cmd, byte *colors, int *rowIndex, int numRows) { @@ -2657,7 +2657,7 @@ void decodeTileColor(byte cmd, byte *colors, int *rowIndex, int numRows) { void GdiPCEngine::decodeStrip(const byte *ptr, uint16 *tiles, byte *colors, uint16 *masks, int numRows, bool isObject) { int loopCnt; uint16 lastTileData; - + /* * read tiles indices */ @@ -2670,34 +2670,34 @@ void GdiPCEngine::decodeStrip(const byte *ptr, uint16 *tiles, byte *colors, uint tiles[numRows - 1] = 0; loopCnt = numRows - 1; } - + while (true) { uint16 cmd = READ_LE_UINT16(ptr); ptr += 2; if (cmd & 0x8000) { tiles[rowIndex - 1] = cmd & 0x0FFF; } else if (cmd & 0x4000) { - tiles[numRows - 1] = cmd & 0x0FFF; + tiles[numRows - 1] = cmd & 0x0FFF; } else { tiles[rowIndex++] = cmd; lastTileData = cmd; break; } - } - + } + while (rowIndex < loopCnt) { byte cmd = *ptr++; int cnt = cmd & 0x1F; - + if (cmd & 0x80) { for (int i = 0; i < cnt; ++i) { tiles[rowIndex++] = lastTileData; - } + } } else if (cmd & 0x40) { for (int i = 0; i < cnt; ++i) { ++lastTileData; tiles[rowIndex++] = lastTileData; - } + } } else { for (int i = 0; i < cnt; ++i) { lastTileData = READ_LE_UINT16(ptr); @@ -2710,8 +2710,8 @@ void GdiPCEngine::decodeStrip(const byte *ptr, uint16 *tiles, byte *colors, uint /* * read palette data */ - - rowIndex = 0; + + rowIndex = 0; byte cmd = *ptr++; if (cmd == 0xFE) { while (rowIndex < numRows) { @@ -2736,11 +2736,11 @@ void GdiPCEngine::decodeStrip(const byte *ptr, uint16 *tiles, byte *colors, uint } } } - + /* * read mask indices */ - + if (_distaff || _PCE.maskIDSize == 0 || numRows > 18) { return; } @@ -2770,7 +2770,7 @@ void GdiPCEngine::decodeStrip(const byte *ptr, uint16 *tiles, byte *colors, uint masks[rowIndex++] = READ_LE_UINT16(ptr); ptr += 2; } - } + } } } } @@ -2787,14 +2787,14 @@ void GdiPCEngine::decodePCEngineGfx(const byte *room) { int numRows = *smap_ptr++; _PCE.maskIDSize = *smap_ptr++; *smap_ptr++; // unknown - + memset(_PCE.nametable, 0, sizeof(_PCE.nametable)); memset(_PCE.colortable, 0, sizeof(_PCE.colortable)); readOffsetTable(smap_ptr, &stripOffsets, &numStrips); for (int i = 0; i < numStrips; ++i) { - const byte *tilePtr = smap_ptr + stripOffsets[i]; - decodeStrip(tilePtr, - &_PCE.nametable[i * numRows], + const byte *tilePtr = smap_ptr + stripOffsets[i]; + decodeStrip(tilePtr, + &_PCE.nametable[i * numRows], &_PCE.colortable[i * numRows], &_PCE.masktable[i * numRows], numRows, @@ -2813,10 +2813,10 @@ void GdiPCEngine::decodePCEngineObject(const byte *ptr, int xpos, int ypos, int readOffsetTable(ptr, &stripOffsets, &numStrips); for (int i = 0; i < numStrips; ++i) { const byte *tilePtr = ptr + stripOffsets[i]; - decodeStrip(tilePtr, - &_PCE.nametableObj[i * numRows], - &_PCE.colortableObj[i * numRows], - &_PCE.masktableObj[i * numRows], + decodeStrip(tilePtr, + &_PCE.nametableObj[i * numRows], + &_PCE.colortableObj[i * numRows], + &_PCE.masktableObj[i * numRows], numRows, true); } @@ -2831,7 +2831,7 @@ void setTileData(byte *tile, int index, byte byte0, byte byte1) { plane02Bit = (byte0 >> (7-col)) & 0x1; // plane=0: bit0, plane=2: bit2 plane13Bit = (byte1 >> (7-col)) & 0x1; // plane=0: bit1, plane=2: bit3 tile[row * 8 + col] |= plane02Bit << (plane + 0); - tile[row * 8 + col] |= plane13Bit << (plane + 1); + tile[row * 8 + col] |= plane13Bit << (plane + 1); } } @@ -2842,7 +2842,7 @@ void GdiPCEngine::decodePCEngineTileData(const byte *ptr) { byte byte0, byte1; readOffsetTable(ptr, &tileOffsets, &_PCE.numTiles); - + if (_distaff) { free(_PCE.staffTiles); _PCE.staffTiles = (byte*)calloc(_PCE.numTiles * 8 * 8, sizeof(byte)); diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp index d5513262ee..1ac7e98689 100644 --- a/engines/scumm/he/wiz_he.cpp +++ b/engines/scumm/he/wiz_he.cpp @@ -1473,7 +1473,7 @@ uint8 *Wiz::drawWizImage(int resNum, int state, int maskNum, int maskState, int mask = _vm->findWrappedBlock(MKID_BE('WIZD'), maskPtr, maskState, 0); assert(mask); - } + } if (flags & kWIFHasPalette) { uint8 *pal = _vm->findWrappedBlock(MKID_BE('RGBS'), dataPtr, state, 0); diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp index 7e142921f8..5e3f9fefeb 100644 --- a/engines/scumm/input.cpp +++ b/engines/scumm/input.cpp @@ -597,16 +597,16 @@ void ScummEngine::processKeyboard(Common::KeyState lastKeyHit) { // the menu screen. switch (lastKeyHit.keycode) { case Common::KEYCODE_UP: - _mouseAndKeyboardStat = 328; + _mouseAndKeyboardStat = 328; break; - case Common::KEYCODE_DOWN: - _mouseAndKeyboardStat = 336; + case Common::KEYCODE_DOWN: + _mouseAndKeyboardStat = 336; break; - case Common::KEYCODE_LEFT: - _mouseAndKeyboardStat = 331; + case Common::KEYCODE_LEFT: + _mouseAndKeyboardStat = 331; break; - case Common::KEYCODE_RIGHT: - _mouseAndKeyboardStat = 333; + case Common::KEYCODE_RIGHT: + _mouseAndKeyboardStat = 333; break; default: break; diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp index 43143a0187..c6ac53b862 100644 --- a/engines/scumm/object.cpp +++ b/engines/scumm/object.cpp @@ -326,7 +326,7 @@ int ScummEngine::whereIsObjectInventory(int object) { _v0ObjectInInventory = true; res = whereIsObject(object); _v0ObjectInInventory = false; - + return res; } diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp index 8be707c281..ed61f9ab3b 100644 --- a/engines/scumm/palette.cpp +++ b/engines/scumm/palette.cpp @@ -245,12 +245,12 @@ void ScummEngine::setPCEPaletteFromPtr(const byte *ptr) { byte charsetR, charsetG, charsetB; int paletteOffset = *ptr++; - int numPalettes = *ptr++; + int numPalettes = *ptr++; int firstIndex = paletteOffset * 16; int numcolor = numPalettes * 16; - // the only color over which a background sprite + // the only color over which a background sprite // (bit 7 of the sprite attributes) will be visible colorPCEToRGB(READ_LE_UINT16(ptr), &bgSpriteR, &bgSpriteG, &bgSpriteB); ptr += 2; diff --git a/engines/scumm/player_pce.cpp b/engines/scumm/player_pce.cpp index bd0a358c3e..4c7f2980bc 100644 --- a/engines/scumm/player_pce.cpp +++ b/engines/scumm/player_pce.cpp @@ -60,19 +60,19 @@ static const byte wave_table[7][32] = { 0x10, 0x1C, 0x1D, 0x1E, 0x1E, 0x1F, 0x1F, 0x1E, 0x1C, 0x1E, 0x1F, 0x1F, 0x1E, 0x1E, 0x1D, 0x1C, 0x10, 0x03, 0x02, 0x01, 0x01, 0x00, 0x00, 0x01, 0x03, 0x01, 0x00, 0x00, 0x01, 0x01, 0x02, 0x03, }, { // square - 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, + 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, }, { // triangle - 0x10, 0x0C, 0x08, 0x04, 0x01, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x18, 0x1C, 0x1F, 0x1C, 0x18, 0x14, - 0x10, 0x0C, 0x08, 0x04, 0x01, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x18, 0x1C, 0x1F, 0x1C, 0x18, 0x14, + 0x10, 0x0C, 0x08, 0x04, 0x01, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x18, 0x1C, 0x1F, 0x1C, 0x18, 0x14, + 0x10, 0x0C, 0x08, 0x04, 0x01, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x18, 0x1C, 0x1F, 0x1C, 0x18, 0x14, }, { // saw-tooth 0x00, 0x01, 0x02, 0x03, 0x04, 0x06, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, }, { // sigmoid - 0x07, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x1F, 0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, + 0x07, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x1F, 0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, 0x08, 0x06, 0x05, 0x03, 0x02, 0x01, 0x00, 0x00, 0x0F, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x16, }, { // MW-shaped - 0x1F, 0x1E, 0x1D, 0x1D, 0x1C, 0x1A, 0x17, 0x0F, 0x0F, 0x17, 0x1A, 0x1C, 0x1D, 0x1D, 0x1E, 0x1F, + 0x1F, 0x1E, 0x1D, 0x1D, 0x1C, 0x1A, 0x17, 0x0F, 0x0F, 0x17, 0x1A, 0x1C, 0x1D, 0x1D, 0x1E, 0x1F, 0x00, 0x01, 0x02, 0x02, 0x03, 0x05, 0x08, 0x0F, 0x0F, 0x08, 0x05, 0x03, 0x02, 0x02, 0x01, 0x00 } }; @@ -84,19 +84,19 @@ static const int control_offsets[14] = { // AED8 static const byte control_data[205] = { - /* 0*/ 0xF0, 0x00, 0xF8, 0x01, 0x00, 0x00, 0xFF, - /* 7*/ 0xF0, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x01, 0x00, 0xF0, 0x3A, 0x00, 0xFD, 0xFF, + /* 0*/ 0xF0, 0x00, 0xF8, 0x01, 0x00, 0x00, 0xFF, + /* 7*/ 0xF0, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x01, 0x00, 0xF0, 0x3A, 0x00, 0xFD, 0xFF, /* 20*/ 0xF0, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x01, 0x00, 0xF0, 0x1D, 0x00, 0xF8, 0xFF, /* 33*/ 0xF0, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x02, 0x00, 0xF0, 0x1E, 0x00, 0xFC, 0xFF, - /* 46*/ 0xF0, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x07, 0x00, 0xE0, 0xFF, + /* 46*/ 0xF0, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x07, 0x00, 0xE0, 0xFF, /* 56*/ 0xF0, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x01, 0x00, 0xD8, 0xF0, 0x00, 0xD8, 0x01, 0x00, 0x00, 0x04, 0x00, 0xF0, 0xFF, /* 75*/ 0xF0, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x03, 0x00, 0xF8, 0x6E, 0x00, 0xFF, 0xFF, - /* 88*/ 0xF0, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x08, 0x00, 0xF0, 0xF0, 0x00, 0xD0, 0x01, 0x00, 0x00, 0x05, 0x00, 0xF0, 0xF0, 0x00, 0xB8, 0xE6, 0x80, 0xFF, 0xE6, 0x80, 0xFF, 0xFF, - /*116*/ 0xF0, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x05, 0x00, 0xD0, 0xFF, - /*126*/ 0xF0, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x04, 0x00, 0xF8, 0xFF, - /*136*/ 0xF0, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x03, 0x00, 0xF4, 0xE6, 0xC0, 0xFF, 0xE6, 0xC0, 0xFF, 0xFF, - /*152*/ 0xF0, 0x00, 0xD0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x10, 0x0E, 0x00, 0xFE, 0xFF, - /*165*/ 0xF0, 0x00, 0xA8, 0x01, 0x00, 0x00, 0x18, 0x00, 0x02, 0xE6, 0x80, 0xFE, 0xE6, 0xC0, 0xFF, 0xFF, + /* 88*/ 0xF0, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x08, 0x00, 0xF0, 0xF0, 0x00, 0xD0, 0x01, 0x00, 0x00, 0x05, 0x00, 0xF0, 0xF0, 0x00, 0xB8, 0xE6, 0x80, 0xFF, 0xE6, 0x80, 0xFF, 0xFF, + /*116*/ 0xF0, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x05, 0x00, 0xD0, 0xFF, + /*126*/ 0xF0, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x04, 0x00, 0xF8, 0xFF, + /*136*/ 0xF0, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x03, 0x00, 0xF4, 0xE6, 0xC0, 0xFF, 0xE6, 0xC0, 0xFF, 0xFF, + /*152*/ 0xF0, 0x00, 0xD0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x10, 0x0E, 0x00, 0xFE, 0xFF, + /*165*/ 0xF0, 0x00, 0xA8, 0x01, 0x00, 0x00, 0x18, 0x00, 0x02, 0xE6, 0x80, 0xFE, 0xE6, 0xC0, 0xFF, 0xFF, /*181*/ 0xF0, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x02, 0x00, 0xF8, 0x02, 0x00, 0x00, 0x02, 0x00, 0xF0, 0x01, 0x00, 0xF8, 0x02, 0x00, 0x08, 0xF1, 0x99, 0xAF }; @@ -120,8 +120,8 @@ static const uint16 freq_offset[3] = { }; static const uint16 freq_table[] = { - 0x0000, 0x0800, - 0xFFB0, 0xFFD1, 0xFFE8, 0xFFF1, 0x0005, 0x0000, 0x0800, + 0x0000, 0x0800, + 0xFFB0, 0xFFD1, 0xFFE8, 0xFFF1, 0x0005, 0x0000, 0x0800, 0xFF9C, 0xFFD8, 0x0000, 0x000F, 0x0005, 0x0000, 0x0800 }; @@ -130,7 +130,7 @@ static const int sound_table[13] = { }; // 0xAE12 -// Note: +// Note: // - offsets relative to data_table // - byte one of each sound was always 0x3F (= use all channels) -> removed from table static const uint16 sounds[13][6] = { @@ -158,63 +158,63 @@ static const byte data_table[482] = { 0xF2, 0xB2, 0xE1, 0x08, 0xF2, 0xF2, 0xB2, 0xE1, 0x09, 0xF2, 0xF2, 0xB2, 0xE1, 0x0A, 0xF2, 0xF2, 0xB2, 0xE1, 0x0B, 0xF2, 0xF2, 0xB2, 0xE1, 0x0C, 0xF2, 0xF2, 0xB2, 0xE1, 0x0D, 0xF2, 0xF2, 0xB2, 0xFF, 0xD1, 0x03, 0xF3, - /* 84*/ 0xFF, - + /* 84*/ 0xFF, + /* 85*/ 0xE2, 0x0C, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD3, 0x07, 0xFF, - /* 96*/ 0xE2, 0x06, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD4, 0xF0, 0x0C, 0x07, 0xFF, - /*109*/ 0xFF, - - /*110*/ 0xE2, 0x0C, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD3, 0x27, 0xFF, - /*121*/ 0xE2, 0x06, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD4, 0xF0, 0x0C, 0x27, 0xFF, - /*134*/ 0xFF, - - /*135*/ 0xE2, 0x0C, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD3, 0x47, 0xFF, - /*146*/ 0xE2, 0x06, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD4, 0xF0, 0x0C, 0x47, 0xFF, - /*159*/ 0xFF, - - /*160*/ 0xE2, 0x0C, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD3, 0x57, 0xFF, - /*171*/ 0xE2, 0x06, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD4, 0xF0, 0x0C, 0x57, 0xFF, - /*184*/ 0xFF, - - /*185*/ 0xE2, 0x0C, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD3, 0x77, 0xFF, - /*196*/ 0xE2, 0x06, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD4, 0xF0, 0x0C, 0x77, 0xFF, - /*209*/ 0xFF, - - /*210*/ 0xE2, 0x0C, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD3, 0x97, 0xFF, - /*221*/ 0xE2, 0x06, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD4, 0xF0, 0x0C, 0x97, 0xFF, - /*234*/ 0xFF, - - /*235*/ 0xE2, 0x0C, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD3, 0xB7, 0xFF, - /*246*/ 0xE2, 0x06, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD4, 0xF0, 0x0C, 0xB7, 0xFF, - /*259*/ 0xFF, - - /*260*/ 0xE2, 0x0C, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD4, 0x07, 0xFF, - /*271*/ 0xE2, 0x06, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD5, 0xF0, 0x0C, 0x07, 0xFF, - /*284*/ 0xFF, - - /*285*/ 0xE2, 0x0B, 0xE1, 0x04, 0xE6, 0xED, 0xE0, 0x0A, 0xD0, 0xDB, 0x14, 0x0E, 0xFF, - /*298*/ 0xE2, 0x0B, 0xE1, 0x04, 0xE6, 0xED, 0xE0, 0x0A, 0xD0, 0xDB, 0x32, 0x1E, 0xFF, + /* 96*/ 0xE2, 0x06, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD4, 0xF0, 0x0C, 0x07, 0xFF, + /*109*/ 0xFF, + + /*110*/ 0xE2, 0x0C, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD3, 0x27, 0xFF, + /*121*/ 0xE2, 0x06, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD4, 0xF0, 0x0C, 0x27, 0xFF, + /*134*/ 0xFF, + + /*135*/ 0xE2, 0x0C, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD3, 0x47, 0xFF, + /*146*/ 0xE2, 0x06, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD4, 0xF0, 0x0C, 0x47, 0xFF, + /*159*/ 0xFF, + + /*160*/ 0xE2, 0x0C, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD3, 0x57, 0xFF, + /*171*/ 0xE2, 0x06, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD4, 0xF0, 0x0C, 0x57, 0xFF, + /*184*/ 0xFF, + + /*185*/ 0xE2, 0x0C, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD3, 0x77, 0xFF, + /*196*/ 0xE2, 0x06, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD4, 0xF0, 0x0C, 0x77, 0xFF, + /*209*/ 0xFF, + + /*210*/ 0xE2, 0x0C, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD3, 0x97, 0xFF, + /*221*/ 0xE2, 0x06, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD4, 0xF0, 0x0C, 0x97, 0xFF, + /*234*/ 0xFF, + + /*235*/ 0xE2, 0x0C, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD3, 0xB7, 0xFF, + /*246*/ 0xE2, 0x06, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD4, 0xF0, 0x0C, 0xB7, 0xFF, + /*259*/ 0xFF, + + /*260*/ 0xE2, 0x0C, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD4, 0x07, 0xFF, + /*271*/ 0xE2, 0x06, 0xE1, 0x02, 0xE0, 0x0F, 0xE6, 0xED, 0xD5, 0xF0, 0x0C, 0x07, 0xFF, + /*284*/ 0xFF, + + /*285*/ 0xE2, 0x0B, 0xE1, 0x04, 0xE6, 0xED, 0xE0, 0x0A, 0xD0, 0xDB, 0x14, 0x0E, 0xFF, + /*298*/ 0xE2, 0x0B, 0xE1, 0x04, 0xE6, 0xED, 0xE0, 0x0A, 0xD0, 0xDB, 0x32, 0x1E, 0xFF, /*311*/ 0xE2, 0x0B, 0xE1, 0x0B, 0xE6, 0xED, 0xE0, 0x0A, 0xD0, 0xDB, 0x50, 0x1E, 0xFF, - /*324*/ 0xE2, 0x0B, 0xE1, 0x0B, 0xE6, 0xED, 0xE0, 0x0A, 0xD0, 0x0E, 0xFF, + /*324*/ 0xE2, 0x0B, 0xE1, 0x0B, 0xE6, 0xED, 0xE0, 0x0A, 0xD0, 0x0E, 0xFF, /*335*/ 0xE2, 0x0B, 0xE1, 0x02, 0xE6, 0xED, 0xE0, 0x0A, 0xD0, 0xDB, 0x0A, 0x0E, 0xFF, - /*348*/ 0xFF, - + /*348*/ 0xFF, + /*349*/ 0xE2, 0x03, 0xE1, 0x01, 0xE6, 0xED, 0xE0, 0x06, 0xD6, 0x17, 0xFF, - /*360*/ 0xFF, - /*361*/ 0xFF, - /*362*/ 0xE2, 0x04, 0xE1, 0x04, 0xE6, 0xED, 0xE0, 0x06, 0xD5, 0xA7, 0xFF, + /*360*/ 0xFF, + /*361*/ 0xFF, + /*362*/ 0xE2, 0x04, 0xE1, 0x04, 0xE6, 0xED, 0xE0, 0x06, 0xD5, 0xA7, 0xFF, /*373*/ 0xE2, 0x03, 0xE1, 0x06, 0xE6, 0xED, 0xE0, 0x06, 0xD6, 0x37, 0xFF, - /*384*/ 0xE2, 0x04, 0xE1, 0x06, 0xE6, 0xED, 0xE0, 0x06, 0xD3, 0x87, 0xFF, - + /*384*/ 0xE2, 0x04, 0xE1, 0x06, 0xE6, 0xED, 0xE0, 0x06, 0xD3, 0x87, 0xFF, + /*395*/ 0xE2, 0x0C, 0xE1, 0x00, 0xE0, 0x04, 0xE6, 0xED, 0xD4, 0x0B, 0xE8, 0x0B, 0xFF, /*408*/ 0xE2, 0x0C, 0xE1, 0x03, 0xE0, 0x04, 0xE6, 0xED, 0xD4, 0xF0, 0x0C, 0x00, 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00, - 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xFF, + 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xE8, 0x00, 0xE8, 0x10, 0xFF, /*467*/ 0xE2, 0x0C, 0xE1, 0x00, 0xE0, 0x04, 0xE6, 0xED, 0xD4, 0x1B, 0xE8, 0x1B, 0xFF, - /*480*/ 0xFF, - + /*480*/ 0xFF, + /*481*/ 0xFF }; @@ -249,7 +249,7 @@ public: void reset(); void write(int offset, byte data); void update(int16* samples, int sampleCnt); - + PSG_HuC6280(double clock, double samplerate); }; @@ -538,8 +538,8 @@ int Player_PCE::readBuffer(int16 *buffer, const int numSamples) { // copy remaining samples to the front of the buffer if (_sampleBufferCnt > 0) { - memmove(&_sampleBuffer[0], - &_sampleBuffer[_samplesPerPeriod - _sampleBufferCnt], + memmove(&_sampleBuffer[0], + &_sampleBuffer[_samplesPerPeriod - _sampleBufferCnt], _sampleBufferCnt * sizeof(int16)); } @@ -552,7 +552,7 @@ void Player_PCE::procA731(channel_t *channel) { PSG_Write(0, channel->id); PSG_Write(2, channel->freq & 0xFF); PSG_Write(3, (channel->freq >> 8) & 0xFF); - + int tmp = channel->controlVec11; if ((channel->controlVec11 & 0xC0) == 0x80) { tmp = channel->controlVec11 & 0x1F; @@ -584,7 +584,7 @@ void Player_PCE::processSoundData(channel_t *channel) { } while (true) { - const byte *ptr = channel->soundDataPtr; + const byte *ptr = channel->soundDataPtr; byte value = (ptr ? *ptr++ : 0xFF); if (value < 0xD0) { int mult = (value & 0x0F) + 1; @@ -594,7 +594,7 @@ void Player_PCE::processSoundData(channel_t *channel) { channel->soundDataPtr = ptr; return; } - + // jump_table (A7F7) switch (value - 0xD0) { case 0: /*A85A*/ @@ -662,7 +662,7 @@ void Player_PCE::procAA62(channel_t *channel, int a) { void Player_PCE::procAB7F(channel_t *channel) { uint16 freqValue = channel->controlVecShort02; channel->controlVecShort02 += channel->controlVecShort03; - + int pos = freq_offset[channel->controlVec19] + channel->controlVec18; freqValue += freq_table[pos]; if (freq_table[pos + 1] != 0x0800) { @@ -703,9 +703,9 @@ void Player_PCE::procAC24(channel_t *channel) { } void Player_PCE::procACEA(channel_t *channel, int a) { - int x = a + - channel->controlVec2 + - channel->controlVec8 + + int x = a + + channel->controlVec2 + + channel->controlVec8 + channel->controlVec9; channel->controlVecShort02 = lookup_table[x]; } @@ -730,7 +730,7 @@ Player_PCE::Player_PCE(ScummEngine *scumm, Audio::Mixer *mixer) { } Player_PCE::~Player_PCE() { - _mixer->stopHandle(_soundHandle); + _mixer->stopHandle(_soundHandle); delete[] _sampleBuffer; delete _psg; } diff --git a/engines/scumm/player_pce.h b/engines/scumm/player_pce.h index 37a70b123b..b3d51edbf9 100644 --- a/engines/scumm/player_pce.h +++ b/engines/scumm/player_pce.h @@ -91,7 +91,7 @@ public: bool endOfData() const { return false; } int getRate() const { return _sample_rate; } -private: +private: ScummEngine *_vm; Audio::Mixer *_mixer; Audio::SoundHandle _soundHandle; @@ -118,7 +118,7 @@ private: void updateSound(); void procA731(channel_t *channel); void processSoundData(channel_t *channel); - void procA9F3(int x); + void procA9F3(int x); void procAA62(channel_t *channel, int a); uint16 procAAF6(int x); void procAB7F(channel_t *channel); diff --git a/engines/scumm/player_sid.h b/engines/scumm/player_sid.h index e03728d901..bfc9453070 100644 --- a/engines/scumm/player_sid.h +++ b/engines/scumm/player_sid.h @@ -189,7 +189,7 @@ private: // never read //uint8 vec19[7]; // never read (needed by scumm engine?) - //bool curChannelActive; + //bool curChannelActive; uint8* vec20[7]; @@ -232,10 +232,10 @@ private: bool pulseWidthSwapped; bool swapPrepared; - + // never read //uint8 var5163; - + bool filterSwapped; uint8 SIDReg24_HiNibble; bool keepSwapVars; diff --git a/engines/scumm/player_v2.h b/engines/scumm/player_v2.h index e2dd252b5b..83094617da 100644 --- a/engines/scumm/player_v2.h +++ b/engines/scumm/player_v2.h @@ -178,7 +178,7 @@ public: bool isStereo() const { return true; } bool endOfData() const { return false; } int getRate() const { return _sample_rate; } - + protected: #include "common/pack-start.h" // START STRUCT PACKING @@ -192,12 +192,12 @@ protected: int16 vibrato2; int16 noise; } PACKED_STRUCT; - + struct Voice2 { byte *amplitudeOutput; byte *freqOutput; byte *octaveOutput; - + uint8 channel; int8 sustainLevel; int8 attackRate; @@ -208,7 +208,7 @@ protected: int8 releaseTime; int8 vibratoRate; int8 vibratoDepth; - + int8 curVibratoRate; int8 curVibratoUnk; @@ -230,7 +230,7 @@ protected: byte chanNumber; } PACKED_STRUCT; - + struct MusicChip { byte ampl[4]; byte freq[4]; @@ -241,7 +241,7 @@ protected: Voice _cmsVoicesBase[16]; Voice2 _cmsVoices[8]; MusicChip _cmsChips[2]; - + int8 _tempo; int8 _tempoSum; byte _looping; @@ -251,35 +251,35 @@ protected: byte _midiChannelUse[16]; byte *_midiData; byte *_midiSongBegin; - + int _loadedMidiSong; - + byte _lastMidiCommand; uint _outputTableReady; byte _clkFrequenz; byte _restart; byte _curSno; - + void loadMidiData(byte *data, int sound); void play(); - + void processChannel(Voice2 *channel); void processRelease(Voice2 *channel); void processAttack(Voice2 *channel); void processDecay(Voice2 *channel); void processSustain(Voice2 *channel); void processVibrato(Voice2 *channel); - + void playMusicChips(const MusicChip *table); void playNote(byte *&data); void clearNote(byte *&data); void offAllChannels(); void playVoice(); void processMidiData(uint ticks); - + Voice2 *getFreeVoice(); Voice2 *getPlayVoice(byte param); - + // from Player_V2 protected: bool _isV3Game; diff --git a/engines/scumm/player_v2cms.cpp b/engines/scumm/player_v2cms.cpp index 4c993b7c2d..ccc93df902 100644 --- a/engines/scumm/player_v2cms.cpp +++ b/engines/scumm/player_v2cms.cpp @@ -153,16 +153,16 @@ public: _sampleRate = sampleRate; memset(_saa1099, 0, sizeof(SAA1099)*2); } - + ~CMSEmulator() { } - + void portWrite(int port, int val); void readBuffer(int16 *buffer, const int numSamples); private: uint32 _sampleRate; - + SAA1099 _saa1099[2]; - + void envelope(int chip, int ch); void update(int chip, int16 *buffer, int length); void portWriteIntern(int chip, int offset, int data); @@ -173,7 +173,7 @@ void CMSEmulator::portWrite(int port, int val) { case 0x220: portWriteIntern(0, 1, val); break; - + case 0x221: _saa1099[0].selected_reg = val & 0x1f; if (_saa1099[0].selected_reg == 0x18 || _saa1099[0].selected_reg == 0x19) { @@ -182,11 +182,11 @@ void CMSEmulator::portWrite(int port, int val) { if (_saa1099[0].env_clock[1]) envelope(0, 1); } break; - + case 0x222: portWriteIntern(1, 1, val); break; - + case 0x223: _saa1099[1].selected_reg = val & 0x1f; if (_saa1099[1].selected_reg == 0x18 || _saa1099[1].selected_reg == 0x19) { @@ -195,7 +195,7 @@ void CMSEmulator::portWrite(int port, int val) { if (_saa1099[1].env_clock[1]) envelope(1, 1); } break; - + default: warning("CMSEmulator got port: 0x%X", port); break; @@ -254,7 +254,7 @@ void CMSEmulator::update(int chip, int16 *buffer, int length) { } return; } - + if (chip == 0) { memset(buffer, 0, sizeof(int16)*length*2); } @@ -349,7 +349,7 @@ void CMSEmulator::portWriteIntern(int chip, int offset, int data) { saa->channels[ch].amplitude[LEFT] = amplitude_lookup[data & 0x0f]; saa->channels[ch].amplitude[RIGHT] = amplitude_lookup[(data >> 4) & 0x0f]; break; - + /* channel i frequency */ case 0x08: case 0x09: @@ -360,7 +360,7 @@ void CMSEmulator::portWriteIntern(int chip, int offset, int data) { ch = reg & 7; saa->channels[ch].frequency = data & 0xff; break; - + /* channel i octave */ case 0x10: case 0x11: @@ -369,7 +369,7 @@ void CMSEmulator::portWriteIntern(int chip, int offset, int data) { saa->channels[ch + 0].octave = data & 0x07; saa->channels[ch + 1].octave = (data >> 4) & 0x07; break; - + /* channel i frequency enable */ case 0x14: saa->channels[0].freq_enable = data & 0x01; @@ -379,7 +379,7 @@ void CMSEmulator::portWriteIntern(int chip, int offset, int data) { saa->channels[4].freq_enable = data & 0x10; saa->channels[5].freq_enable = data & 0x20; break; - + /* channel i noise enable */ case 0x15: saa->channels[0].noise_enable = data & 0x01; @@ -389,13 +389,13 @@ void CMSEmulator::portWriteIntern(int chip, int offset, int data) { saa->channels[4].noise_enable = data & 0x10; saa->channels[5].noise_enable = data & 0x20; break; - + /* noise generators parameters */ case 0x16: saa->noise_params[0] = data & 0x03; saa->noise_params[1] = (data >> 4) & 0x03; break; - + /* envelope generators parameters */ case 0x18: case 0x19: @@ -408,7 +408,7 @@ void CMSEmulator::portWriteIntern(int chip, int offset, int data) { /* reset the envelope */ saa->env_step[ch] = 0; break; - + /* channels enable & reset generators */ case 0x1c: saa->all_ch_enable = data & 0x01; @@ -422,7 +422,7 @@ void CMSEmulator::portWriteIntern(int chip, int offset, int data) { } } break; - + default: /* Error! */ error("CMS Unkown write to reg %x with %x",reg, data); } @@ -720,7 +720,7 @@ static const byte freqTable[] = { /*static const byte amplTable[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0 % - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 10 % 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, // 20 % @@ -740,13 +740,13 @@ static const byte freqTable[] = { 0x00, 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, // 90 % 0x70, 0x80, 0x90, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, // 100 % - 0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0 + 0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0 };*/ static const byte octaveTable[] = { 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x04, 0x00, 0x05, 0x00, 0x06, 0x00, 0x07, - 0x00, 0x08, 0x00, 0x09, 0x00, 0x0A, 0x00, 0x0B, + 0x00, 0x08, 0x00, 0x09, 0x00, 0x0A, 0x00, 0x0B, 0x01, 0x00, 0x01, 0x01, 0x01, 0x02, 0x01, 0x03, 0x01, 0x04, 0x01, 0x05, 0x01, 0x06, 0x01, 0x07, 0x01, 0x08, 0x01, 0x09, 0x01, 0x0A, 0x01, 0x0B, @@ -842,14 +842,14 @@ Player_V2CMS::Player_V2CMS(ScummEngine *scumm, Audio::Mixer *mixer) { _timer_output = 0; for (i = 0; i < 4; i++) _timer_count[i] = 0; - + memset(_cmsVoicesBase, 0, sizeof(Voice)*16); memset(_cmsVoices, 0, sizeof(Voice2)*8); memset(_cmsChips, 0, sizeof(MusicChip)*2); _midiDelay = _octaveMask = _looping = _tempo = 0; _midiData = _midiSongBegin = 0; _loadedMidiSong = 0; - memset(_midiChannel, 0, sizeof(Voice2*)*16); + memset(_midiChannel, 0, sizeof(Voice2*)*16); memset(_midiChannelUse, 0, sizeof(byte)*16); _cmsVoices[0].amplitudeOutput = &(_cmsChips[0].ampl[0]); @@ -884,7 +884,7 @@ Player_V2CMS::Player_V2CMS(ScummEngine *scumm, Audio::Mixer *mixer) { 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x04, 0x00, 0x05, 0x00, 0x14, 0x3F, 0x15, 0x00, 0x16, 0x00, 0x18, 0x00, 0x19, 0x00, 0x1C, 0x01 }; - + i = 0; for (int cmsPort = 0x220; i < 2; cmsPort += 2, ++i) { for (int off = 0; off < 13; ++off) { @@ -892,7 +892,7 @@ Player_V2CMS::Player_V2CMS(ScummEngine *scumm, Audio::Mixer *mixer) { g_cmsEmu->portWrite(cmsPort, cmsInitData[off*2+1]); } } - + _mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); } @@ -974,7 +974,7 @@ void Player_V2CMS::stopSound(int nr) { void Player_V2CMS::startSound(int nr) { byte *data = _vm->getResourceAddress(rtSound, nr); assert(data); - + if (data[6] == 0x80) { mutex_up(); loadMidiData(data, nr); @@ -1021,28 +1021,28 @@ void Player_V2CMS::startSound(int nr) { void Player_V2CMS::loadMidiData(byte *data, int sound) { memset(_midiChannelUse, 0, sizeof(byte)*16); - + _tempo = data[7]; _looping = data[8]; - + byte channels = data[14]; byte curChannel = 0; byte *voice2 = data + 23; - + for (; channels != 0; ++curChannel, --channels, voice2 += 16) { if (*(data + 15 + curChannel)) { byte channel = *(data + 15 + curChannel) - 1; _midiChannelUse[channel] = 1; - + Voice *voiceDef = &_cmsVoicesBase[channel]; - + byte attackDecay = voice2[10]; voiceDef->attack = attackRate[attackDecay >> 4]; voiceDef->decay = decayRate[attackDecay & 0x0F]; byte sustainRelease = voice2[11]; voiceDef->sustain = sustainRate[sustainRelease >> 4]; voiceDef->release = releaseRate[sustainRelease & 0x0F]; - + if (voice2[3] & 0x40) { voiceDef->vibrato = 0x0301; if (voice2[13] & 0x40) { @@ -1051,7 +1051,7 @@ void Player_V2CMS::loadMidiData(byte *data, int sound) { } else { voiceDef->vibrato = 0; } - + if (voice2[8] & 0x80) { voiceDef->vibrato2 = 0x0506; if (voice2[13] & 0x80) { @@ -1060,7 +1060,7 @@ void Player_V2CMS::loadMidiData(byte *data, int sound) { } else { voiceDef->vibrato2 = 0; } - + if ((voice2[8] & 0x0F) > 1) { voiceDef->octadd = 0x01; } else { @@ -1068,7 +1068,7 @@ void Player_V2CMS::loadMidiData(byte *data, int sound) { } } } - + for (int i = 0, channel = 0; i < 8; ++i, channel += 2) { _cmsVoices[i].chanNumber = 0xFF; _cmsVoices[i].curVolume = 0; @@ -1076,12 +1076,12 @@ void Player_V2CMS::loadMidiData(byte *data, int sound) { _midiChannel[channel] = 0; } - + _midiDelay = 0; memset(_cmsChips, 0, sizeof(MusicChip)*2); _midiData = data + 151; _midiSongBegin = _midiData + data[9]; - + _loadedMidiSong = sound; } @@ -1306,7 +1306,7 @@ void Player_V2CMS::next_freqs(ChannelInfo *channel) { if (channel->d.freqmod_offset != 0) if (channel->d.freqmod_offset > channel->d.freqmod_modulo) channel->d.freqmod_offset -= channel->d.freqmod_modulo; - + channel->d.freq = (int) (freqmod_table[channel->d.freqmod_table + (channel->d.freqmod_offset >> 4)]) * (int) channel->d.freqmod_multiplier / 256 @@ -1382,12 +1382,12 @@ void Player_V2CMS::processMidiData(uint ticks) { } else { _lastMidiCommand = command; if (command < 0x90) { - clearNote(currentData); + clearNote(currentData); } else { playNote(currentData); } } - + temp = command = *currentData++; if (command & 0x80) { temp = (command & 0x7F) << 8; @@ -1399,14 +1399,14 @@ void Player_V2CMS::processMidiData(uint ticks) { int lastBit = temp & 1; temp >>= 1; temp += lastBit; - + if (temp) break; } _midiData = currentData; _midiDelay = temp; } - + _midiDelay -= ticks; if (_midiDelay < 0) _midiDelay = 0; @@ -1426,7 +1426,7 @@ int Player_V2CMS::readBuffer(int16 *buffer, const int numSamples) { if (!(_clkFrequenz & 0x01)) { playVoice(); } - + _tempoSum += _tempo; // FIXME: _tempoSum is declared as char; on some systems char is unsigned. // E.g. on OS X. Hence the following check is always false. @@ -1437,7 +1437,7 @@ int Player_V2CMS::readBuffer(int16 *buffer, const int numSamples) { processMidiData(1); } } - + if (!(_next_tick >> FIXP_SHIFT) && !_midiData) { _next_tick += _tick_len; nextTick(); @@ -1461,29 +1461,29 @@ void Player_V2CMS::playVoice() { playMusicChips(_cmsChips); _outputTableReady = 0; } - + _octaveMask = 0xF0; Voice2 *voice =0; for (int i = 0; i < 8; ++i) { voice = &_cmsVoices[i]; _octaveMask = ~_octaveMask; - + if (voice->chanNumber != 0xFF) { processChannel(voice); continue; } - + if (!voice->curVolume) { *(voice->amplitudeOutput) = 0; } - + int volume = voice->curVolume - voice->releaseRate; voice->curVolume = volume; - + if (volume < 0) { volume = voice->curVolume = 0; } - + *(voice->amplitudeOutput) = ((volume >> 4) | (volume & 0xF0)) & voice->channel; ++_outputTableReady; } @@ -1495,23 +1495,23 @@ void Player_V2CMS::processChannel(Voice2 *channel) { case PROCESS_RELEASE: processRelease(channel); break; - + case PROCESS_ATTACK: processAttack(channel); break; - + case PROCESS_DECAY: processDecay(channel); break; - + case PROCESS_SUSTAIN: processSustain(channel); break; - + case PROCESS_VIBRATO: processVibrato(channel); break; - + default: break; } @@ -1573,7 +1573,7 @@ void Player_V2CMS::processVibrato(Voice2 *channel) { channel->curVibratoUnk = (channel->vibratoDepth & 0x0F) << 1; } } - + byte *output = channel->amplitudeOutput; *output = ((channel->curVolume >> 4) | (channel->curVolume & 0xF0)) & channel->channel; output = channel->freqOutput; @@ -1584,14 +1584,14 @@ void Player_V2CMS::processVibrato(Voice2 *channel) { void Player_V2CMS::offAllChannels() { warning("offAllChannels STUB"); -/* +/* // after using this sound can not be played anymore (since it would deinit the emulator) static const byte cmsOffData[10*2] = { 0x1C, 0x02, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x04, 0x00, 0x05, 0x00, 0x14, 0x3F, 0x15, 0x00, 0x16, 0x00 }; - + for (int cmsPort = 0x220, i = 0; i < 2; cmsPort += 2, ++i) { for (int off = 0; off < 10; ++off) { g_cmsEmu->portWrite(cmsPort+1, cmsOffData[off*2]); @@ -1604,7 +1604,7 @@ Player_V2CMS::Voice2 *Player_V2CMS::getFreeVoice() { Voice2 *curVoice = 0; Voice2 *selected = 0; uint8 volume = 0xFF; - + for (int i = 0; i < 8; ++i) { curVoice = &_cmsVoices[i]; @@ -1613,23 +1613,23 @@ Player_V2CMS::Voice2 *Player_V2CMS::getFreeVoice() { selected = curVoice; break; } - + if (curVoice->curVolume < volume) { selected = curVoice; volume = selected->curVolume; } } } - + if (selected) { selected->chanNumber = _lastMidiCommand & 0x0F; - + uint8 channel = selected->chanNumber; Voice2 *oldChannel = _midiChannel[channel]; _midiChannel[channel] = selected; selected->nextVoice = oldChannel; } - + return selected; } @@ -1647,13 +1647,13 @@ void Player_V2CMS::playNote(byte *&data) { freeVoice->vibratoRate = freeVoice->curVibratoRate = voice->vibrato; freeVoice->unkVibratoRate = freeVoice->unkRate = voice->vibrato2; freeVoice->maxAmpl = 0xFF; - + uint8 rate = freeVoice->attackRate; uint8 volume = freeVoice->curVolume >> 1; - + if (rate < volume) rate = volume; - + rate -= freeVoice->attackRate; freeVoice->curVolume = rate; freeVoice->playingNote = *data; @@ -1680,7 +1680,7 @@ void Player_V2CMS::playNote(byte *&data) { Player_V2CMS::Voice2 *Player_V2CMS::getPlayVoice(byte param) { byte channelNum = _lastMidiCommand & 0x0F; Voice2 *channel = _midiChannel[channelNum]; - + if (channel) { Voice2 *backUp = 0; while (true) { @@ -1692,7 +1692,7 @@ Player_V2CMS::Voice2 *Player_V2CMS::getPlayVoice(byte param) { if (!channel) return 0; } - + Voice2 *backUp2 = channel->nextVoice; { Voice2 *temp = backUp; @@ -1706,7 +1706,7 @@ Player_V2CMS::Voice2 *Player_V2CMS::getPlayVoice(byte param) { } channel = backUp; } - + return channel; } @@ -1723,18 +1723,18 @@ void Player_V2CMS::clearNote(byte *&data) { void Player_V2CMS::play() { _octaveMask = 0xF0; channel_data *chan = &(_channels[0].d); - + static byte volumeReg[4] = { 0x00, 0x00, 0x00, 0x00 }; static byte octaveReg[4] = { 0x66, 0x66, 0x66, 0x66 }; static byte freqReg[4] = { 0xFF, 0xFF, 0xFF, 0xFF }; - + static byte freqEnable = 0x3E; static byte noiseEnable = 0x01; static byte noiseGen = 0x02; for (int i = 1; i <= 4; ++i) { if (chan->time_left) { uint16 freq = chan->freq; - + if (i == 4) { if ((freq >> 8) & 0x40) { noiseGen = freq & 0xFF; @@ -1747,10 +1747,10 @@ void Player_V2CMS::play() { if (freq == 0) { freq = 0xFFC0; } - + int cmsOct = 2; int freqOct = 0x8000; - + while (true) { if (freq >= freqOct) { break; @@ -1765,11 +1765,11 @@ void Player_V2CMS::play() { } byte oct = cmsOct << 4; oct |= cmsOct; - + oct &= _octaveMask; oct |= ((~_octaveMask) & octaveReg[((i & 3) >> 1)]); octaveReg[((i & 3) >> 1)] = oct; - + freq >>= -(cmsOct-9); freqReg[(i&3)] = (-(freq-511)) & 0xFF; } @@ -1805,9 +1805,9 @@ void Player_V2CMS::play() { g_cmsEmu->portWrite(0x221, 0x11); g_cmsEmu->portWrite(0x220, octaveReg[1]); g_cmsEmu->portWrite(0x221, 0x14); - g_cmsEmu->portWrite(0x220, freqEnable); + g_cmsEmu->portWrite(0x220, freqEnable); g_cmsEmu->portWrite(0x221, 0x15); - g_cmsEmu->portWrite(0x220, noiseEnable); + g_cmsEmu->portWrite(0x220, noiseEnable); g_cmsEmu->portWrite(0x221, 0x16); g_cmsEmu->portWrite(0x220, noiseGen); } diff --git a/engines/scumm/player_v4a.cpp b/engines/scumm/player_v4a.cpp index ad5d5c0a5b..28489f86ce 100644 --- a/engines/scumm/player_v4a.cpp +++ b/engines/scumm/player_v4a.cpp @@ -52,7 +52,7 @@ Player_V4A::Player_V4A(ScummEngine *scumm, Audio::Mixer *mixer) bool Player_V4A::init() { if (_vm->_game.id != GID_MONKEY_VGA) error("player_v4a - unknown game"); - + Common::File fileMdat, fileSample; if (fileMdat.open("music.dat") && fileSample.open("sample.dat")) { @@ -63,7 +63,7 @@ bool Player_V4A::init() { } } else warning("player_v4a: couldnt load one of the music resources: music.dat, sample.dat"); - + return false; } @@ -81,7 +81,7 @@ void Player_V4A::stopAllSounds() { debug(5, "player_v4a: stopAllSounds"); if (_initState > 0) { _tfmxMusic.stopSong(); - _signal = 0; + _signal = 0; _musicId = 0; _tfmxSfx.stopSong(); @@ -164,7 +164,7 @@ void Player_V4A::startSound(int nr) { _tfmxMusic.doSong(index); _signal = 2; - // the Tfmx-player never "ends" the output by itself, so this should be threadsafe + // the Tfmx-player never "ends" the output by itself, so this should be threadsafe if (!_mixer->isSoundHandleActive(_musicHandle)) _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_musicHandle, &_tfmxMusic, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO); _musicId = nr; @@ -176,7 +176,7 @@ int Player_V4A::getMusicTimer() { if (_initState < 0) return 2000; if (_musicId) { - // The titlesong (and a few others) is running with ~70 ticks per second and the scale seems to be based on that. + // The titlesong (and a few others) is running with ~70 ticks per second and the scale seems to be based on that. // The Game itself doesnt get the timing from the Tfmx Player however, so we just use the elapsed time // 357 ~ 1000 * 25 * (1 / 70) return _mixer->getSoundElapsedTime(_musicHandle) / 357; diff --git a/engines/scumm/player_v4a.h b/engines/scumm/player_v4a.h index 15e225854c..abacd8e511 100644 --- a/engines/scumm/player_v4a.h +++ b/engines/scumm/player_v4a.h @@ -69,7 +69,7 @@ private: // byte type; } _sfxSlots[4]; - int8 _initState; // < 0: failed, 0: uninitialised, > 0: initialised + int8 _initState; // < 0: failed, 0: uninitialised, > 0: initialised int getSfxChan(int id) const { for (int i = 0; i < ARRAYSIZE(_sfxSlots); ++i) diff --git a/engines/scumm/script_v0.cpp b/engines/scumm/script_v0.cpp index d0339f478a..d21b26beb3 100644 --- a/engines/scumm/script_v0.cpp +++ b/engines/scumm/script_v0.cpp @@ -411,7 +411,7 @@ void ScummEngine_v0::decodeParseString() { void ScummEngine_v0::drawSentenceWord(int object, bool usePrep, bool objInInventory) { const byte *temp; int sentencePrep = 0; - + // If object not in inventory, we except an index if (!objInInventory) _v0ObjectIndex = true; @@ -497,7 +497,7 @@ void ScummEngine_v0::drawSentence() { else inventoryFirst = true; } - + // Draw the inventory? if (_activeInventory > 0 && _activeObject2 == 0) { @@ -511,8 +511,8 @@ void ScummEngine_v0::drawSentence() { } else // Room based drawSentenceWord(_activeObjectIndex, inventoryFirst, false); } - - // Draw the 2nd active object + + // Draw the 2nd active object } else if (_activeObject2) { // 2nd Object is in inventory @@ -527,7 +527,7 @@ void ScummEngine_v0::drawSentence() { // Draw the active actor if (_activeActor) { Actor *a = derefActor(_activeActor, ""); - + strcat(_sentenceBuf, " "); strcat(_sentenceBuf, (const char*)a->getActorName()); } @@ -780,7 +780,7 @@ void ScummEngine_v0::o_pickupObject() { if (whereIsObjectInventory(_activeObject2) == WIO_INVENTORY) /* Don't take an */ return; /* object twice */ - + addObjectToInventory(obj, _roomResource); markObjectRectAsDirty(obj); putOwner(obj, VAR(VAR_EGO)); @@ -803,7 +803,7 @@ void ScummEngine_v0::o_setActorBitVar() { byte act = getVarOrDirectByte(PARAM_1); byte mask = getVarOrDirectByte(PARAM_2); byte mod = getVarOrDirectByte(PARAM_3); - + // 0x63ED if (act >= _numActors) return; diff --git a/engines/scumm/script_v6.cpp b/engines/scumm/script_v6.cpp index 435cbf50c7..1380c9c0ba 100644 --- a/engines/scumm/script_v6.cpp +++ b/engines/scumm/script_v6.cpp @@ -700,12 +700,12 @@ void ScummEngine_v6::o6_ifNot() { void ScummEngine_v6::o6_jump() { int offset = fetchScriptWordSigned(); - // WORKAROUND bug #2826144: Talking to the guard at the bigfoot party, after + // WORKAROUND bug #2826144: Talking to the guard at the bigfoot party, after // he's let you inside, will cause the game to hang, if you end the conversation. // This is a script bug, due to a missing jump in one segment of the script. if (_game.id == GID_SAMNMAX && vm.slot[_currentScript].number == 101 && readVar(0x8000 + 97) == 1 && offset == 1) { offset = -18; - } + } _scriptPointer += offset; } diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index e474e8b5a8..a286f5a162 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -507,7 +507,7 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) case Common::kRenderCGA: case Common::kRenderEGA: case Common::kRenderAmiga: - if ((_game.version >= 4 && !(_game.features & GF_16COLOR) + if ((_game.version >= 4 && !(_game.features & GF_16COLOR) && !(_game.platform == Common::kPlatformAmiga && _renderMode == Common::kRenderEGA)) || (_game.features & GF_OLD256)) _renderMode = Common::kRenderDefault; diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 5c49d50531..5442c12185 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -994,7 +994,7 @@ protected: // HACK Double the array size to handle 16-bit images. // this should be dynamically allocated based on game depth instead. - byte _grabbedCursor[16384]; + byte _grabbedCursor[16384]; byte _currentCursor; byte _newEffect, _switchRoomEffect2, _switchRoomEffect; @@ -1039,7 +1039,7 @@ protected: void setPaletteFromTable(const byte *ptr, int numcolor, int firstIndex = 0); void resetPalette(); - + void setCurrentPalette(int pal); void setRoomPalette(int pal, int room); void setPCEPaletteFromPtr(const byte *ptr); diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index 6004ac62b3..6760072ed7 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -424,7 +424,7 @@ void Sound::playSound(int soundID) { size = READ_BE_UINT16(ptr + 12); assert(size); - + rate = 3579545 / READ_BE_UINT16(ptr + 20); sound = (byte *)malloc(size); int vol = ptr[24] * 4; @@ -2113,7 +2113,7 @@ int ScummEngine::readSoundResourceSmallHeader(int idx) { if (_game.features & GF_OLD_BUNDLE) { _fileHandle->seek(wa_offs + wa_size + 6, SEEK_SET); byte musType = _fileHandle->readByte(); - + if (musType == 0x80) { _fileHandle->seek(ad_offs, SEEK_SET); _fileHandle->read(_res->createResource(rtSound, idx, ad_size), ad_size); diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp index d371f8744d..d63c1f9381 100644 --- a/engines/scumm/verbs.cpp +++ b/engines/scumm/verbs.cpp @@ -709,7 +709,7 @@ bool ScummEngine_v0::verbMoveToActor(int actor) { return false; return true; - } + } return true; } @@ -744,8 +744,8 @@ bool ScummEngine_v0::verbMove(int object, int objectIndex, bool invObject) { _activeObjectIndex = objectIndex; _v0ObjectIndex = true; - // Execute pickup - runObject(objectIndex, 14); + // Execute pickup + runObject(objectIndex, 14); _v0ObjectIndex = false; _activeObject = oldActive; @@ -753,7 +753,7 @@ bool ScummEngine_v0::verbMove(int object, int objectIndex, bool invObject) { // Finished picking up _verbPickup = false; - } + } } return false; @@ -792,7 +792,7 @@ bool ScummEngine_v0::verbObtain(int obj, int objIndex) { } int ScummEngine_v0::verbPrep(int object) { - if (!_v0ObjectInInventory) + if (!_v0ObjectInInventory) _v0ObjectIndex = true; else _v0ObjectIndex = false; @@ -825,7 +825,7 @@ bool ScummEngine_v0::verbExec() { // Lets try walk to the object if (_activeObject && _activeObjectIndex && !_activeObjectObtained && _currentMode != 0) { prep = verbPrep(_activeObjectIndex); - + if (verbObtain(_activeObject, _activeObjectIndex)) return true; @@ -838,7 +838,7 @@ bool ScummEngine_v0::verbExec() { _v0ObjectInInventory = false; if (verbObtain(_activeObject2, _activeObject2Index)) return true; - + if (prep != 1 && prep != 4) { _activeInventory = _activeObject; _activeObject = _activeObject2; @@ -901,7 +901,7 @@ bool ScummEngine_v0::verbExec() { resetSentence(true); return false; } - + resetSentence(); return false; } @@ -914,10 +914,10 @@ bool ScummEngine_v0::verbExec() { if (verbExecutes(_activeInventory, true) == false) { if (_activeObject2 && verbExecutes(_activeObject2, true)) { _v0ObjectInInventory = true; - + _activeObject = _activeInventory; _activeInventory = _activeObject2; - + runObject(_activeObject, _activeVerb); } else { _v0ObjectInInventory = true; @@ -952,7 +952,7 @@ void ScummEngine_v0::checkExecVerbs() { int over = findVerbAtPos(_mouse.x, _mouse.y); int act = getActorFromPos(_virtualMouse.x, _virtualMouse.y); int obj = findObject(_virtualMouse.x, _virtualMouse.y); - + if (over && over != _activeVerb) { _activeVerb = over; _verbExecuting = false; @@ -960,7 +960,7 @@ void ScummEngine_v0::checkExecVerbs() { } if (!obj && !act && !over) { - resetSentence(false); + resetSentence(false); } else { a = derefActor(VAR(VAR_EGO), "checkExecVerbs"); a->stopActorMoving(); @@ -1000,7 +1000,7 @@ void ScummEngine_v0::checkExecVerbs() { checkV2Inventory(_mouse.x, _mouse.y); if (!_activeInventory) return; - + // Did we just change the selected inventory item? if (prevInventory && prevInventory != _activeInventory && _activeInventory != _activeObject2) { _activeObject = 0; @@ -1042,7 +1042,7 @@ void ScummEngine_v0::checkExecVerbs() { if (_activeVerb != 7) { _activeVerb = over; over = 0; - } + } if (over) { _activeVerb = 13; @@ -1054,7 +1054,7 @@ void ScummEngine_v0::checkExecVerbs() { return; } - + // Clicked on nothing, walk here? if (!over && !act && _activeVerb == 13 && !obj && _currentMode != 0) { // Clear all selected @@ -1123,10 +1123,10 @@ void ScummEngine_v0::checkExecVerbs() { } else { _activeObject = obj; _activeObjectIndex = objIdx; - + if (_activeVerb != 13) return; - + //return; } } diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp index 1dd9b97a10..e6cc5e09fa 100644 --- a/engines/sword1/detection.cpp +++ b/engines/sword1/detection.cpp @@ -49,7 +49,7 @@ static const PlainGameDescriptorGUIOpts sword1PSXSettings = {"sword1psx", "Broken Sword: The Shadow of the Templars (PlayStation)", Common::GUIO_NOMIDI}; static const PlainGameDescriptorGUIOpts sword1PSXDemoSettings = {"sword1psxdemo", "Broken Sword: The Shadow of the Templars (PlayStation demo)", Common::GUIO_NOMIDI}; - + // check these subdirectories (if present) static const char *g_dirNames[] = { "clusters", "speech", "english", "italian"}; @@ -57,7 +57,7 @@ static const char *g_dirNames[] = { "clusters", "speech", "english", "italian"}; #define NUM_COMMON_FILES_TO_CHECK 1 #define NUM_PC_FILES_TO_CHECK 3 #define NUM_MAC_FILES_TO_CHECK 4 -#define NUM_PSX_FILES_TO_CHECK 1 +#define NUM_PSX_FILES_TO_CHECK 1 #define NUM_PSX_DEMO_FILES_TO_CHECK 2 #define NUM_DEMO_FILES_TO_CHECK 1 #define NUM_MAC_DEMO_FILES_TO_CHECK 1 diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp index d28ab8efd9..88c50f8121 100644 --- a/engines/sword1/sound.cpp +++ b/engines/sword1/sound.cpp @@ -257,7 +257,7 @@ void Sound::playSample(QueueElement *elem) { int8 pan = (volR - volL) / 2; uint8 volume = (volR + volL) / 2; - if (SwordEngine::isPsx()) { + if (SwordEngine::isPsx()) { uint32 size = READ_LE_UINT32(sampleData); Audio::AudioStream *audStream = Audio::makeLoopingAudioStream(new Audio::VagStream(new Common::MemoryReadStream(sampleData + 4, size-4)), (_fxList[elem->id].type == FX_LOOP) ? 0 : 1); _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &elem->handle, audStream, elem->id, volume, pan); @@ -316,7 +316,7 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) { warning ("Could not open speech.inf"); return false; } - + uint16 numRooms = file.readUint16LE(); // Read number of rooms referenced in this file file.seek(locIndex * 4 + 2); // 4 bytes per room, skip first 2 bytes diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp index a1ff5087cf..45ad91d6ea 100644 --- a/engines/sword1/sword1.cpp +++ b/engines/sword1/sword1.cpp @@ -139,7 +139,7 @@ Common::Error SwordEngine::init() { _systemVars.playSpeech = 1; _mouseState = 0; - + // Some Mac versions use big endian for the speech files but not all of them. if (_systemVars.platform == Common::kPlatformMacintosh) _sound->checkSpeechFileEndianness(); diff --git a/engines/teenagent/actor.cpp b/engines/teenagent/actor.cpp index 3d93c977a9..1fef2b79ab 100644 --- a/engines/teenagent/actor.cpp +++ b/engines/teenagent/actor.cpp @@ -63,29 +63,29 @@ Common::Rect Actor::render(Graphics::Surface *surface, const Common::Point &posi const uint8 frames_up[] = {18, 19, 20, 21, 22, 23, 24, 25, }; const uint8 frames_down[] = {10, 11, 12, 13, 14, 15, 16, 17, }; - const uint8 frames_head_left_right[] = { - 0x27, 0x1a, 0x1b, - 0x27, 0x1c, 0x1d, - 0x27, 0x1a, - 0x27, 0x1e, 0x1f, - 0x27, 0x1a, 0x1b, - 0x27, 0x1c, - 0x27, 0x1e, - 0x27, 0x1a, + const uint8 frames_head_left_right[] = { + 0x27, 0x1a, 0x1b, + 0x27, 0x1c, 0x1d, + 0x27, 0x1a, + 0x27, 0x1e, 0x1f, + 0x27, 0x1a, 0x1b, + 0x27, 0x1c, + 0x27, 0x1e, + 0x27, 0x1a, }; - + const uint8 frames_head_up[] = { - 0x29, 0x25, 0x29, 0x29, - 0x26, 0x29, 0x26, 0x29, - 0x29, 0x25, 0x29, 0x25, - 0x29, 0x29, 0x29, 0x25, + 0x29, 0x25, 0x29, 0x29, + 0x26, 0x29, 0x26, 0x29, + 0x29, 0x25, 0x29, 0x25, + 0x29, 0x29, 0x29, 0x25, 0x25, 0x29, 0x29, 0x26 }; const uint8 frames_head_down[] = { - 0x20, 0x21, 0x22, 0x23, - 0x28, 0x24, 0x28, 0x28, - 0x24, 0x28, 0x20, 0x21, - 0x20, 0x23, 0x28, 0x20, + 0x20, 0x21, 0x22, 0x23, + 0x28, 0x24, 0x28, 0x28, + 0x24, 0x28, 0x20, 0x21, + 0x20, 0x23, 0x28, 0x20, 0x28, 0x28, 0x20, 0x28 }; @@ -139,10 +139,10 @@ Common::Rect Actor::render(Graphics::Surface *surface, const Common::Point &posi warning("no surface, skipping"); return Common::Rect(); } - + Common::Rect dirty; Common::Rect clip(0, 0, s->w, s->h); - if (head != NULL) + if (head != NULL) clip.top = head->h; int xp = position.x - s->w * zoom / 512 - s->x, yp = position.y - s->h * zoom / 256 - s->y; diff --git a/engines/teenagent/callbacks.cpp b/engines/teenagent/callbacks.cpp index 931cab7544..67e05385bd 100644 --- a/engines/teenagent/callbacks.cpp +++ b/engines/teenagent/callbacks.cpp @@ -100,7 +100,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { setLan(2, 1); Dialog::show(scene, 0x748e, 914, 915, 0xe7, 0xd7, 2, 1); displayCredits(0xe3c2); - + loadScene(42, 139, 156, 3); playSound(15, 20); playAnimation(916, 1); @@ -113,7 +113,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playAnimation(917, 1, true); waitAnimation(); displayCredits(0xe3e6); - + loadScene(40, 139, 156, 3); playMusic(3); Dialog::show(scene, 0x750d, 920, 924, 0xe7, 0xeb, 1, 2); //as i told you, our organization... @@ -190,7 +190,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { } else { for (byte i = 11; i <= 27; i += 4) playSound(76, i); - + playSound(56, 35); playSound(19, 59); playActorAnimation(864); @@ -281,7 +281,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { setLan(1, 0); playAnimation(812, 0, true); playActorAnimation(811); - + Dialog::show(scene, 0x6117, 0, 813, 0xd1, 0xec, 0, 1); loadScene(6, 230, 184); Dialog::show(scene, 0x626a, 0, 814, 0xd1, 0xec, 0, 1); @@ -766,7 +766,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { setTimerCallback(0x516d, 40); playAnimation(544, 0, true, true); //ignore busy flag for this animation return true; - + case 0x516d: //too late to scare guard, resetting SET_FLAG(0, 0); return true; @@ -775,8 +775,8 @@ bool TeenAgentEngine::processCallback(uint16 addr) { SET_FLAG(0, 0); setTimerCallback(0, 0); scene->getAnimation(0)->free(); - SET_FLAG(0xDB9C, 1); - + SET_FLAG(0xDB9C, 1); + displayAsyncMessage(0x3563, 320 * 130 + 300, 1, 5); setOns(0, 16); enableObject(2); @@ -927,7 +927,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(541); } return true; - + case 0x603e: if (CHECK_FLAG(0xDBB3, 1)) { displayMessage(0x44a7); @@ -965,7 +965,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playMusic(6); loadScene(25, 151, 156, 2); return true; - + case 0x63dc: Dialog::showMono(scene, 0x3375, 0, 0xd1, 0); return true; @@ -974,7 +974,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { case 0x6475: Dialog::showMono(scene, 0x32C1, 0, 0xd1, 0); return true; - + case 0x6479: Dialog::showMono(scene, 0x325e, 0, 0xd1, 0); return true; @@ -1366,7 +1366,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { moveTo(94, 115, 4); //call 557e, but it's not needed I guess loadScene(19, 223, 199, 1); return true; - + case 0x55a1: processCallback(0x557e); rejectMessage(); @@ -1473,9 +1473,9 @@ bool TeenAgentEngine::processCallback(uint16 addr) { case 0x5a8b: if (!CHECK_FLAG(0xDBAD, 1)) { playSound(43, 4); //grrrrrr - playSound(42, 15); - playSound(42, 17); - playSound(42, 19); + playSound(42, 15); + playSound(42, 17); + playSound(42, 19); playAnimation(656, 0); displayMessage(0x3c16); } else if (!CHECK_FLAG(0xDBA3, 1)) {//Dog has bone @@ -2055,12 +2055,12 @@ bool TeenAgentEngine::processCallback(uint16 addr) { Dialog::showMono(scene, 0x5556, 775, 0xd0, 1); playAnimation(771, 1, true, true, true); playAnimation(776, 0); - + Dialog::show(scene, 0x55f7, 777, 778, 0xd0, 0xe5, 1, 2); //i have to kill you anyway - + playAnimation(779, 0, true, true, true); playAnimation(780, 1, true, true, true); - + for (byte i = 1; i <= 6; ++i) playSound(58, i); playSound(58, 10); @@ -2072,7 +2072,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { waitAnimation(); setOns(1, 75); setOns(2, 76); - + for (byte i = 1; i <= 6; ++i) playSound(58, i); playSound(58, 9); @@ -2094,7 +2094,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { setOns(3, 79); setOns(0, 0); - + showActor(); playAnimation(0, 0); playAnimation(787, 2, true); @@ -2102,7 +2102,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { waitAnimation(); playAnimation(0, 1); - + playSound(32, 2); playSound(24, 7); @@ -2117,7 +2117,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playAnimation(792, 3, true, true, true); moveTo(40, 171, 4); - + setOns(3, 81, 35); enableObject(12, 35); playAnimation(0, 3); @@ -2134,7 +2134,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { case 0x783d: Dialog::pop(scene, 0xdb36, 0, 797, 0xd1, 0xd0, 0, 1); return true; - + case 0x7966: if (CHECK_FLAG(0xDBA4, 1)) return false; @@ -2143,7 +2143,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { case 0x7ad0: case 0x7ad7: return !processCallback(0x70e0); - + case 0x7ab9: if (CHECK_FLAG(0xDBB6, 1)) return false; @@ -2328,7 +2328,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(622, true); playAnimation(624, 0, true); waitAnimation(); - + displayMessage(0x3afd); inventory->remove(43); @@ -2464,7 +2464,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playAnimation(506, 0, true); playActorAnimation(504, true); waitAnimation(); - + setOns(0, 0); playSound(24, 2); playSound(22, 24); @@ -2478,7 +2478,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(505, true); playAnimation(507, 0, true); waitAnimation(); - + setOns(0, 4); { Object *obj = scene->getObject(3); @@ -2516,7 +2516,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(9, 8); setLan(1, 0); playAnimation(512, 0); - + warning("FIXME: fadeout not implemented"); displayMessage(0x3d3a); { @@ -2767,7 +2767,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { setLan(2, 4, 27); enableObject(4, 27); SET_FLAG(0xdba9, 0); - } + } SET_FLAG(0, 0); return true; @@ -3173,7 +3173,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { case 0x6cc4: //secret diary playActorAnimation(754); hideActor(); - + displayCutsceneMessage(0x517b, 30430); playMusic(3); @@ -3186,7 +3186,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playAnimation(753, 1, true); waitAnimation(); Dialog::show(scene, 0x5168, 529, 751, 0xd9, 0xe5, 1, 2); - + loadScene(30, scene->getPosition()); Dialog::show(scene, 0x449e, 733, 734, 0xe5, 0xd0, 2, 3); @@ -3218,7 +3218,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playAnimation(747, 2, true); waitAnimation(); - + Dialog::show(scene, 0x4da5, 734, 734, 0xd0, 0xd0, 3, 3); Dialog::show(scene, 0x4eb9, 748, 748, 0xd0, 0xd0, 3, 3); Dialog::show(scene, 0x4f15, 749, 749, 0xd0, 0xd0, 3, 3); @@ -3342,7 +3342,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(976); displayMessage(0x5955); return true; - + case 0x77d5: if (CHECK_FLAG(0xdbd7, 1) && !CHECK_FLAG(0xdbd8, 1)) { //disallow exiting through the first door until switch turned on, not present in original game displayMessage(0x52cb); @@ -3416,12 +3416,12 @@ bool TeenAgentEngine::processCallback(uint16 addr) { return true; } else return false; - + case 0x7af7: if (CHECK_FLAG(0xDBD0, 1)) { displayMessage(0x5082); return true; - } else + } else return false; case 0x7b09: { @@ -3745,7 +3745,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { //moveTo(105, 157, 0, true); playMusic(3); loadScene(11, 105, 157, 4); - + Dialog::show(scene, 0x8409, 0, 938, 0xd1, 0xec, 0, 1); playAnimation(939, 0, true, true); @@ -3756,12 +3756,12 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playAnimation(935, 1, true, true); playActorAnimation(943, true); waitAnimation(); - + playAnimation(940, 0, true, true); playAnimation(936, 1, true, true); playActorAnimation(944, true); waitAnimation(); - + playAnimation(941, 0, true, true); playAnimation(937, 1, true, true); playActorAnimation(945, true); @@ -3834,7 +3834,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { } } return true; - + case 0x9a1d: //no anchor, timeout SET_FLAG(0, 0); processCallback(0x9a7a); @@ -3855,11 +3855,11 @@ bool TeenAgentEngine::processCallback(uint16 addr) { case 5: displayMessage(0x39ae); break; - default: + default: displayMessage(0x39b7); } return true; - + case 0x99e0: //success getting an anchor SET_FLAG(0, 0); setTimerCallback(0, 0); @@ -3874,7 +3874,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { inventory->add(42); displayMessage(0x3989); return true; - + case 0x9a7a: loadScene(15, 156, 180, 3); playSound(5, 5); @@ -3883,7 +3883,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(5, 25); playActorAnimation(616); return true; - + case 0x9aca: if (scene->getId() == 13) { moveTo(172, 181, 1); @@ -3963,7 +3963,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { obj->actor_rect.top = obj->actor_rect.bottom = 193; obj->actor_orientation = 1; obj->save(); - + SET_FLAG(0xDBD7, 1); } return true; diff --git a/engines/teenagent/console.cpp b/engines/teenagent/console.cpp index ef317097a6..b4b8770d44 100644 --- a/engines/teenagent/console.cpp +++ b/engines/teenagent/console.cpp @@ -38,13 +38,13 @@ bool Console::enableObject(int argc, const char **argv) { DebugPrintf("usage: %s object_id [scene_id]\n", argv[0]); return true; } - + int id = atoi(argv[1]); if (id < 0) { DebugPrintf("object id %d is invalid\n", id); return true; } - + int scene_id = 0; if (argc > 2) { scene_id = atoi(argv[2]); @@ -53,12 +53,12 @@ bool Console::enableObject(int argc, const char **argv) { return true; } } - + if (strcmp(argv[0], "disable_object") == 0) _engine->disableObject(id, scene_id); else _engine->enableObject(id, scene_id); - + return true; } @@ -67,13 +67,13 @@ bool Console::setOns(int argc, const char **argv) { DebugPrintf("usage: %s index(0-3) value [scene_id]\n", argv[0]); return true; } - + int index = atoi(argv[1]); if (index < 0 || index > 3) { DebugPrintf("index %d is invalid\n", index); return true; } - + int value = 0; value = atoi(argv[2]); if (value < 0) { @@ -89,9 +89,9 @@ bool Console::setOns(int argc, const char **argv) { return true; } } - + _engine->setOns(index, value, scene_id); - + return true; } diff --git a/engines/teenagent/detection.cpp b/engines/teenagent/detection.cpp index 24aa250c0e..fdff5fce6d 100644 --- a/engines/teenagent/detection.cpp +++ b/engines/teenagent/detection.cpp @@ -51,7 +51,7 @@ static const ADGameDescription teenAgentGameDescriptions[] = { {"mmm.res", 0, NULL, -1}, {"sam_mmm.res", 0, NULL, -1}, {"sam_sam.res", 0, NULL, -1}, - {"unlogic.res", 0, NULL, -1}, + {"unlogic.res", 0, NULL, -1}, {NULL, 0, NULL, 0} }, Common::EN_ANY, @@ -137,7 +137,7 @@ public: buf[24] = 0; Common::String description = buf; saveList.push_back(SaveStateDescriptor(slot, description)); - + delete in; } } diff --git a/engines/teenagent/font.cpp b/engines/teenagent/font.cpp index 51de84b50e..c5d22cd2eb 100644 --- a/engines/teenagent/font.cpp +++ b/engines/teenagent/font.cpp @@ -55,7 +55,7 @@ uint Font::render(Graphics::Surface *surface, int x, int y, char c, byte color) int h = glyph[0], w = glyph[1]; if (surface == NULL || surface->pixels == NULL || y + h <= 0 || y >= 200 || x + w <= 0 || x >= 320) return w - width_pack; - + int i0 = 0, j0 = 0; if (x < 0) { j0 = -x; diff --git a/engines/teenagent/inventory.cpp b/engines/teenagent/inventory.cpp index 4468dcd593..9455a97500 100644 --- a/engines/teenagent/inventory.cpp +++ b/engines/teenagent/inventory.cpp @@ -54,7 +54,7 @@ void Inventory::init(TeenAgentEngine *engine) { for (byte i = 0; i <= 92; ++i) { InventoryObject io; uint16 obj_addr = res->dseg.get_word(0xc4a4 + i * 2); - if (obj_addr != 0) + if (obj_addr != 0) io.load(res->dseg.ptr(obj_addr)); objects.push_back(io); } @@ -155,10 +155,10 @@ bool Inventory::processEvent(const Common::Event &event) { //check combine if (!_active) return false; - + if (hovered_obj == NULL) return true; - + debug(0, "lclick on %u:%s", hovered_obj->id, hovered_obj->name.c_str()); if (selected_obj == NULL) { diff --git a/engines/teenagent/music.cpp b/engines/teenagent/music.cpp index abb4a18dd4..ba63a7043b 100644 --- a/engines/teenagent/music.cpp +++ b/engines/teenagent/music.cpp @@ -118,7 +118,7 @@ void MusicPlayer::stop() { void MusicPlayer::interrupt() { if (_rows.empty()) return; - + _currRow %= _rows.size(); Row *row = &_rows[_currRow]; diff --git a/engines/teenagent/music.h b/engines/teenagent/music.h index 3868edb514..9c518b58e0 100644 --- a/engines/teenagent/music.h +++ b/engines/teenagent/music.h @@ -67,10 +67,10 @@ protected: size = s; } } - void clear() { - delete[] data; - data = 0; - size = 0; + void clear() { + delete[] data; + data = 0; + size = 0; } } _samples[256]; byte sampleCount; diff --git a/engines/teenagent/objects.cpp b/engines/teenagent/objects.cpp index 87635ae44b..f8df4fee77 100644 --- a/engines/teenagent/objects.cpp +++ b/engines/teenagent/objects.cpp @@ -60,9 +60,9 @@ void Object::load(byte * src) { id = *src++; - rect.load(src); + rect.load(src); src += 8; - actor_rect.load(src); + actor_rect.load(src); src += 8; actor_orientation = *src++; @@ -141,8 +141,8 @@ void UseHotspot::load(byte *src) { } void UseHotspot::dump(int level) const { - debug(level, - "hotspot: inv_id: %02x, obj_id: %02x, orientation?: %02x, actor position: (%d,%d), callback: %04x", + debug(level, + "hotspot: inv_id: %02x, obj_id: %02x, orientation?: %02x, actor position: (%d,%d), callback: %04x", inventory_id, object_id, orientation, actor_x, actor_y, callback ); } diff --git a/engines/teenagent/objects.h b/engines/teenagent/objects.h index c4bca3331b..59e9d732fc 100644 --- a/engines/teenagent/objects.h +++ b/engines/teenagent/objects.h @@ -61,10 +61,10 @@ struct Rect { inline void clear() { left = top = right = bottom = 0; } - + void load(byte *src); //8 bytes void save() const; - + inline bool intersects_hline(int x1, int x2, int y) const { if (x1 > x2) SWAP(x1, x2); @@ -76,22 +76,22 @@ struct Rect { SWAP(y1, y2); return x >= left && x <= right && y1 <= bottom && y2 >= top; } - + inline bool contains(const Rect & rect) const { return rect.left >= left && rect.right <= right && rect.top >= top && rect.bottom <= bottom; } - + static inline bool inside(int x, int a, int b) { if (a > b) SWAP(a, b); return x >= a && x <= b; } - + int intersects_line(const Common::Point &a, const Common::Point &b) const { int dy = b.y - a.y, dx = b.x - a.x; int mask = 0; //orientation bitmask: 1 - top, 2 - right, 3 - bottom, 4 - left - + if (dx != 0) { int yl = (left - a.x) * dy / dx + a.y; if (yl > top && yl < bottom && inside(yl, a.y, b.y) && inside(left, a.x, b.x)) { @@ -103,8 +103,8 @@ struct Rect { //c[idx++] = Common::Point(right, yr); mask |= 2; } - } - + } + if (dy != 0) { int xt = (top - a.y) * dx / dy + a.x; if (xt > left && xt < right && inside(xt, a.x, b.x) && inside(top, a.y, b.y)) { @@ -121,7 +121,7 @@ struct Rect { } return mask; } - + void side(Common::Point &p1, Common::Point &p2, int o, const Common::Point &nearest) const { switch(o) { case kActorLeft: @@ -143,12 +143,12 @@ struct Rect { p1 = Common::Point(left, bottom); p2 = Common::Point(right, bottom); break; - + default: p1 = Common::Point(); p2 = Common::Point(); } - if (p1.sqrDist(nearest) >= p2.sqrDist(nearest)) + if (p1.sqrDist(nearest) >= p2.sqrDist(nearest)) SWAP(p1, p2); } @@ -171,7 +171,7 @@ struct Object { void setName(const Common::String &name); void load(byte *addr); void save() const; - + static Common::String parse_description(const char *name); protected: @@ -182,7 +182,7 @@ struct InventoryObject { byte id; byte animated; Common::String name, description; - + InventoryObject(): id(0), animated(0), _base(0) {} void load(byte *addr); diff --git a/engines/teenagent/pack.cpp b/engines/teenagent/pack.cpp index 25c6c8853d..1176bbc301 100644 --- a/engines/teenagent/pack.cpp +++ b/engines/teenagent/pack.cpp @@ -45,7 +45,7 @@ void Pack::close() { bool Pack::open(const Common::String &filename) { if (!file.open(filename)) return false; - + count = file.readUint32LE(); debug(0, "opened %s, found %u entries", filename.c_str(), count); offsets = new uint32[count + 1]; diff --git a/engines/teenagent/pack.h b/engines/teenagent/pack.h index 4013998152..0c9dccaceb 100644 --- a/engines/teenagent/pack.h +++ b/engines/teenagent/pack.h @@ -40,7 +40,7 @@ public: bool open(const Common::String &filename); void close(); - + inline uint32 files_count() const { return count; } uint32 get_size(uint32 id) const; uint32 read(uint32 id, byte *dst, uint32 size) const; diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp index 5393275a60..ef3dccca8b 100644 --- a/engines/teenagent/scene.cpp +++ b/engines/teenagent/scene.cpp @@ -38,9 +38,9 @@ namespace TeenAgent { Scene::Scene() : intro(false), _engine(NULL), _system(NULL), _id(0), ons(0), - orientation(kActorRight), actor_talking(false), - message_timer(0), message_first_frame(0), message_last_frame(0), message_animation(NULL), - current_event(SceneEvent::kNone), hide_actor(false), callback(0), callback_timer(0), + orientation(kActorRight), actor_talking(false), + message_timer(0), message_first_frame(0), message_last_frame(0), message_animation(NULL), + current_event(SceneEvent::kNone), hide_actor(false), callback(0), callback_timer(0), _fade_timer(0), _fade_type(0), _idle_timer(0) {} void Scene::warp(const Common::Point &_point, byte o) { @@ -55,7 +55,7 @@ bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Poi const Common::Array<Walkbox> &scene_walkboxes = walkboxes[_id - 1]; if (dst.x < 0 || dst.x > 319 || dst.y < 0 || dst.y > 199) return false; - + debug(1, "findPath %d,%d -> %d,%d", src.x, src.y, dst.x, dst.y); p.clear(); p.push_back(src); @@ -67,16 +67,16 @@ bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Poi if (!w.rect.in(src) && !w.rect.in(dst)) boxes.push_back(i); } - + for(Path::iterator i = p.begin(); i != p.end() && !boxes.empty(); ) { Path::iterator next = i; ++next; if (next == p.end()) break; - + const Common::Point &p1 = *i, &p2 = *next; debug(1, "%d,%d -> %d,%d", p1.x, p1.y, p2.x, p2.y); - + Common::List<uint>::iterator wi; for(wi = boxes.begin(); wi != boxes.end(); ++wi) { const Walkbox & w = scene_walkboxes[*wi]; @@ -84,7 +84,7 @@ bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Poi if (mask == 0) { continue; } - + w.dump(1); debug(1, "%u: intersection mask 0x%04x, searching hints", *wi, mask); int dx = p2.x - p1.x, dy = p2.y - p1.y; @@ -182,7 +182,7 @@ void Scene::moveTo(const Common::Point &_point, byte orient, bool validate) { path.push_back(point); return; } - + if (!findPath(path, position, point)) { _engine->cancel(); return; @@ -195,12 +195,12 @@ void Scene::moveTo(const Common::Point &_point, byte orient, bool validate) { void Scene::init(TeenAgentEngine *engine, OSystem *system) { _engine = engine; _system = system; - + _fade_timer = 0; _fade_type = 0; memset(palette, 0, sizeof(palette)); - + Resources *res = Resources::instance(); Common::SeekableReadStream *s = res->varia.getStream(1); if (s == NULL) @@ -217,7 +217,7 @@ void Scene::init(TeenAgentEngine *engine, OSystem *system) { teenagent_idle.load(s, Animation::kTypeVaria); if (teenagent_idle.empty()) error("invalid mark animation"); - + loadObjectData(); } @@ -228,11 +228,11 @@ void Scene::loadObjectData() { objects.resize(42); walkboxes.resize(42); fades.resize(42); - + for (byte i = 0; i < 42; ++i) { Common::Array<Object> &scene_objects = objects[i]; scene_objects.clear(); - + uint16 scene_table = res->dseg.get_word(0x7254 + i * 2); uint16 object_addr; while ((object_addr = res->dseg.get_word(scene_table)) != 0) { @@ -271,9 +271,9 @@ void Scene::loadObjectData() { Object *Scene::findObject(const Common::Point &point) { if (_id == 0) return NULL; - + Common::Array<Object> &scene_objects = objects[_id - 1]; - + for (uint i = 0; i < scene_objects.size(); ++i) { Object &obj = scene_objects[i]; if (obj.enabled != 0 && obj.rect.in(point)) @@ -358,7 +358,7 @@ void Scene::init(int id, const Common::Point &pos) { debug(0, "init(%d)", id); _id = id; sounds.clear(); - for (byte i = 0; i < 4; ++i) + for (byte i = 0; i < 4; ++i) custom_animation[i].free(); if (background.pixels == NULL) @@ -386,7 +386,7 @@ void Scene::init(int id, const Common::Point &pos) { int sub_hack = 0; if (id == 7) { //something patched in the captains room switch(res->dseg.get_byte(0xdbe6)) { - case 2: + case 2: break; case 1: sub_hack = 1; @@ -406,7 +406,7 @@ void Scene::init(int id, const Common::Point &pos) { if (now_playing != res->dseg.get_byte(0xDB90)) _engine->music->load(res->dseg.get_byte(0xDB90)); - + _system->copyRectToScreen((const byte *)background.pixels, background.pitch, 0, 0, background.w, background.h); setPalette(0); } @@ -468,13 +468,13 @@ bool Scene::processEvent(const Common::Event &event) { sounds.clear(); current_event.clear(); message_color = 0xd1; - for (int i = 0; i < 4; ++i) + for (int i = 0; i < 4; ++i) custom_animation[i].free(); _engine->playMusic(4); _engine->loadScene(10, Common::Point(136, 153)); return true; } - + if (!message.empty() && message_first_frame == 0) { clearMessage(); nextEvent(); @@ -519,7 +519,7 @@ struct ZOrderCmp { int Scene::lookupZoom(uint y) const { Resources *res = Resources::instance(); for(byte *zoom_table = res->dseg.ptr(res->dseg.get_word(0x70f4 + (_id - 1) * 2)); - zoom_table[0] != 0xff && zoom_table[1] != 0xff; + zoom_table[0] != 0xff && zoom_table[1] != 0xff; zoom_table += 2 ) { //debug(0, "%d %d->%d", y, zoom_table[0], zoom_table[1]); @@ -542,7 +542,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 message_delta) { do { restart = false; busy = processEventQueue(); - + if (_fade_timer && game_delta != 0) { if (_fade_timer > 0) { _fade_timer -= game_delta; @@ -552,7 +552,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 message_delta) { setPalette(_fade_timer + 4); } } - + switch(current_event.type) { case SceneEvent::kCredits: { _system->fillScreen(0); @@ -586,7 +586,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 message_delta) { res->font8.render(surface, current_event.dst.x, current_event.dst.y, message, current_event.color); } else { res->font7.render(surface, current_event.dst.x, current_event.dst.y, message, 0xd1); - } + } _system->unlockScreen(); return true; } @@ -607,14 +607,14 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 message_delta) { s->render(surface); } } - + Common::List<Surface *> z_order; - + for (byte i = 0; i < 4; ++i) { Animation *a = custom_animation + i; Surface *s = a->currentFrame(game_delta); if (s != NULL) { - if (!a->ignore) + if (!a->ignore) busy = true; if (!a->paused && !a->loop) got_any_animation = true; @@ -627,7 +627,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 message_delta) { } s = a->currentFrame(game_delta); } - + if (current_event.type == SceneEvent::kWaitLanAnimationFrame && current_event.slot == i) { if (s == NULL) { restart |= nextEvent(); @@ -639,10 +639,10 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 message_delta) { restart |= nextEvent(); } } - + if (s == NULL) continue; - + if (debug_features.feature[DebugFeatures::kShowLan]) z_order.push_back(s); @@ -675,9 +675,9 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 message_delta) { if (mark != NULL) { actor_animation_position = mark->render(surface); - if (!actor_animation.ignore) + if (!actor_animation.ignore) busy = true; - else + else busy = false; got_any_animation = true; } else if (!hide_actor) { @@ -702,13 +702,13 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 message_delta) { speed_x = 1; if (speed_y == 0) speed_y = 1; - + position.y += (ABS(dp.y) < speed_y? dp.y: SIGN(dp.y) * speed_y); - position.x += (o == kActorDown || o == kActorUp)? + position.x += (o == kActorDown || o == kActorUp)? (ABS(dp.x) < speed_y? dp.x: SIGN(dp.x) * speed_y): (ABS(dp.x) < speed_x? dp.x: SIGN(dp.x) * speed_x); } - + _idle_timer = 0; teenagent_idle.resetIndex(); actor_animation_position = teenagent.render(surface, position, o, mark_delta, false, zoom); @@ -730,7 +730,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 message_delta) { _idle_timer += mark_delta; if (_idle_timer < 50) actor_animation_position = teenagent.render(surface, position, orientation, 0, actor_talking, zoom); - else + else actor_animation_position = teenagent_idle.renderIdle(surface, position, orientation, mark_delta, zoom); } } @@ -761,13 +761,13 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 message_delta) { visible = false; } } - + if (visible) { res->font7.render(surface, message_pos.x, message_pos.y, message, message_color); busy = true; } } - + if (!busy && !restart && callback_timer) { if (--callback_timer == 0) { if (_engine->inventory->active()) @@ -784,7 +784,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 message_delta) { for (uint i = 0; i < scene_walkboxes.size(); ++i) { scene_walkboxes[i].rect.render(surface, 0xd0 + i); } - + Common::Point last_p = position; for(Path::const_iterator p = path.begin(); p != path.end(); ++p) { const Common::Point dp(p->x - last_p.x, p->y - last_p.y); @@ -899,7 +899,7 @@ bool Scene::processEventQueue() { message_animation = custom_animation + (current_event.slot - 1); //else if (!animation[current_event.slot].empty()) // message_animation = animation + current_event.slot; - } else + } else message_animation = &actor_animation; debug(0, "async message %d-%d (slot %u)", message_first_frame, message_last_frame, current_event.slot); } else { @@ -908,7 +908,7 @@ bool Scene::processEventQueue() { } Common::Point p; if (current_event.dst.x == 0 && current_event.dst.y == 0) { - p = Common::Point((actor_animation_position.left + actor_animation_position.right) / 2, + p = Common::Point((actor_animation_position.left + actor_animation_position.right) / 2, actor_animation_position.top); } else { p = current_event.dst; @@ -924,12 +924,12 @@ bool Scene::processEventQueue() { if (s != NULL) { p.x = s->x + s->w / 2; p.y = s->y; - } else + } else warning("no animation in slot %u", message_slot); } message_pos = messagePosition(message, p); message_color = current_event.color; - + if (message_first_frame) current_event.clear(); //async message, clearing event } @@ -1018,7 +1018,7 @@ bool Scene::processEventQueue() { case SceneEvent::kWaitLanAnimationFrame: debug(0, "waiting for the frame %d in slot %d", current_event.animation, current_event.slot); break; - + case SceneEvent::kTimer: callback = current_event.callback; callback_timer = current_event.timer; @@ -1056,7 +1056,7 @@ bool Scene::processEventQueue() { debug(0, "quit!"); _engine->quitGame(); break; - + default: error("empty/unhandler event[%d]", (int)current_event.type); } @@ -1082,18 +1082,18 @@ void Scene::setPalette(unsigned mul) { Object *Scene::getObject(int id, int scene_id) { assert(id > 0); - + if (scene_id == 0) scene_id = _id; if (scene_id == 0) return NULL; - + Common::Array<Object> &scene_objects = objects[scene_id - 1]; --id; if (id >= (int)scene_objects.size()) return NULL; - + return &scene_objects[id]; } @@ -1131,7 +1131,7 @@ uint Scene::messageDuration(const Common::String &str) { if (speed < 0) speed = 60; uint delay_delta = 1 + (255 - speed) * 99 / 255; - + uint delay = 60 + (total_width * delay_delta) / 8; //debug(0, "delay = %u, delta: %u", delay, delay_delta); return delay * 10; diff --git a/engines/teenagent/scene.h b/engines/teenagent/scene.h index 9177511795..b7fe6753fe 100644 --- a/engines/teenagent/scene.h +++ b/engines/teenagent/scene.h @@ -198,7 +198,7 @@ private: bool actor_talking; bool findPath(Path &p, const Common::Point &src, const Common::Point &dst) const; - + Common::Array<Common::Array<Object> > objects; Common::Array<Common::Array<Walkbox> > walkboxes; Common::Array<Common::Array<FadeType> > fades; @@ -215,9 +215,9 @@ private: EventList events; SceneEvent current_event; bool hide_actor; - + uint16 callback, callback_timer; - + int _fade_timer; int _fade_type; uint _idle_timer; @@ -228,18 +228,18 @@ private: }; typedef Common::List<Sound> Sounds; Sounds sounds; - + struct DebugFeatures { - enum { + enum { kShowBack, kShowLan, kShowOns, - kShowOn, - kHidePath, + kShowOn, + kHidePath, kMax }; bool feature[kMax]; - + DebugFeatures() { for(uint i = 0; i < kMax; ++i) { feature[i] = true; diff --git a/engines/teenagent/surface.cpp b/engines/teenagent/surface.cpp index 890c02366b..735ce67785 100644 --- a/engines/teenagent/surface.cpp +++ b/engines/teenagent/surface.cpp @@ -85,7 +85,7 @@ Common::Rect Surface::render(Graphics::Surface *surface, int dx, int dy, bool mi } if (src_rect.isEmpty() || dst_rect.isEmpty()) return Common::Rect(); - + if (zoom == 256) { byte *src = (byte *)getBasePtr(0, src_rect.top); byte *dst_base = (byte *)surface->getBasePtr(dst_rect.left, dst_rect.top); diff --git a/engines/teenagent/surface_list.cpp b/engines/teenagent/surface_list.cpp index 5485b42fa4..481263444b 100644 --- a/engines/teenagent/surface_list.cpp +++ b/engines/teenagent/surface_list.cpp @@ -32,22 +32,22 @@ SurfaceList::SurfaceList() : surfaces(NULL), surfaces_n(0) {} void SurfaceList::load(Common::SeekableReadStream *stream, Type type, int sub_hack) { free(); - + byte fn = stream->readByte(); if (stream->eos()) return; - + surfaces_n = fn - sub_hack; debug(0, "loading %u surfaces from list (skip %d)", surfaces_n, sub_hack); if (surfaces_n == 0) return; - + surfaces = new Surface[surfaces_n]; for (byte i = 0; i < surfaces_n; ++i) { uint offset = stream->readUint16LE(); - uint pos = stream->pos(); + uint pos = stream->pos(); stream->seek(offset); surfaces[i].load(stream, Surface::kTypeOns); stream->seek(pos); @@ -66,7 +66,7 @@ void SurfaceList::render(Graphics::Surface *surface, const Common::Rect & clip) Common::Rect r(s.x, s.y, s.x + s.w, s.y + s.h); if (r.bottom < clip.bottom || !clip.intersects(r)) continue; - + r.clip(clip); r.translate(-s.x, -s.y); s.render(surface, r.left, r.top, false, r); diff --git a/engines/teenagent/surface_list.h b/engines/teenagent/surface_list.h index 1f6ca0c510..289148af6c 100644 --- a/engines/teenagent/surface_list.h +++ b/engines/teenagent/surface_list.h @@ -33,12 +33,12 @@ class Surface; class SurfaceList { public: enum Type { kTypeOn }; - + SurfaceList(); void load(Common::SeekableReadStream *stream, Type type, int sub_hack = 0); void free(); void render(Graphics::Surface *surface, const Common::Rect & clip) const; - + protected: Surface * surfaces; uint surfaces_n; diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp index 825d12776a..19f4ef1613 100644 --- a/engines/teenagent/teenagent.cpp +++ b/engines/teenagent/teenagent.cpp @@ -52,7 +52,7 @@ bool TeenAgentEngine::trySelectedObject() { Resources *res = Resources::instance(); debug(0, "checking active object %u on %u", inv->id, dst_object->id); - + //mouse time challenge hack: if ( (res->dseg.get_byte(0) == 1 && inv->id == 49 && dst_object->id == 5) || @@ -98,14 +98,14 @@ void TeenAgentEngine::processObject() { dcall = res->dseg.ptr(READ_LE_UINT16(dcall + scene->getId() * 2 - 2)); dcall += 2 * dst_object->id - 2; uint16 callback = READ_LE_UINT16(dcall); - if (callback == 0 || !processCallback(callback)) + if (callback == 0 || !processCallback(callback)) displayMessage(dst_object->description); } break; case kActionUse: { if (trySelectedObject()) break; - + byte *dcall = res->dseg.ptr(0xb89c); dcall = res->dseg.ptr(READ_LE_UINT16(dcall + scene->getId() * 2 - 2)); dcall += 2 * dst_object->id - 2; @@ -159,7 +159,7 @@ void TeenAgentEngine::examine(const Common::Point &point, Object *object) { void TeenAgentEngine::init() { _mark_delay = 80; _game_delay = 110; - + Resources * res = Resources::instance(); use_hotspots.resize(42); byte *scene_hotspots = res->dseg.ptr(0xbb87); @@ -275,14 +275,14 @@ bool TeenAgentEngine::showLogo() { byte bg[0xfa00]; byte palette[0x400]; - + Common::SeekableReadStream *frame = logo.getStream(1); if (frame == NULL) return true; frame->read(bg, sizeof(bg)); memset(palette, 0, sizeof(palette)); - + for(uint c = 0; c < 0x100; ++c) { uint idx = c * 4; frame->read(palette + idx, 3); @@ -293,7 +293,7 @@ bool TeenAgentEngine::showLogo() { _system->setPalette(palette, 0, 0x100); uint n = logo.files_count(); - for(uint f = 0; f < 4; ++f) + for(uint f = 0; f < 4; ++f) for(uint i = 2; i <= n; ++i) { { int r = skipEvents(); @@ -301,7 +301,7 @@ bool TeenAgentEngine::showLogo() { return r > 0? true: false; } _system->copyRectToScreen(bg, 320, 0, 0, 320, 200); - + frame = logo.getStream(i); if (frame == NULL) return true; @@ -323,9 +323,9 @@ bool TeenAgentEngine::showLogo() { bool TeenAgentEngine::showMetropolis() { _system->fillScreen(0); _system->updateScreen(); - + Resources *res = Resources::instance(); - + byte palette[0x400]; memset(palette, 0, sizeof(palette)); { @@ -338,13 +338,13 @@ bool TeenAgentEngine::showMetropolis() { palette[idx + 2] *= 4; } } - + _system->setPalette(palette, 0, 0x100); - + byte varia_6[21760], varia_9[18302]; res->varia.read(6, varia_6, sizeof(varia_6)); res->varia.read(9, varia_9, sizeof(varia_9)); - + byte colors[56 * 160 * 2]; memset(colors, 0, sizeof(colors)); @@ -360,7 +360,7 @@ bool TeenAgentEngine::showMetropolis() { if (logo_y > 0) { surface->fillRect(Common::Rect(0, 0, 320, logo_y), 0); } - + { //generate colors matrix memmove(colors + 320, colors + 480, 8480); @@ -373,9 +373,9 @@ bool TeenAgentEngine::showMetropolis() { for(uint y = 1; y < 56; ++y) { for(uint x = 1; x < 160; ++x) { uint offset = y * 160 + x; - uint v = - (uint)colors[offset - 161] + colors[offset - 160] + colors[offset - 159] + - (uint)colors[offset - 1] + colors[offset + 1] + + uint v = + (uint)colors[offset - 161] + colors[offset - 160] + colors[offset - 159] + + (uint)colors[offset - 1] + colors[offset + 1] + (uint)colors[offset + 161] + colors[offset + 160] + colors[offset + 159]; v >>= 3; colors[offset + 8960] = v; @@ -390,21 +390,21 @@ bool TeenAgentEngine::showMetropolis() { for(uint x = 0; x < 320; ++x) { if (*src++ == 1) { *dst++ = colors[19 * 160 + y / 2 * 160 + x / 2]; - } else + } else ++dst; } } _system->unlockScreen(); - + _system->copyRectToScreen( - varia_9 + (logo_y < 0? -logo_y * 320: 0), 320, - 0, logo_y >= 0? logo_y: 0, + varia_9 + (logo_y < 0? -logo_y * 320: 0), 320, + 0, logo_y >= 0? logo_y: 0, 320, logo_y >= 0? 57: 57 + logo_y); if (logo_y < 82 - 57) ++logo_y; - - + + _system->updateScreen(); _system->delayMillis(100); } @@ -426,7 +426,7 @@ Common::Error TeenAgentEngine::run() { scene->init(this, _system); inventory->init(this); - + init(); CursorMan.pushCursor(res->dseg.ptr(0x00da), 8, 12, 0, 0, 1); @@ -708,7 +708,7 @@ void TeenAgentEngine::displayCutsceneMessage(uint16 addr, uint16 position) { event.dst.x = position % 320; event.dst.y = position / 320; event.lan = 7; - + scene->push(event); } @@ -768,7 +768,7 @@ void TeenAgentEngine::loadScene(byte id, const Common::Point &pos, byte o) { void TeenAgentEngine::loadScene(byte id, uint16 x, uint16 y, byte o) { if (scene->last_event_type() != SceneEvent::kCreditsMessage) fadeOut(); - + SceneEvent event(SceneEvent::kLoadScene); event.scene = id; event.dst.x = x; @@ -855,7 +855,7 @@ void TeenAgentEngine::waitLanAnimationFrame(byte slot, uint16 frame) { SceneEvent event(SceneEvent::kWaitLanAnimationFrame); if (frame > 0) --frame; - + event.slot = slot - 1; event.animation = frame; scene->push(event); diff --git a/engines/teenagent/teenagent.h b/engines/teenagent/teenagent.h index 5750194ea8..9acc71adab 100644 --- a/engines/teenagent/teenagent.h +++ b/engines/teenagent/teenagent.h @@ -133,9 +133,9 @@ private: Audio::AudioStream *_musicStream; Audio::SoundHandle _musicHandle, _soundHandle; const ADGameDescription *_gameDescription; - + uint _mark_delay, _game_delay; - + Common::Array<Common::Array<UseHotspot> > use_hotspots; }; diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp index 859ceaf6fb..cd2e6b58a5 100644 --- a/engines/tinsel/detection.cpp +++ b/engines/tinsel/detection.cpp @@ -394,7 +394,7 @@ static const TinselGameDescription gameDescriptions[] = { "CD", { {"dw.scn", 0, "cfc40a8d5d476a1c9d3abf826fa46f8c", 1265532}, - {"english.smp", 0, NULL, -1}, + {"english.smp", 0, NULL, -1}, {NULL, 0, NULL, 0} }, Common::EN_ANY, diff --git a/engines/tinsel/palette.cpp b/engines/tinsel/palette.cpp index 1e139ccb3f..ec518d9e68 100644 --- a/engines/tinsel/palette.cpp +++ b/engines/tinsel/palette.cpp @@ -106,14 +106,14 @@ void psxPaletteMapper(PALQ *originalPal, uint8 *psxClut, byte *mapperTable) { clutEntry = READ_LE_UINT16(psxClut + (sizeof(uint16) * j)); if (clutEntry) { if (clutEntry == 0x7EC0) { // This is an already known value, used by the in-game text - mapperTable[j] = 232; + mapperTable[j] = 232; continue; } - + // Check for correspondent color for (uint i = 0; (i < FROM_LE_32(pal->numColours)) && !colorFound; i++) { // get R G B values in the same way as psx format converters - uint16 psxEquivalent = TINSEL_PSX_RGB(TINSEL_GetRValue(pal->palRGB[i]) >> 3, TINSEL_GetGValue(pal->palRGB[i]) >> 3, TINSEL_GetBValue(pal->palRGB[i]) >> 3); + uint16 psxEquivalent = TINSEL_PSX_RGB(TINSEL_GetRValue(pal->palRGB[i]) >> 3, TINSEL_GetGValue(pal->palRGB[i]) >> 3, TINSEL_GetBValue(pal->palRGB[i]) >> 3); if (psxEquivalent == clutEntry) { mapperTable[j] = i + 1; // Add entry in the table for the found color diff --git a/engines/tinsel/pcode.cpp b/engines/tinsel/pcode.cpp index 9cdec86d8f..7fd6df78d0 100644 --- a/engines/tinsel/pcode.cpp +++ b/engines/tinsel/pcode.cpp @@ -139,12 +139,12 @@ const int fragment10_size = 6; const WorkaroundEntry workaroundList[] = { // DW1-SCN: Global 206 is whether Rincewind is trying to take the book back to the present. - // In the GRA version, it was global 373, and was reset when he is returned to the past, but + // In the GRA version, it was global 373, and was reset when he is returned to the past, but // was forgotten in the SCN version, so this ensures the flag is properly reset {TINSEL_V1, true, 427942095, 1, fragment1_size, fragment1}, // DW1-GRA: Rincewind exiting the Inn is blocked by the luggage. Whilst you can then move - // into walkable areas, saving and restoring the game, it will error if you try to move. + // into walkable areas, saving and restoring the game, it will error if you try to move. // This fragment turns off NPC blocking for the Outside Inn rooms so that the luggage won't block // Past Outside Inn {TINSEL_V1, false, 444622076, 0, fragment2_size, fragment2}, @@ -523,7 +523,7 @@ static int32 Fetch(byte opcode, const byte *code, const WorkaroundEntry* &wkEntr return GetBytes(code, wkEntry, ip, 1); else if (opcode & OPSIZE16) return GetBytes(code, wkEntry, ip, 2); - + return GetBytes(code, wkEntry, ip, 4); } @@ -539,7 +539,7 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) { if (wkEntry == NULL) { // Check to see if a workaround fragment needs to be executed for (wkEntry = workaroundList; wkEntry->script != NULL; ++wkEntry) { - if ((wkEntry->version == TinselVersion) && + if ((wkEntry->version == TinselVersion) && (wkEntry->hCode == ic->hCode) && (wkEntry->ip == ip) && (!TinselV1 || (wkEntry->scnFlag == ((_vm->getFeatures() & GF_SCNFILES) != 0)))) { diff --git a/engines/tinsel/tinlib.cpp b/engines/tinsel/tinlib.cpp index 890912ece2..677392a35d 100644 --- a/engines/tinsel/tinlib.cpp +++ b/engines/tinsel/tinlib.cpp @@ -3833,7 +3833,7 @@ void Walk(CORO_PARAM, int actor, int x, int y, SCNHANDLE hFilm, int hold, bool i bool bQuick = hold != 0; PMOVER pMover = GetMover(actor); - + assert(pMover); // Can't walk a non-moving actor CORO_BEGIN_CODE(_ctx); diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp index e6167c225e..ba667cf224 100644 --- a/engines/tinsel/tinsel.cpp +++ b/engines/tinsel/tinsel.cpp @@ -507,14 +507,14 @@ void SetNewScene(SCNHANDLE scene, int entrance, int transition) { } // Workaround for "Missing Red Dragon in square" bug in Discworld 1 PSX, act IV. - // This happens with the original interpreter on PSX too: the red dragon in Act IV + // This happens with the original interpreter on PSX too: the red dragon in Act IV // doesn't show up inside the square at the right time. Original game required the // player to go in and out the square until the dragon appears (wasting hours). // I'm forcing the load of the right scene by checking that the player has (or has not) the // right items: player must have Mambo the swamp dragon, and mustn't have fireworks (used on // the swamp dragon previously to "load it up"). if (TinselV1PSX && NextScene.scene == 0x1800000 && NextScene.entry == 2) { - if ((IsInInventory(261, INV_1) || IsInInventory(261, INV_2)) && + if ((IsInInventory(261, INV_1) || IsInInventory(261, INV_2)) && (!IsInInventory(232, INV_1) && !IsInInventory(232, INV_2))) NextScene.entry = 1; } @@ -669,7 +669,7 @@ bool ChangeScene(bool bReset) { } else if (--CountOut == 0) { if (!TinselV2) ClearScreen(); - + StartNewScene(NextScene.scene, NextScene.entry); NextScene.scene = 0; @@ -835,7 +835,7 @@ TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc) // Add DW2 subfolder to search path in case user is running directly from the CDs SearchMan.addSubDirectoryMatching(_gameDataDir, "dw2"); - // Add subfolders needed for psx versions of Discworld 1 + // Add subfolders needed for psx versions of Discworld 1 if (TinselV1PSX) SearchMan.addDirectory(_gameDataDir.getPath(), _gameDataDir, 0, 3, true); diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp index a75f2172a6..9f380cb409 100644 --- a/engines/tucker/sequences.cpp +++ b/engines/tucker/sequences.cpp @@ -592,9 +592,9 @@ Audio::RewindableAudioStream *AnimationSequencePlayer::loadSound(int index, Anim size = f.size(); rate = 22050; flags = Audio::FLAG_UNSIGNED; - if (type == kAnimationSoundType16BitsRAW) + if (type == kAnimationSoundType16BitsRAW) flags = Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_16BITS; - + if (size != 0) { uint8 *sampleData = (uint8 *)malloc(size); if (sampleData) { @@ -607,7 +607,7 @@ Audio::RewindableAudioStream *AnimationSequencePlayer::loadSound(int index, Anim stream = Audio::makeWAVStream(&f, DisposeAfterUse::NO); break; } - + } return stream; } |