aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics
diff options
context:
space:
mode:
authorMatthew Hoops2012-05-25 00:21:51 -0400
committerMatthew Hoops2012-05-25 00:35:38 -0400
commitf1f6a82cd57fceb52afdd393f44a80c40f3c9a15 (patch)
tree06a04072df44bd5f337ff79b43684d8109a72f59 /engines/sci/graphics
parentb2506abccf6aa64da31b497b45fe0e1949530053 (diff)
parentbeef27fc10bb714fe37f2ee0c35cd143dc706829 (diff)
downloadscummvm-rg350-f1f6a82cd57fceb52afdd393f44a80c40f3c9a15.tar.gz
scummvm-rg350-f1f6a82cd57fceb52afdd393f44a80c40f3c9a15.tar.bz2
scummvm-rg350-f1f6a82cd57fceb52afdd393f44a80c40f3c9a15.zip
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'engines/sci/graphics')
-rw-r--r--engines/sci/graphics/frameout.cpp61
-rw-r--r--engines/sci/graphics/frameout.h3
-rw-r--r--engines/sci/graphics/text32.cpp7
-rw-r--r--engines/sci/graphics/view.cpp13
4 files changed, 82 insertions, 2 deletions
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index b12413ab69..709a708d8b 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -31,6 +31,7 @@
#include "graphics/surface.h"
#include "sci/sci.h"
+#include "sci/console.h"
#include "sci/engine/kernel.h"
#include "sci/engine/state.h"
#include "sci/engine/selector.h"
@@ -237,6 +238,7 @@ void GfxFrameout::kernelAddScreenItem(reg_t object) {
memset(itemEntry, 0, sizeof(FrameoutEntry));
itemEntry->object = object;
itemEntry->givenOrderNr = _screenItems.size();
+ itemEntry->visible = true;
_screenItems.push_back(itemEntry);
kernelUpdateScreenItem(object);
@@ -266,6 +268,11 @@ void GfxFrameout::kernelUpdateScreenItem(reg_t object) {
itemEntry->signal = readSelectorValue(_segMan, object, SELECTOR(signal));
itemEntry->scaleX = readSelectorValue(_segMan, object, SELECTOR(scaleX));
itemEntry->scaleY = readSelectorValue(_segMan, object, SELECTOR(scaleY));
+ itemEntry->visible = true;
+
+ // Check if the entry can be hidden
+ if (lookupSelector(_segMan, object, SELECTOR(visible), NULL, NULL) != kSelectorNone)
+ itemEntry->visible = readSelectorValue(_segMan, object, SELECTOR(visible));
}
void GfxFrameout::kernelDeleteScreenItem(reg_t object) {
@@ -433,6 +440,7 @@ void GfxFrameout::createPlaneItemList(reg_t planeObject, FrameoutList &itemList)
picEntry->x = planePicture->getSci32celX(pictureCelNr);
picEntry->picStartX = pictureIt->startX;
picEntry->picStartY = pictureIt->startY;
+ picEntry->visible = true;
picEntry->priority = planePicture->getSci32celPriority(pictureCelNr);
@@ -541,6 +549,9 @@ void GfxFrameout::kernelFrameout() {
for (FrameoutList::iterator listIterator = itemList.begin(); listIterator != itemList.end(); listIterator++) {
FrameoutEntry *itemEntry = *listIterator;
+ if (!itemEntry->visible)
+ continue;
+
if (itemEntry->object.isNull()) {
// Picture cel data
itemEntry->x = upscaleHorizontalCoordinate(itemEntry->x);
@@ -667,4 +678,54 @@ void GfxFrameout::kernelFrameout() {
g_sci->getEngineState()->_throttleTrigger = true;
}
+void GfxFrameout::printPlaneList(Console *con) {
+ for (PlaneList::const_iterator it = _planes.begin(); it != _planes.end(); ++it) {
+ PlaneEntry p = *it;
+ Common::String curPlaneName = _segMan->getObjectName(p.object);
+ Common::Rect r = p.upscaledPlaneRect;
+ Common::Rect cr = p.upscaledPlaneClipRect;
+
+ con->DebugPrintf("%04x:%04x (%s): prio %d, lastprio %d, offsetX %d, offsetY %d, pic %d, mirror %d, back %d\n",
+ PRINT_REG(p.object), curPlaneName.c_str(),
+ (int16)p.priority, (int16)p.lastPriority,
+ p.planeOffsetX, p.planeOffsetY, p.pictureId,
+ p.planePictureMirrored, p.planeBack);
+ con->DebugPrintf(" rect: (%d, %d, %d, %d), clip rect: (%d, %d, %d, %d)\n",
+ r.left, r.top, r.right, r.bottom,
+ cr.left, cr.top, cr.right, cr.bottom);
+
+ if (p.pictureId != 0xffff && p.pictureId != 0xfffe) {
+ con->DebugPrintf("Pictures:\n");
+
+ for (PlanePictureList::iterator pictureIt = _planePictures.begin(); pictureIt != _planePictures.end(); pictureIt++) {
+ if (pictureIt->object == p.object) {
+ con->DebugPrintf(" Picture %d: x %d, y %d\n", pictureIt->pictureId, pictureIt->startX, pictureIt->startY);
+ }
+ }
+ }
+ }
+}
+
+void GfxFrameout::printPlaneItemList(Console *con, reg_t planeObject) {
+ for (FrameoutList::iterator listIterator = _screenItems.begin(); listIterator != _screenItems.end(); listIterator++) {
+ FrameoutEntry *e = *listIterator;
+ reg_t itemPlane = readSelector(_segMan, e->object, SELECTOR(plane));
+
+ if (planeObject == itemPlane) {
+ Common::String curItemName = _segMan->getObjectName(e->object);
+ Common::Rect icr = e->celRect;
+ GuiResourceId picId = e->picture ? e->picture->getResourceId() : 0;
+
+ con->DebugPrintf("%d: %04x:%04x (%s), view %d, loop %d, cel %d, x %d, y %d, z %d, "
+ "signal %d, scale signal %d, scaleX %d, scaleY %d, rect (%d, %d, %d, %d), "
+ "pic %d, picX %d, picY %d, visible %d\n",
+ e->givenOrderNr, PRINT_REG(e->object), curItemName.c_str(),
+ e->viewId, e->loopNo, e->celNo, e->x, e->y, e->z,
+ e->signal, e->scaleSignal, e->scaleX, e->scaleY,
+ icr.left, icr.top, icr.right, icr.bottom,
+ picId, e->picStartX, e->picStartY, e->visible);
+ }
+ }
+}
+
} // End of namespace Sci
diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h
index 8c3cc261d5..ec4de62c0a 100644
--- a/engines/sci/graphics/frameout.h
+++ b/engines/sci/graphics/frameout.h
@@ -60,6 +60,7 @@ struct FrameoutEntry {
GfxPicture *picture;
int16 picStartX;
int16 picStartY;
+ bool visible;
};
typedef Common::List<FrameoutEntry *> FrameoutList;
@@ -103,6 +104,8 @@ public:
void addPlanePicture(reg_t object, GuiResourceId pictureId, uint16 startX, uint16 startY = 0);
void deletePlanePictures(reg_t object);
void clear();
+ void printPlaneList(Console *con);
+ void printPlaneItemList(Console *con, reg_t planeObject);
private:
void showVideo();
diff --git a/engines/sci/graphics/text32.cpp b/engines/sci/graphics/text32.cpp
index 7894c7109c..cd24ca5a99 100644
--- a/engines/sci/graphics/text32.cpp
+++ b/engines/sci/graphics/text32.cpp
@@ -187,8 +187,11 @@ void GfxText32::drawTextBitmap(int16 x, int16 y, Common::Rect planeRect, reg_t t
byte *memoryPtr = _segMan->getHunkPointer(hunkId);
- if (!memoryPtr)
- error("Attempt to draw an invalid text bitmap");
+ if (!memoryPtr) {
+ // Happens when restoring in some SCI32 games
+ warning("Attempt to draw an invalid text bitmap");
+ return;
+ }
byte *surface = memoryPtr + BITMAP_HEADER_SIZE;
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index a77bcccc52..4e5c4da8b2 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -720,6 +720,19 @@ void GfxView::draw(const Common::Rect &rect, const Common::Rect &clipRect, const
bitmap += (clipRect.top - rect.top) * celWidth + (clipRect.left - rect.left);
+ // WORKAROUND: EcoQuest French and German draw the fish and anemone sprites
+ // with priority 15 in scene 440. Afterwards, a dialog is shown on top of
+ // these sprites with priority 15 as well. This is undefined behavior
+ // actually, as the sprites and dialog share the same priority, so in our
+ // implementation the sprites get drawn incorrectly on top of the dialog.
+ // Perhaps this worked by mistake in SSCI because of subtle differences in
+ // how sprites are drawn. We compensate for this by resetting the priority
+ // of all sprites that have a priority of 15 in scene 440 to priority 14,
+ // so that the speech bubble can be drawn correctly on top of them. Fixes
+ // bug #3040625.
+ if (g_sci->getGameId() == GID_ECOQUEST && g_sci->getEngineState()->currentRoomNumber() == 440 && priority == 15)
+ priority = 14;
+
if (!_EGAmapping) {
for (y = 0; y < height; y++, bitmap += celWidth) {
for (x = 0; x < width; x++) {