diff options
Diffstat (limited to 'engines')
26 files changed, 194 insertions, 114 deletions
diff --git a/engines/adl/configure.engine b/engines/adl/configure.engine index 844e2b8e6a..944b043af8 100644 --- a/engines/adl/configure.engine +++ b/engines/adl/configure.engine @@ -1,3 +1,3 @@ # This file is included from the main "configure" script # add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] -add_engine adl "ADL" no +add_engine adl "ADL" yes diff --git a/engines/adl/detection.cpp b/engines/adl/detection.cpp index 2d568b28d7..1cfeb9a859 100644 --- a/engines/adl/detection.cpp +++ b/engines/adl/detection.cpp @@ -93,7 +93,7 @@ static const AdlGameDescription gameDescriptions[] = { }, Common::EN_ANY, Common::kPlatformApple2, - ADGF_TESTING, + ADGF_NO_FLAGS, GUIO2(GAMEOPTION_COLOR_DEFAULT_OFF, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES1 @@ -107,7 +107,7 @@ static const AdlGameDescription gameDescriptions[] = { }, Common::EN_ANY, Common::kPlatformApple2, - ADGF_TESTING, + ADGF_NO_FLAGS, GUIO2(GAMEOPTION_COLOR_DEFAULT_OFF, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES1 @@ -121,7 +121,7 @@ static const AdlGameDescription gameDescriptions[] = { }, Common::EN_ANY, Common::kPlatformApple2, - ADGF_TESTING, + ADGF_NO_FLAGS, GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES2 @@ -135,7 +135,7 @@ static const AdlGameDescription gameDescriptions[] = { }, Common::EN_ANY, Common::kPlatformApple2, - ADGF_TESTING, + ADGF_NO_FLAGS, GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES) }, GAME_TYPE_HIRES0 diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp index d6f63a8584..2eaddc50f2 100644 --- a/engines/director/frame.cpp +++ b/engines/director/frame.cpp @@ -22,6 +22,7 @@ #include "common/system.h" #include "graphics/font.h" +#include "graphics/macgui/macfontmanager.h" #include "graphics/macgui/macwindowmanager.h" #include "image/bmp.h" @@ -606,16 +607,14 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID) { int height = _sprites[spriteID]->_height; int width = _sprites[spriteID]->_width; - const char *fontName; + Graphics::MacFont macFont(textCast->fontId, textCast->fontSize); if (_vm->_currentScore->_fontMap.contains(textCast->fontId)) { - fontName = _vm->_currentScore->_fontMap[textCast->fontId].c_str(); - } else if ((fontName = _vm->_wm->getFontName(textCast->fontId, textCast->fontSize)) == NULL) { - warning("Unknown font id %d, falling back to default", textCast->fontId); - fontName = _vm->_wm->getFontName(0, 12); + // Override + macFont.setName(_vm->_currentScore->_fontMap[textCast->fontId]); } - const Graphics::Font *font = _vm->_wm->getFont(fontName, Graphics::FontManager::kBigGUIFont); + const Graphics::Font *font = _vm->_wm->_fontMan->getFont(macFont); font->drawString(&surface, text, x, y, width, 0); diff --git a/engines/gnap/configure.engine b/engines/gnap/configure.engine index f3742ef0d2..8723ef501b 100644 --- a/engines/gnap/configure.engine +++ b/engines/gnap/configure.engine @@ -1,3 +1,3 @@ # This file is included from the main "configure" script # add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] -add_engine gnap "UFOs" no "" "" "highres" +add_engine gnap "UFOs" yes "" "" "highres" diff --git a/engines/gnap/detection.cpp b/engines/gnap/detection.cpp index b1e9818d29..d19d420ff8 100644 --- a/engines/gnap/detection.cpp +++ b/engines/gnap/detection.cpp @@ -43,7 +43,7 @@ static const ADGameDescription gameDescriptions[] = { {"stock_n.dat", 0, "46819043d019a2f36b727cc2bdd6980f", 12515823}, AD_LISTEND }, - Common::EN_ANY, Common::kPlatformWindows, ADGF_TESTING, GUIO0() + Common::EN_ANY, Common::kPlatformWindows, ADGF_NO_FLAGS, GUIO0() }, { "gnap", "", @@ -51,7 +51,7 @@ static const ADGameDescription gameDescriptions[] = { {"stock_n.dat", 0, "46819043d019a2f36b727cc2bdd6980f", 13497301}, AD_LISTEND }, - Common::EN_ANY, Common::kPlatformWindows, ADGF_TESTING, GUIO0() + Common::EN_ANY, Common::kPlatformWindows, ADGF_NO_FLAGS, GUIO0() }, { "gnap", "", @@ -59,7 +59,7 @@ static const ADGameDescription gameDescriptions[] = { {"stock_n.dat", 0, "46819043d019a2f36b727cc2bdd6980f", 12995485}, AD_LISTEND }, - Common::RU_RUS, Common::kPlatformWindows, ADGF_TESTING, GUIO0() + Common::RU_RUS, Common::kPlatformWindows, ADGF_NO_FLAGS, GUIO0() }, { "gnap", "Fargus", @@ -67,7 +67,7 @@ static const ADGameDescription gameDescriptions[] = { {"stock_n.dat", 0, "46819043d019a2f36b727cc2bdd6980f", 12847726}, AD_LISTEND }, - Common::RU_RUS, Common::kPlatformWindows, ADGF_TESTING, GUIO0() + Common::RU_RUS, Common::kPlatformWindows, ADGF_NO_FLAGS, GUIO0() }, AD_TABLE_END_MARKER diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp index 9e0a6e9f00..3b7c3a244b 100644 --- a/engines/macventure/gui.cpp +++ b/engines/macventure/gui.cpp @@ -33,6 +33,7 @@ #include "common/debug-channels.h" #include "common/debug.h" #include "image/bmp.h" +#include "graphics/macgui/macfontmanager.h" #include "macventure/gui.h" #include "macventure/dialog.h" @@ -266,7 +267,7 @@ const WindowData &Gui::getWindowData(WindowReference reference) { } const Graphics::Font &Gui::getCurrentFont() { - return *_wm.getFont("Chicago-12", Graphics::FontManager::kBigGUIFont); + return *_wm._fontMan->getFont(Graphics::MacFont(Graphics::kMacFontChicago, 12)); } void Gui::bringToFront(WindowReference winID) { diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h index f481472bae..2636cc4434 100644 --- a/engines/mohawk/detection_tables.h +++ b/engines/mohawk/detection_tables.h @@ -40,7 +40,7 @@ static const MohawkGameDescription gameDescriptions[] = { AD_ENTRY1("MYST.DAT", "ae3258c9c90128d274aa6a790b3ad181"), Common::EN_ANY, Common::kPlatformWindows, - ADGF_TESTING, + ADGF_NO_FLAGS, GUI_OPTIONS_MYST }, GType_MYST, @@ -58,7 +58,7 @@ static const MohawkGameDescription gameDescriptions[] = { AD_ENTRY1("DEMO.DAT", "c39303dd53fb5c4e7f3c23231c606cd0"), Common::EN_ANY, Common::kPlatformWindows, - ADGF_DEMO | ADGF_TESTING, + ADGF_DEMO | ADGF_NO_FLAGS, GUI_OPTIONS_MYST_DEMO }, GType_MYST, @@ -76,7 +76,7 @@ static const MohawkGameDescription gameDescriptions[] = { AD_ENTRY1("MYST.DAT", "4beb3366ed3f3b9bfb6e81a14a43bdcc"), Common::DE_DEU, Common::kPlatformWindows, - ADGF_TESTING, + ADGF_NO_FLAGS, GUI_OPTIONS_MYST }, GType_MYST, @@ -94,7 +94,7 @@ static const MohawkGameDescription gameDescriptions[] = { AD_ENTRY1("MYST.DAT", "e0937cca1ab125e48e30dc3cd5046ddf"), Common::DE_DEU, Common::kPlatformWindows, - ADGF_TESTING, + ADGF_NO_FLAGS, GUI_OPTIONS_MYST }, GType_MYST, @@ -112,7 +112,7 @@ static const MohawkGameDescription gameDescriptions[] = { AD_ENTRY1("MYST.DAT", "f7e7d7ca69934f1351b5acd4fe4d44c2"), Common::ES_ESP, Common::kPlatformWindows, - ADGF_TESTING, + ADGF_NO_FLAGS, GUI_OPTIONS_MYST }, GType_MYST, @@ -130,7 +130,7 @@ static const MohawkGameDescription gameDescriptions[] = { AD_ENTRY1("MYST.DAT", "a5795ce1751fc42525e4f9a1859181d5"), Common::IT_ITA, Common::kPlatformWindows, - ADGF_TESTING, + ADGF_NO_FLAGS, GUI_OPTIONS_MYST }, GType_MYST, @@ -148,7 +148,7 @@ static const MohawkGameDescription gameDescriptions[] = { AD_ENTRY1("MYST.DAT", "032c88e3b7e8db4ca475e7b7db9a66bb"), Common::JA_JPN, Common::kPlatformWindows, - ADGF_TESTING, + ADGF_NO_FLAGS, GUI_OPTIONS_MYST }, GType_MYST, @@ -166,7 +166,7 @@ static const MohawkGameDescription gameDescriptions[] = { AD_ENTRY1("MYST.DAT", "d631d42567a941c67c78f2e491f4ea58"), Common::FR_FRA, Common::kPlatformWindows, - ADGF_TESTING, + ADGF_NO_FLAGS, GUI_OPTIONS_MYST }, GType_MYST, @@ -184,7 +184,7 @@ static const MohawkGameDescription gameDescriptions[] = { AD_ENTRY1("MAKING.DAT", "f6387e8f0f7b8a3e42c95294315d6a0e"), Common::EN_ANY, Common::kPlatformWindows, - ADGF_TESTING, + ADGF_NO_FLAGS, GUI_OPTIONS_MYST_MAKING_OF }, GType_MAKINGOF, @@ -202,7 +202,7 @@ static const MohawkGameDescription gameDescriptions[] = { AD_ENTRY1("MAKING.DAT", "03ff62607e64419ab2b6ebf7b7bcdf63"), Common::JA_JPN, Common::kPlatformWindows, - ADGF_TESTING, + ADGF_NO_FLAGS, GUI_OPTIONS_MYST_MAKING_OF }, GType_MAKINGOF, @@ -220,7 +220,7 @@ static const MohawkGameDescription gameDescriptions[] = { AD_ENTRY1("MYST.DAT", "c4cae9f143b5947262e6cb2397e1617e"), Common::EN_ANY, Common::kPlatformWindows, - ADGF_TESTING, + ADGF_NO_FLAGS, GUI_OPTIONS_MYST_ME }, GType_MYST, @@ -238,7 +238,7 @@ static const MohawkGameDescription gameDescriptions[] = { AD_ENTRY1("MYST.DAT", "f88e0ace66dbca78eebdaaa1d3314ceb"), Common::DE_DEU, Common::kPlatformWindows, - ADGF_TESTING, + ADGF_NO_FLAGS, GUI_OPTIONS_MYST_ME }, GType_MYST, @@ -256,7 +256,7 @@ static const MohawkGameDescription gameDescriptions[] = { AD_ENTRY1("MYST.DAT", "aea81633b2d2ae498f09072fb87263b6"), Common::FR_FRA, Common::kPlatformWindows, - ADGF_TESTING, + ADGF_NO_FLAGS, GUI_OPTIONS_MYST_ME }, GType_MYST, @@ -274,7 +274,7 @@ static const MohawkGameDescription gameDescriptions[] = { AD_ENTRY1("MYST.DAT", "4a05771b60f4a69869838d01e85c9e80"), Common::PL_POL, Common::kPlatformWindows, - ADGF_TESTING, + ADGF_NO_FLAGS, GUI_OPTIONS_MYST_ME }, GType_MYST, @@ -2754,7 +2754,7 @@ static const MohawkGameDescription fallbackDescs[] = { AD_ENTRY1(0, 0), Common::UNK_LANG, Common::kPlatformWindows, - ADGF_TESTING, + ADGF_NO_FLAGS, GUI_OPTIONS_MYST }, GType_MYST, @@ -2769,7 +2769,7 @@ static const MohawkGameDescription fallbackDescs[] = { AD_ENTRY1(0, 0), Common::UNK_LANG, Common::kPlatformWindows, - ADGF_TESTING, + ADGF_NO_FLAGS, GUI_OPTIONS_MYST_MAKING_OF }, GType_MAKINGOF, @@ -2784,7 +2784,7 @@ static const MohawkGameDescription fallbackDescs[] = { AD_ENTRY1(0, 0), Common::UNK_LANG, Common::kPlatformWindows, - ADGF_TESTING, + ADGF_NO_FLAGS, GUI_OPTIONS_MYST_ME }, GType_MYST, diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 20889f230b..f01e2a677e 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -632,13 +632,16 @@ void SoundCommandParser::syncPlayList(Common::Serializer &s) { } void SoundCommandParser::reconstructPlayList() { - Common::StackLock lock(_music->_mutex); + _music->_mutex.lock(); // We store all songs here because starting songs may re-shuffle their order MusicList songs; for (MusicList::iterator i = _music->getPlayListStart(); i != _music->getPlayListEnd(); ++i) songs.push_back(*i); + // Done with main playlist, so release lock + _music->_mutex.unlock(); + for (MusicList::iterator i = songs.begin(); i != songs.end(); ++i) { initSoundResource(*i); diff --git a/engines/titanic/debugger.cpp b/engines/titanic/debugger.cpp index a9da83f724..086c6bfaaa 100644 --- a/engines/titanic/debugger.cpp +++ b/engines/titanic/debugger.cpp @@ -23,7 +23,9 @@ #include "titanic/debugger.h" #include "titanic/titanic.h" #include "titanic/core/tree_item.h" +#include "titanic/game/movie_tester.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/support/movie.h" namespace Titanic { @@ -33,6 +35,7 @@ Debugger::Debugger(TitanicEngine *vm) : GUI::Debugger(), _vm(vm) { registerCmd("room", WRAP_METHOD(Debugger, cmdRoom)); registerCmd("pet", WRAP_METHOD(Debugger, cmdPET)); registerCmd("item", WRAP_METHOD(Debugger, cmdItem)); + registerCmd("movie", WRAP_METHOD(Debugger, cmdMovie)); } int Debugger::strToInt(const char *s) { @@ -260,4 +263,35 @@ bool Debugger::cmdItem(int argc, const char **argv) { return true; } +bool Debugger::cmdMovie(int argc, const char **argv) { + if (argc < 2) { + debugPrintf("movie filename.avi [startFrame endFrame]\n"); + return true; + } + + CViewItem *view = g_vm->_window->_gameManager->getView(); + CMovieTester *tester = static_cast<CMovieTester *>( + view->findChildInstanceOf(CMovieTester::_type)); + if (!tester) { + // No movie tester present, so create one + tester = new CMovieTester(); + tester->addUnder(view); + } + + CString filename(argv[1]); + if (!filename.hasSuffix(".avi")) + filename += ".avi"; + tester->loadMovie(filename); + + if (argc == 2) { + tester->playMovie(MOVIE_STOP_PREVIOUS); + } else { + uint startFrame = strToInt(argv[2]); + uint endFrame = strToInt(argv[2]); + tester->playMovie(startFrame, endFrame, MOVIE_STOP_PREVIOUS); + } + + return false; +} + } // End of namespace Titanic diff --git a/engines/titanic/debugger.h b/engines/titanic/debugger.h index 5edb7cb324..cae8a07d80 100644 --- a/engines/titanic/debugger.h +++ b/engines/titanic/debugger.h @@ -89,6 +89,11 @@ private: * Item handling */ bool cmdItem(int argc, const char **argv); + + /** + * Shows a movie + */ + bool cmdMovie(int argc, const char **argv); protected: TitanicEngine *_vm; public: diff --git a/engines/titanic/game/movie_tester.h b/engines/titanic/game/movie_tester.h index 17a7d489d8..60eacee7e9 100644 --- a/engines/titanic/game/movie_tester.h +++ b/engines/titanic/game/movie_tester.h @@ -45,6 +45,14 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file); + + /** + * Loads a movie + */ + void loadMovie(const CString &name, bool pendingFlag = true) { + CGameObject::loadMovie(name, pendingFlag); + _surface->flipVertically(); + } }; } // End of namespace Titanic diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp index a45d586695..45c3ce94b3 100644 --- a/engines/titanic/support/avi_surface.cpp +++ b/engines/titanic/support/avi_surface.cpp @@ -223,10 +223,10 @@ void AVISurface::setupDecompressor() { bool flag = false; if (idx == 0 && _videoSurface && _videoSurface->getPitch() == _movieFrameSurface[idx]->pitch) { - const Graphics::PixelFormat &ff = _decoder->getVideoTrack(0).getPixelFormat(); + const uint bitCount = _decoder->getVideoTrack(0).getBitCount(); const int vDepth = _videoSurface->getPixelDepth(); - switch (ff.bpp()) { + switch (bitCount) { case 15: flag = vDepth == 1; break; @@ -248,6 +248,9 @@ void AVISurface::setupDecompressor() { _framePixels = new Graphics::ManagedSurface(_decoder->getWidth(), _decoder->getHeight(), _decoder->getVideoTrack(0).getPixelFormat()); } else if (idx == 0) { + // The original developers used a vertical flipped playback to indicate + // an incompatibility between source video and dest surface bit-depths, + // which would result in poor playback performance _videoSurface->_flipVertically = true; } } diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp index 39a0b777a1..45d593755e 100644 --- a/engines/titanic/support/font.cpp +++ b/engines/titanic/support/font.cpp @@ -292,13 +292,13 @@ void STFont::copyRect(CVideoSurface *surface, const Point &pt, Rect &rect) { if (surface->lock()) { uint16 *lineP = surface->getBasePtr(pt.x, pt.y); uint16 color = getColor(); - bool is16Bit = surface->getPixelDepth() == 2; for (int yp = rect.top; yp < rect.bottom; ++yp, lineP += surface->getWidth()) { uint16 *destP = lineP; for (int xp = rect.left; xp < rect.right; ++xp, ++destP) { const byte *transP = _dataPtr + yp * _dataWidth + xp; - surface->copyPixel(destP, &color, *transP >> 3, is16Bit, true); + surface->copyPixel(destP, &color, *transP >> 3, + surface->getRawSurface()->format, true); } } diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp index 3983e9fe60..665ead3056 100644 --- a/engines/titanic/support/mouse_cursor.cpp +++ b/engines/titanic/support/mouse_cursor.cpp @@ -22,6 +22,7 @@ #include "graphics/cursorman.h" #include "titanic/support/mouse_cursor.h" +#include "titanic/support/transparency_surface.h" #include "titanic/support/video_surface.h" #include "titanic/titanic.h" @@ -107,12 +108,16 @@ void CMouseCursor::setCursor(CursorId cursorId) { Graphics::ManagedSurface surface(CURSOR_SIZE, CURSOR_SIZE, g_system->getScreenFormat()); const uint16 *srcP = srcSurface.getPixels(); - const byte *maskP = (const byte *)ce._transSurface->getPixels(); + CTransparencySurface transSurface(&ce._transSurface->rawSurface(), TRANS_DEFAULT); uint16 *destP = (uint16 *)surface.getPixels(); for (int y = 0; y < CURSOR_SIZE; ++y) { - for (int x = 0; x < CURSOR_SIZE; ++x, ++srcP, ++maskP, ++destP) { - *destP = ((*maskP >> 4) == 0) ? srcSurface.getTransparencyColor() : *srcP; + transSurface.setRow(y); + transSurface.setCol(0); + + for (int x = 0; x < CURSOR_SIZE; ++x, ++srcP, ++destP) { + *destP = transSurface.isPixelTransparent() ? srcSurface.getTransparencyColor() : *srcP; + transSurface.moveX(); } } diff --git a/engines/titanic/support/transparency_surface.cpp b/engines/titanic/support/transparency_surface.cpp index f917dfb48b..5ffa8b99b1 100644 --- a/engines/titanic/support/transparency_surface.cpp +++ b/engines/titanic/support/transparency_surface.cpp @@ -67,17 +67,7 @@ int CTransparencySurface::moveX() { uint CTransparencySurface::getPixel() const { const byte *pixelP = (const byte *)_surface->getBasePtr(_pos.x, _pos.y); - return _flag1 ? 0xFF - *pixelP : *pixelP; -} - -bool CTransparencySurface::isPixelTransparent1() const { - const byte *pixelP = (const byte *)_surface->getBasePtr(_pos.x, _pos.y); - return _flag1 ? *pixelP == 0xF0 : *pixelP == 0x10; -} - -bool CTransparencySurface::isPixelTransparent2() const { - const byte *pixelP = (const byte *)_surface->getBasePtr(_pos.x, _pos.y); - return _flag2 ? *pixelP == 0xF0 : *pixelP == 0x10; + return *pixelP; } } // End of namespace Titanic diff --git a/engines/titanic/support/transparency_surface.h b/engines/titanic/support/transparency_surface.h index 5593dfa66d..0391b6d5b7 100644 --- a/engines/titanic/support/transparency_surface.h +++ b/engines/titanic/support/transparency_surface.h @@ -43,19 +43,40 @@ private: bool _flag1; bool _flag2; public: + /** + * Constructor + */ CTransparencySurface(const Graphics::Surface *surface, TransparencyMode transMode); + /** + * Sets the row to get transparencies from + */ void setRow(int yp) { _pos.y = yp; } + /** + * Sets the column to get transparencies from + */ void setCol(int xp) { _pos.x = xp; } - uint getPixel() const; + /** + * Moves reading position horizontally by a single pixel + */ + int moveX(); - bool isPixelTransparent1() const; + /** + * Returns a byte from the transparency surface + */ + uint getPixel() const; - bool isPixelTransparent2() const; + /** + * Returns the alpha value for the pixel (0-31) + */ + uint getAlpha() const { return 31 - (getPixel() >> 3); } - int moveX(); + /** + * Returns true if the pixel is completely transparent + */ + bool isPixelTransparent() const { return getAlpha() == 31; } }; } // End of namespace Titanic diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index 1991d7423f..c71f898889 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -52,16 +52,11 @@ CVideoSurface::~CVideoSurface() { void CVideoSurface::setupPalette(byte palette[32][32], byte val) { for (uint idx1 = 0; idx1 < 32; ++idx1) { for (uint idx2 = 0, base = 0; idx2 < 32; ++idx2, base += idx1) { - int64 v = 0x84210843; - v *= base; - uint v2 = (v >> 36); - v = ((v2 >> 31) + v2) & 0xff; - palette[idx1][idx2] = v << 3; + uint v = base / 31; + palette[idx1][idx2] = (byte)v; if (val != 0xff && v != idx2) { - v = 0x80808081 * v * val; - v2 = v >> 39; - palette[idx1][idx2] = ((v2 >> 31) + v2) << 3; + assert(0); } } } @@ -238,7 +233,6 @@ void CVideoSurface::transBlitRect(const Rect &srcRect, const Rect &destRect, CVi const uint16 *srcPtr = (const uint16 *)srcSurface->getBasePtr( srcRect.left, flipFlag ? srcRect.top : srcRect.bottom - 1); uint16 *destPtr = (uint16 *)destArea.getBasePtr(0, destArea.h - 1); - bool is16Bit = src->getPixelDepth() == 2; bool isAlpha = src->_transparencyMode == TRANS_ALPHA0 || src->_transparencyMode == TRANS_ALPHA255; @@ -252,15 +246,13 @@ void CVideoSurface::transBlitRect(const Rect &srcRect, const Rect &destRect, CVi transSurface.setCol(srcRect.left); for (int srcX = srcRect.left; srcX < srcRect.right; ++srcX) { - transSurface.moveX(); - - if (!transSurface.isPixelTransparent2()) { - copyPixel(lineDestP, lineSrcP, transSurface.getPixel() >> 3, - is16Bit, isAlpha); + if (!transSurface.isPixelTransparent()) { + copyPixel(lineDestP, lineSrcP, transSurface.getAlpha(), srcSurface->format, isAlpha); } ++lineSrcP; ++lineDestP; + transSurface.moveX(); } // Move to next line @@ -294,30 +286,37 @@ bool CVideoSurface::hasFrame() { } } -void CVideoSurface::copyPixel(uint16 *destP, const uint16 *srcP, byte transVal, bool is16Bit, bool isAlpha) { - const Graphics::PixelFormat srcFormat = is16Bit ? - Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0) : - Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); +#define RGB_SHIFT 3 +void CVideoSurface::copyPixel(uint16 *destP, const uint16 *srcP, byte alpha, + const Graphics::PixelFormat &srcFormat, bool isAlpha) { const Graphics::PixelFormat destFormat = _ddSurface->getFormat(); - transVal &= 0xff; - assert(transVal < 32); + alpha &= 0xff; + assert(alpha < 32); - // Get the color + // Get the source color byte r, g, b; srcFormat.colorToRGB(*srcP, r, g, b); + r >>= RGB_SHIFT; + g >>= RGB_SHIFT; + b >>= RGB_SHIFT; + if (isAlpha) { - r = _palette1[31 - transVal][r >> 3]; - g = _palette1[31 - transVal][g >> 3]; - b = _palette1[31 - transVal][b >> 3]; + r = _palette1[31 - alpha][r]; + g = _palette1[31 - alpha][g]; + b = _palette1[31 - alpha][b]; } byte r2, g2, b2; destFormat.colorToRGB(*destP, r2, g2, b2); - r2 = _palette1[transVal][r2 >> 3]; - g2 = _palette1[transVal][g2 >> 3]; - b2 = _palette1[transVal][b2 >> 3]; + r2 >>= RGB_SHIFT; + g2 >>= RGB_SHIFT; + b2 >>= RGB_SHIFT; + r2 = _palette1[alpha][r2]; + g2 = _palette1[alpha][g2]; + b2 = _palette1[alpha][b2]; - *destP = destFormat.RGBToColor(r + r2, g + g2, b + b2); + *destP = destFormat.RGBToColor((r + r2) << RGB_SHIFT, + (g + g2) << RGB_SHIFT, (b + b2) << RGB_SHIFT); } /*------------------------------------------------------------------------*/ @@ -517,7 +516,7 @@ uint16 OSVideoSurface::getPixel(const Common::Point &pt) { transSurface.setRow(_flipVertically ? getHeight() - pt.y - 1 : pt.y); transSurface.setCol(pt.x); - if (transSurface.isPixelTransparent2()) + if (transSurface.isPixelTransparent()) return getTransparencyColor(); } diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index 4a4ce1861a..690669b79b 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -58,7 +58,6 @@ public: */ static void setup() { setupPalette(_palette1, 0xff); - setupPalette(_palette2, 0xe0); } private: /** @@ -340,8 +339,16 @@ public: /** * Copies a pixel, handling transparency - */ - void copyPixel(uint16 *destP, const uint16 *srcP, byte transVal, bool is16Bit, bool isAlpha); + * @param destP Dest pointer to 16-bit pixel + * @param srcP Source pointer to 16-bit pixel + * @param alpha Alpha (0-31). At 0, it's completely opaque, + * and overwrites the dest pixel. Through to 31, which is completely + * transparent, and ignores the source pixel. + * @param srcFormat The source surface format + * @param isAlpha If true, has alpha channel + */ + void copyPixel(uint16 *destP, const uint16 *srcP, byte alpha, + const Graphics::PixelFormat &srcFormat, bool isAlpha); }; class OSVideoSurface : public CVideoSurface { diff --git a/engines/wage/dialog.cpp b/engines/wage/dialog.cpp index ffb4f9c93d..a8500a7ebe 100644 --- a/engines/wage/dialog.cpp +++ b/engines/wage/dialog.cpp @@ -48,6 +48,7 @@ #include "common/system.h" #include "common/events.h" +#include "graphics/macgui/macfontmanager.h" #include "graphics/macgui/macwindowmanager.h" #include "wage/wage.h" @@ -92,7 +93,7 @@ Dialog::~Dialog() { } const Graphics::Font *Dialog::getDialogFont() { - return _gui->_wm.getFont(_gui->_wm.getFontName(0, 12), Graphics::FontManager::kBigGUIFont); // Default is Chicago + return _gui->_wm._fontMan->getFont(Graphics::MacFont(Graphics::kMacFontChicago, 12)); } void Dialog::paint() { diff --git a/engines/wage/entities.cpp b/engines/wage/entities.cpp index 5ec54493a7..90247a5b21 100644 --- a/engines/wage/entities.cpp +++ b/engines/wage/entities.cpp @@ -54,6 +54,7 @@ #include "common/memstream.h" #include "graphics/managed_surface.h" +#include "graphics/macgui/macfontmanager.h" namespace Wage { @@ -86,8 +87,7 @@ Scene::Scene() { _script = NULL; _design = NULL; _textBounds = NULL; - _fontSize = 0; - _fontType = 0; + _font = NULL; for (int i = 0; i < 4; i++) _blocked[i] = false; @@ -111,8 +111,7 @@ Scene::Scene(Common::String name, Common::SeekableReadStream *data) { _script = NULL; _textBounds = NULL; - _fontSize = 0; - _fontType = 0; + _font = NULL; setDesignBounds(readRect(data)); _worldY = data->readSint16BE(); @@ -138,6 +137,7 @@ Scene::Scene(Common::String name, Common::SeekableReadStream *data) { Scene::~Scene() { delete _script; delete _textBounds; + delete _font; } void Scene::paint(Graphics::ManagedSurface *surface, int x, int y) { @@ -157,15 +157,6 @@ void Scene::paint(Graphics::ManagedSurface *surface, int x, int y) { } } -const char *Scene::getFontName() { - const char *name = ((WageEngine *)g_engine)->_gui->_wm.getFontName(_fontType, _fontSize); - - if (!name) - return "Unknown"; - - return name; -} - Designed *Scene::lookUpEntity(int x, int y) { for (ObjList::const_iterator it = _objs.end(); it != _objs.begin(); ) { it--; diff --git a/engines/wage/entities.h b/engines/wage/entities.h index b7cafb2294..a755af5360 100644 --- a/engines/wage/entities.h +++ b/engines/wage/entities.h @@ -50,6 +50,7 @@ namespace Graphics { class ManagedSurface; + class MacFont; } namespace Wage { @@ -308,8 +309,7 @@ public: Script *_script; Common::String _text; Common::Rect *_textBounds; - int _fontSize; - int _fontType; // 3 => Geneva, 22 => Courier, param to TextFont() function + Graphics::MacFont *_font; bool _blocked[4]; Common::String _messages[4]; int _soundFrequency; // times a minute, max 3600 @@ -334,7 +334,7 @@ public: void paint(Graphics::ManagedSurface *screen, int x, int y); - const char *getFontName(); + const Graphics::MacFont *getFont() { return _font; } }; } // End of namespace Wage diff --git a/engines/wage/gui-console.cpp b/engines/wage/gui-console.cpp index a5e71463f7..37031f0dd9 100644 --- a/engines/wage/gui-console.cpp +++ b/engines/wage/gui-console.cpp @@ -51,6 +51,7 @@ #include "graphics/cursorman.h" #include "graphics/fonts/bdf.h" #include "graphics/palette.h" +#include "graphics/macgui/macfontmanager.h" #include "graphics/macgui/macwindow.h" #include "graphics/macgui/macmenu.h" @@ -65,7 +66,7 @@ namespace Wage { const Graphics::Font *Gui::getConsoleFont() { Scene *scene = _engine->_world->_player->_currentScene; - return _wm.getFont(scene->getFontName(), Graphics::FontManager::kConsoleFont); + return _wm._fontMan->getFont(*scene->getFont()); } void Gui::clearOutput() { diff --git a/engines/wage/world.cpp b/engines/wage/world.cpp index 3e56c0daa7..90d689720e 100644 --- a/engines/wage/world.cpp +++ b/engines/wage/world.cpp @@ -46,6 +46,7 @@ */ #include "common/file.h" +#include "graphics/macgui/macfontmanager.h" #include "wage/wage.h" #include "wage/entities.h" @@ -203,8 +204,9 @@ bool World::loadWorld(Common::MacResManager *resMan) { res = resMan->getResource(MKTAG('A','T','X','T'), *iter); if (res != NULL) { scene->_textBounds = readRect(res); - scene->_fontType = res->readUint16BE(); - scene->_fontSize = res->readUint16BE(); + int fontType = res->readUint16BE(); + int fontSize = res->readUint16BE(); + scene->_font = new Graphics::MacFont(fontType, fontSize, Graphics::kMacFontRegular, Graphics::FontManager::kConsoleFont); Common::String text; while (res->pos() < res->size()) { diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp index 1af7e2b56d..ef3cc2d84f 100644 --- a/engines/wintermute/base/base_game.cpp +++ b/engines/wintermute/base/base_game.cpp @@ -70,6 +70,7 @@ #include "common/keyboard.h" #include "common/system.h" #include "common/file.h" +#include "graphics/scaler.h" #if EXTENDED_DEBUGGER_ENABLED #include "engines/wintermute/base/scriptables/debuggable/debuggable_script_engine.h" @@ -171,7 +172,12 @@ BaseGame::BaseGame(const Common::String &targetName) : BaseObject(this), _target _forceNonStreamedSounds = false; - _thumbnailWidth = _thumbnailHeight = 0; + // These are NOT the actual engine defaults (they are 0, 0), + // but we have a use for thumbnails even for games that don't + // use them in-game, hence we set a default that is suitably + // sized for the GMM (expecting 4:3 ratio) + _thumbnailWidth = kThumbnailWidth; + _thumbnailHeight = kThumbnailHeight2; _localSaveDir = "saves"; diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h index ca30204462..4d7c9e917e 100644 --- a/engines/wintermute/detection_tables.h +++ b/engines/wintermute/detection_tables.h @@ -148,6 +148,10 @@ static const WMEGameDescription gameDescriptions[] = { WME_WINENTRY("5ma", "", WME_ENTRY2s("english.dcp", "2f97bca09260ba23b645da9f0855ce7f", 893681, "data.dcp", "0134e92bcd5fd2837df3971087e96067", 163316498), Common::EN_ANY, ADGF_UNSTABLE, WME_1_7_0), + // Five Magical Amulets (German) + WME_WINENTRY("5ma", "", + WME_ENTRY2s("german.dcp", "bfa74aae81672803d0d0748ac0a532b7", 885150, + "data.dcp", "0134e92bcd5fd2837df3971087e96067", 163316498), Common::DE_DEU, ADGF_UNSTABLE, WME_1_7_0), // Five Magical Amulets (Polish) WME_WINENTRY("5ma", "", WME_ENTRY2s("polish.dcp", "bb877d48795471a17f25b0b5109100d1", 1132197, @@ -205,16 +209,16 @@ static const WMEGameDescription gameDescriptions[] = { WME_ENTRY1s("data.dcp", "2b343b48a7aee508d728a546b414a255", 620005266), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION), // Chivalry is Not Dead WME_WINENTRY("chivalry", "", - WME_ENTRY1s("data.dcp", "ebd0915d9a12df5224be22f53bb23eb6", 7278306), Common::EN_ANY, ADGF_TESTING, LATEST_VERSION), + WME_ENTRY1s("data.dcp", "ebd0915d9a12df5224be22f53bb23eb6", 7278306), Common::EN_ANY, ADGF_NO_FLAGS, LATEST_VERSION), // Chivalry is Not Dead (Version from deirdrakai.com) WME_WINENTRY("chivalry", "", - WME_ENTRY1s("data.dcp", "ae6d91b9517f4d2851a8ad94c96951c8", 7278302), Common::EN_ANY, ADGF_TESTING, LATEST_VERSION), + WME_ENTRY1s("data.dcp", "ae6d91b9517f4d2851a8ad94c96951c8", 7278302), Common::EN_ANY, ADGF_NO_FLAGS, LATEST_VERSION), // Conspiracao Dumont WME_WINENTRY("conspiracao", "", WME_ENTRY1s("ConspiracaoDumont.exe", "106f3f2c8f18bb5ffffeed634ace256c", 32908032), Common::EN_ANY, ADGF_UNSTABLE | ADGF_DEMO, LATEST_VERSION), // Corrosion: Cold Winter Waiting WME_WINENTRY("corrosion", "", - WME_ENTRY1s("data.dcp", "ae885b1a8faa0b27f43c0e8f0df02fc9", 525931618), Common::EN_ANY, ADGF_TESTING, LATEST_VERSION), + WME_ENTRY1s("data.dcp", "ae885b1a8faa0b27f43c0e8f0df02fc9", 525931618), Common::EN_ANY, ADGF_NO_FLAGS, LATEST_VERSION), // Dead City (Czech) // The Czech data are in data.dcp, so in this case we'll have to // just detect the english version twice, to give the user a choice. diff --git a/engines/wintermute/ui/ui_edit.cpp b/engines/wintermute/ui/ui_edit.cpp index ffe8d66b4d..81030e09c3 100644 --- a/engines/wintermute/ui/ui_edit.cpp +++ b/engines/wintermute/ui/ui_edit.cpp @@ -899,7 +899,7 @@ int UIEdit::deleteChars(int start, int end) { ////////////////////////////////////////////////////////////////////////// int UIEdit::insertChars(int pos, const byte *chars, int num) { - if ((int)strlen(_text) + num > _maxLength) { + if ((_maxLength != -1) && (int)strlen(_text) + num > _maxLength) { num -= (strlen(_text) + num - _maxLength); } |