From 1342d0482110ca26bffdf10bbc66eb377e22fd03 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 6 Oct 2009 17:13:57 +0000 Subject: [PATCH] Moved the LSL1VGA workaround inside the font class svn-id: r44705 --- engines/sci/gui/gui_font.cpp | 5 +++++ engines/sci/gui/gui_gfx.cpp | 8 ++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/engines/sci/gui/gui_font.cpp b/engines/sci/gui/gui_font.cpp index 31bd0233cc9..57e736613ec 100644 --- a/engines/sci/gui/gui_font.cpp +++ b/engines/sci/gui/gui_font.cpp @@ -35,6 +35,11 @@ SciGuiFont::SciGuiFont(ResourceManager *resMan, GuiResourceId resourceId) : _resourceId(resourceId) { assert(resourceId != -1); + // Workaround: lsl1sci mixes its own internal fonts with the global + // SCI ones, so we translate them here, by removing their extra bits + if (!resMan->testResource(ResourceId(kResourceTypeFont, resourceId))) + resourceId = resourceId & 0x7ff; + Resource *fontResource = resMan->findResource(ResourceId(kResourceTypeFont, resourceId), false); if (!fontResource) { error("font resource %d not found", resourceId); diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp index 2e2d1b9cceb..e6b2c854647 100644 --- a/engines/sci/gui/gui_gfx.cpp +++ b/engines/sci/gui/gui_gfx.cpp @@ -111,14 +111,10 @@ SciGuiFont *SciGuiGfx::GetFont() { } void SciGuiGfx::SetFont(GuiResourceId fontId) { - // Workaround: lsl1sci mixes its own internal fonts with the global - // SCI ones, so we translate them here, by removing their extra bits - GuiResourceId actualFontId = (_s->_gameName == "lsl1sci") ? fontId & 0x7ff : fontId; - if ((_font == NULL) || (_font->getResourceId() != fontId)) - _font = new SciGuiFont(_s->resMan, actualFontId); + _font = new SciGuiFont(_s->resMan, fontId); - _curPort->fontId = actualFontId; + _curPort->fontId = _font->getResourceId(); _curPort->fontHeight = _font->getHeight(); }