aboutsummaryrefslogtreecommitdiff
path: root/engines/illusions/backgroundresource.cpp
diff options
context:
space:
mode:
authorjohndoe1232014-03-27 18:55:41 +0100
committerEugene Sandulenko2018-07-20 06:43:33 +0000
commit33d28deb690c79a6aca190c5b1bc998c39d95662 (patch)
treefaf3167dacc8c56a63e455af79cb8d7b2f16e2aa /engines/illusions/backgroundresource.cpp
parent22e898f7eb1bddc363900f4146696bf6e9d41e2f (diff)
downloadscummvm-rg350-33d28deb690c79a6aca190c5b1bc998c39d95662.tar.gz
scummvm-rg350-33d28deb690c79a6aca190c5b1bc998c39d95662.tar.bz2
scummvm-rg350-33d28deb690c79a6aca190c5b1bc998c39d95662.zip
ILLUSIONS: Additions in various places
- Add NamedPoint and related code - Remove some debug output - Fix right mouse button input - Add bubble code - Add BBDOU inventory skeleton
Diffstat (limited to 'engines/illusions/backgroundresource.cpp')
-rw-r--r--engines/illusions/backgroundresource.cpp33
1 files changed, 25 insertions, 8 deletions
diff --git a/engines/illusions/backgroundresource.cpp b/engines/illusions/backgroundresource.cpp
index d80a9e2dd9..d2b01fea93 100644
--- a/engines/illusions/backgroundresource.cpp
+++ b/engines/illusions/backgroundresource.cpp
@@ -86,7 +86,7 @@ void TileMap::load(byte *dataStart, Common::SeekableReadStream &stream) {
uint32 mapOffs = stream.pos();
_map = dataStart + mapOffs;
- debug("TileMap::load() _width: %d; _height: %d",
+ debug(0, "TileMap::load() _width: %d; _height: %d",
_width, _height);
}
@@ -104,7 +104,7 @@ void BgInfo::load(byte *dataStart, Common::SeekableReadStream &stream) {
_tileMap.load(dataStart, stream);
_tilePixels = dataStart + tilePixelsOffs;
- debug("BgInfo::load() _flags: %08X; _priorityBase: %d; tileMapOffs: %08X; tilePixelsOffs: %08X",
+ debug(0, "BgInfo::load() _flags: %08X; _priorityBase: %d; tileMapOffs: %08X; tilePixelsOffs: %08X",
_flags, _priorityBase, tileMapOffs, tilePixelsOffs);
}
@@ -121,7 +121,7 @@ void PriorityLayer::load(byte *dataStart, Common::SeekableReadStream &stream) {
_map += 8;
_values = dataStart + valuesOffs;
- debug("PriorityLayer::load() _width: %d; _height: %d; mapOffs: %08X; valuesOffs: %08X; _mapWidth: %d; _mapHeight: %d",
+ debug(0, "PriorityLayer::load() _width: %d; _height: %d; mapOffs: %08X; valuesOffs: %08X; _mapWidth: %d; _mapHeight: %d",
_width, _height, mapOffs, valuesOffs, _mapWidth, _mapHeight);
}
@@ -140,7 +140,7 @@ void ScaleLayer::load(byte *dataStart, Common::SeekableReadStream &stream) {
uint32 valuesOffs = stream.readUint32LE();
_values = dataStart + valuesOffs;
- debug("ScaleLayer::load() _height: %d; valuesOffs: %08X",
+ debug(0, "ScaleLayer::load() _height: %d; valuesOffs: %08X",
_height, valuesOffs);
}
@@ -158,7 +158,7 @@ void BackgroundObject::load(byte *dataStart, Common::SeekableReadStream &stream)
uint32 pointsConfigOffs = stream.readUint32LE();
_pointsConfig = dataStart + pointsConfigOffs;
- debug("BackgroundObject::load() _objectId: %08X; _flags: %04X; _priority: %d; pointsConfigOffs: %08X",
+ debug(0, "BackgroundObject::load() _objectId: %08X; _flags: %04X; _priority: %d; pointsConfigOffs: %08X",
_objectId, _flags, _priority, pointsConfigOffs);
}
@@ -192,7 +192,7 @@ void BackgroundResource::load(byte *data, uint32 dataSize) {
_scaleLayers = new ScaleLayer[_scaleLayersCount];
stream.seek(0x2C);
uint32 scaleLayersOffs = stream.readUint32LE();
- debug("_scaleLayersCount: %d", _scaleLayersCount);
+ debug(0, "_scaleLayersCount: %d", _scaleLayersCount);
for (uint i = 0; i < _scaleLayersCount; ++i) {
stream.seek(scaleLayersOffs + i * 8);
_scaleLayers[i].load(data, stream);
@@ -204,7 +204,7 @@ void BackgroundResource::load(byte *data, uint32 dataSize) {
_priorityLayers = new PriorityLayer[_priorityLayersCount];
stream.seek(0x34);
uint32 priorityLayersOffs = stream.readUint32LE();
- debug("_priorityLayersCount: %d", _priorityLayersCount);
+ debug(0, "_priorityLayersCount: %d", _priorityLayersCount);
for (uint i = 0; i < _priorityLayersCount; ++i) {
stream.seek(priorityLayersOffs + i * 12);
_priorityLayers[i].load(data, stream);
@@ -216,11 +216,19 @@ void BackgroundResource::load(byte *data, uint32 dataSize) {
_backgroundObjects = new BackgroundObject[_backgroundObjectsCount];
stream.seek(0x44);
uint32 backgroundObjectsOffs = stream.readUint32LE();
- debug("_backgroundObjectsCount: %d", _backgroundObjectsCount);
+ debug(0, "_backgroundObjectsCount: %d", _backgroundObjectsCount);
for (uint i = 0; i < _backgroundObjectsCount; ++i) {
stream.seek(backgroundObjectsOffs + i * 12);
_backgroundObjects[i].load(data, stream);
}
+
+ // Load named points
+ stream.seek(0xC);
+ uint namedPointsCount = stream.readUint16LE();
+ stream.seek(0x24);
+ uint32 namedPointsOffs = stream.readUint32LE();
+ stream.seek(namedPointsOffs);
+ _namedPoints.load(namedPointsCount, stream);
}
@@ -239,6 +247,10 @@ ScaleLayer *BackgroundResource::getScaleLayer(uint index) {
return &_scaleLayers[index];
}
+bool BackgroundResource::findNamedPoint(uint32 namedPointId, Common::Point &pt) {
+ return _namedPoints.findNamedPoint(namedPointId, pt);
+}
+
// BackgroundItem
BackgroundItem::BackgroundItem(IllusionsEngine *vm) : _vm(vm), _tag(0), _pauseCtr(0), _bgRes(0) {
@@ -421,6 +433,11 @@ void BackgroundItems::refreshPan() {
}
}
+bool BackgroundItems::findActiveBackgroundNamedPoint(uint32 namedPointId, Common::Point &pt) {
+ BackgroundResource *backgroundResource = getActiveBgResource();
+ return backgroundResource ? backgroundResource->findNamedPoint(namedPointId, pt) : false;
+}
+
BackgroundItem *BackgroundItems::debugFirst() {
return *(_items.begin());
}