aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock/objects.h
diff options
context:
space:
mode:
authorPaul Gilbert2015-04-28 21:35:20 -1000
committerPaul Gilbert2015-04-28 21:35:20 -1000
commit34a7ec7cdfe6b2eae699968afa28f2f75ee3126c (patch)
treedad8829c73b406099e217e468856f1dcd578d512 /engines/sherlock/objects.h
parent7be410621e9fbc61ff4ec715044afaa79aa54717 (diff)
downloadscummvm-rg350-34a7ec7cdfe6b2eae699968afa28f2f75ee3126c.tar.gz
scummvm-rg350-34a7ec7cdfe6b2eae699968afa28f2f75ee3126c.tar.bz2
scummvm-rg350-34a7ec7cdfe6b2eae699968afa28f2f75ee3126c.zip
SHERLOCK: Fix icon disappearing when moving to Covent Gradens on map
Co-ordinates in Sherlock are frequently multiplied by 100. Thus, on the overland map, the values can go up to 64000, which overflows the signed 16-bit values allowed by the standard Common::Point class
Diffstat (limited to 'engines/sherlock/objects.h')
-rw-r--r--engines/sherlock/objects.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/engines/sherlock/objects.h b/engines/sherlock/objects.h
index 80b0b9d9f3..e2b53ec541 100644
--- a/engines/sherlock/objects.h
+++ b/engines/sherlock/objects.h
@@ -79,6 +79,25 @@ enum {
#define FLIP_CODE (64 + 128)
#define SOUND_CODE (34 + 128)
+class Point32 {
+public:
+ int x;
+ int y;
+
+ Point32() : x(0), y(0) {}
+ Point32(int x1, int y1) : x(x1), y(y1) {}
+ Point32(const Common::Point &pt) : x(pt.x), y(pt.y) {}
+
+ bool operator==(const Point32 &p) const { return x == p.x && y == p.y; }
+ bool operator!=(const Point32 &p) const { return x != p.x || y != p.y; }
+ Point32 operator+(const Point32 &delta) const { return Point32(x + delta.x, y + delta.y); }
+ Point32 operator-(const Point32 &delta) const { return Point32(x - delta.x, y - delta.y); }
+ operator Common::Point() { return Common::Point(x, y); }
+
+ void operator+=(const Point32 &delta) { x += delta.x; y += delta.y; }
+ void operator-=(const Point32 &delta) { x -= delta.x; y -= delta.y; }
+};
+
class Sprite {
private:
static SherlockEngine *_vm;
@@ -95,8 +114,8 @@ public:
int _allow; // Allowed menu commands - ObjectAllow
int _frameNumber; // Frame number in rame sequence to draw
int _sequenceNumber; // Sequence being used
- Common::Point _position; // Current position
- Common::Point _delta; // Momvement delta
+ Point32 _position; // Current position
+ Point32 _delta; // Momvement delta
Common::Point _oldPosition; // Old position
Common::Point _oldSize; // Image's old size
Common::Point _goto; // Walk destination