mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-25 13:42:37 +00:00
SCI: Minor cleanup
This commit is contained in:
parent
023cb90842
commit
2a2c7f5bef
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user