diff options
-rw-r--r-- | scumm/actor.cpp | 2 | ||||
-rw-r--r-- | scumm/boxes.cpp | 24 | ||||
-rw-r--r-- | scumm/boxes.h | 10 | ||||
-rw-r--r-- | scumm/gfx.cpp | 6 | ||||
-rw-r--r-- | scumm/gfx.h | 10 | ||||
-rw-r--r-- | scumm/scumm.h | 21 |
6 files changed, 33 insertions, 40 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp index ea8f66d498..ee0e9ec921 100644 --- a/scumm/actor.cpp +++ b/scumm/actor.cpp @@ -1400,7 +1400,7 @@ void Actor::walkActor() { } void Actor::walkActorOld() { - ScummPoint gateLoc[5]; // Gate locations + ScummVM::Point gateLoc[5]; // Gate locations int new_dir, next_box; if (!moving) diff --git a/scumm/boxes.cpp b/scumm/boxes.cpp index 508c338dc2..67ec2e32ec 100644 --- a/scumm/boxes.cpp +++ b/scumm/boxes.cpp @@ -293,7 +293,7 @@ bool Scumm::checkXYInBoxBounds(int b, int x, int y) { if (box.ul.x == box.ur.x && box.ul.y == box.ur.y && box.lr.x == box.ll.x && box.lr.y == box.ll.y || box.ul.x == box.ll.x && box.ul.y == box.ll.y && box.ur.x == box.lr.x && box.ur.y == box.lr.y) { - ScummPoint pt; + ScummVM::Point pt; pt = closestPtOnLine(box.ul.x, box.ul.y, box.lr.x, box.lr.y, x, y); if (distanceFromPt(x, y, pt.x, pt.y) <= 4) return true; @@ -389,11 +389,11 @@ uint Scumm::distanceFromPt(int x, int y, int ptx, int pty) { return diffx + diffy; } -ScummPoint Scumm::closestPtOnLine(int ulx, int uly, int llx, int lly, int x, int y) { +ScummVM::Point Scumm::closestPtOnLine(int ulx, int uly, int llx, int lly, int x, int y) { int lydiff, lxdiff; int32 dist, a, b, c; int x2, y2; - ScummPoint pt; + ScummVM::Point pt; if (llx == ulx) { // Vertical line? x2 = ulx; @@ -497,7 +497,7 @@ bool Scumm::inBoxQuickReject(int b, int x, int y, int threshold) { } AdjustBoxResult Scumm::getClosestPtOnBox(int b, int x, int y) { - ScummPoint pt; + ScummVM::Point pt; AdjustBoxResult best; uint dist; uint bestdist = (uint)0xFFFF; @@ -587,7 +587,7 @@ int Scumm::getPathToDestBox(byte from, byte to) { bool Scumm::findPathTowards(Actor *a, byte box1nr, byte box2nr, byte box3nr, int16 &foundPathX, int16 &foundPathY) { BoxCoords box1; BoxCoords box2; - ScummPoint tmp; + ScummVM::Point tmp; int i, j; int flag; int q, pos; @@ -1026,10 +1026,10 @@ PathVertex *Scumm::addPathVertex() { return (PathVertex *)addToBoxVertexHeap(sizeof(PathVertex)); } -void Scumm::findPathTowardsOld(Actor *actor, byte trap1, byte trap2, byte final_trap, ScummPoint gateLoc[5]) { - ScummPoint pt; - ScummPoint gateA[2]; - ScummPoint gateB[2]; +void Scumm::findPathTowardsOld(Actor *actor, byte trap1, byte trap2, byte final_trap, ScummVM::Point gateLoc[5]) { + ScummVM::Point pt; + ScummVM::Point gateA[2]; + ScummVM::Point gateB[2]; getGates(trap1, trap2, gateA, gateB); @@ -1067,15 +1067,15 @@ void Scumm::findPathTowardsOld(Actor *actor, byte trap1, byte trap2, byte final_ return; } -void Scumm::getGates(int trap1, int trap2, ScummPoint gateA[2], ScummPoint gateB[2]) { +void Scumm::getGates(int trap1, int trap2, ScummVM::Point gateA[2], ScummVM::Point gateB[2]) { int i, j; int dist[8]; int minDist[3]; int closest[3]; int box[3]; BoxCoords coords; - ScummPoint Clo[8]; - ScummPoint poly[8]; + ScummVM::Point Clo[8]; + ScummVM::Point poly[8]; AdjustBoxResult abr; int line1, line2; diff --git a/scumm/boxes.h b/scumm/boxes.h index 98c7751ebc..1fffd7f285 100644 --- a/scumm/boxes.h +++ b/scumm/boxes.h @@ -23,6 +23,8 @@ #ifndef BOXES_H #define BOXES_H +#include "common/rect.h" + #define SIZEOF_BOX_V2 8 #define SIZEOF_BOX_V3 18 #define SIZEOF_BOX 20 @@ -42,10 +44,10 @@ struct AdjustBoxResult { /* Result type of AdjustBox functions */ }; struct BoxCoords { /* Box coordinates */ - ScummPoint ul; - ScummPoint ur; - ScummPoint ll; - ScummPoint lr; + ScummVM::Point ul; + ScummVM::Point ur; + ScummVM::Point ll; + ScummVM::Point lr; }; struct Box; diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index b299bc701f..a032156e17 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -1950,7 +1950,7 @@ void Scumm::setCameraAtEx(int at) { void Scumm::setCameraAt(int pos_x, int pos_y) { if (_features & GF_AFTER_V7) { - ScummPoint old; + ScummVM::Point old; old = camera._cur; @@ -2042,7 +2042,7 @@ void Scumm::setCameraFollows(Actor *a) { } } -void Scumm::clampCameraPos(ScummPoint *pt) { +void Scumm::clampCameraPos(ScummVM::Point *pt) { if (pt->x < VAR(VAR_CAMERA_MIN_X)) pt->x = VAR(VAR_CAMERA_MIN_X); @@ -2058,7 +2058,7 @@ void Scumm::clampCameraPos(ScummPoint *pt) { void Scumm::moveCamera() { if (_features & GF_AFTER_V7) { - ScummPoint old = camera._cur; + ScummVM::Point old = camera._cur; Actor *a = NULL; if (camera._follows) { diff --git a/scumm/gfx.h b/scumm/gfx.h index a0d2760a79..23a6d0c473 100644 --- a/scumm/gfx.h +++ b/scumm/gfx.h @@ -23,6 +23,8 @@ #ifndef GFX_H #define GFX_H +#include "common/rect.h" + enum { /* Camera modes */ CM_NORMAL = 1, CM_FOLLOW_ACTOR = 2, @@ -30,10 +32,10 @@ enum { /* Camera modes */ }; struct CameraData { /* Camera state data */ - ScummPoint _cur; - ScummPoint _dest; - ScummPoint _accel; - ScummPoint _last; + ScummVM::Point _cur; + ScummVM::Point _dest; + ScummVM::Point _accel; + ScummVM::Point _last; int _leftTrigger, _rightTrigger; byte _follows, _mode; bool _movingToActor; diff --git a/scumm/scumm.h b/scumm/scumm.h index 907e018c24..11ee57a683 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -27,6 +27,7 @@ #include "common/gameDetector.h" #include "common/file.h" #include "common/map.h" +#include "common/rect.h" #include "common/str.h" #include "common/timer.h" #include "common/util.h" @@ -59,18 +60,6 @@ enum { KEY_SET_OPTIONS = 3456 // WinCE }; -struct ScummPoint { - int x, y; - bool operator == (const ScummPoint &p) const - { - return p.x == x && p.y == y; - } - bool operator != (const ScummPoint &p) const - { - return p.x != x || p.y != y; - } -}; - #include "gfx.h" #include "boxes.h" @@ -810,7 +799,7 @@ public: void setCameraAt(int pos_x, int pos_y); void panCameraTo(int x, int y); void setCameraFollows(Actor *a); - void clampCameraPos(ScummPoint *pt); + void clampCameraPos(ScummVM::Point *pt); byte *getPalettePtr(); void setupEGAPalette(); @@ -962,7 +951,7 @@ public: PathVertex *addPathVertex(); bool checkXYInBoxBounds(int box, int x, int y); uint distanceFromPt(int x, int y, int ptx, int pty); - ScummPoint closestPtOnLine(int ulx, int uly, int llx, int lly, int x, int y); + ScummVM::Point closestPtOnLine(int ulx, int uly, int llx, int lly, int x, int y); void getBoxCoordinates(int boxnum, BoxCoords *bc); byte getMaskFromBox(int box); Box *getBoxBaseAddr(int box); @@ -985,8 +974,8 @@ public: byte *getBoxMatrixBaseAddr(); int getPathToDestBox(byte from, byte to); bool findPathTowards(Actor *a, byte box, byte box2, byte box3, int16 &foundPathX, int16 &foundPathY); - void findPathTowardsOld(Actor *a, byte box, byte box2, byte box3, ScummPoint gateLoc[5]); - void getGates(int trap1, int trap2, ScummPoint gateA[2], ScummPoint gateB[2]); + void findPathTowardsOld(Actor *a, byte box, byte box2, byte box3, ScummVM::Point gateLoc[5]); + void getGates(int trap1, int trap2, ScummVM::Point gateA[2], ScummVM::Point gateB[2]); bool inBoxQuickReject(int box, int x, int y, int threshold); AdjustBoxResult getClosestPtOnBox(int box, int x, int y); int getSpecialBox(int param1, int param2); |