From 84c45eae37542685bedfe8163fd62d4fa3ee38cf Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 31 Mar 2011 15:51:09 -0400 Subject: MOHAWK: Use ScummVM GUI fonts for the cstime demo The demo is now playable without using fonts from the full game --- engines/mohawk/cstime_ui.cpp | 40 ++++++++++++++++++++++++++++++++++------ engines/mohawk/cstime_ui.h | 6 +++--- engines/mohawk/cstime_view.cpp | 4 ++-- 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/engines/mohawk/cstime_ui.cpp b/engines/mohawk/cstime_ui.cpp index c95e276b5e..935b0321da 100644 --- a/engines/mohawk/cstime_ui.cpp +++ b/engines/mohawk/cstime_ui.cpp @@ -29,6 +29,7 @@ #include "mohawk/resource.h" #include "common/algorithm.h" // find #include "common/events.h" +#include "graphics/fontman.h" namespace Mohawk { @@ -64,12 +65,15 @@ CSTimeInterface::CSTimeInterface(MohawkEngine_CSTime *vm) : _vm(vm) { _note = new CSTimeCarmenNote(_vm); _options = new CSTimeOptions(_vm); - if (!_normalFont.loadFromFON("EvP14.fon")) - error("failed to load normal font"); - if (!_dialogFont.loadFromFON("Int1212.fon")) - error("failed to load dialog font"); - if (!_rolloverFont.loadFromFON("Int1818.fon")) - error("failed to load rollover font"); + // The demo uses hardcoded system fonts + if (!(_vm->getFeatures() & GF_DEMO)) { + if (!_normalFont.loadFromFON("EvP14.fon")) + error("failed to load normal font"); + if (!_dialogFont.loadFromFON("Int1212.fon")) + error("failed to load dialog font"); + if (!_rolloverFont.loadFromFON("Int1818.fon")) + error("failed to load rollover font"); + } _uiFeature = NULL; _dialogTextFeature = NULL; @@ -91,6 +95,30 @@ CSTimeInterface::~CSTimeInterface() { delete _options; } +const Graphics::Font &CSTimeInterface::getNormalFont() const { + // HACK: Use a ScummVM GUI font in place of a system one for the demo + if (_vm->getFeatures() & GF_DEMO) + return *FontMan.getFontByUsage(Graphics::FontManager::kGUIFont); + + return _normalFont; +} + +const Graphics::Font &CSTimeInterface::getDialogFont() const { + // HACK: Use a ScummVM GUI font in place of a system one for the demo + if (_vm->getFeatures() & GF_DEMO) + return *FontMan.getFontByUsage(Graphics::FontManager::kGUIFont); + + return _dialogFont; +} + +const Graphics::Font &CSTimeInterface::getRolloverFont() const { + // HACK: Use a ScummVM GUI font in place of a system one for the demo + if (_vm->getFeatures() & GF_DEMO) + return *FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont); + + return _rolloverFont; +} + void CSTimeInterface::cursorInstall() { _vm->getView()->loadBitmapCursors(200); } diff --git a/engines/mohawk/cstime_ui.h b/engines/mohawk/cstime_ui.h index b849ddbdfb..3ec38492d7 100644 --- a/engines/mohawk/cstime_ui.h +++ b/engines/mohawk/cstime_ui.h @@ -233,9 +233,9 @@ public: const Common::Array &getDialogLines() { return _dialogLines; } const Common::Array &getDialogLineColors() { return _dialogLineColors; } - const Graphics::WinFont &getNormalFont() { return _normalFont; } - const Graphics::WinFont &getDialogFont() { return _dialogFont; } - const Graphics::WinFont &getRolloverFont() { return _rolloverFont; } + const Graphics::Font &getNormalFont() const; + const Graphics::Font &getDialogFont() const; + const Graphics::Font &getRolloverFont() const; Common::Rect _sceneRect, _uiRect; Common::Rect _dialogTextRect, _bookRect, _noteRect; diff --git a/engines/mohawk/cstime_view.cpp b/engines/mohawk/cstime_view.cpp index cad44e3b30..115b363b6e 100644 --- a/engines/mohawk/cstime_view.cpp +++ b/engines/mohawk/cstime_view.cpp @@ -537,7 +537,7 @@ void CSTimeModule::dialogTextDrawProc(Feature *feature) { const Common::Array &lines = _vm->getInterface()->getDialogLines(); const Common::Array &colors = _vm->getInterface()->getDialogLineColors(); const Common::Rect &bounds = feature->_data.bounds; - const Graphics::WinFont &font = _vm->getInterface()->getDialogFont(); + const Graphics::Font &font = _vm->getInterface()->getDialogFont(); Graphics::Surface *screen = _vm->_system->lockScreen(); for (uint i = 0; i < lines.size(); i++) @@ -553,7 +553,7 @@ void CSTimeModule::bubbleTextMoveProc(Feature *feature) { void CSTimeModule::bubbleTextDrawProc(Feature *feature) { Common::Rect bounds = feature->_data.bounds; bounds.grow(-5); - const Graphics::WinFont &font = _vm->getInterface()->getDialogFont(); + const Graphics::Font &font = _vm->getInterface()->getDialogFont(); uint height = font.getFontHeight(); Common::Array lines; -- cgit v1.2.3