Skip to content

Commit

Permalink
FULLPIPE: Further work on the hangers in scene09
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Sep 7, 2016
1 parent b4153be commit 5dddde1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
3 changes: 3 additions & 0 deletions engines/fullpipe/gfx.cpp
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions engines/fullpipe/scenes/scene09.cpp
Expand Up @@ -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;
}
}
Expand Down
6 changes: 5 additions & 1 deletion engines/fullpipe/statics.cpp
Expand Up @@ -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;

Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion engines/fullpipe/statics.h
Expand Up @@ -257,7 +257,7 @@ class StaticANIObject : public GameObject {
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 {
Expand Down

0 comments on commit 5dddde1

Please sign in to comment.