aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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,