mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 13:50:13 +00:00
WAGE: Use bounding box for click detection
This commit is contained in:
parent
fe7aa6eefd
commit
0824d1ad58
@ -185,21 +185,18 @@ void Design::render(Graphics::MacPatterns &patterns) {
|
||||
}
|
||||
}
|
||||
|
||||
bool Design::isPointOpaque(int x, int y) {
|
||||
if (_surface == NULL)
|
||||
error("Surface is null");
|
||||
|
||||
byte pixel = ((byte *)_surface->getBasePtr(x, y))[0];
|
||||
|
||||
return pixel != kColorGreen;
|
||||
}
|
||||
|
||||
bool Design::isInBounds(int x, int y) {
|
||||
if (_surface == NULL)
|
||||
error("Surface is null");
|
||||
if (_len == 0)
|
||||
return true;
|
||||
|
||||
Common::MemoryReadStream in(_data, _len);
|
||||
in.skip(4);
|
||||
in.skip(3);
|
||||
int type = in.readByte();
|
||||
|
||||
if (type == 24)
|
||||
in.skip(2);
|
||||
|
||||
int16 y1 = in.readSint16BE();
|
||||
int16 x1 = in.readSint16BE();
|
||||
|
@ -73,7 +73,6 @@ public:
|
||||
}
|
||||
|
||||
void paint(Graphics::ManagedSurface *canvas, Graphics::MacPatterns &patterns, int x, int y);
|
||||
bool isPointOpaque(int x, int y);
|
||||
bool isInBounds(int x, int y);
|
||||
static void drawRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType);
|
||||
static void drawRect(Graphics::ManagedSurface *surface, int x1, int y1, int x2, int y2, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType);
|
||||
|
@ -183,7 +183,6 @@ static const ADGameDescription gameDescriptions[] = {
|
||||
FANGAME("Periapt", "bc36e40de279d5f0844577fe702d9f64", 405750), // alt version
|
||||
FANGAME("Periapt", "661642865321fa81ce84ae2eedbc1aff", 405736), // alt version
|
||||
FANGAME("The Phoenix", "bd6dabf7a19d2ab7902498a8513f8c71", 431387),
|
||||
// Cannot push buttons
|
||||
FANGAMEN("The Phoenix v1.2", "The Phoenix", "fee9f1de7ad9096d084461d6066192b1", 431384),
|
||||
FANGAME("Pirate Attack!", "d4d3f59b57d5bf3dd690fd657ecdd9c6", 323722),
|
||||
FANGAME("Porno Writer", "9d521bf40f6824228266923774aadfea", 467342),
|
||||
|
@ -159,29 +159,13 @@ void Scene::paint(Graphics::ManagedSurface *surface, int x, int y) {
|
||||
Designed *Scene::lookUpEntity(int x, int y) {
|
||||
for (ObjList::const_iterator it = _objs.end(); it != _objs.begin(); ) {
|
||||
it--;
|
||||
// WORKAROUND: Some games don't draw all pixels
|
||||
if (_name == " Introduction" && _resourceId == 18634 ||
|
||||
_name == " Descriptions" && _resourceId == 17079 ||
|
||||
_name == " Descriptions 2" && _resourceId == 17198)
|
||||
if ((*it)->_design->isInBounds(x, y))
|
||||
return *it;
|
||||
|
||||
// WORKAROUND: Some games draw objects on a different surface
|
||||
if (((*it)->_name == "continue" && (*it)->_resourceId == 22259) ||
|
||||
((*it)->_name == "Goth" && (*it)->_resourceId == 18623))
|
||||
if (_design->isPointOpaque(x, y))
|
||||
return *it;
|
||||
|
||||
// WORKAROUND: Twister needs special check to handle intro sequence
|
||||
if ((*it)->_name == "TWIST.CLICK")
|
||||
return *it;
|
||||
if ((*it)->_design->isPointOpaque(x, y))
|
||||
if ((*it)->_design->isInBounds(x, y))
|
||||
return *it;
|
||||
}
|
||||
|
||||
for (ChrList::const_iterator it = _chrs.end(); it != _chrs.begin(); ) {
|
||||
it--;
|
||||
if ((*it)->_design->isPointOpaque(x, y))
|
||||
if ((*it)->_design->isInBounds(x, y))
|
||||
return *it;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user