diff options
author | Eugene Sandulenko | 2013-08-28 10:50:03 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2013-09-06 14:51:21 +0300 |
commit | 7154d1f2cd91e8d1b160bb89ce416edf38679afd (patch) | |
tree | 69099606950c232c82616c83cc30df2f5767a787 /engines/fullpipe | |
parent | 0daaadc604b5ec8ce3be491736b01156c19afca9 (diff) | |
download | scummvm-rg350-7154d1f2cd91e8d1b160bb89ce416edf38679afd.tar.gz scummvm-rg350-7154d1f2cd91e8d1b160bb89ce416edf38679afd.tar.bz2 scummvm-rg350-7154d1f2cd91e8d1b160bb89ce416edf38679afd.zip |
FULLPIPE: More *AtPos functions
Diffstat (limited to 'engines/fullpipe')
-rw-r--r-- | engines/fullpipe/gfx.cpp | 21 | ||||
-rw-r--r-- | engines/fullpipe/gfx.h | 2 | ||||
-rw-r--r-- | engines/fullpipe/scene.cpp | 14 | ||||
-rw-r--r-- | engines/fullpipe/statics.cpp | 59 | ||||
-rw-r--r-- | engines/fullpipe/statics.h | 2 |
5 files changed, 96 insertions, 2 deletions
diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index 3384b87815..b43ea9706d 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -616,6 +616,27 @@ bool Picture::isPixelHitAtPos(int x, int y) { return _bitmap->isPixelHitAtPos(x, y); } +int Picture::getPixelAtPos(int x, int y) { + return getPixelAtPosEx(x / g_fullpipe->_pictureScale, y / g_fullpipe->_pictureScale); + + return false; +} + +int Picture::getPixelAtPosEx(int x, int y) { +#if 0 + if (x < 0 || y < 0) + return 0; + + v5 = ictureScale + this->width - 1; + if ( x < v5 / g_fullpipe->_pictureScale + && (v6 = g_fullpipe->_pictureScale + this_->height - 1, y < v6 / (unsigned __int16)getPictureScale()) + && (v7 = this_->memoryObject2) != 0 + && (v8 = v7->rows) != 0 ) + return = *(_WORD *)&v8[x][2 * y]; +#endif + return 0; +} + bool Bitmap::isPixelHitAtPos(int x, int y) { debug(0, "STUB: Bitmap::isPixelHitAtPos(%d, %d)", x, y); diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h index feb560c06f..640b888636 100644 --- a/engines/fullpipe/gfx.h +++ b/engines/fullpipe/gfx.h @@ -106,6 +106,8 @@ class Picture : public MemoryObject { Common::Point *getDimensions(Common::Point *p); bool isPointInside(int x, int y); bool isPixelHitAtPos(int x, int y); + int getPixelAtPos(int x, int y); + int getPixelAtPosEx(int x, int y); byte *getPaletteData() { return _paletteData; } void setPaletteData(byte *pal); diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index 25d70770f0..47a68118df 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -477,9 +477,19 @@ void Scene::updateScrolling2() { } StaticANIObject *Scene::getStaticANIObjectAtPos(int x, int y) { - warning("STUB: Scene::getStaticANIObjectAtPos(%d, %d)", x, y); + StaticANIObject *res = 0; - return 0; + for (uint i = 0; i < _staticANIObjectList1.size(); i++) { + StaticANIObject *p = (StaticANIObject *)_staticANIObjectList1[i]; + int pixel; + + if ((p->_field_8 & 1) && (p->_flags & 4) && + p->getPixelAtPos(x, y, &pixel) && + (!res || res->_priority >= p->_priority)) + res = p; + } + + return res; } PictureObject *Scene::getPictureObjectAtPos(int x, int y) { diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index 53111e82d4..7e4c1397ac 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -321,6 +321,65 @@ Movement *StaticANIObject::getMovementByName(char *name) { return 0; } +bool StaticANIObject::getPixelAtPos(int x, int y, int *pixel) { + bool res = false; + Picture *pic; + + if (_movement) + pic = _movement->_currDynamicPhase; + else + pic = _statics; + + if (!pic) + return false; + + int ongoing; + int xani, yani; + int oxani, oyani; + Common::Point point; + + if (_movement) + ongoing = _movement->_currMovement != 0; + else + ongoing = _statics->_staticsId & 0x4000; + + if (_movement) { + _movement->getCurrDynamicPhaseXY(point); + xani = point.x; + yani = point.y; + oxani = _movement->_ox; + oyani = _movement->_oy; + } else { + _statics->getSomeXY(point); + xani = point.x; + yani = point.y; + oxani = _ox; + oyani = _oy; + } + + int xtarget = x - (oxani - xani); + int ytarget = y - (oyani - yani); + + if (ongoing && _movement) + xtarget = pic->getDimensions(&point)->x - xtarget; + + x = pic->_x; + y = pic->_y; + pic->_x = 0; + pic->_y = 0; + if (pic->isPixelHitAtPos(xtarget, ytarget)) { + *pixel = pic->getPixelAtPos(xtarget, ytarget); + + res = true; + } else { + res = false; + } + pic->_x = x; + pic->_y = y; + + return res; +} + void Movement::draw(bool flipFlag, int angle) { debug(3, "Movement::draw(%d, %d)", flipFlag, angle); diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h index 95030180c3..9393612d77 100644 --- a/engines/fullpipe/statics.h +++ b/engines/fullpipe/statics.h @@ -230,6 +230,8 @@ class StaticANIObject : public GameObject { MessageQueue *changeStatics1(int msgNum); void changeStatics2(int objId); + + bool getPixelAtPos(int x, int y, int *pixel); }; struct MovTable { |