[Scummvm-git-logs] scummvm master -> 2eadb3e92463c997c2ad81537db429ee063ad92e
csnover
csnover at users.noreply.github.com
Mon Dec 19 21:49:12 CET 2016
This automated email contains information about 8 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
20c211192d SCI32: Add segment table debugging info for SCI32 arrays
a238f720db SCI32: Fix nitpicky output errors in SCI32 bitmap debugging
6412b32386 SCI32: Fix incorrect parsing of empty |f| text escape code
ba619a08dd SCI32: Change plane and screen item sorting algorithm
4f7173b137 SCI32: Generalize Phant1 kArraySetElements workaround
5220ce1e4f SCI32: Undefine macro for SciBitmap when it is done being used
4cff1e400f SCI32: Add support for alternate graphics selectors
2eadb3e924 SCI32: Improve ScreenItem missing resource error
Commit: 20c211192dcdff42189cc6c3fbe948beb65c1e8e
https://github.com/scummvm/scummvm/commit/20c211192dcdff42189cc6c3fbe948beb65c1e8e
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-19T12:47:48-06:00
Commit Message:
SCI32: Add segment table debugging info for SCI32 arrays
Changed paths:
engines/sci/console.cpp
engines/sci/engine/segment.h
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 63a1f0c..412dfaf 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -2213,9 +2213,16 @@ bool Console::segmentInfo(int nr) {
break;
#ifdef ENABLE_SCI32
- case SEG_TYPE_ARRAY:
+ case SEG_TYPE_ARRAY: {
+ ArrayTable &table = *(ArrayTable *)mobj;
debugPrintf("SCI32 arrays\n");
+ for (uint i = 0; i < table.size(); ++i) {
+ if (table.isValidEntry(i)) {
+ debugPrintf(" [%04x] %s\n", i, table[i].toDebugString().c_str());
+ }
+ }
break;
+ }
case SEG_TYPE_BITMAP: {
BitmapTable &table = *(BitmapTable *)mobj;
diff --git a/engines/sci/engine/segment.h b/engines/sci/engine/segment.h
index 7c415f3..dda0189 100644
--- a/engines/sci/engine/segment.h
+++ b/engines/sci/engine/segment.h
@@ -855,6 +855,29 @@ public:
Common::strlcpy((char *)_data, string.c_str(), string.size() + 1);
}
+ Common::String toDebugString() const {
+ const char *type;
+ switch(_type) {
+ case kArrayTypeID:
+ type = "reg_t";
+ break;
+ case kArrayTypeByte:
+ type = "byte";
+ break;
+ case kArrayTypeInt16:
+ type = "int16";
+ break;
+ case kArrayTypeString:
+ type = "string";
+ break;
+ case kArrayTypeInvalid:
+ type = "invalid";
+ break;
+ }
+
+ return Common::String::format("type %s; %u entries; %u bytes", type, size(), byteSize());
+ }
+
protected:
void *_data;
SciArrayType _type;
Commit: a238f720db9f3b6b2122be84d851eafde8efcd99
https://github.com/scummvm/scummvm/commit/a238f720db9f3b6b2122be84d851eafde8efcd99
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-19T13:56:37-06:00
Commit Message:
SCI32: Fix nitpicky output errors in SCI32 bitmap debugging
Changed paths:
engines/sci/console.cpp
engines/sci/engine/segment.h
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 412dfaf..f1bb8d3 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -2229,7 +2229,7 @@ bool Console::segmentInfo(int nr) {
debugPrintf("SCI32 bitmaps (total %d)\n", table.entries_used);
for (uint i = 0; i < table.size(); ++i) {
if (table.isValidEntry(i)) {
- debugPrintf(" [%04x] %s", i, table[i].toString().c_str());
+ debugPrintf(" [%04x] %s\n", i, table[i].toString().c_str());
}
}
break;
diff --git a/engines/sci/engine/segment.h b/engines/sci/engine/segment.h
index dda0189..98a3969 100644
--- a/engines/sci/engine/segment.h
+++ b/engines/sci/engine/segment.h
@@ -1161,7 +1161,7 @@ public:
}
Common::String toString() const {
- return Common::String::format("%dx%d; res %dx%d; origin %dx%d; skip color %u; %s; %s):\n",
+ return Common::String::format("%dx%d; res %dx%d; origin %dx%d; skip color %u; %s; %s)",
getWidth(), getHeight(),
getXResolution(), getYResolution(),
getOrigin().x, getOrigin().y,
Commit: 6412b323860e9eb351efd46c57ea65ebd56b2823
https://github.com/scummvm/scummvm/commit/6412b323860e9eb351efd46c57ea65ebd56b2823
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-19T14:46:46-06:00
Commit Message:
SCI32: Fix incorrect parsing of empty |f| text escape code
This sequence is used in Hoyle5 when viewing the rules for a game.
Changed paths:
engines/sci/graphics/text32.cpp
diff --git a/engines/sci/graphics/text32.cpp b/engines/sci/graphics/text32.cpp
index 7375fde..181dabc 100644
--- a/engines/sci/graphics/text32.cpp
+++ b/engines/sci/graphics/text32.cpp
@@ -505,12 +505,12 @@ int16 GfxText32::getTextWidth(const uint index, uint length) const {
if (length > 0 && currentChar == 'f') {
GuiResourceId fontId = 0;
- do {
+ while (length > 0 && *text >= '0' && *text <= '9') {
currentChar = *text++;
--length;
fontId = fontId * 10 + currentChar - '0';
- } while (length > 0 && *text >= '0' && *text <= '9');
+ }
if (length > 0) {
font = _cache->getFont(fontId);
Commit: ba619a08dd5a2076c361155690736043f01b4703
https://github.com/scummvm/scummvm/commit/ba619a08dd5a2076c361155690736043f01b4703
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-19T14:46:58-06:00
Commit Message:
SCI32: Change plane and screen item sorting algorithm
SSCI's last resort comparison here was to compare the object IDs
of planes & screen items, but this randomly breaks (at least) the
"you have died" dialog at the end of Phant1, and text & buttons
in Hoyle5, even in SSCI itself.
This commit changes last resort comparison to use a monotonically
increasing ID instead, which keeps objects with identical priority
& z-index in creation order when compared.
Fixes Trac#9585.
Changed paths:
engines/sci/graphics/plane32.cpp
engines/sci/graphics/plane32.h
engines/sci/graphics/screen_item32.cpp
engines/sci/graphics/screen_item32.h
diff --git a/engines/sci/graphics/plane32.cpp b/engines/sci/graphics/plane32.cpp
index f56df4d..4662226 100644
--- a/engines/sci/graphics/plane32.cpp
+++ b/engines/sci/graphics/plane32.cpp
@@ -44,8 +44,10 @@ void DrawList::add(ScreenItem *screenItem, const Common::Rect &rect) {
#pragma mark -
#pragma mark Plane
uint16 Plane::_nextObjectId = 20000;
+uint32 Plane::_nextCreationId = 0;
Plane::Plane(const Common::Rect &gameRect, PlanePictureCodes pictureId) :
+_creationId(_nextCreationId++),
_pictureId(pictureId),
_mirrored(false),
_type(kPlaneTypeColored),
@@ -65,6 +67,7 @@ _gameRect(gameRect) {
}
Plane::Plane(reg_t object) :
+_creationId(_nextCreationId++),
_type(kPlaneTypeColored),
_priorityChanged(false),
_object(object),
@@ -94,6 +97,7 @@ _moved(0) {
}
Plane::Plane(const Plane &other) :
+_creationId(other._creationId),
_pictureId(other._pictureId),
_mirrored(other._mirrored),
_type(other._type),
@@ -106,6 +110,7 @@ _screenRect(other._screenRect),
_screenItemList(other._screenItemList) {}
void Plane::operator=(const Plane &other) {
+ _creationId = other._creationId;
_gameRect = other._gameRect;
_planeRect = other._planeRect;
_vanishingPoint = other._vanishingPoint;
@@ -120,6 +125,7 @@ void Plane::operator=(const Plane &other) {
void Plane::init() {
_nextObjectId = 20000;
+ _nextCreationId = 0;
}
void Plane::convertGameRectToPlaneRect() {
@@ -144,11 +150,12 @@ void Plane::printDebugInfo(Console *con) const {
name = g_sci->getEngineState()->_segMan->getObjectName(_object);
}
- con->debugPrintf("%04x:%04x (%s): type %d, prio %d, pic %d, mirror %d, back %d\n",
+ con->debugPrintf("%04x:%04x (%s): type %d, prio %d, ins %u, pic %d, mirror %d, back %d\n",
PRINT_REG(_object),
name.c_str(),
_type,
_priority,
+ _creationId,
_pictureId,
_mirrored,
_back
@@ -508,7 +515,7 @@ void Plane::calcLists(Plane &visiblePlane, const PlaneList &planeList, DrawList
const ScreenItem *drawnItem = drawListEntry->screenItem;
if (
- (newItem->_priority > drawnItem->_priority || (newItem->_priority == drawnItem->_priority && newItem->_object > drawnItem->_object)) &&
+ (newItem->_priority > drawnItem->_priority || (newItem->_priority == drawnItem->_priority && newItem->_creationId > drawnItem->_creationId)) &&
drawListEntry->rect.intersects(newItem->_screenRect)
) {
mergeToDrawList(j, drawListEntry->rect.findIntersectingRect(newItem->_screenRect), drawList);
diff --git a/engines/sci/graphics/plane32.h b/engines/sci/graphics/plane32.h
index 964d20c..a34df1c 100644
--- a/engines/sci/graphics/plane32.h
+++ b/engines/sci/graphics/plane32.h
@@ -110,6 +110,20 @@ private:
static uint16 _nextObjectId;
/**
+ * A serial used to identify the creation order of
+ * planes, to ensure a stable sort order for planes
+ * with identical priorities.
+ */
+ static uint32 _nextCreationId;
+
+ /**
+ * The creation order number, which ensures a stable
+ * sort when planes with identical priorities are added
+ * to the plane list.
+ */
+ uint32 _creationId;
+
+ /**
* For planes that are used to render picture data, the
* resource ID of the picture to be displayed. This
* value may also be one of the special
@@ -261,7 +275,9 @@ public:
}
if (_priority == other._priority) {
- return _object < other._object;
+ // This is different than SSCI; see ScreenItem::operator< for an
+ // explanation
+ return _creationId < other._creationId;
}
return false;
diff --git a/engines/sci/graphics/screen_item32.cpp b/engines/sci/graphics/screen_item32.cpp
index 9b0d390..a70f25f 100644
--- a/engines/sci/graphics/screen_item32.cpp
+++ b/engines/sci/graphics/screen_item32.cpp
@@ -34,8 +34,10 @@ namespace Sci {
#pragma mark ScreenItem
uint16 ScreenItem::_nextObjectId = 20000;
+uint32 ScreenItem::_nextCreationId = 0;
ScreenItem::ScreenItem(const reg_t object) :
+_creationId(_nextCreationId++),
_celObj(nullptr),
_object(object),
_pictureId(-1),
@@ -51,6 +53,7 @@ _drawBlackLines(false) {
}
ScreenItem::ScreenItem(const reg_t plane, const CelInfo32 &celInfo) :
+_creationId(_nextCreationId++),
_plane(plane),
_useInsetRect(false),
_z(0),
@@ -67,6 +70,7 @@ _mirrorX(false),
_drawBlackLines(false) {}
ScreenItem::ScreenItem(const reg_t plane, const CelInfo32 &celInfo, const Common::Rect &rect) :
+_creationId(_nextCreationId++),
_plane(plane),
_useInsetRect(false),
_z(0),
@@ -87,6 +91,7 @@ _drawBlackLines(false) {
}
ScreenItem::ScreenItem(const reg_t plane, const CelInfo32 &celInfo, const Common::Point &position, const ScaleInfo &scaleInfo) :
+_creationId(_nextCreationId++),
_plane(plane),
_scale(scaleInfo),
_useInsetRect(false),
@@ -104,6 +109,7 @@ _mirrorX(false),
_drawBlackLines(false) {}
ScreenItem::ScreenItem(const ScreenItem &other) :
+_creationId(other._creationId),
_plane(other._plane),
_scale(other._scale),
_useInsetRect(other._useInsetRect),
@@ -131,6 +137,7 @@ void ScreenItem::operator=(const ScreenItem &other) {
_celObj = nullptr;
}
+ _creationId = other._creationId;
_screenRect = other._screenRect;
_mirrorX = other._mirrorX;
_useInsetRect = other._useInsetRect;
@@ -148,6 +155,7 @@ ScreenItem::~ScreenItem() {
void ScreenItem::init() {
_nextObjectId = 20000;
+ _nextCreationId = 0;
}
void ScreenItem::setFromObject(SegManager *segMan, const reg_t object, const bool updateCel, const bool updateBitmap) {
@@ -476,10 +484,11 @@ CelObj &ScreenItem::getCelObj() const {
}
void ScreenItem::printDebugInfo(Console *con) const {
- con->debugPrintf("%04x:%04x (%s), prio %d, x %d, y %d, z: %d, scaledX: %d, scaledY: %d flags: %d\n",
+ con->debugPrintf("%04x:%04x (%s), prio %d, ins %u, x %d, y %d, z: %d, scaledX: %d, scaledY: %d flags: %d\n",
_object.getSegment(), _object.getOffset(),
g_sci->getEngineState()->_segMan->getObjectName(_object),
_priority,
+ _creationId,
_position.x,
_position.y,
_z,
diff --git a/engines/sci/graphics/screen_item32.h b/engines/sci/graphics/screen_item32.h
index 009b608..c2c4e43 100644
--- a/engines/sci/graphics/screen_item32.h
+++ b/engines/sci/graphics/screen_item32.h
@@ -61,6 +61,13 @@ private:
*/
static uint16 _nextObjectId;
+ /**
+ * A serial used to identify the creation order of
+ * screen items, to ensure a stable sort order for
+ * screen items with identical priorities and z-indexes.
+ */
+ static uint32 _nextCreationId;
+
public:
/**
* The parent plane of this screen item.
@@ -120,6 +127,13 @@ private:
public:
/**
+ * The creation order number, which ensures a stable
+ * sort when screen items with identical priorities and
+ * z-indexes are added to the screen item list.
+ */
+ uint32 _creationId;
+
+ /**
* A descriptor for the cel object represented by the
* screen item.
*/
@@ -242,7 +256,26 @@ public:
}
if (_position.y + _z == other._position.y + other._z) {
- return _object < other._object;
+ // SSCI's last resort comparison here is to compare the _object
+ // IDs, but this is wrong and randomly breaks (at least):
+ //
+ // (1) the death dialog at the end of Phant1, where the ID of
+ // the text is often higher than the ID of the border;
+ // (2) text-based buttons and dialogues in Hoyle5, where the ID
+ // of the text is often lower than the ID of the
+ // button/dialogue background.
+ //
+ // This occurs because object IDs (in both ScummVM and SSCI) are
+ // reused, so objects created later may receive a lower ID,
+ // which makes them sort lower when the programmer intended them
+ // to sort higher.
+ //
+ // To fix this problem, we give each ScreenItem a monotonically
+ // increasing insertion ID at construction time, and compare
+ // these insertion IDs instead. They are more stable and cause
+ // objects with identical priority and z-index to be rendered in
+ // the order that they were created.
+ return _creationId < other._creationId;
}
}
@@ -260,7 +293,9 @@ public:
}
if (_position.y + _z == other._position.y + other._z) {
- return _object > other._object;
+ // This is different than SSCI; see ScreenItem::operator< for an
+ // explanation
+ return _creationId > other._creationId;
}
}
Commit: 4f7173b13744fd15ed7677aad4785779b80cb5eb
https://github.com/scummvm/scummvm/commit/4f7173b13744fd15ed7677aad4785779b80cb5eb
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-19T14:46:59-06:00
Commit Message:
SCI32: Generalize Phant1 kArraySetElements workaround
This bug exists in a system script that is called from many, many
rooms, so it is simpler to just make the workaround apply to all
rooms.
Changed paths:
engines/sci/engine/workarounds.cpp
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 68243d1..ed3c604 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -421,8 +421,7 @@ const SciWorkaroundEntry kAbs_workarounds[] = {
// gameID, room,script,lvl, object-name, method-name, local-call-signature, index, workaround
const SciWorkaroundEntry kArraySetElements_workarounds[] = {
{ GID_GK1, 302, 64918, 0, "Str", "callKernel", NULL, 0, { WORKAROUND_FAKE, 0 } }, // when erasing a letter on the wall in St Louis Cemetery
- { GID_PHANTASMAGORIA,902, 64918, 0, "Str", "callKernel", NULL, 0, { WORKAROUND_FAKE, 0 } }, // when starting a new game and selecting a chapter above 1
- { GID_PHANTASMAGORIA,47480, 64918,0, "Str", "callKernel", NULL, 0, { WORKAROUND_FAKE, 0 } }, // after completing the chase successfully
+ { GID_PHANTASMAGORIA, -1, 64918, 0, "Str", "callKernel", NULL, 0, { WORKAROUND_FAKE, 0 } }, // when starting a new game and selecting a chapter above 1, or when quitting the chase (in every chase room), or when completing chase successfully
SCI_WORKAROUNDENTRY_TERMINATOR
};
Commit: 5220ce1e4f9090d0e6272d680dbfa3813233399b
https://github.com/scummvm/scummvm/commit/5220ce1e4f9090d0e6272d680dbfa3813233399b
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-19T14:46:59-06:00
Commit Message:
SCI32: Undefine macro for SciBitmap when it is done being used
Changed paths:
engines/sci/engine/segment.h
diff --git a/engines/sci/engine/segment.h b/engines/sci/engine/segment.h
index 98a3969..c5295c5 100644
--- a/engines/sci/engine/segment.h
+++ b/engines/sci/engine/segment.h
@@ -1171,6 +1171,8 @@ public:
}
};
+#undef BITMAP_PROPERTY
+
struct BitmapTable : public SegmentObjTable<SciBitmap> {
BitmapTable() : SegmentObjTable<SciBitmap>(SEG_TYPE_BITMAP) {}
Commit: 4cff1e400f7e1e885b12990a5a34772d05eb2285
https://github.com/scummvm/scummvm/commit/4cff1e400f7e1e885b12990a5a34772d05eb2285
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-19T14:46:59-06:00
Commit Message:
SCI32: Add support for alternate graphics selectors
Used by at least Phantasmagoria 2.
Changed paths:
engines/sci/engine/features.h
engines/sci/engine/kgraphics32.cpp
engines/sci/engine/selector.cpp
engines/sci/engine/selector.h
engines/sci/graphics/celobj32.cpp
engines/sci/graphics/frameout.cpp
engines/sci/graphics/plane32.cpp
engines/sci/graphics/screen_item32.cpp
diff --git a/engines/sci/engine/features.h b/engines/sci/engine/features.h
index 36b0d06..ee978be 100644
--- a/engines/sci/engine/features.h
+++ b/engines/sci/engine/features.h
@@ -128,6 +128,10 @@ public:
g_sci->getGameId() != GID_SQ6 &&
g_sci->getGameId() != GID_GK2;
}
+
+ inline bool usesAlternateSelectors() const {
+ return g_sci->getGameId() == GID_PHANTASMAGORIA2;
+ }
#endif
/**
diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp
index d437741..880ea0f 100644
--- a/engines/sci/engine/kgraphics32.cpp
+++ b/engines/sci/engine/kgraphics32.cpp
@@ -484,10 +484,18 @@ reg_t kScrollWindowCreate(EngineState *s, int argc, reg_t *argv) {
const reg_t plane = readSelector(segMan, object, SELECTOR(plane));
Common::Rect rect;
- rect.left = readSelectorValue(segMan, object, SELECTOR(nsLeft));
- rect.top = readSelectorValue(segMan, object, SELECTOR(nsTop));
- rect.right = readSelectorValue(segMan, object, SELECTOR(nsRight)) + 1;
- rect.bottom = readSelectorValue(segMan, object, SELECTOR(nsBottom)) + 1;
+
+ if (g_sci->_features->usesAlternateSelectors()) {
+ rect.left = readSelectorValue(segMan, object, SELECTOR(left));
+ rect.top = readSelectorValue(segMan, object, SELECTOR(top));
+ rect.right = readSelectorValue(segMan, object, SELECTOR(right)) + 1;
+ rect.bottom = readSelectorValue(segMan, object, SELECTOR(bottom)) + 1;
+ } else {
+ rect.left = readSelectorValue(segMan, object, SELECTOR(nsLeft));
+ rect.top = readSelectorValue(segMan, object, SELECTOR(nsTop));
+ rect.right = readSelectorValue(segMan, object, SELECTOR(nsRight)) + 1;
+ rect.bottom = readSelectorValue(segMan, object, SELECTOR(nsBottom)) + 1;
+ }
const Common::Point position(rect.left, rect.top);
return g_sci->_gfxControls32->makeScrollWindow(rect, position, plane, foreColor, backColor, fontId, alignment, borderColor, maxNumEntries);
diff --git a/engines/sci/engine/selector.cpp b/engines/sci/engine/selector.cpp
index 585b0ef..2bc4051 100644
--- a/engines/sci/engine/selector.cpp
+++ b/engines/sci/engine/selector.cpp
@@ -21,6 +21,7 @@
*/
#include "sci/sci.h"
+#include "sci/engine/features.h"
#include "sci/engine/kernel.h"
#include "sci/engine/state.h"
#include "sci/engine/selector.h"
@@ -57,11 +58,11 @@ void Kernel::mapSelectors() {
FIND_SELECTOR(nsTop);
FIND_SELECTOR(nsLeft);
FIND_SELECTOR(nsBottom);
+ FIND_SELECTOR(nsRight);
FIND_SELECTOR(lsTop);
FIND_SELECTOR(lsLeft);
FIND_SELECTOR(lsBottom);
FIND_SELECTOR(lsRight);
- FIND_SELECTOR(nsRight);
FIND_SELECTOR(signal);
FIND_SELECTOR(illegalBits);
FIND_SELECTOR(brTop);
@@ -173,6 +174,7 @@ void Kernel::mapSelectors() {
FIND_SELECTOR(left);
FIND_SELECTOR(bottom);
FIND_SELECTOR(right);
+ FIND_SELECTOR(seenRect);
FIND_SELECTOR(resY);
FIND_SELECTOR(resX);
FIND_SELECTOR(dimmed);
@@ -214,9 +216,16 @@ reg_t readSelector(SegManager *segMan, reg_t object, Selector selectorId) {
#ifdef ENABLE_SCI32
void updateInfoFlagViewVisible(Object *obj, int index) {
- // TODO: Make this correct for all SCI versions
- // Selectors 26 through 44 are selectors for View script objects in SQ6
- if (index >= 26 && index <= 44 && getSciVersion() >= SCI_VERSION_2) {
+ int minIndex, maxIndex;
+ if (g_sci->_features->usesAlternateSelectors()) {
+ minIndex = 24;
+ maxIndex = 43;
+ } else {
+ minIndex = 26;
+ maxIndex = 44;
+ }
+
+ if (index >= minIndex && index <= maxIndex && getSciVersion() >= SCI_VERSION_2) {
obj->setInfoSelectorFlag(kInfoFlagViewVisible);
}
}
diff --git a/engines/sci/engine/selector.h b/engines/sci/engine/selector.h
index f2d06d1..8d1edeb 100644
--- a/engines/sci/engine/selector.h
+++ b/engines/sci/engine/selector.h
@@ -135,12 +135,8 @@ struct SelectorCache {
Selector bitmap; // Used to hold the text bitmap for SCI32 texts
Selector plane;
- Selector top;
- Selector left;
- Selector bottom;
- Selector right;
- Selector resX;
- Selector resY;
+ Selector top, left, bottom, right;
+ Selector resX, resY;
Selector fore;
Selector back;
@@ -153,6 +149,7 @@ struct SelectorCache {
Selector mirrored;
Selector visible;
+ Selector seenRect;
Selector useInsetRect;
Selector inTop, inLeft, inBottom, inRight;
Selector textTop, textLeft, textBottom, textRight;
diff --git a/engines/sci/graphics/celobj32.cpp b/engines/sci/graphics/celobj32.cpp
index 09ea05b..fe0fbf7 100644
--- a/engines/sci/graphics/celobj32.cpp
+++ b/engines/sci/graphics/celobj32.cpp
@@ -21,6 +21,7 @@
*/
#include "sci/resource.h"
+#include "sci/engine/features.h"
#include "sci/engine/seg_manager.h"
#include "sci/engine/state.h"
#include "sci/graphics/celobj32.h"
@@ -949,6 +950,9 @@ CelObjView::CelObjView(const GuiResourceId viewId, const int16 loopNo, const int
_width = READ_SCI11ENDIAN_UINT16(celHeader);
_height = READ_SCI11ENDIAN_UINT16(celHeader + 2);
_origin.x = _width / 2 - (int16)READ_SCI11ENDIAN_UINT16(celHeader + 4);
+ if (g_sci->_features->usesAlternateSelectors() && _mirrorX) {
+ _origin.x = _width - _origin.x - 1;
+ }
_origin.y = _height - (int16)READ_SCI11ENDIAN_UINT16(celHeader + 6) - 1;
_skipColor = celHeader[8];
_compressionType = (CelCompressionType)celHeader[9];
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index bf43c8b..fe43c75 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -35,6 +35,7 @@
#include "sci/sci.h"
#include "sci/console.h"
+#include "sci/engine/features.h"
#include "sci/engine/kernel.h"
#include "sci/engine/state.h"
#include "sci/engine/selector.h"
@@ -1368,10 +1369,18 @@ bool GfxFrameout::kernelSetNowSeen(const reg_t screenItemObject) const {
}
Common::Rect result = screenItem->getNowSeenRect(*plane);
- writeSelectorValue(_segMan, screenItemObject, SELECTOR(nsLeft), result.left);
- writeSelectorValue(_segMan, screenItemObject, SELECTOR(nsTop), result.top);
- writeSelectorValue(_segMan, screenItemObject, SELECTOR(nsRight), result.right - 1);
- writeSelectorValue(_segMan, screenItemObject, SELECTOR(nsBottom), result.bottom - 1);
+
+ if (g_sci->_features->usesAlternateSelectors()) {
+ writeSelectorValue(_segMan, screenItemObject, SELECTOR(left), result.left);
+ writeSelectorValue(_segMan, screenItemObject, SELECTOR(top), result.top);
+ writeSelectorValue(_segMan, screenItemObject, SELECTOR(right), result.right - 1);
+ writeSelectorValue(_segMan, screenItemObject, SELECTOR(bottom), result.bottom - 1);
+ } else {
+ writeSelectorValue(_segMan, screenItemObject, SELECTOR(nsLeft), result.left);
+ writeSelectorValue(_segMan, screenItemObject, SELECTOR(nsTop), result.top);
+ writeSelectorValue(_segMan, screenItemObject, SELECTOR(nsRight), result.right - 1);
+ writeSelectorValue(_segMan, screenItemObject, SELECTOR(nsBottom), result.bottom - 1);
+ }
return true;
}
diff --git a/engines/sci/graphics/plane32.cpp b/engines/sci/graphics/plane32.cpp
index 4662226..aa8cd52 100644
--- a/engines/sci/graphics/plane32.cpp
+++ b/engines/sci/graphics/plane32.cpp
@@ -80,10 +80,17 @@ _moved(0) {
_vanishingPoint.x = readSelectorValue(segMan, object, SELECTOR(vanishingX));
_vanishingPoint.y = readSelectorValue(segMan, object, SELECTOR(vanishingY));
- _gameRect.left = readSelectorValue(segMan, object, SELECTOR(inLeft));
- _gameRect.top = readSelectorValue(segMan, object, SELECTOR(inTop));
- _gameRect.right = readSelectorValue(segMan, object, SELECTOR(inRight)) + 1;
- _gameRect.bottom = readSelectorValue(segMan, object, SELECTOR(inBottom)) + 1;
+ if (g_sci->_features->usesAlternateSelectors()) {
+ _gameRect.left = readSelectorValue(segMan, object, SELECTOR(left));
+ _gameRect.top = readSelectorValue(segMan, object, SELECTOR(top));
+ _gameRect.right = readSelectorValue(segMan, object, SELECTOR(right)) + 1;
+ _gameRect.bottom = readSelectorValue(segMan, object, SELECTOR(bottom)) + 1;
+ } else {
+ _gameRect.left = readSelectorValue(segMan, object, SELECTOR(inLeft));
+ _gameRect.top = readSelectorValue(segMan, object, SELECTOR(inTop));
+ _gameRect.right = readSelectorValue(segMan, object, SELECTOR(inRight)) + 1;
+ _gameRect.bottom = readSelectorValue(segMan, object, SELECTOR(inBottom)) + 1;
+ }
convertGameRectToPlaneRect();
_back = readSelectorValue(segMan, object, SELECTOR(back));
@@ -829,10 +836,18 @@ void Plane::update(const reg_t object) {
SegManager *segMan = g_sci->getEngineState()->_segMan;
_vanishingPoint.x = readSelectorValue(segMan, object, SELECTOR(vanishingX));
_vanishingPoint.y = readSelectorValue(segMan, object, SELECTOR(vanishingY));
- _gameRect.left = readSelectorValue(segMan, object, SELECTOR(inLeft));
- _gameRect.top = readSelectorValue(segMan, object, SELECTOR(inTop));
- _gameRect.right = readSelectorValue(segMan, object, SELECTOR(inRight)) + 1;
- _gameRect.bottom = readSelectorValue(segMan, object, SELECTOR(inBottom)) + 1;
+
+ if (g_sci->_features->usesAlternateSelectors()) {
+ _gameRect.left = readSelectorValue(segMan, object, SELECTOR(left));
+ _gameRect.top = readSelectorValue(segMan, object, SELECTOR(top));
+ _gameRect.right = readSelectorValue(segMan, object, SELECTOR(right)) + 1;
+ _gameRect.bottom = readSelectorValue(segMan, object, SELECTOR(bottom)) + 1;
+ } else {
+ _gameRect.left = readSelectorValue(segMan, object, SELECTOR(inLeft));
+ _gameRect.top = readSelectorValue(segMan, object, SELECTOR(inTop));
+ _gameRect.right = readSelectorValue(segMan, object, SELECTOR(inRight)) + 1;
+ _gameRect.bottom = readSelectorValue(segMan, object, SELECTOR(inBottom)) + 1;
+ }
convertGameRectToPlaneRect();
_priority = readSelectorValue(segMan, object, SELECTOR(priority));
diff --git a/engines/sci/graphics/screen_item32.cpp b/engines/sci/graphics/screen_item32.cpp
index a70f25f..3c12a67 100644
--- a/engines/sci/graphics/screen_item32.cpp
+++ b/engines/sci/graphics/screen_item32.cpp
@@ -22,6 +22,7 @@
#include "sci/console.h"
#include "sci/resource.h"
+#include "sci/engine/features.h"
#include "sci/engine/kernel.h"
#include "sci/engine/selector.h"
#include "sci/engine/state.h"
@@ -238,14 +239,26 @@ void ScreenItem::setFromObject(SegManager *segMan, const reg_t object, const boo
_z = readSelectorValue(segMan, object, SELECTOR(z));
_position.y -= _z;
- if (readSelectorValue(segMan, object, SELECTOR(useInsetRect))) {
- _useInsetRect = true;
- _insetRect.left = readSelectorValue(segMan, object, SELECTOR(inLeft));
- _insetRect.top = readSelectorValue(segMan, object, SELECTOR(inTop));
- _insetRect.right = readSelectorValue(segMan, object, SELECTOR(inRight)) + 1;
- _insetRect.bottom = readSelectorValue(segMan, object, SELECTOR(inBottom)) + 1;
+ if (g_sci->_features->usesAlternateSelectors()) {
+ if (readSelectorValue(segMan, object, SELECTOR(seenRect))) {
+ _useInsetRect = true;
+ _insetRect.left = readSelectorValue(segMan, object, SELECTOR(left));
+ _insetRect.top = readSelectorValue(segMan, object, SELECTOR(top));
+ _insetRect.right = readSelectorValue(segMan, object, SELECTOR(right)) + 1;
+ _insetRect.bottom = readSelectorValue(segMan, object, SELECTOR(bottom)) + 1;
+ } else {
+ _useInsetRect = false;
+ }
} else {
- _useInsetRect = false;
+ if (readSelectorValue(segMan, object, SELECTOR(useInsetRect))) {
+ _useInsetRect = true;
+ _insetRect.left = readSelectorValue(segMan, object, SELECTOR(inLeft));
+ _insetRect.top = readSelectorValue(segMan, object, SELECTOR(inTop));
+ _insetRect.right = readSelectorValue(segMan, object, SELECTOR(inRight)) + 1;
+ _insetRect.bottom = readSelectorValue(segMan, object, SELECTOR(inBottom)) + 1;
+ } else {
+ _useInsetRect = false;
+ }
}
segMan->getObject(object)->clearInfoSelectorFlag(kInfoFlagViewVisible);
Commit: 2eadb3e92463c997c2ad81537db429ee063ad92e
https://github.com/scummvm/scummvm/commit/2eadb3e92463c997c2ad81537db429ee063ad92e
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-19T14:46:59-06:00
Commit Message:
SCI32: Improve ScreenItem missing resource error
Changed paths:
engines/sci/graphics/celobj32.h
engines/sci/graphics/screen_item32.cpp
diff --git a/engines/sci/graphics/celobj32.h b/engines/sci/graphics/celobj32.h
index 03d950a..70cbd09 100644
--- a/engines/sci/graphics/celobj32.h
+++ b/engines/sci/graphics/celobj32.h
@@ -122,6 +122,18 @@ struct CelInfo32 {
inline bool operator!=(const CelInfo32 &other) {
return !(*this == other);
}
+
+ inline Common::String toString() const {
+ if (type == kCelTypeView) {
+ return Common::String::format("view %u, loop %d, cel %d", resourceId, loopNo, celNo);
+ } else if (type == kCelTypePic) {
+ return Common::String::format("pic %u", resourceId);
+ } else if (kCelTypeColor) {
+ return Common::String::format("color %d", color);
+ } else if (type == kCelTypeMem) {
+ return Common::String::format("mem %04x:%04x", PRINT_REG(bitmap));
+ }
+ }
};
class CelObj;
diff --git a/engines/sci/graphics/screen_item32.cpp b/engines/sci/graphics/screen_item32.cpp
index 3c12a67..f7239c3 100644
--- a/engines/sci/graphics/screen_item32.cpp
+++ b/engines/sci/graphics/screen_item32.cpp
@@ -178,7 +178,7 @@ void ScreenItem::setFromObject(SegManager *segMan, const reg_t object, const boo
// single location
Resource *view = g_sci->getResMan()->findResource(ResourceId(kResourceTypeView, _celInfo.resourceId), false);
if (!view) {
- error("Failed to load resource %d", _celInfo.resourceId);
+ error("Failed to load %s", _celInfo.toString().c_str());
}
// NOTE: +2 because the header size field itself is excluded from
@@ -514,30 +514,8 @@ void ScreenItem::printDebugInfo(Console *con) const {
con->debugPrintf(" inset rect: (%d, %d, %d, %d)\n", PRINT_RECT(_insetRect));
}
- Common::String celType;
- switch (_celInfo.type) {
- case kCelTypePic:
- celType = "pic";
- break;
- case kCelTypeView:
- celType = "view";
- break;
- case kCelTypeColor:
- celType = "color";
- break;
- case kCelTypeMem:
- celType = "mem";
- break;
- }
+ con->debugPrintf(" %s\n", _celInfo.toString().c_str());
- con->debugPrintf(" type: %s, res %d, loop %d, cel %d, bitmap %04x:%04x, color: %d\n",
- celType.c_str(),
- _celInfo.resourceId,
- _celInfo.loopNo,
- _celInfo.celNo,
- PRINT_REG(_celInfo.bitmap),
- _celInfo.color
- );
if (_celObj != nullptr) {
con->debugPrintf(" width %d, height %d, x-resolution %d, y-resolution %d\n",
_celObj->_width,
More information about the Scummvm-git-logs
mailing list