aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorMartin Kiewitz2010-01-10 09:07:09 +0000
committerMartin Kiewitz2010-01-10 09:07:09 +0000
commit7d16dbeb3581924175cf7d63c6a4189e016e5413 (patch)
tree2e959f1a1124de0d9581913c13419177f0cbb072 /engines/sci
parentda09ee6732b77461d836f064ff7200b2f94ae80f (diff)
downloadscummvm-rg350-7d16dbeb3581924175cf7d63c6a4189e016e5413.tar.gz
scummvm-rg350-7d16dbeb3581924175cf7d63c6a4189e016e5413.tar.bz2
scummvm-rg350-7d16dbeb3581924175cf7d63c6a4189e016e5413.zip
SCI: changed location of hack inside kDrawCel, coordinates of savedhiresbox may not get port adjusted
svn-id: r47218
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/graphics/gfx.cpp26
-rw-r--r--engines/sci/graphics/gfx.h2
-rw-r--r--engines/sci/graphics/gui.cpp15
3 files changed, 24 insertions, 19 deletions
diff --git a/engines/sci/graphics/gfx.cpp b/engines/sci/graphics/gfx.cpp
index 299f2cbd64..8aeb15a22a 100644
--- a/engines/sci/graphics/gfx.cpp
+++ b/engines/sci/graphics/gfx.cpp
@@ -383,12 +383,28 @@ void Gfx::drawCel(View *view, int16 loopNo, int16 celNo, Common::Rect celRect, b
// This is used as replacement for drawCelAndShow() when hires-cels are drawn to screen
// Hires-cels are available only SCI 1.1+
-void Gfx::drawHiresCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY) {
+void Gfx::drawHiresCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, reg_t upscaledHiresHandle, uint16 scaleX, uint16 scaleY) {
View *view = getView(viewId);
Common::Rect celRect, curPortRect, clipRect, clipRectTranslated;
Common::Point curPortPos;
+ bool upscaledHiresHack = false;
if (view) {
+ if ((leftPos == 0) && (topPos == 0)) {
+ // HACK: in kq6, we get leftPos&topPos == 0 SOMETIMES, that's why we need to get coordinates from upscaledHiresHandle
+ // I'm not sure if this is what we are supposed to do or if there is some other bug that actually makes
+ // coordinates to be 0 in the first place
+ byte *memoryPtr = NULL;
+ memoryPtr = kmem(_segMan, upscaledHiresHandle);
+ if (memoryPtr) {
+ Common::Rect upscaledHiresRect;
+ _screen->bitsGetRect(memoryPtr, &upscaledHiresRect);
+ leftPos = upscaledHiresRect.left;
+ topPos = upscaledHiresRect.top;
+ upscaledHiresHack = true;
+ }
+ }
+
celRect.left = leftPos;
celRect.top = topPos;
celRect.right = celRect.left + view->getWidth(loopNo, celNo);
@@ -403,9 +419,11 @@ void Gfx::drawHiresCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, u
return;
clipRectTranslated = clipRect;
- curPortPos.x = _curPort->left * 2; curPortPos.y = _curPort->top * 2;
- clipRectTranslated.top += curPortPos.y; clipRectTranslated.bottom += curPortPos.y;
- clipRectTranslated.left += curPortPos.x; clipRectTranslated.right += curPortPos.x;
+ if (!upscaledHiresHack) {
+ curPortPos.x = _curPort->left * 2; curPortPos.y = _curPort->top * 2;
+ clipRectTranslated.top += curPortPos.y; clipRectTranslated.bottom += curPortPos.y;
+ clipRectTranslated.left += curPortPos.x; clipRectTranslated.right += curPortPos.x;
+ }
view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo, true, scaleX, scaleY);
if (!_screen->_picNotValidSci11) {
diff --git a/engines/sci/graphics/gfx.h b/engines/sci/graphics/gfx.h
index eb7a02b2a1..af1d4b13c7 100644
--- a/engines/sci/graphics/gfx.h
+++ b/engines/sci/graphics/gfx.h
@@ -89,7 +89,7 @@ public:
void drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128);
void drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128);
void drawCel(View *view, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128);
- void drawHiresCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128);
+ void drawHiresCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, reg_t upscaledHiresHandle, uint16 scaleX = 128, uint16 scaleY = 128);
uint16 onControl(uint16 screenMask, Common::Rect rect);
diff --git a/engines/sci/graphics/gui.cpp b/engines/sci/graphics/gui.cpp
index 228527a50a..07c5ee665a 100644
--- a/engines/sci/graphics/gui.cpp
+++ b/engines/sci/graphics/gui.cpp
@@ -372,20 +372,7 @@ void SciGui::drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 lef
if (!hiresMode) {
_gfx->drawCelAndShow(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo);
} else {
- if ((leftPos == 0) && (topPos == 0)) {
- // HACK: in kq6, we get leftPos&topPos == 0 SOMETIMES, that's why we need to get coordinates from upscaledHiresHandle
- // I'm not sure if this is what we are supposed to do or if there is some other bug that actually makes
- // coordinates to be 0 in the first place
- byte *memoryPtr = NULL;
- memoryPtr = kmem(_s->_segMan, upscaledHiresHandle);
- if (memoryPtr) {
- Common::Rect upscaledHiresRect;
- _screen->bitsGetRect(memoryPtr, &upscaledHiresRect);
- leftPos = upscaledHiresRect.left;
- topPos = upscaledHiresRect.top;
- }
- }
- _gfx->drawHiresCelAndShow(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo);
+ _gfx->drawHiresCelAndShow(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo, upscaledHiresHandle);
}
_palette->setOnScreen();
}