From b5a77c93930cac9532eab4bb7a777424c7639e21 Mon Sep 17 00:00:00 2001 From: yinsimei Date: Tue, 4 Jul 2017 17:09:46 +0200 Subject: SLUDGE: check point to non transparent part of a character --- engines/sludge/sprites.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'engines/sludge') diff --git a/engines/sludge/sprites.cpp b/engines/sludge/sprites.cpp index 161cb6237b..6d51b8fd83 100644 --- a/engines/sludge/sprites.cpp +++ b/engines/sludge/sprites.cpp @@ -609,8 +609,6 @@ void setDrawMode(onScreenPerson *thisPerson) { extern GLuint backdropTextureName; #endif -bool checkColourChange(bool reset); - bool scaleSprite(sprite &single, const spritePalette &fontPal, onScreenPerson *thisPerson, bool mirror) { float x = thisPerson->x; float y = thisPerson->y; @@ -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 (thisPerson->extra & EXTRA_RECTANGULAR) 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; -- cgit v1.2.3