[Scummvm-git-logs] scummvm branch-2-9 -> 66b332c709fdfcb8d2c9d3f0efdc0ced5bac0024
athrxx
noreply at scummvm.org
Fri Apr 25 19:01:14 UTC 2025
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
65c8cf4e54 SCI: fix kernel sub function mapping for certain builds
7b33ab3d9a SCI: (KQ6WinCD) - fix hires drawing glitches
66b332c709 SCI: fix bug caused by PR 6319
Commit: 65c8cf4e54214f6eef6c908caba8eac0cd0346f4
https://github.com/scummvm/scummvm/commit/65c8cf4e54214f6eef6c908caba8eac0cd0346f4
Author: athrxx (athrxx at scummvm.org)
Date: 2025-04-25T20:57:05+02:00
Commit Message:
SCI: fix kernel sub function mapping for certain builds
I had issues to run any SCI1 game with MSVC ASan builds.They
always failed to start up with a 'DoSoundMasterVolume: no
previous signatures' error. When I recently had that issue (which
I quickly discussed with digitall on discord) I got it fixed by
simply doing a full rebuild. But not this time. So I looked into it
deeper. And I find it quite surprising that it usually works in 99,9%
of all cases, since it does a comparison of two pointers that are
meant to point to different strings. In the kDoSound_subops
table, each entry gets its own string. My only explanation is that
these string repetitions get optimized away (but apparently not
or not always for the MSVC ASan build). I have replaced it with
a strcmp which seems to work fine.
Changed paths:
engines/sci/engine/kernel.cpp
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index 600d0e95239..4915afce3d4 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -681,7 +681,7 @@ void Kernel::mapFunctions(GameFeatures *features) {
while (kernelSubLeft) {
kernelSubLeft--;
kernelSubMapBack--;
- if (kernelSubMapBack->name == kernelSubMap->name) {
+ if (!strcmp(kernelSubMapBack->name, kernelSubMap->name)) {
if (kernelSubMapBack->signature) {
subFunctions[subId].signature = parseKernelSignature(kernelSubMap->name, kernelSubMapBack->signature);
break;
Commit: 7b33ab3d9a0ed451e11705ee153263ff39f60ddf
https://github.com/scummvm/scummvm/commit/7b33ab3d9a0ed451e11705ee153263ff39f60ddf
Author: athrxx (athrxx at scummvm.org)
Date: 2025-04-25T20:57:14+02:00
Commit Message:
SCI: (KQ6WinCD) - fix hires drawing glitches
(items 1- 3 from bug ticket no. 15594)
I have added redrawing functionality for the hires GFX from the
original interpreter. I guess the original only needed that code
to handle WM_PAINT messages (= full window redraw). It also
does actually call a redraw in kDisposeWindow, the same way I
implemented it here, to refresh the inventory. But that is really
only needed for the speech+text mode which isn't supported
in the original. Maybe they ditched the mode only after they
had already implemented that, who knows...
I have also improved the workaround for the out-of-bounds
portraits to catch the case from the bug ticket.
I added a check in kDisposeWindow. It isn't strictly necessary,
but it it makes the code easier to understand.
I also renamed a var that I had previously renamed in a way
that makes no sense. I had renamed it from `upscaledHiresRect'
to 'portraitRect' since it is neither upscaled nor hires (it is just a
lowres rect). But it isn't a portrait rect either. The portraits get
drawn elsewhere. It's more likely to be a picture frame, a GUI
control or an inventory item.
Changed paths:
engines/sci/engine/kgraphics.cpp
engines/sci/graphics/paint16.cpp
engines/sci/graphics/paint16.h
engines/sci/graphics/screen.cpp
engines/sci/graphics/screen.h
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 7432fd311be..488317e8831 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -1206,6 +1206,12 @@ reg_t kDisposeWindow(EngineState *s, int argc, reg_t *argv) {
g_sci->_gfxPorts->kernelDisposeWindow(windowId, reanimate);
g_sci->_tts->stop();
+ // This is only needed for KQ6WinCD when using the mixed speech+text mode with hires graphics enabled.
+ // The original interpreter does not support the mixed mode, but it still does have this code here. So
+ // we can use that without having to make up a solution ourselves.
+ if (g_sci->_gfxScreen && g_sci->_gfxScreen->gfxDriver()->supportsHiResGraphics())
+ g_sci->_gfxPaint16->redrawHiresCels();
+
return s->r_acc;
}
diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp
index 51731134c4f..1a3b101ed19 100644
--- a/engines/sci/graphics/paint16.cpp
+++ b/engines/sci/graphics/paint16.cpp
@@ -46,14 +46,36 @@ namespace Sci {
GfxPaint16::GfxPaint16(ResourceManager *resMan, SegManager *segMan, GfxCache *cache, GfxPorts *ports, GfxCoordAdjuster16 *coordAdjuster, GfxScreen *screen, GfxPalette *palette, GfxTransitions *transitions, AudioPlayer *audio)
: _resMan(resMan), _segMan(segMan), _cache(cache), _ports(ports),
_coordAdjuster(coordAdjuster), _screen(screen), _palette(palette),
- _transitions(transitions), _audio(audio), _EGAdrawingVisualize(false) {
+ _transitions(transitions), _audio(audio), _EGAdrawingVisualize(false),
+ _hiresDrawObjs(nullptr), _hiresPortraitWorkaroundFlag(false) {
// _animate and _text16 will be initialized later on
_animate = nullptr;
_text16 = nullptr;
}
+// The original KQ6WinCD interpreter saves the hires drawing information in a linked list. This is used to redraw the hires cels after disposing a window.
+struct HiresDrawData {
+ HiresDrawData(HiresDrawData *chain, reg_t hiresHandle, GuiResourceId id, int16 loop, int16 cel, uint16 left, uint16 top, uint16 pal, byte prio, bool needsWorkaround)
+ : handle(hiresHandle), viewId(id), lpNo(loop), celNo(cel), leftPos(left), topPos(top), palNo(pal), prio(prio), waFlag(needsWorkaround), prev(nullptr), next(chain) {
+ if (chain)
+ chain->prev = this;
+ }
+ reg_t handle;
+ GuiResourceId viewId;
+ int16 lpNo, celNo;
+ uint16 leftPos, topPos, palNo;
+ byte prio;
+ bool waFlag;
+ HiresDrawData *prev, *next;
+};
+
GfxPaint16::~GfxPaint16() {
+ while (_hiresDrawObjs) {
+ HiresDrawData *next = _hiresDrawObjs->next;
+ delete _hiresDrawObjs;
+ _hiresDrawObjs = next;
+ }
}
void GfxPaint16::init(GfxAnimate *animate, GfxText16 *text16) {
@@ -131,31 +153,41 @@ void GfxPaint16::drawCel(GfxView *view, int16 loopNo, int16 celNo, const Common:
view->drawScaled(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, scaleX, scaleY, scaleSignal);
}
-// This is used as replacement for drawCelAndShow() when hires-cels are drawn to
-// screen. Hires-cels are available only SCI 1.1+.
-void GfxPaint16::drawHiresCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, reg_t upscaledHiresHandle, uint16 scaleX, uint16 scaleY) {
+// This is used as replacement for drawCelAndShow() when hires cels are drawn to screen. Hires cels are available only in SCI 1.1.
+void GfxPaint16::drawHiresCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, reg_t hiresHandle, bool storeDrawingInfo) {
GfxView *view = _cache->getView(viewId);
if (!view)
return;
- byte *memoryPtr = _segMan->getHunkPointer(upscaledHiresHandle);
- if (!memoryPtr)
- error("drawHiresCelAndShow: Invalid hires handle");
-
- Common::Rect upscaledHiresRect;
- _screen->bitsGetRect(memoryPtr, &upscaledHiresRect);
- Common::Point topLeft(upscaledHiresRect.left, upscaledHiresRect.top);
- Common::Point bottomRight(upscaledHiresRect.right, upscaledHiresRect.bottom);
-
- topLeft = _screen->gfxDriver()->getRealCoords(topLeft);
- bottomRight = _screen->gfxDriver()->getRealCoords(bottomRight);
+ byte *memoryPtr = _segMan->getHunkPointer(hiresHandle);
+ if (!memoryPtr) {
+ // The original KQ6WinCD interpreter does not treat this as an error, it just skips the hires drawing. It happens all the time
+ // when attempting to redraw the hires cels from the _hiresDrawObjs chain. We're supposed to just skip the invalidated items.
+ return;
+ }
+ Common::Rect picRect;
+ _screen->bitsGetRect(memoryPtr, &picRect);
+ Common::Rect clipRect(makeHiresRect(picRect));
Common::Rect celRect(view->getWidth(loopNo, celNo), view->getHeight(loopNo, celNo));
- Common::Rect clipRect(topLeft.x, topLeft.y, bottomRight.x, bottomRight.y);
- celRect.translate(leftPos + topLeft.x, topPos + topLeft.y);
+ celRect.translate(leftPos + clipRect.left, topPos + clipRect.top);
clipRect.clip(celRect);
view->draw(celRect, clipRect, clipRect, loopNo, celNo, priority, paletteNo, true);
+
+ // The original KQ6WinCD interpreter saves the hires drawing information in a linked list. There are two use cases, one is redrawing the
+ // window background when receiving WM_PAINT messages (which is irrelevant for us, since that happens in the backend) and the other is
+ // redrawing the inventory after displaying a text window over it. This only happens in mixed speech+text mode, which does not even exist
+ // in the original. We do have that mode as a ScummVM feature, though. That's why we have that code, to be able to refresh the inventory.
+ // We also check if the portrait is drawn outside the viewport boundaries (happens in the unofficial mixed speech+text mode) and set
+ // a flag to trigger a workaround when restoring the background.
+ if (storeDrawingInfo)
+ _hiresDrawObjs = new HiresDrawData(_hiresDrawObjs, hiresHandle, viewId, loopNo, celNo, leftPos, topPos, paletteNo, priority, picRect.top < _ports->_curPort->top);
+}
+
+void GfxPaint16::redrawHiresCels() {
+ for (HiresDrawData *i = _hiresDrawObjs; i; i = i->next)
+ drawHiresCelAndShow(i->viewId, i->lpNo, i->celNo, i->leftPos, i->topPos, i->prio, i->palNo, i->handle, false);
}
void GfxPaint16::clearScreen(byte color) {
@@ -273,24 +305,24 @@ void GfxPaint16::frameRect(const Common::Rect &rect) {
void GfxPaint16::bitsShow(const Common::Rect &rect) {
Common::Rect workerRect(rect.left, rect.top, rect.right, rect.bottom);
- // WORKAROUND for vertically misplaced hires portraits in mixed speech/text mode in KQ6CD.
- // See comment for the _activeHiresGfx flag in GfxScreen. Another solution would be to
- // improve the script patches that implement the speech/text mode for better vertical
- // placement of the portrait frames (inside the port rect).
- bool needsOffsetRect = true;
- if (_screen->hasActiveHiresView() && rect.left < 0 && rect.top < 0) {
+ // WORKAROUND for vertically misplaced hires portraits in mixed speech+text mode in KQ6CD. The original interpreter
+ // did not have that mode, so the devs had no need to fix it. These portraits get drawn above the viewport top, where
+ // the engine would normally be unable to update the screen. We just have to offset the rect first, before clipping it,
+ // to make it work. Another solution would be to improve the script patches that implement the speech/text mode for
+ // better vertical placement of the portrait frames (inside the port rect).
+ bool triggeredWorkaround = false;;
+ if (rect.top < 0 && _hiresPortraitWorkaroundFlag) {
_ports->offsetRect(workerRect);
- _screen->toggleActiveHiresView(false);
- needsOffsetRect = false;
+ triggeredWorkaround = true;
+ _hiresPortraitWorkaroundFlag = false;
}
workerRect.clip(_ports->_curPort->rect);
if (workerRect.isEmpty()) // nothing to show
return;
- // WORKAROUND, see comment above. Normally, the call to
- // _ports->offsetRect(workerRect) would be unconditional here.
- if (needsOffsetRect || rect.left >= 0 || rect.top >= 0)
+ // WORKAROUND, see comment above. Normally, the call to _ports->offsetRect(workerRect) would be unconditional here.
+ if (!triggeredWorkaround)
_ports->offsetRect(workerRect);
// We adjust the left/right coordinates to even coordinates
@@ -344,6 +376,10 @@ void GfxPaint16::bitsRestore(reg_t memoryHandle) {
_screen->bitsRestore(memoryPtr);
bitsFree(memoryHandle);
}
+
+ // KQ6WinCD specific
+ if (_screen->gfxDriver()->supportsHiResGraphics())
+ removeHiresDrawObject(memoryHandle);
}
}
@@ -375,12 +411,12 @@ void GfxPaint16::kernelDrawPicture(GuiResourceId pictureId, int16 animationNr, b
_ports->setPort(oldPort);
}
-void GfxPaint16::kernelDrawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY, bool hiresMode, reg_t upscaledHiresHandle) {
+void GfxPaint16::kernelDrawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY, bool hiresMode, reg_t hiresHandle) {
// some calls are hiresMode even under kq6 DOS, that's why we check for hires caps here
if (!hiresMode || !_screen->gfxDriver()->supportsHiResGraphics()) {
drawCelAndShow(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo, scaleX, scaleY);
} else {
- drawHiresCelAndShow(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo, upscaledHiresHandle);
+ drawHiresCelAndShow(viewId, loopNo, celNo, leftPos, topPos, priority, paletteNo, hiresHandle, true);
}
}
@@ -619,4 +655,34 @@ void GfxPaint16::kernelPortraitShow(const Common::String &resourceName, Common::
void GfxPaint16::kernelPortraitUnload(uint16 portraitId) {
}
+void GfxPaint16::removeHiresDrawObject(reg_t handle) {
+ for (HiresDrawData *i = _hiresDrawObjs; i; i = i->next) {
+ if (i->handle != handle)
+ continue;
+
+ // WORKAROUND for vertically misplaced hires portraits in mixed speech+text mode in KQ6CD. If we have
+ // an entry which is flagged as needing a workaround, we set the notification for bitsShow() here.
+ _hiresPortraitWorkaroundFlag = i->waFlag;
+
+ // Unlink and delete entry
+ if (i->next)
+ i->next->prev = i->prev;
+ if (i->prev)
+ i->prev->next = i->next;
+ else
+ _hiresDrawObjs = i->next;
+ delete i;
+
+ return;
+ }
+}
+
+Common::Rect GfxPaint16::makeHiresRect(Common::Rect &rect) const {
+ Common::Point topLeft(rect.left, rect.top);
+ Common::Point bottomRight(rect.right, rect.bottom);
+ topLeft = _screen->gfxDriver()->getRealCoords(topLeft);
+ bottomRight = _screen->gfxDriver()->getRealCoords(bottomRight);
+ return Common::Rect(topLeft.x, topLeft.y, bottomRight.x, bottomRight.y);
+}
+
} // End of namespace Sci
diff --git a/engines/sci/graphics/paint16.h b/engines/sci/graphics/paint16.h
index c5da5f15ebd..115fb89809c 100644
--- a/engines/sci/graphics/paint16.h
+++ b/engines/sci/graphics/paint16.h
@@ -29,6 +29,7 @@ class GfxScreen;
class GfxPalette;
class Font;
class GfxView;
+struct HiresDrawData;
/**
* Paint16 class, handles painting/drawing for SCI16 (SCI0-SCI1.1) games
@@ -46,7 +47,8 @@ public:
void drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128, uint16 scaleSignal = 0);
void drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, const Common::Rect &celRect, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128, uint16 scaleSignal = 0);
void drawCel(GfxView *view, int16 loopNo, int16 celNo, const Common::Rect &celRect, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128, uint16 scaleSignal = 0);
- 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);
+ void drawHiresCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, reg_t hiresHandle, bool storeDrawingInfo);
+ void redrawHiresCels();
void clearScreen(byte color = 255);
void invertRect(const Common::Rect &rect);
@@ -63,7 +65,7 @@ public:
void bitsFree(reg_t memoryHandle);
void kernelDrawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo);
- void kernelDrawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY, bool hiresMode, reg_t upscaledHiresHandle);
+ void kernelDrawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY, bool hiresMode, reg_t hiresHandle);
void kernelGraphFillBoxForeground(const Common::Rect &rect);
void kernelGraphFillBoxBackground(const Common::Rect &rect);
@@ -96,6 +98,16 @@ private:
// true means make EGA picture drawing visible
bool _EGAdrawingVisualize;
+
+ // The original KQ6WinCD interpreter saves the hires drawing information in a linked list. There are two use cases: one is redrawing the
+ // window background when receiving WM_PAINT messages (which is irrelevant for us, since that happens in the backend) and the other is
+ // redrawing the inventory after displaying a text window over it. This only happens in mixed speech+text mode, which does not even exist
+ // in the original. We do have that mode as a ScummVM feature, though. That's why we have that code, to be able to refresh the inventory.
+ void removeHiresDrawObject(reg_t handle);
+ Common::Rect makeHiresRect(Common::Rect &rect) const;
+
+ HiresDrawData *_hiresDrawObjs;
+ bool _hiresPortraitWorkaroundFlag;
};
} // End of namespace Sci
diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp
index a4ba268f020..672b993e688 100644
--- a/engines/sci/graphics/screen.cpp
+++ b/engines/sci/graphics/screen.cpp
@@ -38,7 +38,7 @@
namespace Sci {
-GfxScreen::GfxScreen(ResourceManager *resMan, Common::RenderMode renderMode) : _resMan(resMan), _hiresGlyphBuffer(nullptr), _activeHiresView(false) {
+GfxScreen::GfxScreen(ResourceManager *resMan, Common::RenderMode renderMode) : _resMan(resMan), _hiresGlyphBuffer(nullptr) {
// Scale the screen, if needed
_upscaledHires = GFX_SCREEN_UPSCALED_DISABLED;
@@ -350,7 +350,6 @@ void GfxScreen::copyHiResRectToScreen(const byte *srcBuffer, int pitch, int x, i
_gfxDrv->setColorMap(colorMap);
_gfxDrv->copyRectToScreen(srcBuffer, 0, 0, pitch, x, y, w, h, nullptr, nullptr);
_gfxDrv->clearFlags(GfxDriver::kHiResMode);
- toggleActiveHiresView(true);
}
void GfxScreen::copyRectToScreen(const Common::Rect &rect, int16 x, int16 y) {
diff --git a/engines/sci/graphics/screen.h b/engines/sci/graphics/screen.h
index 733de9ef83a..eaed025a3c2 100644
--- a/engines/sci/graphics/screen.h
+++ b/engines/sci/graphics/screen.h
@@ -232,18 +232,6 @@ private:
*/
GfxScreenUpscaledMode _upscaledHires;
- /**
- * This flag is part of a hack to properly remove hires graphics from the screen
- * when mixed speech/text mode is enabled. Sometimes the portrait is drawn
- * out of bounds of the window/view port rect, so GfxPaint16::bitsShow() will
- * not be able to refresh that part of the screen.
- * The mixed speech/text is a mode that wasn't part of the original game, so
- * there wasn't any need for Sierra to fix it. The mode has been added to ScummVM
- * via complex script patches. Another solution would be to update these patches
- * with better y-coordinates (inside the port rect)...
- */
- bool _activeHiresView;
-
/**
* This buffer is used to draw a single hires font glyph.
*/
@@ -474,9 +462,6 @@ public:
break;
}
}
-
- bool hasActiveHiresView() const { return _activeHiresView; }
- void toggleActiveHiresView(bool toggle) { _activeHiresView = toggle; }
};
} // End of namespace Sci
Commit: 66b332c709fdfcb8d2c9d3f0efdc0ced5bac0024
https://github.com/scummvm/scummvm/commit/66b332c709fdfcb8d2c9d3f0efdc0ced5bac0024
Author: athrxx (athrxx at scummvm.org)
Date: 2025-04-25T20:57:23+02:00
Commit Message:
SCI: fix bug caused by PR 6319
I made a mistake in that PR by assuming that the
handles for the hires graphics would be unique. So
when removing an object from the drawing chain
I really only removed the first object. But in reality
they often have the same handle and the original
interpreter continues to go over the loop until all
of the same handle have been removed.
Also, the original checks for already existent draw
objects with the same x/y-coordinates.
Changed paths:
engines/sci/graphics/paint16.cpp
engines/sci/graphics/paint16.h
diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp
index 1a3b101ed19..266d8d9c1ac 100644
--- a/engines/sci/graphics/paint16.cpp
+++ b/engines/sci/graphics/paint16.cpp
@@ -181,7 +181,7 @@ void GfxPaint16::drawHiresCelAndShow(GuiResourceId viewId, int16 loopNo, int16 c
// in the original. We do have that mode as a ScummVM feature, though. That's why we have that code, to be able to refresh the inventory.
// We also check if the portrait is drawn outside the viewport boundaries (happens in the unofficial mixed speech+text mode) and set
// a flag to trigger a workaround when restoring the background.
- if (storeDrawingInfo)
+ if (storeDrawingInfo && !hasHiresDrawObjectAt(leftPos, topPos))
_hiresDrawObjs = new HiresDrawData(_hiresDrawObjs, hiresHandle, viewId, loopNo, celNo, leftPos, topPos, paletteNo, priority, picRect.top < _ports->_curPort->top);
}
@@ -656,13 +656,17 @@ void GfxPaint16::kernelPortraitUnload(uint16 portraitId) {
}
void GfxPaint16::removeHiresDrawObject(reg_t handle) {
- for (HiresDrawData *i = _hiresDrawObjs; i; i = i->next) {
- if (i->handle != handle)
+ for (HiresDrawData *i = _hiresDrawObjs; i; ) {
+ HiresDrawData *next = i->next;
+ if (i->handle != handle) {
+ i = next;
continue;
+ }
// WORKAROUND for vertically misplaced hires portraits in mixed speech+text mode in KQ6CD. If we have
// an entry which is flagged as needing a workaround, we set the notification for bitsShow() here.
- _hiresPortraitWorkaroundFlag = i->waFlag;
+ if (i->waFlag)
+ _hiresPortraitWorkaroundFlag = true;
// Unlink and delete entry
if (i->next)
@@ -673,8 +677,16 @@ void GfxPaint16::removeHiresDrawObject(reg_t handle) {
_hiresDrawObjs = i->next;
delete i;
- return;
+ i = next;
+ }
+}
+
+bool GfxPaint16::hasHiresDrawObjectAt(uint16 x, uint16 y) const {
+ for (HiresDrawData *i = _hiresDrawObjs; i; i = i->next) {
+ if (i->leftPos == x && i->topPos == y)
+ return true;
}
+ return false;
}
Common::Rect GfxPaint16::makeHiresRect(Common::Rect &rect) const {
diff --git a/engines/sci/graphics/paint16.h b/engines/sci/graphics/paint16.h
index 115fb89809c..d2421f0be21 100644
--- a/engines/sci/graphics/paint16.h
+++ b/engines/sci/graphics/paint16.h
@@ -104,6 +104,7 @@ private:
// redrawing the inventory after displaying a text window over it. This only happens in mixed speech+text mode, which does not even exist
// in the original. We do have that mode as a ScummVM feature, though. That's why we have that code, to be able to refresh the inventory.
void removeHiresDrawObject(reg_t handle);
+ bool hasHiresDrawObjectAt(uint16 x, uint16 y) const;
Common::Rect makeHiresRect(Common::Rect &rect) const;
HiresDrawData *_hiresDrawObjs;
More information about the Scummvm-git-logs
mailing list