[Scummvm-cvs-logs] scummvm master -> 84c45eae37542685bedfe8163fd62d4fa3ee38cf

clone2727 clone2727 at gmail.com
Thu Mar 31 21:59:30 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
84c45eae37 MOHAWK: Use ScummVM GUI fonts for the cstime demo


Commit: 84c45eae37542685bedfe8163fd62d4fa3ee38cf
    https://github.com/scummvm/scummvm/commit/84c45eae37542685bedfe8163fd62d4fa3ee38cf
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-03-31T12:54:21-07:00

Commit Message:
MOHAWK: Use ScummVM GUI fonts for the cstime demo

The demo is now playable without using fonts from the full game

Changed paths:
    engines/mohawk/cstime_ui.cpp
    engines/mohawk/cstime_ui.h
    engines/mohawk/cstime_view.cpp



diff --git a/engines/mohawk/cstime_ui.cpp b/engines/mohawk/cstime_ui.cpp
index c95e276..935b032 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 b849ddb..3ec3849 100644
--- a/engines/mohawk/cstime_ui.h
+++ b/engines/mohawk/cstime_ui.h
@@ -233,9 +233,9 @@ public:
 	const Common::Array<Common::String> &getDialogLines() { return _dialogLines; }
 	const Common::Array<byte> &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 cad44e3..115b363 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<Common::String> &lines = _vm->getInterface()->getDialogLines();
 	const Common::Array<byte> &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<Common::String> lines;






More information about the Scummvm-git-logs mailing list