aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2011-03-30 16:00:46 -0400
committerMatthew Hoops2011-03-30 16:00:46 -0400
commit2a2c7f5bef6b7ddcc6df3aca62683501cc740030 (patch)
tree5a1f34a79f138dc9b4f64e6202f74816b02d2f54
parent023cb90842fde98e3cfa78ab8278b2c984c7cea2 (diff)
downloadscummvm-rg350-2a2c7f5bef6b7ddcc6df3aca62683501cc740030.tar.gz
scummvm-rg350-2a2c7f5bef6b7ddcc6df3aca62683501cc740030.tar.bz2
scummvm-rg350-2a2c7f5bef6b7ddcc6df3aca62683501cc740030.zip
SCI: Minor cleanup
-rw-r--r--engines/sci/graphics/screen.cpp30
-rw-r--r--engines/sci/graphics/view.cpp13
2 files changed, 18 insertions, 25 deletions
diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp
index 1838ba779d..32f54c7e23 100644
--- a/engines/sci/graphics/screen.cpp
+++ b/engines/sci/graphics/screen.cpp
@@ -696,41 +696,35 @@ void GfxScreen::scale2x(const byte *src, byte *dst, int16 srcWidth, int16 srcHei
}
}
-typedef struct {
+struct UpScaledAdjust {
GfxScreenUpscaledMode gameHiresMode;
Sci32ViewNativeResolution viewNativeRes;
int numerator;
int denominator;
-} UpScaledAdjust;
-
-UpScaledAdjust upscaledAdjustTable[] = {
- {GFX_SCREEN_UPSCALED_640x480, SCI_VIEW_NATIVERES_640x400, 5, 6},
};
-int upscaledAdjustTableSize = ARRAYSIZE(upscaledAdjustTable);
+static const UpScaledAdjust s_upscaledAdjustTable[] = {
+ { GFX_SCREEN_UPSCALED_640x480, SCI_VIEW_NATIVERES_640x400, 5, 6 }
+};
void GfxScreen::adjustToUpscaledCoordinates(int16 &y, int16 &x, Sci32ViewNativeResolution viewNativeRes) {
x *= 2;
y = _upscaledMapping[y];
- for (int i = 0; i < upscaledAdjustTableSize; i++)
- {
- if (upscaledAdjustTable[i].gameHiresMode == _upscaledHires &&
- upscaledAdjustTable[i].viewNativeRes == viewNativeRes)
- {
- y = (y * upscaledAdjustTable[i].numerator) / upscaledAdjustTable[i].denominator;
+ for (int i = 0; i < ARRAYSIZE(s_upscaledAdjustTable); i++) {
+ if (s_upscaledAdjustTable[i].gameHiresMode == _upscaledHires &&
+ s_upscaledAdjustTable[i].viewNativeRes == viewNativeRes) {
+ y = (y * s_upscaledAdjustTable[i].numerator) / s_upscaledAdjustTable[i].denominator;
break;
}
}
}
void GfxScreen::adjustBackUpscaledCoordinates(int16 &y, int16 &x, Sci32ViewNativeResolution viewNativeRes) {
- for (int i = 0; i < upscaledAdjustTableSize; i++)
- {
- if (upscaledAdjustTable[i].gameHiresMode == _upscaledHires &&
- upscaledAdjustTable[i].viewNativeRes == viewNativeRes)
- {
- y = (y * upscaledAdjustTable[i].denominator) / upscaledAdjustTable[i].numerator;
+ for (int i = 0; i < ARRAYSIZE(s_upscaledAdjustTable); i++) {
+ if (s_upscaledAdjustTable[i].gameHiresMode == _upscaledHires &&
+ s_upscaledAdjustTable[i].viewNativeRes == viewNativeRes) {
+ y = (y * s_upscaledAdjustTable[i].denominator) / s_upscaledAdjustTable[i].numerator;
break;
}
}
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index 2623bcee20..f31cbacb22 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -204,12 +204,9 @@ void GfxView::initData(GuiResourceId resourceId) {
assert(_loopCount);
palOffset = READ_SCI11ENDIAN_UINT32(_resourceData + 8);
- // FIXME: _resourceData[5] is sometimes 2 in GK1 also denoting scaled, but somehow modified.
- // For a good test, jump to room 720 and talk to Wolfgang. Wolfgang's head is scaled when it
- // shouldn't be, but the positioning of his eyes and mouth is also incorrect.
- if (getSciVersion() >= SCI_VERSION_2)
- {
- _sci2ScaleRes = (Sci32ViewNativeResolution) _resourceData[5];
+ // For SCI32, this is a scale flag
+ if (getSciVersion() >= SCI_VERSION_2) {
+ _sci2ScaleRes = (Sci32ViewNativeResolution)_resourceData[5];
if (_screen->getUpscaledHires() == GFX_SCREEN_UPSCALED_DISABLED)
_sci2ScaleRes = SCI_VIEW_NATIVERES_NONE;
}
@@ -340,7 +337,7 @@ Palette *GfxView::getPalette() {
}
bool GfxView::isSci2Hires() {
- return _sci2ScaleRes > 0;
+ return _sci2ScaleRes > SCI_VIEW_NATIVERES_320x200;
}
bool GfxView::isScaleable() {
@@ -725,6 +722,8 @@ void GfxView::draw(const Common::Rect &rect, const Common::Rect &clipRect, const
// get drawn onto lowres screen.
// FIXME(?): we can't read priority directly with the
// hires coordinates. May not be needed at all in kq6
+ // FIXME: Handle proper aspect ratio. Some GK1 hires images
+ // are in 640x400 instead of 640x480
_screen->putPixelOnDisplay(x2, y2, palette->mapping[color]);
}
}