Skip to content

Commit

Permalink
SLUDGE: check point to non transparent part of a character
Browse files Browse the repository at this point in the history
  • Loading branch information
yinsimei committed Jul 8, 2017
1 parent cfc6647 commit b19911c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions engines/sludge/sprites.cpp
Expand Up @@ -609,8 +609,6 @@ void setDrawMode(onScreenPerson *thisPerson) {
extern GLuint backdropTextureName; extern GLuint backdropTextureName;
#endif #endif


bool checkColourChange(bool reset);

bool scaleSprite(sprite &single, const spritePalette &fontPal, onScreenPerson *thisPerson, bool mirror) { bool scaleSprite(sprite &single, const spritePalette &fontPal, onScreenPerson *thisPerson, bool mirror) {
float x = thisPerson->x; float x = thisPerson->x;
float y = thisPerson->y; float y = thisPerson->y;
Expand Down Expand Up @@ -660,7 +658,15 @@ bool scaleSprite(sprite &single, const spritePalette &fontPal, onScreenPerson *t
if (input.mouseX >= x1 && input.mouseX <= x2 && input.mouseY >= y1 && input.mouseY <= y2) { if (input.mouseX >= x1 && input.mouseX <= x2 && input.mouseY >= y1 && input.mouseY <= y2) {
if (thisPerson->extra & EXTRA_RECTANGULAR) if (thisPerson->extra & EXTRA_RECTANGULAR)
return true; return true;
return true;
// check if point to non transparent part
int pixelx = (int)(single.surface.w * (input.mouseX - x1) / (x2 - x1));
int pixely = (int)(single.surface.h * (input.mouseY - y1) / (y2 - y1));
uint32 *colorPtr = (uint32 *)single.surface.getBasePtr(pixelx, pixely);

uint8 a, r, g, b;
g_sludge->getScreenPixelFormat()->colorToARGB(*colorPtr, a, r, g, b);
return a != 0;
} }
return false; return false;


Expand Down

0 comments on commit b19911c

Please sign in to comment.