Moved the LSL1VGA workaround inside the font class

svn-id: r44705
This commit is contained in:
Filippos Karapetis 2009-10-06 17:13:57 +00:00
parent 0b47085da0
commit 1342d04821
2 changed files with 7 additions and 6 deletions

View File

@ -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);

View File

@ -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();
}