aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2013-08-28 00:11:17 +0300
committerEugene Sandulenko2013-09-06 14:51:20 +0300
commitb209329a1d2924064ddf47c35be76f0c2361419a (patch)
tree206d163470cdf51301719ee3582bdf4a4fc507b1
parent028772d153b79b38e5dfa2d90ba5f01fb287b47e (diff)
downloadscummvm-rg350-b209329a1d2924064ddf47c35be76f0c2361419a.tar.gz
scummvm-rg350-b209329a1d2924064ddf47c35be76f0c2361419a.tar.bz2
scummvm-rg350-b209329a1d2924064ddf47c35be76f0c2361419a.zip
FULLPIPE: Implemented several high level *AtPos functions
-rw-r--r--engines/fullpipe/gfx.cpp32
-rw-r--r--engines/fullpipe/gfx.h4
-rw-r--r--engines/fullpipe/scene.cpp27
3 files changed, 59 insertions, 4 deletions
diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp
index d700fff15e..ef6a589f8f 100644
--- a/engines/fullpipe/gfx.cpp
+++ b/engines/fullpipe/gfx.cpp
@@ -247,6 +247,19 @@ bool PictureObject::isPointInside(int x, int y) {
return res;
}
+bool PictureObject::isPixelHitAtPos(int x, int y) {
+ int oldx = _picture->_x;
+ int oldy = _picture->_y;
+
+ _picture->_x = _ox;
+ _picture->_y = _oy;
+ bool res = _picture->isPixelHitAtPos(x, y);
+ _picture->_x = oldx;
+ _picture->_y = oldy;
+
+ return res;
+}
+
GameObject::GameObject() {
_okeyCode = 0;
_flags = 0;
@@ -590,6 +603,25 @@ bool Picture::isPointInside(int x, int y) {
return false;
}
+bool Picture::isPixelHitAtPos(int x, int y) {
+ if (x < _x || y < _y || x >= _x + _width || y >= _y + _height)
+ return false;
+
+ if (!_bitmap )
+ init();
+
+ _bitmap->_x = _x;
+ _bitmap->_y = _y;
+
+ return _bitmap->isPixelHitAtPos(x, y);
+}
+
+bool Bitmap::isPixelHitAtPos(int x, int y) {
+ debug(0, "STUB: Bitmap::isPixelHitAtPos(%d, %d)", x, y);
+
+ return false;
+}
+
void Bitmap::putDib(int x, int y, int32 *palette) {
debug(0, "Bitmap::putDib(%d, %d)", x, y);
diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h
index 59edaf49e4..feb560c06f 100644
--- a/engines/fullpipe/gfx.h
+++ b/engines/fullpipe/gfx.h
@@ -60,6 +60,8 @@ struct Bitmap {
void drawShaded(int type, int x, int y, byte *palette);
void drawRotated(int x, int y, int angle, byte *palette);
+
+ bool isPixelHitAtPos(int x, int y);
};
class Picture : public MemoryObject {
@@ -103,6 +105,7 @@ class Picture : public MemoryObject {
Common::Point *getDimensions(Common::Point *p);
bool isPointInside(int x, int y);
+ bool isPixelHitAtPos(int x, int y);
byte *getPaletteData() { return _paletteData; }
void setPaletteData(byte *pal);
@@ -161,6 +164,7 @@ class PictureObject : public GameObject {
bool setPicAniInfo(PicAniInfo *picAniInfo);
bool isPointInside(int x, int y);
+ bool isPixelHitAtPos(int x, int y);
};
class Background : public CObject {
diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp
index 95d2876ca9..25d70770f0 100644
--- a/engines/fullpipe/scene.cpp
+++ b/engines/fullpipe/scene.cpp
@@ -483,15 +483,34 @@ StaticANIObject *Scene::getStaticANIObjectAtPos(int x, int y) {
}
PictureObject *Scene::getPictureObjectAtPos(int x, int y) {
- warning("STUB: Scene::getPictureObjectAtPos(%d, %d)", x, y);
+ PictureObject *res = 0;
- return 0;
+ for (uint i = 0; i < _picObjList.size(); i++) {
+ PictureObject *p = (PictureObject *)_picObjList[i];
+ if ((p->_field_8 & 1) && (p->_flags & 4) &&
+ p->isPixelHitAtPos(x, y) &&
+ (!res || res->_priority >= p->_priority))
+ res = p;
+ }
+
+ return res;
}
int Scene::getPictureObjectIdAtPos(int x, int y) {
- warning("STUB: Scene::getPictureObjectIdAtPos(%d, %d)", x, y);
+ PictureObject *resp = 0;
+ int res = 0;
- return 0;
+ for (uint i = 0; i < _picObjList.size(); i++) {
+ PictureObject *p = (PictureObject *)_picObjList[i];
+ if ((p->_field_8 & 1) && (p->_flags & 4) &&
+ p->isPixelHitAtPos(x, y) &&
+ (!res || resp->_priority >= p->_priority)) {
+ resp = p;
+ res = p->_id;
+ }
+ }
+
+ return res;
}
void Scene::update(int counterdiff) {