diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index ad56b46fbcc..7760ba20855 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -63,9 +63,8 @@ Gadget *EventManager::checkGadgetHit(GadgetList *gadgetList, Common::Point pos) for (GadgetList::iterator gadgetItr = gadgetList->begin(); gadgetItr != gadgetList->end(); ++gadgetItr) { Gadget *gadget = *gadgetItr; Common::Rect gadgetRect(gadget->x, gadget->y, gadget->x + gadget->_image->_width - 1, gadget->y + gadget->_image->_height - 1); - bool gadgetIsEnabled = !(gadget->_flags & GADGETOFF); - if (gadgetRect.contains(pos) && gadgetIsEnabled) { + if (gadgetRect.contains(pos) && gadget->isEnabled) { if (_vm->_isHiRes) { _hitGadget = gadget; } else { diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 13cbd1e581f..d041160349b 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -48,6 +48,7 @@ Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image gptr->_keyEquiv = key; gptr->_image = im; gptr->_altImage = imalt; + gptr->isEnabled = true; return gptr; } else @@ -69,7 +70,7 @@ void drawGadgetList(GadgetList *gadgetList) { for (GadgetList::iterator gadget = gadgetList->begin(); gadget != gadgetList->end(); ++gadget) { (*gadget)->_image->drawImage((*gadget)->x, (*gadget)->y); - if (GADGETOFF & (*gadget)->_flags) + if (!(*gadget)->isEnabled) disableGadget((*gadget), 1); } } @@ -79,7 +80,7 @@ void drawGadgetList(GadgetList *gadgetList) { */ void disableGadget(Gadget *curgad, uint16 pencolor) { g_lab->_graphics->overlayRect(pencolor, curgad->x, curgad->y, curgad->x + curgad->_image->_width - 1, curgad->y + curgad->_image->_height - 1); - curgad->_flags |= GADGETOFF; + curgad->isEnabled = false; } /** @@ -87,7 +88,7 @@ void disableGadget(Gadget *curgad, uint16 pencolor) { */ void enableGadget(Gadget *curgad) { curgad->_image->drawImage(curgad->x, curgad->y); - curgad->_flags &= !(GADGETOFF); + curgad->isEnabled = true; } /** @@ -114,7 +115,7 @@ Gadget *LabEngine::checkNumGadgetHit(GadgetList *gadgetList, uint16 key) { Gadget *gadget = *gadgetItr; if ((gkey - 1 == gadget->_gadgetID || (gkey == 0 && gadget->_gadgetID == 9) || (gadget->_keyEquiv != 0 && makeGadgetKeyEquiv(key) == gadget->_keyEquiv)) - && !(GADGETOFF & gadget->_flags)) { + && gadget->isEnabled) { _event->mouseHide(); gadget->_altImage->drawImage(gadget->x, gadget->y); _event->mouseShow(); diff --git a/engines/lab/interface.h b/engines/lab/interface.h index bd9c3c96971..50e89e38f7d 100644 --- a/engines/lab/interface.h +++ b/engines/lab/interface.h @@ -46,13 +46,10 @@ struct IntuiMessage { struct Gadget { uint16 x, y, _gadgetID; uint16 _keyEquiv; // if not zero, a key that activates gadget - uint32 _flags; + bool isEnabled; Image *_image, *_altImage; }; -// Defines for the GadgetFlags portion -#define GADGETOFF 0x01 - typedef Common::List GadgetList; // Defines for the Class variable in IntuiMessage