From 5dddde199fef11650f635c666dd797df011fcdb3 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 7 Sep 2016 10:36:51 +0200 Subject: FULLPIPE: Further work on the hangers in scene09 --- engines/fullpipe/gfx.cpp | 3 +++ engines/fullpipe/scenes/scene09.cpp | 8 ++++---- engines/fullpipe/statics.cpp | 6 +++++- engines/fullpipe/statics.h | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index 547b6cf5db..de0faf071e 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -749,6 +749,9 @@ int Picture::getPixelAtPosEx(int x, int y) { if (x < 0 || y < 0) return 0; + warning("STUB: Picture::getPixelAtPosEx(%d, %d)", x, y); + + // It looks like this doesn't really work. TODO. FIXME if (x < (g_fp->_pictureScale + _width - 1) / g_fp->_pictureScale && y < (g_fp->_pictureScale + _height - 1) / g_fp->_pictureScale && _memoryObject2 != 0 && _memoryObject2->_rows != 0) diff --git a/engines/fullpipe/scenes/scene09.cpp b/engines/fullpipe/scenes/scene09.cpp index f9cf58d9df..aaa430d077 100644 --- a/engines/fullpipe/scenes/scene09.cpp +++ b/engines/fullpipe/scenes/scene09.cpp @@ -365,19 +365,19 @@ void sceneHandler09_checkHangerCollide() { } LABEL_11: - int pixel; + bool hit; for (int i = 0; i < g_vars->scene09_numMovingHangers; i++) { for (int j = 0; j < 4; j++) { - g_vars->scene09_hangers[i]->ani->getPixelAtPos(newx + g_vars->scene09_hangerOffsets[j].x, ball->_oy + g_vars->scene09_hangerOffsets[j].y, &pixel); + hit = g_vars->scene09_hangers[i]->ani->getPixelAtPos(newx + g_vars->scene09_hangerOffsets[j].x, ball->_oy + g_vars->scene09_hangerOffsets[j].y, 0, true); - if (pixel) { + if (hit) { sceneHandler09_ballExplode(b); break; } } - if (pixel) + if (hit) break; } } diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index 1d88b3bf5d..a1f91bc9db 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -458,7 +458,7 @@ Movement *StaticANIObject::getMovementByName(char *name) { return 0; } -bool StaticANIObject::getPixelAtPos(int x, int y, int *pixel) { +bool StaticANIObject::getPixelAtPos(int x, int y, int *pixel, bool hitOnly) { bool res = false; Picture *pic; @@ -504,6 +504,10 @@ bool StaticANIObject::getPixelAtPos(int x, int y, int *pixel) { y = pic->_y; pic->_x = 0; pic->_y = 0; + + if (hitOnly) + return pic->isPixelHitAtPos(xtarget, ytarget); + if (pic->isPixelHitAtPos(xtarget, ytarget)) { *pixel = pic->getPixelAtPos(xtarget, ytarget); diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h index c7baac7502..5082d501b3 100644 --- a/engines/fullpipe/statics.h +++ b/engines/fullpipe/statics.h @@ -257,7 +257,7 @@ public: MessageQueue *changeStatics1(int msgNum); void changeStatics2(int objId); - bool getPixelAtPos(int x, int y, int *pixel); + bool getPixelAtPos(int x, int y, int *pixel, bool hitOnly = false); }; struct MovTable { -- cgit v1.2.3