aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2010-01-25 20:44:13 +0000
committerMartin Kiewitz2010-01-25 20:44:13 +0000
commitba7eb790748fe455f3db269176666f52761a4a8e (patch)
tree692c53ebbc50fc87c59a1e5823bb864cc90155a4
parent3b7af74af4f178e48b105a47841b4f86d9257e7c (diff)
downloadscummvm-rg350-ba7eb790748fe455f3db269176666f52761a4a8e.tar.gz
scummvm-rg350-ba7eb790748fe455f3db269176666f52761a4a8e.tar.bz2
scummvm-rg350-ba7eb790748fe455f3db269176666f52761a4a8e.zip
SCI: removed EGA mapping for amiga games, cause changing K_GRAPH_GET_COLORS_NR to support amiga also fixes it - also fixes other odd issues like the ones in kq5 and castle of dr. brain/sq1 (thx. to waltervn for finding this out)
svn-id: r47560
-rw-r--r--engines/sci/engine/kgraphics.cpp4
-rw-r--r--engines/sci/graphics/gui.cpp20
-rw-r--r--engines/sci/graphics/palette.cpp16
-rw-r--r--engines/sci/graphics/palette.h3
4 files changed, 3 insertions, 40 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 3f96afcd9a..61c23c13ba 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -223,7 +223,9 @@ reg_t kGraph(EngineState *s, int argc, reg_t *argv) {
switch (argv[0].toSint16()) {
case K_GRAPH_GET_COLORS_NR:
- return make_reg(0, !s->resMan->isVGA() ? 0x10 : 0x100);
+ if (s->resMan->isAmiga32color())
+ return make_reg(0, 32);
+ return make_reg(0, !s->resMan->isVGA() ? 16 : 256);
break;
case K_GRAPH_DRAW_LINE:
diff --git a/engines/sci/graphics/gui.cpp b/engines/sci/graphics/gui.cpp
index a923c381dc..388598d5ba 100644
--- a/engines/sci/graphics/gui.cpp
+++ b/engines/sci/graphics/gui.cpp
@@ -176,11 +176,6 @@ int16 SciGui::priorityToCoordinate(int16 priority) {
reg_t SciGui::newWindow(Common::Rect dims, Common::Rect restoreRect, uint16 style, int16 priority, int16 colorPen, int16 colorBack, const char *title) {
Window *wnd = NULL;
- if (_s->resMan->isAmiga32color()) {
- colorPen = _palette->mapAmigaColor(colorPen);
- colorBack = _palette->mapAmigaColor(colorBack);
- }
-
if (restoreRect.top != 0 && restoreRect.left != 0 && restoreRect.height() != 0 && restoreRect.width() != 0)
wnd = _windowMgr->NewWindow(dims, &restoreRect, title, style, priority, false);
else
@@ -237,15 +232,11 @@ void SciGui::display(const char *text, int argc, reg_t *argv) {
break;
case SCI_DISPLAY_SETPENCOLOR:
colorPen = argv[0].toUint16();
- if (_s->resMan->isAmiga32color())
- colorPen = _palette->mapAmigaColor(colorPen);
_gfx->PenColor(colorPen);
argc--; argv++;
break;
case SCI_DISPLAY_SETBACKGROUNDCOLOR:
colorBack = argv[0].toUint16();
- if (_s->resMan->isAmiga32color())
- colorBack = _palette->mapAmigaColor(colorBack);
argc--; argv++;
break;
case SCI_DISPLAY_SETGREYEDOUTPUT:
@@ -324,11 +315,6 @@ void SciGui::textColors(int argc, reg_t *argv) {
void SciGui::drawStatus(const char *text, int16 colorPen, int16 colorBack) {
Port *oldPort = _gfx->SetPort(_gfx->_menuPort);
- if (_s->resMan->isAmiga32color()) {
- colorPen = _palette->mapAmigaColor(colorPen);
- colorBack = _palette->mapAmigaColor(colorBack);
- }
-
_gfx->FillRect(_gfx->_menuBarRect, 1, colorBack);
_gfx->PenColor(colorPen);
_gfx->MoveTo(0, 1);
@@ -506,23 +492,17 @@ void SciGui::graphFillBoxBackground(Common::Rect rect) {
}
void SciGui::graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int16 priority, int16 control) {
- if (_s->resMan->isAmiga32color())
- color = _palette->mapAmigaColor(color);
_gfx->FillRect(rect, colorMask, color, priority, control);
}
void SciGui::graphFrameBox(Common::Rect rect, int16 color) {
int16 oldColor = _gfx->GetPort()->penClr;
- if (_s->resMan->isAmiga32color())
- color = _palette->mapAmigaColor(color);
_gfx->PenColor(color);
_gfx->FrameRect(rect);
_gfx->PenColor(oldColor);
}
void SciGui::graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control) {
- if (_s->resMan->isAmiga32color())
- color = _palette->mapAmigaColor(color);
_gfx->OffsetLine(startPoint, endPoint);
_screen->drawLine(startPoint.x, startPoint.y, endPoint.x, endPoint.y, color, priority, control);
}
diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp
index 807848ae68..3d92973595 100644
--- a/engines/sci/graphics/palette.cpp
+++ b/engines/sci/graphics/palette.cpp
@@ -53,8 +53,6 @@ SciPalette::SciPalette(ResourceManager *resMan, Screen *screen, bool autoSetPale
_sysPalette.colors[255].g = 255;
_sysPalette.colors[255].b = 255;
- memset(&_amigaEGAtable, 0, sizeof(_amigaEGAtable));
-
if (autoSetPalette) {
if (_resMan->getViewType() == kViewEga)
setEGA();
@@ -153,24 +151,11 @@ bool SciPalette::setAmiga() {
file.close();
// Directly set the palette, because setOnScreen() wont do a thing for amiga
_screen->setPalette(&_sysPalette);
-
- // Create EGA to amiga table
- for (curColor = 1; curColor < 16; curColor++) {
- _amigaEGAtable[curColor] = matchColor(&_sysPalette, EGApalette[curColor][0], EGApalette[curColor][1], EGApalette[curColor][2]);
- }
return true;
}
return false;
}
-// On amiga the scripts send us an EGA color, we need to match it to the active amiga palette
-int16 SciPalette::mapAmigaColor(int16 color) {
- // TODO: not sure what pq3 means by using color 31
- if (color > 15)
- return color;
- return _amigaEGAtable[color];
-}
-
// Called from picture class, some amiga sci1 games set half of the palette
void SciPalette::modifyAmigaPalette(byte *data) {
int16 curColor, curPos = 0;
@@ -183,7 +168,6 @@ void SciPalette::modifyAmigaPalette(byte *data) {
_sysPalette.colors[curColor].b = (byte2 & 0x0F) * 0x11;
}
_screen->setPalette(&_sysPalette);
- // TODO: when games do this it seems the EGAmapping isnt used anymore, at least the colors are wrong in any case
}
void SciPalette::setEGA() {
diff --git a/engines/sci/graphics/palette.h b/engines/sci/graphics/palette.h
index 67a0beb3b0..6d1a3a9845 100644
--- a/engines/sci/graphics/palette.h
+++ b/engines/sci/graphics/palette.h
@@ -38,7 +38,6 @@ public:
void createFromData(byte *data, Palette *paletteOut);
bool setAmiga();
- int16 mapAmigaColor(int16 color);
void modifyAmigaPalette(byte *data);
void setEGA();
bool setFromResource(GuiResourceId resourceId, uint16 flag);
@@ -61,8 +60,6 @@ private:
ResourceManager *_resMan;
Common::Array<PalSchedule> _schedules;
-
- byte _amigaEGAtable[16];
};
} // End of namespace Sci