aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authormd52011-03-02 08:24:31 +0200
committermd52011-03-02 08:24:31 +0200
commited7c481e93e7563751cd6260ee89ea29df7e4f7f (patch)
tree1f0922baca7d84fa10fda913f4910e786224d15c /engines
parentbc48b124f05f0f602d80bf26eecc1f7237c83da3 (diff)
downloadscummvm-rg350-ed7c481e93e7563751cd6260ee89ea29df7e4f7f.tar.gz
scummvm-rg350-ed7c481e93e7563751cd6260ee89ea29df7e4f7f.tar.bz2
scummvm-rg350-ed7c481e93e7563751cd6260ee89ea29df7e4f7f.zip
SCI: Cleanup
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/kgraphics.cpp42
1 files changed, 15 insertions, 27 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index afcc2d17c6..ca794e9884 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -58,6 +58,17 @@
namespace Sci {
+static int16 adjustGraphColor(int16 color) {
+ // WORKAROUND: SCI1 EGA and Amiga games can set invalid colors (above 0 - 15).
+ // Colors above 15 are all white in SCI1 EGA games, which is why this was never
+ // observed. We clip them all to (0, 15) instead, as colors above 15 are used
+ // for the undithering algorithm in EGA games - bug #3048908.
+ if (getSciVersion() >= SCI_VERSION_1_EARLY && g_sci->getResMan()->getViewType() == kViewEga)
+ return color & 0x0F; // 0 - 15
+ else
+ return color;
+}
+
void showScummVMDialog(const Common::String &message) {
GUI::MessageDialog dialog(message, "OK");
dialog.runModal();
@@ -248,17 +259,10 @@ reg_t kGraphGetColorCount(EngineState *s, int argc, reg_t *argv) {
}
reg_t kGraphDrawLine(EngineState *s, int argc, reg_t *argv) {
- int16 color = argv[4].toSint16();
+ int16 color = adjustGraphColor(argv[4].toSint16());
int16 priority = (argc > 5) ? argv[5].toSint16() : -1;
int16 control = (argc > 6) ? argv[6].toSint16() : -1;
- // WORKAROUND: SCI1 EGA games can set invalid colors (above 0 - 15).
- // Colors above 15 are all white in SCI1 EGA games, which is why this was never
- // observed. We clip them all to (0, 15) instead, as colors above 15 are used
- // for the undithering algorithm in EGA games - bug #3048908.
- if (g_sci->getResMan()->getViewType() == kViewEga && getSciVersion() >= SCI_VERSION_1_EARLY)
- color &= 0x0F;
-
g_sci->_gfxPaint16->kernelGraphDrawLine(getGraphPoint(argv), getGraphPoint(argv + 2), color, priority, control);
return s->r_acc;
}
@@ -290,17 +294,10 @@ reg_t kGraphFillBoxForeground(EngineState *s, int argc, reg_t *argv) {
reg_t kGraphFillBoxAny(EngineState *s, int argc, reg_t *argv) {
Common::Rect rect = getGraphRect(argv);
int16 colorMask = argv[4].toUint16();
- int16 color = argv[5].toSint16();
+ int16 color = adjustGraphColor(argv[5].toSint16());
int16 priority = argv[6].toSint16(); // yes, we may read from stack sometimes here
int16 control = argv[7].toSint16(); // sierra did the same
- // WORKAROUND: SCI1 EGA games can set invalid colors (above 0 - 15).
- // Colors above 15 are all white in SCI1 EGA games, which is why this was never
- // observed. We clip them all to (0, 15) instead, as colors above 15 are used
- // for the undithering algorithm in EGA games - bug #3048908.
- if (g_sci->getResMan()->getViewType() == kViewEga && getSciVersion() >= SCI_VERSION_1_EARLY)
- color &= 0x0F;
-
g_sci->_gfxPaint16->kernelGraphFillBox(rect, colorMask, color, priority, control);
return s->r_acc;
}
@@ -1083,17 +1080,8 @@ reg_t kNewWindow(EngineState *s, int argc, reg_t *argv) {
int argextra = argc >= 13 ? 4 : 0; // Triggers in PQ3 and SCI1.1 games, argc 13 for DOS argc 15 for mac
int style = argv[5 + argextra].toSint16();
int priority = (argc > 6 + argextra) ? argv[6 + argextra].toSint16() : -1;
- int colorPen = (argc > 7 + argextra) ? argv[7 + argextra].toSint16() : 0;
- int colorBack = (argc > 8 + argextra) ? argv[8 + argextra].toSint16() : 255;
-
- // WORKAROUND: SCI1 EGA games can set invalid colors (above 0 - 15).
- // Colors above 15 are all white in SCI1 EGA games, which is why this was never
- // observed. We clip them all to (0, 15) instead, as colors above 15 are used
- // for the undithering algorithm in EGA games - bug #3048908.
- if (g_sci->getResMan()->getViewType() == kViewEga && getSciVersion() >= SCI_VERSION_1_EARLY) {
- colorPen &= 0x0F;
- colorBack &= 0x0F;
- }
+ int colorPen = adjustGraphColor((argc > 7 + argextra) ? argv[7 + argextra].toSint16() : 0);
+ int colorBack = adjustGraphColor((argc > 8 + argextra) ? argv[8 + argextra].toSint16() : 255);
// const char *title = argv[4 + argextra].segment ? kernel_dereference_char_pointer(s, argv[4 + argextra], 0) : NULL;
if (argc>=13) {