diff options
author | Paul Gilbert | 2015-04-28 21:35:20 -1000 |
---|---|---|
committer | Paul Gilbert | 2015-04-28 21:35:20 -1000 |
commit | 34a7ec7cdfe6b2eae699968afa28f2f75ee3126c (patch) | |
tree | dad8829c73b406099e217e468856f1dcd578d512 /engines/sherlock | |
parent | 7be410621e9fbc61ff4ec715044afaa79aa54717 (diff) | |
download | scummvm-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')
-rw-r--r-- | engines/sherlock/map.h | 6 | ||||
-rw-r--r-- | engines/sherlock/objects.cpp | 2 | ||||
-rw-r--r-- | engines/sherlock/objects.h | 23 |
3 files changed, 25 insertions, 6 deletions
diff --git a/engines/sherlock/map.h b/engines/sherlock/map.h index 564ae73691..435ca8d5d7 100644 --- a/engines/sherlock/map.h +++ b/engines/sherlock/map.h @@ -68,7 +68,7 @@ private: ImageFile *_shapes; ImageFile *_iconShapes; byte _sequences[MAX_HOLMES_SEQUENCE][MAX_FRAME]; - Common::Point _lDrawnPos; + Point32 _lDrawnPos; int _point; bool _placesShown; int _cursorIndex; @@ -96,8 +96,8 @@ private: void highlightIcon(const Common::Point &pt); public: bool _active; - Common::Point _overPos; - Common::Point _bigPos; + Point32 _overPos; + Point32 _bigPos; int _charPoint, _oldCharPoint; public: Map(SherlockEngine *vm); diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp index f662d00aed..d9cc38e55f 100644 --- a/engines/sherlock/objects.cpp +++ b/engines/sherlock/objects.cpp @@ -184,7 +184,7 @@ void Sprite::checkSprite() { Scene &scene = *_vm->_scene; Screen &screen = *_vm->_screen; Talk &talk = *_vm->_talk; - Common::Point pt; + Point32 pt; Common::Rect objBounds; Common::Point spritePt(_position.x / 100, _position.y / 100); 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 |