aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/kmenu.cpp3
-rw-r--r--engines/sci/gui/gui.cpp16
-rw-r--r--engines/sci/gui/gui_gfx.cpp16
-rw-r--r--engines/sci/gui/gui_picture.cpp4
-rw-r--r--engines/sci/gui/gui_screen.cpp20
-rw-r--r--engines/sci/gui/gui_screen.h2
-rw-r--r--engines/sci/gui/gui_view.cpp5
7 files changed, 28 insertions, 38 deletions
diff --git a/engines/sci/engine/kmenu.cpp b/engines/sci/engine/kmenu.cpp
index 5f3f00d1e6..3a46f228a9 100644
--- a/engines/sci/engine/kmenu.cpp
+++ b/engines/sci/engine/kmenu.cpp
@@ -69,7 +69,7 @@ reg_t kDrawStatus(EngineState *s, int argc, reg_t *argv) {
reg_t textReference = argv[0];
Common::String text;
int16 colorPen = (argc > 1) ? argv[1].toSint16() : 0; // old code was: s->status_bar_foreground;
- int16 colorBack = (argc > 2) ? argv[2].toSint16() : 255; // s->status_bar_background;
+ int16 colorBack = (argc > 2) ? argv[2].toSint16() : s->resMan->isVGA() ? 255 : 15; // s->status_bar_background;
if (!textReference.isNull()) {
// Sometimes this is called without giving text, if thats the case dont process it
@@ -80,7 +80,6 @@ reg_t kDrawStatus(EngineState *s, int argc, reg_t *argv) {
return s->r_acc;
}
-
reg_t kDrawMenuBar(EngineState *s, int argc, reg_t *argv) {
if (argv[0].toSint16())
sciw_set_menubar(s, s->titlebar_port, s->_menubar, -1);
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp
index 9352c6c348..e08f231286 100644
--- a/engines/sci/gui/gui.cpp
+++ b/engines/sci/gui/gui.cpp
@@ -107,11 +107,6 @@ void SciGui::localToGlobal(int16 *x, int16 *y) {
reg_t SciGui::newWindow(Common::Rect dims, Common::Rect restoreRect, uint16 style, int16 priority, int16 colorPen, int16 colorBack, const char *title) {
GuiWindow *wnd = NULL;
- if (!_s->resMan->isVGA()) {
- colorPen |= (colorPen << 4);
- colorBack |= (colorBack << 4);
- }
-
if (restoreRect.top != 0 && restoreRect.left != 0 && restoreRect.height() != 0 && restoreRect.width() != 0)
wnd = _windowMgr->NewWindow(dims, &restoreRect, title, style, priority, false);
else
@@ -197,8 +192,6 @@ void SciGui::display(const char *text, int argc, reg_t *argv) {
break;
}
}
- if (!_s->resMan->isVGA())
- bgcolor |= (bgcolor << 4);
// now drawing the text
_gfx->TextSize(rect, text, -1, width);
@@ -241,11 +234,6 @@ void SciGui::textColors(int argc, reg_t *argv) {
void SciGui::drawStatus(const char *text, int16 colorPen, int16 colorBack) {
GuiPort *oldPort = _gfx->SetPort(_gfx->_menuPort);
- if (!_s->resMan->isVGA()) {
- colorPen |= colorPen << 4;
- colorBack |= colorBack << 4;
- }
-
_gfx->FillRect(_gfx->_menuRect, 1, colorBack);
_gfx->PenColor(colorPen);
_gfx->MoveTo(0, 1);
@@ -323,15 +311,11 @@ void SciGui::graphFillBoxBackground(Common::Rect rect) {
}
void SciGui::graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int16 priority, int16 control) {
- if (!_s->resMan->isVGA())
- color |= (color << 4);
_gfx->FillRect(rect, colorMask, color, priority, control);
_screen->copyToScreen();
}
void SciGui::graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control) {
- if (!_s->resMan->isVGA())
- color |= (color << 4);
_gfx->Draw_Line(startPoint.x, startPoint.y, endPoint.x, endPoint.y, color, priority, control);
_screen->copyToScreen();
}
diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp
index 06ddac40f3..ee2702bf9f 100644
--- a/engines/sci/gui/gui_gfx.cpp
+++ b/engines/sci/gui/gui_gfx.cpp
@@ -383,10 +383,7 @@ void SciGuiGfx::OpenPort(GuiPort *port) {
}
void SciGuiGfx::PenColor(int16 color) {
- if (!_s->resMan->isVGA())
- _curPort->penClr = color;
- else
- _curPort->penClr = color | (color << 4);
+ _curPort->penClr = color;
}
void SciGuiGfx::PenMode(int16 mode) {
@@ -1183,15 +1180,8 @@ void SciGuiGfx::Pic_Fill(int16 x, int16 y, byte color, byte prio, byte control)
byte t_con = _screen->getControl(p.x, p.y);
int16 w, e, a_set, b_set;
// if in 1st point priority,control or color is already set to target, clear the flag
- if (!_s->resMan->isVGA()) {
- // EGA 16 colors
- if (flag & 1 && ((t_col == (color & 0x0F)) || (t_col == (color >> 4))))
- flag ^= 1;
- } else {
- // VGA 256 colors
- if (flag & 1 && t_col == color)
- flag ^= 1;
- }
+ if (flag & 1 && t_col == color)
+ flag ^= 1;
if (flag & 2 && t_pri == prio)
flag ^= 2;
if (flag & 4 && t_con == control)
diff --git a/engines/sci/gui/gui_picture.cpp b/engines/sci/gui/gui_picture.cpp
index 17e135722b..4dba63ab96 100644
--- a/engines/sci/gui/gui_picture.cpp
+++ b/engines/sci/gui/gui_picture.cpp
@@ -501,6 +501,10 @@ void SciGuiPicture::drawVectorData(byte *data, int dataSize) {
break;
case PIC_OP_TERMINATE:
_priority = pic_priority;
+ // Dithering EGA pictures
+ if (isEGA) {
+ _screen->dither();
+ }
return;
default:
error("Unsupported pic-operation %X", pic_op);
diff --git a/engines/sci/gui/gui_screen.cpp b/engines/sci/gui/gui_screen.cpp
index 672b0775eb..36826c77ba 100644
--- a/engines/sci/gui/gui_screen.cpp
+++ b/engines/sci/gui/gui_screen.cpp
@@ -90,10 +90,6 @@ void SciGuiScreen::putPixel(int x, int y, byte drawMask, byte color, byte priori
int offset = _baseTable[y] + x;
if (drawMask & SCI_SCREEN_MASK_VISUAL) {
- if (!_s->resMan->isVGA()) {
- // EGA output (16 colors, dithered)
- color = ((x^y) & 1) ? color >> 4 : color & 0x0F;
- }
*(_visualScreen + offset) = color;
_displayScreen[_baseDisplayTable[y] + x] = color;
}
@@ -198,4 +194,20 @@ void SciGuiScreen::restoreBitsScreen(Common::Rect rect, byte *&memoryPtr, byte *
}
}
+// Currently not really done, its supposed to be possible to only dither _visualScreen
+void SciGuiScreen::dither() {
+ int y, x;
+ byte color;
+ byte *screenPtr = _visualScreen;
+ byte *displayPtr = _displayScreen;
+
+ for (y = 0; y < _height; y++) {
+ for (x = 0; x < _width; x++) {
+ color = *screenPtr;
+ color = ((x^y) & 1) ? color >> 4 : color & 0x0F;
+ *screenPtr++ = color; *displayPtr++ = color;
+ }
+ }
+}
+
} // End of namespace Sci
diff --git a/engines/sci/gui/gui_screen.h b/engines/sci/gui/gui_screen.h
index 417c2e9de0..be7a35b6d0 100644
--- a/engines/sci/gui/gui_screen.h
+++ b/engines/sci/gui/gui_screen.h
@@ -59,6 +59,8 @@ public:
void saveBits(Common::Rect rect, byte mask, byte *memoryPtr);
void restoreBits(byte *memoryPtr);
+ void dither();
+
GuiPalette _sysPalette;
uint16 _width;
diff --git a/engines/sci/gui/gui_view.cpp b/engines/sci/gui/gui_view.cpp
index f0229e509f..71263b485f 100644
--- a/engines/sci/gui/gui_view.cpp
+++ b/engines/sci/gui/gui_view.cpp
@@ -111,12 +111,11 @@ void SciGuiView::initData(GuiResourceId resourceId) {
cel->height = READ_LE_UINT16(celData + 2);
cel->displaceX = celData[4];
cel->displaceY = celData[5];
+ cel->clearKey = celData[6];
if (IsEGA) {
- cel->clearKey = celData[6] | celData[6] << 4;
cel->offsetEGA = celOffset + 7;
cel->offsetRLE = 0;
} else {
- cel->clearKey = celData[6];
cel->offsetEGA = 0;
cel->offsetRLE = celOffset + 8;
}
@@ -245,7 +244,7 @@ void SciGuiView::unpackCel(GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte *outPt
byte = *literalPtr++;
runLength = byte >> 4;
byte = _EGAMapping[byte & 0x0F];
- memset(outPtr + pixelNo, byte | byte << 4, MIN<uint16>(runLength, pixelCount - pixelNo));
+ memset(outPtr + pixelNo, byte, MIN<uint16>(runLength, pixelCount - pixelNo));
pixelNo += runLength;
}
return;