aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/gui/gui_gfx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/gui/gui_gfx.cpp')
-rw-r--r--engines/sci/gui/gui_gfx.cpp67
1 files changed, 52 insertions, 15 deletions
diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp
index 3fe0eb0867..0745da943e 100644
--- a/engines/sci/gui/gui_gfx.cpp
+++ b/engines/sci/gui/gui_gfx.cpp
@@ -336,16 +336,30 @@ GUIResourceId SciGUIgfx::GetFontId() {
}
SciGUIfont *SciGUIgfx::GetFont() {
- if ((_font == NULL) || (_font->getResourceId() != _curPort->fontId)) {
- _font = new SciGUIfont(_s, _screen, _curPort->fontId);
- }
+ GUIResourceId fontId = _curPort->fontId;
+
+ // Workaround: lsl1sci mixes its own internal fonts with the global
+ // SCI ones, so we translate them here, by removing their extra bits
+ if (_s->_gameName == "lsl1sci")
+ fontId &= 0x7ff;
+
+ if ((_font == NULL) || (_font->getResourceId() != _curPort->fontId))
+ _font = new SciGUIfont(_s->resMan, fontId);
+
return _font;
}
void SciGUIgfx::SetFont(GUIResourceId fontId) {
- if ((_font == NULL) || (_font->getResourceId() != fontId)) {
- _font = new SciGUIfont(_s, _screen, fontId);
- }
+ GUIResourceId actualFontId = fontId;
+
+ // Workaround: lsl1sci mixes its own internal fonts with the global
+ // SCI ones, so we translate them here, by removing their extra bits
+ if (_s->_gameName == "lsl1sci")
+ actualFontId &= 0x7ff;
+
+ if ((_font == NULL) || (_font->getResourceId() != fontId))
+ _font = new SciGUIfont(_s->resMan, actualFontId);
+
_curPort->fontId = fontId;
_curPort->fontHeight = _font->getHeight();
}
@@ -747,7 +761,7 @@ void SciGUIgfx::DrawText(const char *text, int16 from, int16 len, GUIResourceId
EraseRect(rect);
}
// CharStd
- _font->draw(curChar, _curPort->top + _curPort->curTop, _curPort->left + _curPort->curLeft, _curPort->penClr, _curPort->textFace);
+ _font->draw(_screen, curChar, _curPort->top + _curPort->curTop, _curPort->left + _curPort->curLeft, _curPort->penClr, _curPort->textFace);
_curPort->curLeft += charWidth;
}
}
@@ -942,6 +956,21 @@ const byte pattern_Circles[8][15] = {
{ 0x18, 0x3C, 0x7E, 0x7E, 0x7E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7E, 0x7E, 0x7E, 0x3C, 0x18 }
};
+// TODO: perhaps this is a better way to set the pattern_Textures array below?
+#if 0
+const byte patternTextures[32 * 2] = {
+ 0x04, 0x29, 0x40, 0x24, 0x09, 0x41, 0x25, 0x45,
+ 0x41, 0x90, 0x50, 0x44, 0x48, 0x08, 0x42, 0x28,
+ 0x89, 0x52, 0x89, 0x88, 0x10, 0x48, 0xA4, 0x08,
+ 0x44, 0x15, 0x28, 0x24, 0x00, 0x0A, 0x24, 0x20,
+ // Now the table is actually duplicated, so we won't need to wrap around
+ 0x04, 0x29, 0x40, 0x24, 0x09, 0x41, 0x25, 0x45,
+ 0x41, 0x90, 0x50, 0x44, 0x48, 0x08, 0x42, 0x28,
+ 0x89, 0x52, 0x89, 0x88, 0x10, 0x48, 0xA4, 0x08,
+ 0x44, 0x15, 0x28, 0x24, 0x00, 0x0A, 0x24, 0x20,
+};
+#endif
+
const bool pattern_Textures[32 * 8 * 2] = {
false, false, false, false, false, true, false, false, // 0x20
false, false, true, false, true, false, false, true, // 0x94
@@ -1012,14 +1041,22 @@ const bool pattern_Textures[32 * 8 * 2] = {
// Bit offsets into pattern_textures
const byte pattern_TextureOffset[128] = {
- 0x00, 0x18, 0x30, 0xc4, 0xdc, 0x65, 0xeb, 0x48, 0x60, 0xbd, 0x89, 0x05, 0x0a, 0xf4, 0x7d, 0x7d,
- 0x85, 0xb0, 0x8e, 0x95, 0x1f, 0x22, 0x0d, 0xdf, 0x2a, 0x78, 0xd5, 0x73, 0x1c, 0xb4, 0x40, 0xa1,
- 0xb9, 0x3c, 0xca, 0x58, 0x92, 0x34, 0xcc, 0xce, 0xd7, 0x42, 0x90, 0x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, 0x70, 0x4b, 0xa4, 0xe2,
+ 0xe6, 0xe5, 0xab, 0xe4, 0xd2, 0xaa, 0x4c, 0xe3,
+ 0x06, 0x6f, 0xc6, 0x4a, 0xa4, 0x75, 0x97, 0xe1
+};
void SciGUIgfx::Draw_Box(Common::Rect box, byte color, byte prio, byte control) {
byte flag = _screen->GetDrawingMask(color, prio, control);