aboutsummaryrefslogtreecommitdiff
path: root/engines/gob
diff options
context:
space:
mode:
authorSven Hesse2012-03-11 21:39:14 +0100
committerSven Hesse2012-03-11 21:39:14 +0100
commit3664088f6f562f74bcaebb5d1006a33da29c5637 (patch)
tree167830ab654c79c3d667667a399eebd106860b06 /engines/gob
parentc340159486b499783c297453a14b4df76b4aa535 (diff)
downloadscummvm-rg350-3664088f6f562f74bcaebb5d1006a33da29c5637.tar.gz
scummvm-rg350-3664088f6f562f74bcaebb5d1006a33da29c5637.tar.bz2
scummvm-rg350-3664088f6f562f74bcaebb5d1006a33da29c5637.zip
GOB: Add a way to add sprite coordinates to CMP files
Because the meter bar and icons for Penetration are not even in the CMP's RXY.
Diffstat (limited to 'engines/gob')
-rw-r--r--engines/gob/cmpfile.cpp13
-rw-r--r--engines/gob/cmpfile.h2
-rw-r--r--engines/gob/rxyfile.cpp11
-rw-r--r--engines/gob/rxyfile.h2
4 files changed, 28 insertions, 0 deletions
diff --git a/engines/gob/cmpfile.cpp b/engines/gob/cmpfile.cpp
index 62ac9f3fa4..7b21c4c835 100644
--- a/engines/gob/cmpfile.cpp
+++ b/engines/gob/cmpfile.cpp
@@ -230,4 +230,17 @@ void CMPFile::draw(Surface &dest, uint16 left, uint16 top, uint16 right, uint16
dest.blit(*_surface, left, top, right, bottom, x, y, transp);
}
+uint16 CMPFile::addSprite(uint16 left, uint16 top, uint16 right, uint16 bottom) {
+ if (empty())
+ return 0;
+
+ const uint16 height = bottom - top + 1;
+ const uint16 width = right - left + 1;
+
+ _maxWidth = MAX(_maxWidth , width);
+ _maxHeight = MAX(_maxHeight, height);
+
+ return _coordinates->add(left, top, right, bottom);
+}
+
} // End of namespace Gob
diff --git a/engines/gob/cmpfile.h b/engines/gob/cmpfile.h
index d409e15161..2b669e4d38 100644
--- a/engines/gob/cmpfile.h
+++ b/engines/gob/cmpfile.h
@@ -68,6 +68,8 @@ public:
void draw(Surface &dest, uint16 left, uint16 top, uint16 right, uint16 bottom,
uint16 x, uint16 y, int32 transp = -1) const;
+ uint16 addSprite(uint16 left, uint16 top, uint16 right, uint16 bottom);
+
private:
GobEngine *_vm;
diff --git a/engines/gob/rxyfile.cpp b/engines/gob/rxyfile.cpp
index 06a07bdc9c..9702dc8c7f 100644
--- a/engines/gob/rxyfile.cpp
+++ b/engines/gob/rxyfile.cpp
@@ -88,4 +88,15 @@ void RXYFile::load(Common::SeekableReadStream &rxy) {
}
}
+uint16 RXYFile::add(uint16 left, uint16 top, uint16 right, uint16 bottom) {
+ _coords.resize(_coords.size() + 1);
+
+ _coords.back().left = left;
+ _coords.back().top = top;
+ _coords.back().right = right;
+ _coords.back().bottom = bottom;
+
+ return _coords.size() - 1;
+}
+
} // End of namespace Gob
diff --git a/engines/gob/rxyfile.h b/engines/gob/rxyfile.h
index 3b4d3de636..bc9600b5b0 100644
--- a/engines/gob/rxyfile.h
+++ b/engines/gob/rxyfile.h
@@ -58,6 +58,8 @@ public:
const Coordinates &operator[](uint i) const;
+ uint16 add(uint16 left, uint16 top, uint16 right, uint16 bottom);
+
private:
typedef Common::Array<Coordinates> CoordArray;