aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/director/frame.cpp11
-rw-r--r--engines/macventure/gui.cpp3
-rw-r--r--engines/wage/dialog.cpp3
-rw-r--r--engines/wage/entities.cpp17
-rw-r--r--engines/wage/entities.h6
-rw-r--r--engines/wage/gui-console.cpp3
-rw-r--r--engines/wage/world.cpp6
7 files changed, 22 insertions, 27 deletions
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/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/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..100517b836 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::FontManager::kConsoleFont);
Common::String text;
while (res->pos() < res->size()) {