diff options
Diffstat (limited to 'engines/director')
-rw-r--r-- | engines/director/director.cpp | 5 | ||||
-rw-r--r-- | engines/director/director.h | 5 | ||||
-rw-r--r-- | engines/director/score.cpp | 54 | ||||
-rw-r--r-- | engines/director/score.h | 1 |
4 files changed, 19 insertions, 46 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp index c6806e8de2..469aeb80cb 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -36,6 +36,7 @@ #include "engines/util.h" #include "graphics/surface.h" +#include "graphics/macgui/macwindowmanager.h" #include "director/director.h" #include "director/dib.h" @@ -65,6 +66,8 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam _movies = nullptr; + _wm = nullptr; + const Common::FSNode gameDataDir(ConfMan.get("path")); SearchMan.addSubDirectoryMatching(gameDataDir, "data"); SearchMan.addSubDirectoryMatching(gameDataDir, "install"); @@ -97,6 +100,8 @@ Common::Error DirectorEngine::run() { _macBinary = nullptr; _soundManager = nullptr; + _wm = new Graphics::MacWindowManager; + _lingo = new Lingo(this); _soundManager = new DirectorSound(); diff --git a/engines/director/director.h b/engines/director/director.h index 0d4ffa7612..6208df2197 100644 --- a/engines/director/director.h +++ b/engines/director/director.h @@ -36,6 +36,10 @@ namespace Common { class MacResManager; } +namespace Graphics { +class MacWindowManager; +} + namespace Director { enum DirectorGameID { @@ -79,6 +83,7 @@ public: Score *_currentScore; Common::RandomSource _rnd; + Graphics::MacWindowManager *_wm; protected: virtual Common::Error run(); diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 51c70ab93f..5fdf315241 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -38,6 +38,7 @@ #include "common/events.h" #include "engines/util.h" #include "graphics/managed_surface.h" +#include "graphics/macgui/macwindowmanager.h" #include "image/bmp.h" #include "graphics/fontman.h" #include "graphics/fonts/bdf.h" @@ -111,7 +112,6 @@ static byte defaultPalette[768] = { 255, 255, 102, 255, 255, 153, 255, 255, 204, 255, 255, 255 }; Score::Score(DirectorEngine *vm) { - loadMacFonts(); _vm = vm; _surface = new Graphics::ManagedSurface; _trailSurface = new Graphics::ManagedSurface; @@ -663,47 +663,6 @@ void Score::loadFontMap(Common::SeekableSubReadStreamEndian &stream) { } } -void Score::loadMacFonts() { - //Copy from Wage - Common::Archive *dat; - - dat = Common::makeZipArchive("classicmacfonts.dat"); - - if (!dat) { - warning("Could not find classicmacfonts.dat. Falling back to built-in fonts"); - return; - } - - Common::ArchiveMemberList list; - dat->listMembers(list); - - for (Common::ArchiveMemberList::iterator it = list.begin(); it != list.end(); ++it) { - Common::SeekableReadStream *stream = dat->createReadStreamForMember((*it)->getName()); - - Graphics::BdfFont *font = Graphics::BdfFont::loadFont(*stream); - - delete stream; - - Common::String fontName = (*it)->getName(); - - // Trim the .bdf extension - for (int i = fontName.size() - 1; i >= 0; --i) { - if (fontName[i] == '.') { - while ((uint)i < fontName.size()) { - fontName.deleteLastChar(); - } - break; - } - } - - FontMan.assignFontToName(fontName, font); - - debug(" %s", fontName.c_str()); - } - - delete dat; -} - BitmapCast::BitmapCast(Common::SeekableSubReadStreamEndian &stream) { /*byte flags = */ stream.readByte(); uint16 someFlaggyThing = stream.readUint16(); @@ -1432,12 +1391,17 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID) { int height = _sprites[spriteID]->_height; int width = _sprites[spriteID]->_width; - const Graphics::Font *font = FontMan.getFontByName(_vm->_currentScore->_fontMap[textCast->fontId]); + const char *fontName; - if (!font) { - error("Cannot load font '%s', id %d", _vm->_currentScore->_fontMap[textCast->fontId].c_str(), textCast->fontId); + if (_vm->_currentScore->_fontMap.contains(textCast->fontId)) { + fontName = _vm->_currentScore->_fontMap[textCast->fontId].c_str(); + } else if ((fontName = _vm->_wm->getFontName(textCast->fontId)) == NULL) { + warning("Unknown font id %d, falling back to default", textCast->fontId); + fontName = _vm->_wm->getFontName(0); } + const Graphics::Font *font = _vm->_wm->getFont(fontName, Graphics::FontManager::kBigGUIFont); + font->drawString(&surface, text, x, y, width, 0); if (textCast->borderSize != kSizeNone) { diff --git a/engines/director/score.h b/engines/director/score.h index b4abeb612a..d483afab1c 100644 --- a/engines/director/score.h +++ b/engines/director/score.h @@ -402,7 +402,6 @@ private: void update(); void readVersion(uint32 rid); void loadConfig(Common::SeekableSubReadStreamEndian &stream); - void loadMacFonts(); void loadPalette(Common::SeekableSubReadStreamEndian &stream); void loadFrames(Common::SeekableSubReadStreamEndian &stream); void loadLabels(Common::SeekableSubReadStreamEndian &stream); |