aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Snover2016-12-10 14:27:52 -0600
committerColin Snover2016-12-19 14:46:59 -0600
commit2eadb3e92463c997c2ad81537db429ee063ad92e (patch)
tree9d0bb8649ea024d9971f7ef04c2b75dccc198c80
parent4cff1e400f7e1e885b12990a5a34772d05eb2285 (diff)
downloadscummvm-rg350-2eadb3e92463c997c2ad81537db429ee063ad92e.tar.gz
scummvm-rg350-2eadb3e92463c997c2ad81537db429ee063ad92e.tar.bz2
scummvm-rg350-2eadb3e92463c997c2ad81537db429ee063ad92e.zip
SCI32: Improve ScreenItem missing resource error
-rw-r--r--engines/sci/graphics/celobj32.h12
-rw-r--r--engines/sci/graphics/screen_item32.cpp26
2 files changed, 14 insertions, 24 deletions
diff --git a/engines/sci/graphics/celobj32.h b/engines/sci/graphics/celobj32.h
index 03d950a3c3..70cbd09e7d 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 3c12a673a7..f7239c33bb 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,