aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk/riven_stacks/aspit.cpp
diff options
context:
space:
mode:
authorBastien Bouclet2018-08-11 08:37:06 +0200
committerBastien Bouclet2018-08-11 08:58:12 +0200
commitab46dae8d731f4fa7171505a85c5304ee0585060 (patch)
tree9baf7318b061d310a0fd50f317261f5efe5e43d4 /engines/mohawk/riven_stacks/aspit.cpp
parent90299eb73e3a4336db1d15a7cb7de0dba6eb73a4 (diff)
downloadscummvm-rg350-ab46dae8d731f4fa7171505a85c5304ee0585060.tar.gz
scummvm-rg350-ab46dae8d731f4fa7171505a85c5304ee0585060.tar.bz2
scummvm-rg350-ab46dae8d731f4fa7171505a85c5304ee0585060.zip
MOHAWK: RIVEN: Rework font loading so the TTF font is not leaked
Diffstat (limited to 'engines/mohawk/riven_stacks/aspit.cpp')
-rw-r--r--engines/mohawk/riven_stacks/aspit.cpp55
1 files changed, 3 insertions, 52 deletions
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp
index 6f22786777..ba36dccdd7 100644
--- a/engines/mohawk/riven_stacks/aspit.cpp
+++ b/engines/mohawk/riven_stacks/aspit.cpp
@@ -93,42 +93,6 @@ void ASpit::xastartupbtnhide(const ArgumentArray &args) {
if (!(_vm->getFeatures() & GF_25TH))
return;
- Common::File file;
-
- const char *fontname;
- const Graphics::Font *font = nullptr;
-
- if (_vm->getLanguage() != Common::JA_JPN) {
- fontname = "FreeSans.ttf";
- } else {
- fontname = "mplus-2c-regular.ttf";
- }
-
-#if defined(USE_FREETYPE2)
- int fontHeight;
-
- if (_vm->getLanguage() != Common::JA_JPN) {
- fontHeight = 12;
- } else {
- fontHeight = 11;
- }
-
- if (file.open(fontname)) {
- font = Graphics::loadTTFFont(file, fontHeight);
- }
-#endif
-
- if (!font) {
- warning("Cannot load font %s directly", fontname);
- font = FontMan.getFontByName(fontname);
- }
-
- if (!font) {
- warning("Cannot load font %s", fontname);
-
- font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
- }
-
int lang = -1;
for (int i = 0; menuItems[i].language != -1; i++) {
if (menuItems[i].language == _vm->getLanguage()) {
@@ -168,24 +132,11 @@ void ASpit::xastartupbtnhide(const ArgumentArray &args) {
bool enabled = !items[i].requiresStartedGame || _vm->isGameStarted();
hotspot->enable(enabled);
- Common::Rect hotspotRect = hotspot->getRect();
-
- Graphics::Surface surface;
- surface.create(hotspotRect.width(), hotspotRect.height(), _vm->_gfx->getBackScreen()->format);
-
- uint32 textColor;
- if (enabled) {
- textColor = surface.format.RGBToColor(164, 164, 164);
- } else {
- textColor = surface.format.RGBToColor(96, 96, 96);
- }
-
Common::U32String str = Common::convertUtf8ToUtf32(menuItems[lang].items[i]);
+ Common::Rect hotspotRect = hotspot->getRect();
+ uint8 greyLevel = enabled ? 164 : 96;
- font->drawString(&surface, str, 0, 0, surface.w, textColor);
-
- _vm->_gfx->copySurfaceToScreen(&surface, hotspotRect.left, hotspotRect.top);
- surface.free();
+ _vm->_gfx->drawText(str, hotspotRect, greyLevel);
}
}