diff --git a/engines/saga2/automap.cpp b/engines/saga2/automap.cpp index cb267534df1..a04da31ef65 100644 --- a/engines/saga2/automap.cpp +++ b/engines/saga2/automap.cpp @@ -235,7 +235,7 @@ void AutoMap::locateRegion() { // deactivation void AutoMap::deactivate() { - selected = 0; + _selected = 0; gPanel::deactivate(); } @@ -244,7 +244,7 @@ void AutoMap::deactivate() { bool AutoMap::activate(gEventType why) { if (why == gEventMouseDown) { // momentarily depress - selected = 1; + _selected = 1; notify(why, 0); // notify App of successful hit return true; } @@ -253,7 +253,7 @@ bool AutoMap::activate(gEventType why) { bool AutoMap::keyStroke(gPanelMessage &msg) { gEvent ev; - switch (msg.key) { + switch (msg._key) { case Common::ASCII_ESCAPE: cmdAutoMapEsc(ev); return true; @@ -292,7 +292,7 @@ gPanel *AutoMap::keyTest(int16 key) { // ------------------------------------------------------------------------ // mouse movement event handler void AutoMap::pointerMove(gPanelMessage &msg) { - Point16 pos = msg.pickAbsPos; + Point16 pos = msg._pickAbsPos; if (Rect16(_extent.x, _extent.y, _extent.width, _extent.height).ptInside(pos)) { // mouse hit inside autoMap @@ -315,7 +315,7 @@ void AutoMap::pointerMove(gPanelMessage &msg) { // mouse click event handler bool AutoMap::pointerHit(gPanelMessage &msg) { - Point16 pos = msg.pickAbsPos; + Point16 pos = msg._pickAbsPos; if (Rect16(0, 0, _extent.width, _extent.height).ptInside(pos)) { // mouse hit inside autoMap @@ -346,13 +346,13 @@ bool AutoMap::pointerHit(gPanelMessage &msg) { win = getWindow(); // get the window pointer if (win) - ri = (requestInfo *)win->userData; + ri = (requestInfo *)win->_userData; else ri = nullptr; if (ri) { ri->running = 0; - ri->result = id; + ri->result = _id; } } @@ -364,7 +364,7 @@ bool AutoMap::pointerHit(gPanelMessage &msg) { // mouse drag event handler void AutoMap::pointerDrag(gPanelMessage &) { - if (selected) { + if (_selected) { notify(gEventMouseDrag, 0); } } @@ -373,7 +373,7 @@ void AutoMap::pointerDrag(gPanelMessage &) { // mouse click release event handler void AutoMap::pointerRelease(gPanelMessage &) { - if (selected) notify(gEventMouseUp, 0); // notify App of successful hit + if (_selected) notify(gEventMouseUp, 0); // notify App of successful hit deactivate(); } @@ -568,7 +568,7 @@ int16 openAutoMap() { decRes, 'M', 'A', 'P'); // attach the structure to the book - pAutoMap->userData = &rInfo; + pAutoMap->_userData = &rInfo; // locate where the center actor is, and open the map pAutoMap->locateRegion(); @@ -600,11 +600,11 @@ APPFUNC(cmdAutoMapQuit) { if (ev.panel && ev.eventType == gEventNewValue && ev.value) { win = ev.panel->getWindow(); // get the window pointer - ri = win ? (requestInfo *)win->userData : nullptr; + ri = win ? (requestInfo *)win->_userData : nullptr; if (ri) { ri->running = 0; - ri->result = ev.panel->id; + ri->result = ev.panel->_id; } } } @@ -647,7 +647,7 @@ APPFUNC(cmdAutoMapAppFunc) { } APPFUNCV(AutoMap::cmdAutoMapEsc) { - requestInfo *ri = (requestInfo *) userData; + requestInfo *ri = (requestInfo *)_userData; if (ri) { ri->running = 0; ri->result = 0; diff --git a/engines/saga2/button.cpp b/engines/saga2/button.cpp index 4b27ca9aebe..d19eef9d57f 100644 --- a/engines/saga2/button.cpp +++ b/engines/saga2/button.cpp @@ -110,7 +110,7 @@ GfxCompImage::GfxCompImage(gPanelList &list, const Rect16 &box, void *image, con _compImages[0] = image; _max = 0; _numPtrAlloc = 1; - title = text; + _title = text; _textFont = &Onyx10Font; // >>> this should be dynamic _textPal = pal; } @@ -143,7 +143,7 @@ GfxCompImage::GfxCompImage(gPanelList &list, const Rect16 &box, void **images, _currentImage = clamp(_min, initial, _max); } - title = text; + _title = text; _textFont = &Onyx10Font; // >>> this should be dynamic _textPal = pal; } @@ -161,7 +161,7 @@ GfxCompImage::GfxCompImage(gPanelList &list, const StaticRect &box, void **image _currentImage = clamp(_min, initial, _max); } - title = text; + _title = text; _textFont = &Onyx10Font; // >>> this should be dynamic _textPal = pal; } @@ -191,7 +191,7 @@ void GfxCompImage::pointerMove(gPanelMessage &msg) { // call the superclass's pointerMove gControl::pointerMove(msg); - notify(gEventMouseMove, (msg.pointerEnter ? enter : 0) | (msg.pointerLeave ? leave : 0)); + notify(gEventMouseMove, (msg._pointerEnter ? enter : 0) | (msg._pointerLeave ? leave : 0)); } void GfxCompImage::enable(bool abled) { @@ -199,12 +199,12 @@ void GfxCompImage::enable(bool abled) { } void GfxCompImage::invalidate(Rect16 *) { - window.update(_extent); + _window.update(_extent); } void GfxCompImage::draw() { - gPort &port = window.windowPort; - Rect16 rect = window.getExtent(); + gPort &port = _window._windowPort; + Rect16 rect = _window.getExtent(); SAVE_GPORT_STATE(port); // save pen color, etc. g_vm->_pointer->hide(port, _extent); // hide mouse pointer @@ -241,7 +241,7 @@ void GfxCompImage::select(uint16 val) { setCurrent(val); if (getEnabled()) { - window.update(_extent); + _window.update(_extent); } } @@ -280,12 +280,12 @@ void GfxCompImage::drawClipped(gPort &port, else drawCompressedImage(port, pos, dispImage); // this could be modified to get the current text coloring - if (title) { + if (_title) { Rect16 textRect = _extent; textRect.x -= offset.x; textRect.y -= offset.y; - writePlaqText(port, textRect, _textFont, 0, _textPal, selected, title); + writePlaqText(port, textRect, _textFont, 0, _textPal, _selected, _title); } } } @@ -520,19 +520,19 @@ void GfxCompButton::dim(bool enableFlag) { _dimmed = false; } - window.update(_extent); + _window.update(_extent); } void GfxCompButton::deactivate() { - selected = 0; - window.update(_extent); + _selected = 0; + _window.update(_extent); gPanel::deactivate(); } bool GfxCompButton::activate(gEventType why) { - selected = 1; - window.update(_extent); + _selected = 1; + _window.update(_extent); if (why == gEventKeyDown) { // momentarily depress deactivate(); @@ -561,16 +561,16 @@ bool GfxCompButton::pointerHit(gPanelMessage &) { void GfxCompButton::pointerRelease(gPanelMessage &) { // We have to test selected first because deactivate clears it. - if (selected) { + if (_selected) { deactivate(); // give back input focus notify(gEventNewValue, 1); // notify App of successful hit } else deactivate(); } void GfxCompButton::pointerDrag(gPanelMessage &msg) { - if (selected != msg.inPanel) { - selected = msg.inPanel; - window.update(_extent); + if (_selected != msg._inPanel) { + _selected = msg._inPanel; + _window.update(_extent); } } @@ -579,13 +579,13 @@ void GfxCompButton::enable(bool abled) { } void GfxCompButton::invalidate(Rect16 *) { - window.update(_extent); + _window.update(_extent); } void GfxCompButton::draw() { - gPort &port = window.windowPort; - Rect16 rect = window.getExtent(); + gPort &port = _window._windowPort; + Rect16 rect = _window.getExtent(); SAVE_GPORT_STATE(port); // save pen color, etc. g_vm->_pointer->hide(port, _extent); // hide mouse pointer @@ -596,7 +596,7 @@ void GfxCompButton::draw() { void *GfxCompButton::getCurrentCompImage() { if (_dimmed) { return _dimImage; - } else if (selected) { + } else if (_selected) { return _resImage; } else { return _forImage; @@ -618,7 +618,7 @@ bool GfxOwnerSelCompButton::activate(gEventType why) { // selected = !selected; // window.update( extent ); gPanel::deactivate(); - notify(gEventNewValue, selected); // notify App of successful hit + notify(gEventNewValue, _selected); // notify App of successful hit playMemSound(2); } return false; @@ -629,12 +629,12 @@ bool GfxOwnerSelCompButton::pointerHit(gPanelMessage &) { } void GfxOwnerSelCompButton::select(uint16 val) { - selected = val; + _selected = val; setCurrent(val); if (getEnabled()) { - window.update(_extent); + _window.update(_extent); } } @@ -728,7 +728,7 @@ bool GfxMultCompButton::activate(gEventType why) { if (++_current > _max) { _current = 0; } - window.update(_extent); + _window.update(_extent); } gPanel::deactivate(); @@ -805,7 +805,7 @@ int16 GfxSlider::getSliderLenVal() { } void GfxSlider::draw() { - gPort &port = window.windowPort; + gPort &port = _window._windowPort; Point16 offset = Point16(0, 0); SAVE_GPORT_STATE(port); // save pen color, etc. @@ -838,8 +838,8 @@ void GfxSlider::drawClipped(gPort &port, bool GfxSlider::activate(gEventType why) { if (why == gEventKeyDown || why == gEventMouseDown) { - selected = 1; - window.update(_extent); + _selected = 1; + _window.update(_extent); gPanel::deactivate(); notify(gEventNewValue, _slCurrent); // notify App of successful hit } @@ -847,29 +847,29 @@ bool GfxSlider::activate(gEventType why) { } void GfxSlider::deactivate() { - selected = 0; - window.update(_extent); + _selected = 0; + _window.update(_extent); gPanel::deactivate(); } bool GfxSlider::pointerHit(gPanelMessage &msg) { // update the image index - updateSliderIndexes(msg.pickPos); + updateSliderIndexes(msg._pickPos); // redraw the control should any visual change hath occurred - window.update(_extent); + _window.update(_extent); activate(gEventMouseDown); return true; } void GfxSlider::pointerMove(gPanelMessage &msg) { - if (selected) { + if (_selected) { // update the image index - updateSliderIndexes(msg.pickPos); + updateSliderIndexes(msg._pickPos); // redraw the control should any visual change hath occurred - window.update(_extent); + _window.update(_extent); notify(gEventMouseMove, _slCurrent); } @@ -877,7 +877,7 @@ void GfxSlider::pointerMove(gPanelMessage &msg) { void GfxSlider::pointerRelease(gPanelMessage &) { // We have to test selected first because deactivate clears it. - if (selected) { + if (_selected) { deactivate(); // give back input focus notify(gEventNewValue, _slCurrent); // notify App of successful hit } else deactivate(); @@ -885,11 +885,11 @@ void GfxSlider::pointerRelease(gPanelMessage &) { void GfxSlider::pointerDrag(gPanelMessage &msg) { // update the image index - updateSliderIndexes(msg.pickPos); + updateSliderIndexes(msg._pickPos); notify(gEventNewValue, _slCurrent); // notify App of successful hit // redraw the control should any visual change hath occurred - window.update(_extent); + _window.update(_extent); } void GfxSlider::updateSliderIndexes(Point16 &pos) { diff --git a/engines/saga2/contain.cpp b/engines/saga2/contain.cpp index d68d7ec0c20..134aa1661b1 100644 --- a/engines/saga2/contain.cpp +++ b/engines/saga2/contain.cpp @@ -527,7 +527,7 @@ void ContainerView::deactivate() { } void ContainerView::pointerMove(gPanelMessage &msg) { - if (msg.pointerLeave) { + if (msg._pointerLeave) { g_vm->_cnm->_lastPickedObjectID = Nothing; g_vm->_cnm->_lastPickedObjectQuantity = -1; g_vm->_mouseInfo->setText(nullptr); @@ -557,7 +557,7 @@ void ContainerView::pointerMove(gPanelMessage &msg) { } // Determine if mouse is pointing at a new object - updateMouseText(msg.pickPos); + updateMouseText(msg._pickPos); } } @@ -566,13 +566,13 @@ bool ContainerView::pointerHit(gPanelMessage &msg) { GameObject *slotObject; uint16 mouseSet; - slotObject = pickObject(msg.pickPos); + slotObject = pickObject(msg._pickPos); mouseObject = g_vm->_mouseInfo->getObject(); mouseSet = mouseObject ? mouseObject->containmentSet() : 0; if (!g_vm->_mouseInfo->getDoable()) return false; - if (msg.doubleClick && !g_vm->_cnm->_alreadyDone) { + if (msg._doubleClick && !g_vm->_cnm->_alreadyDone) { dblClick(mouseObject, slotObject, msg); } else { // single click if (mouseObject != nullptr) { @@ -615,7 +615,7 @@ bool ContainerView::pointerHit(gPanelMessage &msg) { // total the mass and bulk of all the objects in this container totalObjects(); - window.update(_extent); + _window.update(_extent); return activate(gEventMouseDown); } @@ -638,7 +638,7 @@ void ContainerView::timerTick(gPanelMessage &msg) { // validate objToGet and make sure that the number selected for move // is less then or equal to the number of items present in the merged object if (g_vm->_cnm->_objToGet && g_vm->_cnm->_amountIndY != -1) { - int32 rate = (g_vm->_cnm->_amountIndY - msg.pickAbsPos.y); + int32 rate = (g_vm->_cnm->_amountIndY - msg._pickAbsPos.y); rate = rate * ((rate > 0) ? rate : -rate); @@ -732,7 +732,7 @@ void ContainerView::dropPhysical( // test to check if item is accepted by container if (_containerObject->canContain(mObj->thisID())) { Actor *centerActor = getCenterActor(); - Location loc(pickObjectSlot(msg.pickPos), + Location loc(pickObjectSlot(msg._pickPos), _containerObject->thisID()); // check if no object in the current slot @@ -784,7 +784,7 @@ void ContainerView::useConcept( // If there is no object already in this slot drop the // mouse object here - Location loc(pickObjectSlot(msg.pickPos), + Location loc(pickObjectSlot(msg._pickPos), _containerObject->thisID()); mObj->drop(centerActorID, loc); @@ -1147,7 +1147,7 @@ TangibleContainerWindow::TangibleContainerWindow( // set the userdata such that we can extract the container object later // through an appfunc. - this->userData = _view->_containerObject; + this->_userData = _view->_containerObject; _massWeightIndicator = new CMassWeightIndicator( this, diff --git a/engines/saga2/document.cpp b/engines/saga2/document.cpp index e03d25209f5..103430509bc 100644 --- a/engines/saga2/document.cpp +++ b/engines/saga2/document.cpp @@ -223,13 +223,13 @@ CDocument::~CDocument() { } void CDocument::deactivate() { - selected = 0; + _selected = 0; gPanel::deactivate(); } bool CDocument::activate(gEventType why) { if (why == gEventMouseDown) { // momentarily depress - selected = 1; + _selected = 1; notify(why, 0); // notify App of successful hit return true; } @@ -238,7 +238,7 @@ bool CDocument::activate(gEventType why) { bool CDocument::keyStroke(gPanelMessage &msg) { gEvent ev; - switch (msg.key) { + switch (msg._key) { case Common::ASCII_ESCAPE: cmdDocumentEsc(ev); return true; @@ -276,9 +276,9 @@ gPanel *CDocument::keyTest(int16 key) { // Cursor images for turning book pages void CDocument::pointerMove(gPanelMessage &msg) { - Point16 pos = msg.pickPos; + Point16 pos = msg._pickPos; - if (msg.inPanel && Rect16(0, 0, _extent.width, _extent.height).ptInside(pos)) { + if (msg._inPanel && Rect16(0, 0, _extent.width, _extent.height).ptInside(pos)) { if (_app.orientation == pageOrientVertical) { // find out which end of the book we're on if (pos.y < _extent.height / 2) setMouseImage(kMousePgUpImage, -7, -7); @@ -288,7 +288,7 @@ void CDocument::pointerMove(gPanelMessage &msg) { if (pos.x < _extent.width / 2) setMouseImage(kMousePgLeftImage, -7, -7); else setMouseImage(kMousePgRightImage, -7, -7); } - } else if (msg.pointerLeave) { + } else if (msg._pointerLeave) { setMouseImage(kMouseArrowImage, 0, 0); } @@ -296,15 +296,15 @@ void CDocument::pointerMove(gPanelMessage &msg) { } void CDocument::pointerDrag(gPanelMessage &) { - if (selected) { + if (_selected) { notify(gEventMouseDrag, 0); } } bool CDocument::pointerHit(gPanelMessage &msg) { - Point16 pos = msg.pickPos; + Point16 pos = msg._pickPos; - if (msg.inPanel && Rect16(0, 0, _extent.width, _extent.height).ptInside(pos)) { + if (msg._inPanel && Rect16(0, 0, _extent.width, _extent.height).ptInside(pos)) { gEvent ev; if (_app.orientation == pageOrientVertical) { // find out which end of the book we're on @@ -321,11 +321,11 @@ bool CDocument::pointerHit(gPanelMessage &msg) { requestInfo *ri; win = getWindow(); // get the window pointer - ri = win ? (requestInfo *)win->userData : nullptr; + ri = win ? (requestInfo *)win->_userData : nullptr; if (ri) { ri->running = 0; - ri->result = id; + ri->result = _id; setMouseImage(kMouseArrowImage, 0, 0); } @@ -347,7 +347,7 @@ void CDocument::gotoPage(int8 page) { } void CDocument::pointerRelease(gPanelMessage &) { - if (selected) notify(gEventMouseUp, 0); // notify App of successful hit + if (_selected) notify(gEventMouseUp, 0); // notify App of successful hit deactivate(); } @@ -548,7 +548,7 @@ void CDocument::makePages() { // This function will draw the text onto the book. void CDocument::renderText() { gPort tPort; - gPort &port = window.windowPort; + gPort &port = _window._windowPort; uint16 pageIndex; uint16 lineIndex; uint16 linesPerPage = _pageHeight / (_textHeight + 1); @@ -748,10 +748,10 @@ int16 openScroll(uint16 textScript) { // make the quit button closeScroll = new GfxCompButton(*win, scrollAppearance.closeRect, closeBtnImage, numBtnImages, 0, cmdDocumentQuit); - closeScroll->accelKey = 0x1B; + closeScroll->_accelKey = 0x1B; // attach the structure to the book, open the book - win->userData = &rInfo; + win->_userData = &rInfo; win->open(); // do stuff @@ -799,10 +799,10 @@ int16 openBook(uint16 textScript) { // make the quit button closeBook = new GfxCompButton(*win, bookAppearance.closeRect, cmdDocumentQuit); - closeBook->accelKey = 0x1B; + closeBook->_accelKey = 0x1B; // attach the structure to the book, open the book - win->userData = &rInfo; + win->_userData = &rInfo; win->open(); // do stuff @@ -844,10 +844,10 @@ int16 openParchment(uint16 textScript) { win = new CDocument(parchAppearance, bookText, &Script10Font, 0, nullptr); // make the quit button closeParchment = new GfxCompButton(*win, parchAppearance.closeRect, cmdDocumentQuit); - closeParchment->accelKey = 0x1B; + closeParchment->_accelKey = 0x1B; // attach the structure to the book, open the book - win->userData = &rInfo; + win->_userData = &rInfo; win->open(); // do stuff @@ -869,17 +869,17 @@ APPFUNC(cmdDocumentQuit) { if (ev.panel && ev.eventType == gEventNewValue && ev.value) { win = ev.panel->getWindow(); // get the window pointer - ri = win ? (requestInfo *)win->userData : nullptr; + ri = win ? (requestInfo *)win->_userData : nullptr; if (ri) { ri->running = 0; - ri->result = ev.panel->id; + ri->result = ev.panel->_id; } } } APPFUNCV(CDocument::cmdDocumentEsc) { - requestInfo *ri = (requestInfo *) userData; + requestInfo *ri = (requestInfo *)_userData; if (ri) { ri->running = 0; ri->result = 0; diff --git a/engines/saga2/floating.cpp b/engines/saga2/floating.cpp index fc5e05caa98..51e2ba41a3a 100644 --- a/engines/saga2/floating.cpp +++ b/engines/saga2/floating.cpp @@ -296,12 +296,12 @@ BackWindow::BackWindow(const Rect16 &r, uint16 ident, AppFunc *cmd) void BackWindow::invalidate(Rect16 *area) { if (displayEnabled()) - window.update(*area); + _window.update(*area); } void BackWindow::invalidate(const StaticRect *area) { if (displayEnabled()) - window.update(*area); + _window.update(*area); } // Return true if window floats above animated are @@ -336,11 +336,11 @@ void DragBar::deactivate() { } bool DragBar::pointerHit(gPanelMessage &msg) { - Rect16 wExtent = window.getExtent(); + Rect16 wExtent = _window.getExtent(); _dragPos.x = wExtent.x; _dragPos.y = wExtent.y; - _dragOffset.set(msg.pickAbsPos.x, msg.pickAbsPos.y); + _dragOffset.set(msg._pickAbsPos.x, msg._pickAbsPos.y); return true; } @@ -349,20 +349,20 @@ bool DragBar::pointerHit(gPanelMessage &msg) { // be dragged... void DragBar::pointerDrag(gPanelMessage &msg) { - Rect16 ext = window.getExtent(); + Rect16 ext = _window.getExtent(); Point16 pos; // Calculate new window position - pos.x = msg.pickAbsPos.x + ext.x - _dragOffset.x; - pos.y = msg.pickAbsPos.y + ext.y - _dragOffset.y; + pos.x = msg._pickAbsPos.x + ext.x - _dragOffset.x; + pos.y = msg._pickAbsPos.y + ext.y - _dragOffset.y; // If window position has changed, then signal the drawing loop if (pos != _dragPos) { _dragPos.set(pos.x, pos.y); _update = true; - _dragWindow = (FloatingWindow *)&window; + _dragWindow = (FloatingWindow *)&_window; } } @@ -378,13 +378,13 @@ void DragBar::pointerRelease(gPanelMessage &) { * ===================================================================== */ void gButton::deactivate() { - selected = 0; + _selected = 0; draw(); gPanel::deactivate(); } bool gButton::activate(gEventType why) { - selected = 1; + _selected = 1; draw(); if (why == gEventKeyDown) { // momentarily depress @@ -402,22 +402,22 @@ bool gButton::pointerHit(gPanelMessage &) { void gButton::pointerRelease(gPanelMessage &) { // We have to test selected first because deactivate clears it. - if (selected) { + if (_selected) { deactivate(); // give back input focus notify(gEventNewValue, 1); // notify App of successful hit } else deactivate(); } void gButton::pointerDrag(gPanelMessage &msg) { - if (selected != msg.inPanel) { - selected = msg.inPanel; + if (_selected != msg._inPanel) { + _selected = msg._inPanel; draw(); } } void gButton::draw() { - gPort &port = window.windowPort; - Rect16 rect = window.getExtent(); + gPort &port = _window._windowPort; + Rect16 rect = _window.getExtent(); g_vm->_pointer->hide(port, _extent); // hide mouse pointer if (displayEnabled()) @@ -431,7 +431,7 @@ void gButton::draw() { * ===================================================================== */ void gImageButton::drawClipped(gPort &port, const Point16 &offset, const Rect16 &r) { - gPixelMap *currentImage = selected ? _selImage : _deselImage; + gPixelMap *currentImage = _selected ? _selImage : _deselImage; if (displayEnabled()) if (_extent.overlap(r)) @@ -450,10 +450,10 @@ void gImageButton::drawClipped(gPort &port, const Point16 &offset, const Rect16 bool gToggleButton::activate(gEventType why) { if (why == gEventKeyDown || why == gEventMouseDown) { - selected = !selected; + _selected = !_selected; draw(); gPanel::deactivate(); - notify(gEventNewValue, selected); // notify App of successful hit + notify(gEventNewValue, _selected); // notify App of successful hit } return false; } @@ -482,8 +482,8 @@ LabeledButton::LabeledButton(gPanelList &list, cmd) { const char *underscore; - if ((underscore = strchr(title, '_')) != nullptr) - accelKey = toupper(underscore[1]); + if ((underscore = strchr(_title, '_')) != nullptr) + _accelKey = toupper(underscore[1]); } void LabeledButton::drawClipped( @@ -508,14 +508,14 @@ void LabeledButton::drawClipped( gImageButton::drawClipped(port, offset, r); textOrigin.x = origin.x + ((_extent.width - - TextWidth(textFont, title, -1, textStyleUnderBar)) >> 1); + TextWidth(textFont, _title, -1, textStyleUnderBar)) >> 1); textOrigin.y = origin.y + ((_extent.height - textFont->height) >> 1); port.setColor(2); port.moveTo(textOrigin); port.setFont(textFont); port.setStyle(textStyleUnderBar); - port.drawText(title, -1); + port.drawText(_title, -1); } diff --git a/engines/saga2/grequest.cpp b/engines/saga2/grequest.cpp index 3213ff852df..42d6a30e9a1 100644 --- a/engines/saga2/grequest.cpp +++ b/engines/saga2/grequest.cpp @@ -65,11 +65,11 @@ static void handleRequestEvent(gEvent &ev) { if (ev.panel && ev.eventType == gEventNewValue && ev.value) { win = ev.panel->getWindow(); // get the window pointer - ri = win ? (requestInfo *)win->userData : nullptr; + ri = win ? (requestInfo *)win->_userData : nullptr; if (ri) { ri->running = 0; - ri->result = ev.panel->id; + ri->result = ev.panel->_id; } } } @@ -321,12 +321,12 @@ public: }; void ModalDisplayWindow::pointerRelease(gPanelMessage &) { - requestInfo *ri = (requestInfo *)userData; + requestInfo *ri = (requestInfo *)_userData; if (ri) ri->running = false; } bool ModalDisplayWindow::keyStroke(gPanelMessage &) { - requestInfo *ri = (requestInfo *)userData; + requestInfo *ri = (requestInfo *)_userData; if (ri) ri->running = false; return true; } @@ -363,7 +363,7 @@ int16 GameDialogA( error("Unable to open requester window."); } - win->userData = &rInfo; + win->_userData = &rInfo; win->open(); EventLoop(rInfo.running, false); @@ -415,7 +415,7 @@ int16 GameDisplayA( error("Unable to open requester window."); } - win->userData = &rInfo; + win->_userData = &rInfo; win->open(); EventLoop(rInfo.running, false); diff --git a/engines/saga2/gtextbox.cpp b/engines/saga2/gtextbox.cpp index ba300bbebc5..e1d36d77b75 100644 --- a/engines/saga2/gtextbox.cpp +++ b/engines/saga2/gtextbox.cpp @@ -199,7 +199,7 @@ gTextBox::gTextBox( _onEnter = cmdEnter; _onEscape = cmdEscape; _isActiveCtl = false; - selected = 0; + _selected = 0; _parent = &list; _blinkStart = 0; @@ -231,7 +231,7 @@ gTextBox::gTextBox( gTextBox::~gTextBox() { deSelect(); - selected = 0; + _selected = 0; if (_undoBuffer) { delete[] _undoBuffer; } @@ -331,7 +331,7 @@ void gTextBox::setText(char *newText) { insertText(newText, len); _cursorPos = _anchorPos = 0; - if (window.isOpen()) drawContents(); + if (_window.isOpen()) drawContents(); } //----------------------------------------------------------------------- @@ -348,15 +348,15 @@ void gTextBox::setEditExtent(const Rect16 &r) { bool gTextBox::activate(gEventType why) { if (why == gEventAltValue) { // momentarily depress - selected = 1; + _selected = 1; notify(why, 0); // notify App of successful hit return true; } _isActiveCtl = true; - if (!selected) { + if (!_selected) { enSelect(_index); } - selected = 1; + _selected = 1; _fullRedraw = true; draw(); if (why == gEventNone) @@ -367,7 +367,7 @@ bool gTextBox::activate(gEventType why) { //----------------------------------------------------------------------- void gTextBox::deactivate() { - selected = 0; + _selected = 0; _isActiveCtl = false; draw(); _fullRedraw = true; @@ -563,7 +563,7 @@ void gTextBox::scrollDown() { //----------------------------------------------------------------------- bool gTextBox::pointerHit(gPanelMessage &msg) { - Point16 pos = msg.pickPos; + Point16 pos = msg._pickPos; int16 newPos; @@ -577,11 +577,11 @@ bool gTextBox::pointerHit(gPanelMessage &msg) { reSelect(newIndex); if (_editing) { if (_textFont) { - newPos = WhichIChar(_textFont, (uint8 *)_fieldStrings[_index], msg.pickPos.x - 3, _currentLen[_index]); + newPos = WhichIChar(_textFont, (uint8 *)_fieldStrings[_index], msg._pickPos.x - 3, _currentLen[_index]); } else { - newPos = WhichIChar(mainFont, (uint8 *)_fieldStrings[_index], msg.pickPos.x - 3, _currentLen[_index]); + newPos = WhichIChar(mainFont, (uint8 *)_fieldStrings[_index], msg._pickPos.x - 3, _currentLen[_index]); } - if (msg.leftButton) { + if (msg._leftButton) { if (_cursorPos != newPos || _anchorPos != newPos) { _anchorPos = newPos; _cursorPos = newPos; @@ -605,11 +605,11 @@ bool gTextBox::pointerHit(gPanelMessage &msg) { void gTextBox::pointerDrag(gPanelMessage &msg) { int16 newPos; - if (msg.leftButton) { + if (msg._leftButton) { if (_textFont) { - newPos = WhichIChar(_textFont, (uint8 *)_fieldStrings[_index], msg.pickPos.x - 3, _currentLen[_index]); + newPos = WhichIChar(_textFont, (uint8 *)_fieldStrings[_index], msg._pickPos.x - 3, _currentLen[_index]); } else { - newPos = WhichIChar(mainFont, (uint8 *)_fieldStrings[_index], msg.pickPos.x - 3, _currentLen[_index]); + newPos = WhichIChar(mainFont, (uint8 *)_fieldStrings[_index], msg._pickPos.x - 3, _currentLen[_index]); } _inDrag = true; if (_cursorPos != newPos) { @@ -628,7 +628,7 @@ void gTextBox::pointerDrag(gPanelMessage &msg) { // Mouse release code void gTextBox::pointerRelease(gPanelMessage &msg) { - if (!msg.leftButton) { + if (!msg._leftButton) { _inDrag = false; draw(); } @@ -638,10 +638,10 @@ void gTextBox::pointerRelease(gPanelMessage &msg) { bool gTextBox::keyStroke(gPanelMessage &msg) { - gPort &port = window.windowPort; + gPort &port = _window._windowPort; int16 selStart = MIN(_cursorPos, _anchorPos), selWidth = ABS(_cursorPos - _anchorPos); - uint16 key = msg.key; + uint16 key = msg._key; // Process the various keystrokes... if (_editing && _cursorPos > _anchorPos) { @@ -703,14 +703,14 @@ bool gTextBox::keyStroke(gPanelMessage &msg) { case Common::KEYCODE_LEFT: if (_anchorPos > 0) _anchorPos--; - if (!(msg.qualifier & qualifierShift)) + if (!(msg._qualifier & qualifierShift)) _cursorPos = _anchorPos; break; case Common::KEYCODE_RIGHT: if (_anchorPos < _currentLen[_index]) _anchorPos++; - if (!(msg.qualifier & qualifierShift)) + if (!(msg._qualifier & qualifierShift)) _cursorPos = _anchorPos; break; @@ -725,7 +725,7 @@ bool gTextBox::keyStroke(gPanelMessage &msg) { break; case Common::KEYCODE_z: // Alt-Z - if (msg.qualifier & (qualifierControl | qualifierAlt)) { + if (msg._qualifier & (qualifierControl | qualifierAlt)) { if (_undoBuffer) { _cursorPos = _anchorPos = _currentLen[_index] = _undoLen; memcpy(_fieldStrings[_index], _undoBuffer, _currentLen[_index] + 1); @@ -844,14 +844,14 @@ void gTextBox::timerTick(gPanelMessage &msg) { //----------------------------------------------------------------------- void gTextBox::handleTimerTick(int32 tick) { - if (selected && !_displayOnly && _editing && !_inDrag) { + if (_selected && !_displayOnly && _editing && !_inDrag) { if (_blinkStart == 0) { _blinkState = 0; _blinkStart = tick; return; } if (tick - _blinkStart > blinkTime) { - gPort &port = window.windowPort; + gPort &port = _window._windowPort; SAVE_GPORT_STATE(port); // save pen color, etc. g_vm->_pointer->hide(port, _extent); // hide mouse pointer @@ -885,7 +885,7 @@ void gTextBox::drawContents() { assert(_textFont); assert(_fontColorBack != -1); - gPort &port = window.windowPort, + gPort &port = _window._windowPort, tPort; @@ -909,7 +909,7 @@ void gTextBox::drawContents() { editRectFill(tPort, port._penMap); } - if (selected) { // if panel is selected + if (_selected) { // if panel is selected // Determine the pixel position of the cursor and // anchor positions. @@ -987,8 +987,8 @@ void gTextBox::drawContents() { //----------------------------------------------------------------------- void gTextBox::drawClipped() { - gPort &port = window.windowPort; - Rect16 rect = window.getExtent(); + gPort &port = _window._windowPort; + Rect16 rect = _window.getExtent(); #if 0 if (!_inDrag && _cursorPos > _anchorPos) { diff --git a/engines/saga2/intrface.cpp b/engines/saga2/intrface.cpp index 34f8ad5d892..080db3a45e1 100644 --- a/engines/saga2/intrface.cpp +++ b/engines/saga2/intrface.cpp @@ -416,12 +416,12 @@ void CPlaqText::enable(bool abled) { } void CPlaqText::invalidate(Rect16 *) { - window.update(_extent); + _window.update(_extent); } void CPlaqText::draw() { - gPort &port = window.windowPort; - Rect16 rect = window.getExtent(); + gPort &port = _window._windowPort; + Rect16 rect = _window.getExtent(); // save pen color, etc. @@ -450,7 +450,7 @@ void CPlaqText::drawClipped(gPort &port, _textRect.y -= offset.y; - writePlaqText(port, _textRect, _buttonFont, _textPosition, _textFacePal, selected, _lineBuf); + writePlaqText(port, _textRect, _buttonFont, _textPosition, _textFacePal, _selected, _lineBuf); } } } @@ -637,7 +637,7 @@ void CStatusLine::experationCheck() { && (_waitAlarm.check() || (_queueTail != _queueHead && _minWaitAlarm.check()))) { enable(false); - window.update(_extent); + _window.update(_extent); _lineDisplayed = false; } @@ -662,7 +662,7 @@ void CStatusLine::experationCheck() { _queueTail = bump(_queueTail); // draw the new textline - window.update(_extent); + _window.update(_extent); _lineDisplayed = true; } @@ -670,7 +670,7 @@ void CStatusLine::experationCheck() { void CStatusLine::clear() { enable(false); - window.update(_extent); + _window.update(_extent); _lineDisplayed = false; _queueHead = _queueTail = 0; @@ -747,7 +747,7 @@ CMassWeightIndicator::CMassWeightIndicator(gPanelList *panel, const Point16 &pos // if this is something other then the ready containers if (type > 1) { - _containerObject = (GameObject *)panel->userData; + _containerObject = (GameObject *)panel->_userData; } else { _containerObject = nullptr; } @@ -923,7 +923,7 @@ Rect16 CManaIndicator::getManaRegionRect(int8 nRegion) { void CManaIndicator::draw() { - gPort &port = window.windowPort; + gPort &port = _window._windowPort; // save pen color, etc. @@ -2067,7 +2067,7 @@ APPFUNC(cmdPortrait) { const int bufSize = 80; const int stateBufSize = 60; - uint16 panID = ev.panel->id; + uint16 panID = ev.panel->_id; GameObject *mouseObject = g_vm->_mouseInfo->getObject(); // object being dragged switch (ev.eventType) { @@ -2186,7 +2186,7 @@ void toggleAgression(PlayerActorID bro, bool all) { } APPFUNC(cmdAggressive) { - uint16 transBroID = translatePanID(ev.panel->id); + uint16 transBroID = translatePanID(ev.panel->_id); // check for message update stuff // and aggression update @@ -2258,7 +2258,7 @@ APPFUNC(cmdArmor) { } APPFUNC(cmdCenter) { - uint16 transBroID = translatePanID(ev.panel->id); + uint16 transBroID = translatePanID(ev.panel->_id); if (ev.eventType == gEventNewValue) { if (rightButtonState()) @@ -2287,7 +2287,7 @@ void toggleBanding(PlayerActorID bro, bool all) { } APPFUNC(cmdBand) { - uint16 transBroID = translatePanID(ev.panel->id); + uint16 transBroID = translatePanID(ev.panel->_id); if (ev.eventType == gEventNewValue) { toggleBanding(transBroID, rightButtonState()); @@ -2323,18 +2323,18 @@ APPFUNC(cmdOptions) { APPFUNC(cmdBroChange) { if (ev.eventType == gEventNewValue) { - if (!isBrotherDead(ev.panel->id)) { - setCenterBrother(ev.panel->id); + if (!isBrotherDead(ev.panel->_id)) { + setCenterBrother(ev.panel->_id); // this sets up the _buttons in trio mode to the correct // state ( must be called before indiv mode switchtes ) setTrioBtns(); - setControlPanelsToIndividualMode(ev.panel->id); + setControlPanelsToIndividualMode(ev.panel->_id); } } else if (ev.eventType == gEventMouseMove) { const int bufSize = 80; const int stateBufSize = 60; - uint16 panID = ev.panel->id; + uint16 panID = ev.panel->_id; if (ev.value == GfxCompImage::enter) { // working buffer @@ -2364,7 +2364,7 @@ APPFUNC(cmdBroChange) { } APPFUNC(cmdHealthStar) { - uint16 transBroID = translatePanID(ev.panel->id); + uint16 transBroID = translatePanID(ev.panel->_id); if (ev.eventType == gEventMouseMove) { if (ev.value == GfxCompImage::leave) { @@ -2403,8 +2403,8 @@ APPFUNC(cmdMassInd) { assert(win); // is it something other than the brother's indicators? - if (ev.panel->id > 1) { - _containerObject = (GameObject *)win->userData; + if (ev.panel->_id > 1) { + _containerObject = (GameObject *)win->_userData; } else { _containerObject = (GameObject *)g_vm->_playerList[getCenterActorPlayerID()]->getActor(); } @@ -2441,8 +2441,8 @@ APPFUNC(cmdBulkInd) { assert(win); // is it something other than the brother's indicators? - if (ev.panel->id > 1) { - _containerObject = (GameObject *)win->userData; + if (ev.panel->_id > 1) { + _containerObject = (GameObject *)win->_userData; } else { _containerObject = (GameObject *)g_vm->_playerList[getCenterActorPlayerID()]->getActor(); } @@ -2654,7 +2654,7 @@ void gEnchantmentDisplay::drawClipped(gPort &port, const Point16 &offset, con } void gEnchantmentDisplay::pointerMove(gPanelMessage &msg) { - if (msg.pointerLeave) { + if (msg._pointerLeave) { g_vm->_mouseInfo->setText(nullptr); } else { int16 x = _extent.width - 10; @@ -2667,7 +2667,7 @@ void gEnchantmentDisplay::pointerMove(gPanelMessage &msg) { Sprite *sp = mentalSprites->sprite(i + 162); x -= sp->size.x + 2; - if (msg.pickPos.x >= x) { + if (msg._pickPos.x >= x) { // set the text in the cursor char buf[128]; diff --git a/engines/saga2/modal.cpp b/engines/saga2/modal.cpp index f577794a4ab..557965c4787 100644 --- a/engines/saga2/modal.cpp +++ b/engines/saga2/modal.cpp @@ -72,7 +72,7 @@ ModalWindow::~ModalWindow() { } bool ModalWindow::isModal() { - return openFlag; + return _openFlag; } bool ModalWindow::open() { diff --git a/engines/saga2/mouseimg.cpp b/engines/saga2/mouseimg.cpp index c26be411bf1..9eea9d68c15 100644 --- a/engines/saga2/mouseimg.cpp +++ b/engines/saga2/mouseimg.cpp @@ -354,7 +354,7 @@ void setMouseText(char *text) { void setMouseTextF(char *format, ...) { if (format == nullptr) { setMouseText(nullptr); - g_vm->_toolBase->mouseHintSet = true; + g_vm->_toolBase->_mouseHintSet = true; } else { char lineBuf[128]; va_list argptr; @@ -364,7 +364,7 @@ void setMouseTextF(char *format, ...) { va_end(argptr); setMouseText(lineBuf); - g_vm->_toolBase->mouseHintSet = true; + g_vm->_toolBase->_mouseHintSet = true; } } diff --git a/engines/saga2/msgbox.cpp b/engines/saga2/msgbox.cpp index 03c11633c22..f0644332df6 100644 --- a/engines/saga2/msgbox.cpp +++ b/engines/saga2/msgbox.cpp @@ -106,11 +106,11 @@ APPFUNC(ErrorWindow::cmdMessageWindow) { if (ev.panel && ev.eventType == gEventNewValue && ev.value) { win = ev.panel->getWindow(); // get the window pointer - ri = win ? (requestInfo *)win->userData : nullptr; + ri = win ? (requestInfo *)win->_userData : nullptr; if (ri) { ri->running = 0; - ri->result = ev.panel->id; + ri->result = ev.panel->_id; } } } @@ -151,7 +151,7 @@ ErrorWindow::ErrorWindow(const char *msg, const char *btnMsg1, const char *btnMs } } - userData = &_rInfo; + _userData = &_rInfo; } @@ -212,7 +212,7 @@ SimpleWindow::SimpleWindow(const Rect16 &r, GameMode *gameModes[] = {&PlayMode, &TileMode, &SimpleMode}; GameMode::SetStack(gameModes, 3); - title = stitle; + _title = stitle; } SimpleWindow::~SimpleWindow() { @@ -251,7 +251,7 @@ void SimpleWindow::drawClipped( g_vm->_pointer->hide(port, _extent); // hide mouse pointer DrawOutlineFrame(port, _extent, windowColor); - writeWrappedPlaqText(port, box, mbButtonFont, textPos, pal, false, title); + writeWrappedPlaqText(port, box, mbButtonFont, textPos, pal, false, _title); gWindow::drawClipped(port, p, r); @@ -344,13 +344,13 @@ SimpleButton::SimpleButton(gWindow &win, const Rect16 &box, const char *title_, } void SimpleButton::deactivate() { - selected = 0; + _selected = 0; draw(); gPanel::deactivate(); } bool SimpleButton::activate(gEventType why) { - selected = 1; + _selected = 1; draw(); if (why == gEventKeyDown) { // momentarily depress @@ -371,21 +371,21 @@ bool SimpleButton::pointerHit(gPanelMessage &) { void SimpleButton::pointerRelease(gPanelMessage &) { // We have to test selected first because deactivate clears it. - if (selected) { + if (_selected) { deactivate(); // give back input focus notify(gEventNewValue, 1); // notify App of successful hit } else deactivate(); } void SimpleButton::pointerDrag(gPanelMessage &msg) { - if (selected != msg.inPanel) { - selected = msg.inPanel; + if (_selected != msg._inPanel) { + _selected = msg._inPanel; draw(); } } void SimpleButton::draw() { - gDisplayPort &port = _window->windowPort; + gDisplayPort &port = _window->_windowPort; Rect16 rect = _window->getExtent(); SAVE_GPORT_STATE(port); // save pen color, etc. diff --git a/engines/saga2/panel.cpp b/engines/saga2/panel.cpp index 9690d62c053..eb03b61d037 100644 --- a/engines/saga2/panel.cpp +++ b/engines/saga2/panel.cpp @@ -39,7 +39,7 @@ namespace Saga2 { extern char iniFile[]; // Function to enable/disable user interface keys -extern bool enableUIKeys(bool enabled); +extern bool enableUIKeys(bool _enabled); /* ======================================================================= * global dispatcher base @@ -56,69 +56,69 @@ int lockUINest = 0; * ======================================================================= */ gPanel::gPanel(gWindow &win, const Rect16 &box, AppFunc *cmd) - : window(win), _extent(box), command(cmd) { - enabled = 1; - ghosted = 0; - selected = 0; - imageLabel = 0; - title = nullptr; - id = 0; - wantMousePoll = 0; - userData = nullptr; + : _window(win), _extent(box), _command(cmd) { + _enabled = 1; + _ghosted = 0; + _selected = 0; + _imageLabel = 0; + _title = nullptr; + _id = 0; + _wantMousePoll = 0; + _userData = nullptr; } gPanel::gPanel(gPanelList &list, const Rect16 &box, const char *newTitle, uint16 ident, AppFunc *cmd) - : window(list.window) { - title = newTitle; + : _window(list._window) { + _title = newTitle; _extent = box; - enabled = 1; - ghosted = 0; - selected = 0; - imageLabel = 0; - command = cmd; - id = ident; - wantMousePoll = 0; - userData = nullptr; + _enabled = 1; + _ghosted = 0; + _selected = 0; + _imageLabel = 0; + _command = cmd; + _id = ident; + _wantMousePoll = 0; + _userData = nullptr; } gPanel::gPanel(gPanelList &list, const Rect16 &box, gPixelMap &pic, uint16 ident, AppFunc *cmd) - : window(list.window) { - title = (char *)&pic; + : _window(list._window) { + _title = (char *)&pic; _extent = box; - enabled = 1; - ghosted = 0; - selected = 0; - imageLabel = 1; - command = cmd; - id = ident; - wantMousePoll = 0; - userData = nullptr; + _enabled = 1; + _ghosted = 0; + _selected = 0; + _imageLabel = 1; + _command = cmd; + _id = ident; + _wantMousePoll = 0; + _userData = nullptr; } gPanel::gPanel(gPanelList &list, const StaticRect &box, const char *newTitle, uint16 ident, AppFunc *cmd) - : window(list.window) { - title = newTitle; + : _window(list._window) { + _title = newTitle; _extent = Rect16(box); - enabled = 1; - ghosted = 0; - selected = 0; - imageLabel = 0; - command = cmd; - id = ident; - wantMousePoll = 0; - userData = nullptr; + _enabled = 1; + _ghosted = 0; + _selected = 0; + _imageLabel = 0; + _command = cmd; + _id = ident; + _wantMousePoll = 0; + _userData = nullptr; } // Dummy virtual functions gPanel::~gPanel() { - if (this == g_vm->_toolBase->mousePanel) - g_vm->_toolBase->mousePanel = nullptr; - if (this == g_vm->_toolBase->activePanel) - g_vm->_toolBase->activePanel = nullptr; + if (this == g_vm->_toolBase->_mousePanel) + g_vm->_toolBase->_mousePanel = nullptr; + if (this == g_vm->_toolBase->_activePanel) + g_vm->_toolBase->_activePanel = nullptr; } void gPanel::draw() {} void gPanel::drawClipped(gPort &, const Point16 &, const Rect16 &) {} @@ -138,19 +138,19 @@ void gPanel::timerTick(gPanelMessage &) {} void gPanel::onMouseHintDelay() {} void gPanel::enable(bool abled) { - enabled = abled ? 1 : 0; + _enabled = abled ? 1 : 0; } void gPanel::select(uint16 sel) { - selected = sel ? 1 : 0; + _selected = sel ? 1 : 0; } void gPanel::ghost(bool b) { - ghosted = b ? 1 : 0; + _ghosted = b ? 1 : 0; } bool gPanel::isActive() { - return (this == g_vm->_toolBase->activePanel); + return (this == g_vm->_toolBase->_activePanel); } void gPanel::notify(enum gEventType type, int32 value) { @@ -159,12 +159,12 @@ void gPanel::notify(enum gEventType type, int32 value) { ev.panel = this; ev.eventType = type; ev.value = value; - ev.mouse.x = g_vm->_toolBase->pickPos.x - _extent.x; - ev.mouse.y = g_vm->_toolBase->pickPos.y - _extent.y; - ev.window = &window; + ev.mouse.x = g_vm->_toolBase->_pickPos.x - _extent.x; + ev.mouse.y = g_vm->_toolBase->_pickPos.y - _extent.y; + ev.window = &_window; - if (command) command(ev); - else if (this != &window) window.notify(ev); + if (_command) _command(ev); + else if (this != &_window) _window.notify(ev); } bool gPanel::activate(gEventType) { @@ -172,7 +172,7 @@ bool gPanel::activate(gEventType) { } void gPanel::deactivate() { - if (isActive()) g_vm->_toolBase->activePanel = nullptr; + if (isActive()) g_vm->_toolBase->_activePanel = nullptr; } void gPanel::makeActive() { @@ -181,24 +181,24 @@ void gPanel::makeActive() { void gPanel::invalidate(Rect16 *) { assert(displayEnabled()); - window.update(_extent); + _window.update(_extent); } void gPanel::drawTitle(enum text_positions placement) { - gPort &port = window.windowPort; + gPort &port = _window._windowPort; Rect16 r = _extent; const gPixelMap *img = nullptr; - if (title == nullptr) + if (_title == nullptr) return; - if (imageLabel) { - img = (const gPixelMap *)title; + if (_imageLabel) { + img = (const gPixelMap *)_title; r.width = img->_size.x; r.height = img->_size.y; } else { - r.width = TextWidth(mainFont, title, -1, textStyleUnderBar); + r.width = TextWidth(mainFont, _title, -1, textStyleUnderBar); r.height = mainFont->height; } @@ -231,7 +231,7 @@ void gPanel::drawTitle(enum text_positions placement) { SAVE_GPORT_STATE(port); // save pen color, etc. - if (imageLabel) { + if (_imageLabel) { port.setIndirectColor(blackPen); // pen color black port.setMode(drawModeColor); // draw as glyph port.bltPixels(*img, 0, 0, r.x, r.y, r.width, r.height); @@ -242,13 +242,13 @@ void gPanel::drawTitle(enum text_positions placement) { port.moveTo(r.x, r.y); // move to new text pos g_vm->_pointer->hide(*globalPort, r); // hide the pointer - port.drawText(title, -1); // draw the text + port.drawText(_title, -1); // draw the text g_vm->_pointer->show(*globalPort, r); // hide the pointer } } gPanel *gPanel::hitTest(const Point16 &p) { - return enabled && !ghosted && _extent.ptInside(p) ? this : nullptr; + return _enabled && !_ghosted && _extent.ptInside(p) ? this : nullptr; } gPanel *gPanel::keyTest(int16) { @@ -264,29 +264,29 @@ gPanel *gPanel::keyTest(int16) { gPanelList::gPanelList(gWindow &win, const Rect16 &box, char *newTitle, uint16 ident, AppFunc *cmd) : gPanel(win, box, cmd) { - title = newTitle; - id = ident; + _title = newTitle; + _id = ident; } // Constructor for standalone panels.. gPanelList::gPanelList(gPanelList &list) - : gPanel(list, list.window.getExtent(), nullptr, 0, nullptr) { - window.contents.push_back(this); + : gPanel(list, list._window.getExtent(), nullptr, 0, nullptr) { + _window._contents.push_back(this); } gPanelList::~gPanelList() { removeControls(); - window.contents.remove(this); + _window._contents.remove(this); } void gPanelList::removeControls() { gPanel *ctl; // Delete all sub-panels. - while (contents.size()) { - ctl = contents.front(); - contents.remove(ctl); + while (_contents.size()) { + ctl = _contents.front(); + _contents.remove(ctl); delete ctl; } } @@ -303,15 +303,15 @@ void gPanelList::invalidate(Rect16 *) { assert(displayEnabled()); if (displayEnabled()) - if (contents.size()) { - ctl = contents.back(); + if (_contents.size()) { + ctl = _contents.back(); invArea = ctl->getExtent(); - for (Common::List::iterator it = contents.reverse_begin(); it != contents.end(); --it) { + for (Common::List::iterator it = _contents.reverse_begin(); it != _contents.end(); --it) { ctl = *it; invArea = bound(invArea, ctl->getExtent()); } - window.update(invArea); + _window.update(invArea); } } @@ -319,8 +319,8 @@ void gPanelList::draw() { gPanel *ctl; if (displayEnabled()) - if (enabled) { - for (Common::List::iterator it = contents.reverse_begin(); it != contents.end(); --it) { + if (_enabled) { + for (Common::List::iterator it = _contents.reverse_begin(); it != _contents.end(); --it) { ctl = *it; if (ctl->getEnabled()) ctl->draw(); @@ -337,8 +337,8 @@ void gPanelList::drawClipped( Rect16 tmpR = r - Point16(_extent.x, _extent.y); if (displayEnabled()) - if (enabled) { - for (Common::List::iterator it = contents.reverse_begin(); it != contents.end(); --it) { + if (_enabled) { + for (Common::List::iterator it = _contents.reverse_begin(); it != _contents.end(); --it) { ctl = *it; if (ctl->getEnabled()) ctl->drawClipped(port, tmpOffset, tmpR); @@ -350,8 +350,8 @@ gPanel *gPanelList::hitTest(const Point16 &p) { gPanel *ctl; gPanel *result; - if (enabled && !ghosted) { - for (Common::List::iterator it = contents.begin(); it != contents.end(); ++it) { + if (_enabled && !_ghosted) { + for (Common::List::iterator it = _contents.begin(); it != _contents.end(); ++it) { ctl = *it; if ((result = ctl->hitTest(p)) != nullptr) return result; @@ -364,8 +364,8 @@ gPanel *gPanelList::keyTest(int16 key) { gPanel *ctl; gPanel *result; - if (enabled && !ghosted) { - for (Common::List::iterator it = contents.reverse_begin(); it != contents.end(); --it) { + if (_enabled && !_ghosted) { + for (Common::List::iterator it = _contents.reverse_begin(); it != _contents.end(); --it) { ctl = *it; if ((result = ctl->keyTest(key)) != nullptr) return result; @@ -381,15 +381,14 @@ gPanel *gPanelList::keyTest(int16 key) { // gWindow static variables -int gWindow::dragMode = 0; // current dragging mode -StaticRect gWindow::dragExtent = {0, 0, 0, 0}; // dragging extent -StaticPoint16 gWindow::dragOffset = {0, 0}; // offset to window origin +int gWindow::_dragMode = 0; // current dragging mode +StaticRect gWindow::_dragExtent = {0, 0, 0, 0}; // dragging extent +StaticPoint16 gWindow::_dragOffset = {0, 0}; // offset to window origin gWindow::gWindow(const Rect16 &box, uint16 ident, const char saveName[], AppFunc *cmd) - : gPanelList(*this, box, nullptr, ident, cmd) + : gPanelList(*this, box, nullptr, ident, cmd) { //, saver(WIIFF_POS|WIIFS_NORMAL|WIIFE_ONEXIT,iniFile,saveName,box,this) -{ - openFlag = false; + _openFlag = false; // pointerImage = &arrowPtr; // pointerOffset = Point16( 0, 0 ); @@ -399,8 +398,8 @@ gWindow::gWindow(const Rect16 &box, uint16 ident, const char saveName[], AppFunc // Set up the window's gPort - windowPort.setFont(mainFont); - windowPort.setPenMap(globalPort->_penMap); + _windowPort.setFont(mainFont); + _windowPort.setPenMap(globalPort->_penMap); /* if (windowFeatures & windowBackSaved) // backsave data under window { @@ -433,8 +432,8 @@ bool gWindow::open() { // Send a "pointer-leave" message to mouse panel. g_vm->_toolBase->leavePanel(); - g_vm->_toolBase->windowList.push_front(this); - g_vm->_toolBase->activeWindow = this; + g_vm->_toolBase->_windowList.push_front(this); + g_vm->_toolBase->_activeWindow = this; g_vm->_toolBase->setActive(nullptr); // g_vm->_pointer->hide(); @@ -442,7 +441,7 @@ bool gWindow::open() { // g_vm->_pointer->setImage( *pointerImage, pointerOffset.x, pointerOffset.y ); // g_vm->_pointer->show(); - openFlag = true; + _openFlag = true; draw(); return true; @@ -453,22 +452,22 @@ void gWindow::close() { if (!isOpen()) return; // If any panels on this window are active, then deactivate them. - if (g_vm->_toolBase->activePanel && g_vm->_toolBase->activePanel->getWindow() == this) - g_vm->_toolBase->activePanel->deactivate(); + if (g_vm->_toolBase->_activePanel && g_vm->_toolBase->_activePanel->getWindow() == this) + g_vm->_toolBase->_activePanel->deactivate(); // Don't close a window that is being dragged (should never happen, // but just in case). if (DragBar::_dragWindow == (FloatingWindow *)this) return; - openFlag = false; + _openFlag = false; // remove this window from the window list. - g_vm->_toolBase->windowList.remove(this); + g_vm->_toolBase->_windowList.remove(this); - g_vm->_toolBase->mouseWindow = g_vm->_toolBase->activeWindow = g_vm->_toolBase->windowList.front(); - g_vm->_toolBase->mousePanel = g_vm->_toolBase->activePanel = nullptr; + g_vm->_toolBase->_mouseWindow = g_vm->_toolBase->_activeWindow = g_vm->_toolBase->_windowList.front(); + g_vm->_toolBase->_mousePanel = g_vm->_toolBase->_activePanel = nullptr; } // Move the window to the front... @@ -476,11 +475,11 @@ void gWindow::close() { void gWindow::toFront() { // re-order the windows if (!isOpen()) return; - g_vm->_toolBase->windowList.remove(this); - g_vm->_toolBase->windowList.push_front(this); + g_vm->_toolBase->_windowList.remove(this); + g_vm->_toolBase->_windowList.push_front(this); - g_vm->_toolBase->activePanel = nullptr; - g_vm->_toolBase->activeWindow = this; + g_vm->_toolBase->_activePanel = nullptr; + g_vm->_toolBase->_activeWindow = this; // redraw the window update(_extent); @@ -500,14 +499,14 @@ void gWindow::setPos(Point16 pos) { // We also need to set up the window's port in a similar fashion. - windowPort._origin.x = _extent.x; - windowPort._origin.y = _extent.y; + _windowPort._origin.x = _extent.x; + _windowPort._origin.y = _extent.y; // set port's clip newClip = intersect(_extent, g_vm->_mainPort._clip); newClip.x -= _extent.x; newClip.y -= _extent.y; - windowPort.setClip(newClip); + _windowPort.setClip(newClip); //saver.onMove(this); // if (backSave) backSave->setPos( pos ); @@ -523,7 +522,7 @@ void gWindow::setExtent(const Rect16 &r) { // insert window into window list void gWindow::insert() { - g_vm->_toolBase->windowList.push_front(this); + g_vm->_toolBase->_windowList.push_front(this); } @@ -531,13 +530,13 @@ void gWindow::insert() { // redefine the address of the pixel map. void gWindow::deactivate() { - selected = 0; + _selected = 0; gPanel::deactivate(); } bool gWindow::activate(gEventType why) { if (why == gEventMouseDown) { // momentarily depress - selected = 1; + _selected = 1; notify(why, 0); // notify App of successful hit return true; } @@ -554,13 +553,13 @@ bool gWindow::pointerHit(gPanelMessage &) { } void gWindow::pointerDrag(gPanelMessage &) { - if (selected) { + if (_selected) { notify(gEventMouseDrag, 0); } } void gWindow::pointerRelease(gPanelMessage &) { - if (selected) notify(gEventMouseUp, 0); // notify App of successful hit + if (_selected) notify(gEventMouseUp, 0); // notify App of successful hit deactivate(); } @@ -594,7 +593,7 @@ void gWindow::setPointer( gPixelMap &map, int x, int y ) pointerOffset.x = x; pointerOffset.y = y; - if (this == g_vm->_toolBase->activeWindow) + if (this == g_vm->_toolBase->_activeWindow) { g_vm->_pointer->hide(); g_vm->_pointer->setImage( *pointerImage, pointerOffset.x, pointerOffset.y ); @@ -609,36 +608,36 @@ void gWindow::setPointer( gPixelMap &map, int x, int y ) gControl::gControl(gPanelList &list, const Rect16 &box, const char *title_, uint16 ident, AppFunc *cmd) : gPanel(list, box, title_, ident, cmd) { - accelKey = 0; + _accelKey = 0; // Add control to the window's control list. _list = &list; - list.contents.push_back(this); + list._contents.push_back(this); } gControl::gControl(gPanelList &list, const Rect16 &box, gPixelMap &img, uint16 ident, AppFunc *cmd) : gPanel(list, box, img, ident, cmd) { - accelKey = 0; + _accelKey = 0; // Add control to the window's control list. _list = &list; - list.contents.push_back(this); + list._contents.push_back(this); } gControl::~gControl() { - _list->contents.remove(this); + _list->_contents.remove(this); } gControl::gControl(gPanelList &list, const StaticRect &box, const char *title_, uint16 ident, AppFunc *cmd) : gPanel(list, box, title_, ident, cmd) { - accelKey = 0; + _accelKey = 0; // Add control to the window's control list. _list = &list; - list.contents.push_back(this); + list._contents.push_back(this); } void gControl::enable(bool abled) { @@ -663,7 +662,7 @@ void gControl::ghost(bool sel) { } gPanel *gControl::keyTest(int16 key) { - return accelKey == key ? this : nullptr; + return _accelKey == key ? this : nullptr; } // For many controls, the only drawing routine we need is the @@ -671,12 +670,12 @@ gPanel *gControl::keyTest(int16 key) { // drawClipped with the main port. void gControl::draw() { - g_vm->_pointer->hide(window.windowPort, _extent); + g_vm->_pointer->hide(_window._windowPort, _extent); if (displayEnabled()) drawClipped(*globalPort, - Point16(-window._extent.x, -window._extent.y), - window._extent); - g_vm->_pointer->show(window.windowPort, _extent); + Point16(-_window._extent.x, -_window._extent.y), + _window._extent); + g_vm->_pointer->show(_window._windowPort, _extent); } /* ===================================================================== * @@ -686,31 +685,31 @@ void gControl::draw() { gGenericControl::gGenericControl(gPanelList &list, const Rect16 &box, uint16 ident, AppFunc *cmd) : gControl(list, box, nullptr, ident, cmd) { - dblClickFlag = false; + _dblClickFlag = false; } bool gGenericControl::activate(gEventType) { - selected = 1; + _selected = 1; return true; } void gGenericControl::deactivate() { - selected = 0; + _selected = 0; gPanel::deactivate(); } void gGenericControl::pointerMove(gPanelMessage &msg) { - notify(gEventMouseMove, (msg.pointerEnter ? enter : 0) | (msg.pointerLeave ? leave : 0)); + notify(gEventMouseMove, (msg._pointerEnter ? enter : 0) | (msg._pointerLeave ? leave : 0)); } bool gGenericControl::pointerHit(gPanelMessage &msg) { - if (msg.rightButton) + if (msg._rightButton) notify(gEventRMouseDown, 0); - else if (msg.doubleClick && !dblClickFlag) { - dblClickFlag = true; + else if (msg._doubleClick && !_dblClickFlag) { + _dblClickFlag = true; notify(gEventDoubleClick, 0); } else { - dblClickFlag = false; + _dblClickFlag = false; notify(gEventMouseDown, 0); } @@ -735,13 +734,13 @@ void gGenericControl::draw() { * ===================================================================== */ void gToolBase::setActive(gPanel *ctl) { - if (activePanel && activePanel == ctl) return; - if (activePanel) activePanel->deactivate(); - if (ctl == nullptr || ctl->activate(gEventNone)) activePanel = ctl; + if (_activePanel && _activePanel == ctl) return; + if (_activePanel) _activePanel->deactivate(); + if (ctl == nullptr || ctl->activate(gEventNone)) _activePanel = ctl; } void gToolBase::handleMouse(Common::Event &event, uint32 time) { - gWindow *w = activeWindow; + gWindow *w = _activeWindow; gPanel *ctl, *pickPanel = nullptr; static gMouseState prevState; @@ -785,8 +784,8 @@ void gToolBase::handleMouse(Common::Event &event, uint32 time) { if (prevState.pos != _curMouseState.pos && prevState.left != _curMouseState.left && prevState.right != _curMouseState.right) { - lastMouseMoveTime = msg.timeStamp; - if (mouseHintSet) + _lastMouseMoveTime = _msg._timeStamp; + if (_mouseHintSet) setMouseTextF(nullptr); } @@ -799,60 +798,60 @@ void gToolBase::handleMouse(Common::Event &event, uint32 time) { // Set up the pick position relative to the window - if (activePanel) { - pickPos.x = _curMouseState.pos.x - activePanel->window._extent.x; - pickPos.y = _curMouseState.pos.y - activePanel->window._extent.y; + if (_activePanel) { + _pickPos.x = _curMouseState.pos.x - _activePanel->_window._extent.x; + _pickPos.y = _curMouseState.pos.y - _activePanel->_window._extent.y; } else { - pickPos.x = _curMouseState.pos.x - w->_extent.x; - pickPos.y = _curMouseState.pos.y - w->_extent.y; + _pickPos.x = _curMouseState.pos.x - w->_extent.x; + _pickPos.y = _curMouseState.pos.y - w->_extent.y; } // Fill in the message to be sent to the various panels - msg.pickAbsPos = pickPos; - msg.leftButton = _curMouseState.left ? 1 : 0; - msg.rightButton = _curMouseState.right ? 1 : 0; - msg.pointerEnter = 0; - msg.pointerLeave = 0; - msg.doubleClick = 0; - msg.timeStamp = time; + _msg._pickAbsPos = _pickPos; + _msg._leftButton = _curMouseState.left ? 1 : 0; + _msg._rightButton = _curMouseState.right ? 1 : 0; + _msg._pointerEnter = 0; + _msg._pointerLeave = 0; + _msg._doubleClick = 0; + _msg._timeStamp = time; - if (((_curMouseState.left && !leftDrag) // if left button hit - || (_curMouseState.right && !rightDrag)) // or right button hit - && activePanel != nullptr) { // and a panel is active + if (((_curMouseState.left && !_leftDrag) // if left button hit + || (_curMouseState.right && !_rightDrag)) // or right button hit + && _activePanel != nullptr) { // and a panel is active // Then we have a button hit event. If the button hit // is occuring outside the panel, then it should be - // deselected. + // de_selected. - if (activePanel->_extent.ptInside(pickPos) == false) - activePanel->deactivate(); + if (_activePanel->_extent.ptInside(_pickPos) == false) + _activePanel->deactivate(); } if (prevState.pos == _curMouseState.pos) ; // don't do anything if same pos - else if (activePanel) { // if control active - mousePanel = activePanel; // assume mouse over active panel + else if (_activePanel) { // if control active + _mousePanel = _activePanel; // assume mouse over active panel - if (leftDrag || rightDrag) { - setMsg(msg, activePanel); // set up gPanelMessage - activePanel->pointerDrag(msg); // send panel a mouse movement + if (_leftDrag || _rightDrag) { + setMsg(_msg, _activePanel); // set up gPanelMessage + _activePanel->pointerDrag(_msg); // send panel a mouse movement } else { - setMsg(msg, activePanel); // set up gPanelMessage - activePanel->pointerMove(msg); // send panel a mouse movement + setMsg(_msg, _activePanel); // set up gPanelMessage + _activePanel->pointerMove(_msg); // send panel a mouse movement } } - if (!activePanel /* && !ms.right */) { + if (!_activePanel /* && !ms.right */) { // If the point is within the window Common::List::iterator it; - for (it = windowList.begin(); it != windowList.end(); ++it) { + for (it = _windowList.begin(); it != _windowList.end(); ++it) { w = *it; if (w->_extent.ptInside(_curMouseState.pos) || w->isModal()) { // Set up the pick position relative to the window - pickPos.x = _curMouseState.pos.x - w->_extent.x; - pickPos.y = _curMouseState.pos.y - w->_extent.y; + _pickPos.x = _curMouseState.pos.x - w->_extent.x; + _pickPos.y = _curMouseState.pos.y - w->_extent.y; - if ((ctl = w->hitTest(pickPos)) != nullptr) + if ((ctl = w->hitTest(_pickPos)) != nullptr) pickPanel = ctl; else pickPanel = w; @@ -861,36 +860,36 @@ void gToolBase::handleMouse(Common::Event &event, uint32 time) { } } - if (it == windowList.end()) { + if (it == _windowList.end()) { prevState = _curMouseState; return; } - mouseWindow = w; + _mouseWindow = w; // If the mouse is not over the control any more, tell it so. - if (mousePanel && mousePanel != pickPanel) { - if (&mousePanel->window != w) { - // Temporarily adjust pickPos to be relative to the old panel's window + if (_mousePanel && _mousePanel != pickPanel) { + if (&_mousePanel->_window != w) { + // Temporarily adjust _pickPos to be relative to the old panel's window // instead of the new panel's window. - pickPos.x = _curMouseState.pos.x - mousePanel->window._extent.x; - pickPos.y = _curMouseState.pos.y - mousePanel->window._extent.y; + _pickPos.x = _curMouseState.pos.x - _mousePanel->_window._extent.x; + _pickPos.y = _curMouseState.pos.y - _mousePanel->_window._extent.y; - setMsgQ(msg, mousePanel); // set up gPanelMessage + setMsgQ(_msg, _mousePanel); // set up gPanelMessage - pickPos.x = _curMouseState.pos.x - w->_extent.x; - pickPos.y = _curMouseState.pos.y - w->_extent.y; + _pickPos.x = _curMouseState.pos.x - w->_extent.x; + _pickPos.y = _curMouseState.pos.y - w->_extent.y; } else { - setMsgQ(msg, mousePanel); // set up gPanelMessage + setMsgQ(_msg, _mousePanel); // set up gPanelMessage } -// msg.pickPos.x = pickPos.x - mousePanel->extent.x; -// msg.pickPos.y = pickPos.y - mousePanel->extent.y; - msg.inPanel = 0; - msg.pointerEnter = 0; - msg.pointerLeave = 1; +// _msg._pickPos.x = _pickPos.x - _mousePanel->extent.x; +// _msg._pickPos.y = _pickPos.y - _mousePanel->extent.y; + _msg._inPanel = 0; + _msg._pointerEnter = 0; + _msg._pointerLeave = 1; - mousePanel->pointerMove(msg); + _mousePanel->pointerMove(_msg); } @@ -898,24 +897,24 @@ void gToolBase::handleMouse(Common::Event &event, uint32 time) { // mouse control. if (pickPanel) { - setMsg(msg, pickPanel); // set up gPanelMessage -// msg.pickPos.x = pickPos.x - pickPanel->extent.x; -// msg.pickPos.y = pickPos.y - pickPanel->extent.y; - msg.leftButton = _curMouseState.left ? 1 : 0; -// msg.inPanel = pickPanel->extent.ptInside(pickPos); - msg.pointerEnter = (mousePanel == pickPanel) ? 0 : 1; - msg.pointerLeave = 0; + setMsg(_msg, pickPanel); // set up gPanelMessage +// _msg._pickPos.x = _pickPos.x - pickPanel->extent.x; +// _msg._pickPos.y = _pickPos.y - pickPanel->extent.y; + _msg._leftButton = _curMouseState.left ? 1 : 0; +// _msg._inPanel = pickPanel->extent.ptInside(_pickPos); + _msg._pointerEnter = (_mousePanel == pickPanel) ? 0 : 1; + _msg._pointerLeave = 0; - mousePanel = pickPanel; - mousePanel->pointerMove(msg); + _mousePanel = pickPanel; + _mousePanel->pointerMove(_msg); } else - mousePanel = nullptr; + _mousePanel = nullptr; } // Fix up flags because earlier code may have changed them - msg.pointerEnter = 0; - msg.pointerLeave = 0; + _msg._pointerEnter = 0; + _msg._pointerLeave = 0; // Send appropriate button-press messages to the panels @@ -932,54 +931,54 @@ void gToolBase::handleMouse(Common::Event &event, uint32 time) { // 1/3 of a second, and that the mouse ptr hasn't moved // very much. - if (((uint32)(msg.timeStamp - lastClickTime) < 333) + if (((uint32)(_msg._timeStamp - lastClickTime) < 333) || _curMouseState.left > 1 || _curMouseState.right > 1) { Point16 diff = lastClickPos - _curMouseState.pos; if (ABS(diff.x) + ABS(diff.y) < 6) - msg.doubleClick = 1; + _msg._doubleClick = 1; } // Record the last mouse time and position for // future double-click checks. - lastClickTime = msg.timeStamp; + lastClickTime = _msg._timeStamp; lastClickPos = _curMouseState.pos; - if (mousePanel) { // if over a control - setMsgQ(msg, mousePanel); // set up gPanelMessage -// msg.pickPos.x = pickPos.x - mousePanel->extent.x; -// msg.pickPos.y = pickPos.y - mousePanel->extent.y; - msg.inPanel = 1; + if (_mousePanel) { // if over a control + setMsgQ(_msg, _mousePanel); // set up gPanelMessage +// _msg._pickPos.x = _pickPos.x - _mousePanel->extent.x; +// _msg._pickPos.y = _pickPos.y - _mousePanel->extent.y; + _msg._inPanel = 1; - if (activeWindow && activeWindow->isModal()) { - mouseWindow = activeWindow; - } else if (mouseWindow == nullptr) { - mouseWindow = &mousePanel->window; + if (_activeWindow && _activeWindow->isModal()) { + _mouseWindow = _activeWindow; + } else if (_mouseWindow == nullptr) { + _mouseWindow = &_mousePanel->_window; } - if (mouseWindow && mouseWindow != activeWindow) { - msg.pickAbsPos = pickPos; + if (_mouseWindow && _mouseWindow != _activeWindow) { + _msg._pickAbsPos = _pickPos; // Re-order the windows. - mouseWindow->toFront(); + _mouseWindow->toFront(); } // send it a hit message - if (mousePanel->pointerHit(msg)) { - activePanel = mousePanel; + if (_mousePanel->pointerHit(_msg)) { + _activePanel = _mousePanel; if (_curMouseState.left) - leftDrag = true; + _leftDrag = true; else - rightDrag = true; + _rightDrag = true; } } - } else if ((leftDrag && _curMouseState.left == false) // check for release - || (rightDrag && _curMouseState.right == false)) { - if (activePanel && mousePanel) { // if a control is active - setMsg(msg, mousePanel); // send it a release message - mousePanel->pointerRelease(msg); + } else if ((_leftDrag && _curMouseState.left == false) // check for release + || (_rightDrag && _curMouseState.right == false)) { + if (_activePanel && _mousePanel) { // if a control is active + setMsg(_msg, _mousePanel); // send it a release message + _mousePanel->pointerRelease(_msg); } - leftDrag = rightDrag = false; + _leftDrag = _rightDrag = false; } } @@ -987,22 +986,22 @@ void gToolBase::handleMouse(Common::Event &event, uint32 time) { } void gToolBase::leavePanel() { - msg.timeStamp = g_system->getMillis(); + _msg._timeStamp = g_system->getMillis(); - if (mousePanel) { - msg.inPanel = 0; - msg.pointerEnter = 0; - msg.pointerLeave = 1; + if (_mousePanel) { + _msg._inPanel = 0; + _msg._pointerEnter = 0; + _msg._pointerLeave = 1; - mousePanel->pointerMove(msg); - mousePanel = nullptr; + _mousePanel->pointerMove(_msg); + _mousePanel = nullptr; } - if (activePanel) activePanel->deactivate(); + if (_activePanel) _activePanel->deactivate(); } void gToolBase::handleKeyStroke(Common::Event &event) { - gWindow *w = activeWindow; + gWindow *w = _activeWindow; gPanel *ctl; uint16 key = event.kbd.ascii; // FIXME @@ -1017,16 +1016,16 @@ void gToolBase::handleKeyStroke(Common::Event &event) { if (event.kbd.flags & Common::KBD_ALT) qualifier |= qualifierAlt; - msg.pickAbsPos = pickPos; - msg.pointerEnter = 0; - msg.pointerLeave = 0; - msg.key = key; - msg.qualifier = qualifier; - msg.timeStamp = g_system->getMillis(); + _msg._pickAbsPos = _pickPos; + _msg._pointerEnter = 0; + _msg._pointerLeave = 0; + _msg._key = key; + _msg._qualifier = qualifier; + _msg._timeStamp = g_system->getMillis(); - if (activePanel) { // send keystroke to active panel - setMsg(msg, activePanel); // set up gPanelMessage - if (activePanel->keyStroke(msg)) + if (_activePanel) { // send keystroke to active panel + setMsg(_msg, _activePanel); // set up gPanelMessage + if (_activePanel->keyStroke(_msg)) return; } @@ -1041,10 +1040,10 @@ void gToolBase::handleKeyStroke(Common::Event &event) { k = toupper(k); if ((ctl = w->keyTest(k)) != nullptr) { - if (activePanel == ctl) return; - if (activePanel) activePanel->deactivate(); + if (_activePanel == ctl) return; + if (_activePanel) _activePanel->deactivate(); if (ctl->activate(gEventKeyDown)) { - activePanel = ctl; + _activePanel = ctl; return; } } @@ -1052,7 +1051,7 @@ void gToolBase::handleKeyStroke(Common::Event &event) { // Try sending the message to the window - if (w->keyStroke(msg)) + if (w->keyStroke(_msg)) return; // else send the message to the app. @@ -1062,21 +1061,21 @@ void gToolBase::handleKeyStroke(Common::Event &event) { } void gToolBase::handleTimerTick(int32 tick) { - msg.pickAbsPos = pickPos; - msg.pointerEnter = 0; - msg.pointerLeave = 0; - msg.timeStamp = tick; + _msg._pickAbsPos = _pickPos; + _msg._pointerEnter = 0; + _msg._pointerLeave = 0; + _msg._timeStamp = tick; - if (activePanel) { // send keystroke to active panel - setMsg(msg, activePanel); // set up gPanelMessage - activePanel->timerTick(msg); - } else if (mousePanel) { - if (mousePanel->wantMousePoll) { - setMsg(msg, mousePanel); // set up gPanelMessage - mousePanel->pointerMove(msg); - } else if (!mouseHintSet - && ((uint32)(tick - lastMouseMoveTime) > 500)) { - mousePanel->onMouseHintDelay(); + if (_activePanel) { // send keystroke to active panel + setMsg(_msg, _activePanel); // set up gPanelMessage + _activePanel->timerTick(_msg); + } else if (_mousePanel) { + if (_mousePanel->_wantMousePoll) { + setMsg(_msg, _mousePanel); // set up gPanelMessage + _mousePanel->pointerMove(_msg); + } else if (!_mouseHintSet + && ((uint32)(tick - _lastMouseMoveTime) > 500)) { + _mousePanel->onMouseHintDelay(); } } } @@ -1103,11 +1102,11 @@ void cleanupPanels() { } int16 leftButtonState() { - return g_vm->_toolBase->msg.leftButton; + return g_vm->_toolBase->_msg._leftButton; } int16 rightButtonState() { - return g_vm->_toolBase->msg.rightButton; + return g_vm->_toolBase->_msg._rightButton; } void LockUI(bool state) { diff --git a/engines/saga2/panel.h b/engines/saga2/panel.h index 0e18f8935c1..fbfc8674bff 100644 --- a/engines/saga2/panel.h +++ b/engines/saga2/panel.h @@ -119,23 +119,23 @@ class gPanel { friend class gToolBase; friend class gWindow; - AppFunc *command; // application function + AppFunc *_command; // application function protected: - gWindow &window; // window this belongs to + gWindow &_window; // window this belongs to Rect16 _extent; // rectangular bounds of the control - const char *title; // title of the panel - byte enabled, // allows disabling the panel - selected, // some panels have a selected state - imageLabel, // button label is image, not text - ghosted, // button is dimmed - wantMousePoll; // send mousemoves even if mouse not moving! + const char *_title; // title of the panel + byte _enabled, // allows disabling the panel + _selected, // some panels have a selected state + _imageLabel, // button label is image, not text + _ghosted, // button is dimmed + _wantMousePoll; // send mousemoves even if mouse not moving! // window constructor gPanel(gWindow &, const Rect16 &, AppFunc *cmd); public: - uint32 id; // panel id number - void *userData; // data for this panel + uint32 _id; // panel id number + void *_userData; // data for this panel // constructor gPanel(gPanelList &, const Rect16 &, const char *, uint16, AppFunc *cmd = NULL); @@ -159,7 +159,7 @@ protected: void notify(enum gEventType, int32 value); void notify(gEvent &ev) { - if (command) command(ev); + if (_command) _command(ev); } void drawTitle(enum text_positions placement); @@ -174,7 +174,7 @@ public: virtual void ghost(bool ghosted); virtual void invalidate(Rect16 *area = nullptr); virtual void setMousePoll(bool abled) { - wantMousePoll = abled ? 1 : 0; + _wantMousePoll = abled ? 1 : 0; } // Redraw the panel, but only a small clipped section, @@ -186,20 +186,20 @@ public: // void setCommand( AppFunc *func ) { command = func; } gWindow *getWindow() { - return &window; + return &_window; } void makeActive(); Rect16 getExtent() { return _extent; } bool isSelected() { - return selected != 0; + return _selected != 0; } bool isGhosted() { - return ghosted != 0; + return _ghosted != 0; } bool getEnabled() const { - return (bool) enabled; + return (bool)_enabled; } void show(bool shown = true, bool inval = true) { enable(shown); @@ -217,32 +217,32 @@ public: class gPanelMessage { public: - Point16 pickPos, // mouse position relative to panel - pickAbsPos; // mouse position relative to display - byte leftButton, // left button state - rightButton, // right button state - inPanel, // whether mouse is currently in panel - pointerEnter, // set when pointer enters panel - pointerLeave, // set when pointer leaves panel - doubleClick; // set when double click detected + Point16 _pickPos, // mouse position relative to panel + _pickAbsPos; // mouse position relative to display + byte _leftButton, // left button state + _rightButton, // right button state + _inPanel, // whether mouse is currently in panel + _pointerEnter, // set when pointer enters panel + _pointerLeave, // set when pointer leaves panel + _doubleClick; // set when double click detected // For keyboard input - uint16 key, // keystroke from keyboard - qualifier; // qualifier from keyboard + uint16 _key, // keystroke from keyboard + _qualifier; // qualifier from keyboard - uint32 timeStamp; // time of message + uint32 _timeStamp; // time of message gPanelMessage() { - leftButton = 0; - rightButton = 0; - inPanel = 0; - pointerEnter = 0; - pointerLeave = 0; - doubleClick = 0; - key = 0; - qualifier = 0; - timeStamp = 0; + _leftButton = 0; + _rightButton = 0; + _inPanel = 0; + _pointerEnter = 0; + _pointerLeave = 0; + _doubleClick = 0; + _key = 0; + _qualifier = 0; + _timeStamp = 0; } }; @@ -262,7 +262,7 @@ class gPanelList : public gPanel { protected: - Common::List contents; // list of panels + Common::List _contents; // list of panels gPanelList(gWindow &, const Rect16 &, char *, uint16, AppFunc *cmd = NULL); @@ -288,13 +288,13 @@ public: }; inline void gPanel::moveToFront(gPanelList &l) { - l.contents.remove(this); - l.contents.push_front(this); + l._contents.remove(this); + l._contents.push_front(this); } inline void gPanel::moveToBack(gPanelList &l) { - l.contents.remove(this); - l.contents.push_back(this); + l._contents.remove(this); + l._contents.push_back(this); } /* ===================================================================== * @@ -319,20 +319,20 @@ class gWindow : public gPanelList { friend class gToolBase; public: - gDisplayPort windowPort; + gDisplayPort _windowPort; gWindow(const Rect16 &, uint16, const char saveName[], AppFunc *cmd = NULL); ~gWindow(); operator gPort() { - return windowPort; + return _windowPort; } void postEvent(gEvent &ev) { gPanel::notify(ev); } protected: - bool openFlag; // true if window open. + bool _openFlag; // true if window open. //gWindowWinInfoInINIFile saver; @@ -352,9 +352,9 @@ private: dragPosition }; - static int dragMode; // current dragging mode - static StaticRect dragExtent; // dragging extent - static StaticPoint16 dragOffset; // offset to window origin + static int _dragMode; // current dragging mode + static StaticRect _dragExtent; // dragging extent + static StaticPoint16 _dragOffset; // offset to window origin void shadow(); @@ -370,7 +370,7 @@ protected: public: bool isOpen() { - return openFlag; // true if window is visible + return _openFlag; // true if window is visible } void draw(); // redraw the panel. void drawClipped( @@ -405,7 +405,7 @@ public: class gControl : public gPanel { public: - uint8 accelKey; + uint8 _accelKey; gPanelList *_list; gControl(gPanelList &, const Rect16 &, const char *, uint16, AppFunc *cmd = NULL); @@ -429,14 +429,14 @@ public: * ===================================================================== */ class gGenericControl : public gControl { - bool dblClickFlag; + bool _dblClickFlag; public: gGenericControl(gPanelList &, const Rect16 &, uint16, AppFunc *cmd = NULL); // Disable double click for next mouse click void disableDblClick() { - dblClickFlag = true; + _dblClickFlag = true; } enum controlValue { @@ -476,50 +476,50 @@ class gToolBase { // windows - Common::List windowList; // list of windows - gWindow *mouseWindow, // window mouse is in - *activeWindow; // current active window - gPanel *mousePanel, // panel that mouse is in - *activePanel; // panel that has input focus - Rect16 dragRect; // dragging rectangle for windows - Point16 pickPos; // mouse pos relative to panel - uint8 leftDrag, // left-button dragging - rightDrag; // right button dragging - gPanelMessage msg; // message that we send out + Common::List _windowList; // list of windows + gWindow *_mouseWindow, // window mouse is in + *_activeWindow; // current active window + gPanel *_mousePanel, // panel that mouse is in + *_activePanel; // panel that has input focus + Rect16 _dragRect; // dragging rectangle for windows + Point16 _pickPos; // mouse pos relative to panel + uint8 _leftDrag, // left-button dragging + _rightDrag; // right button dragging + gPanelMessage _msg; // message that we send out - int32 lastMouseMoveTime; // time of last mouse move + int32 _lastMouseMoveTime; // time of last mouse move gMouseState _curMouseState; public: - bool mouseHintSet; // true if mouse hint is up. + bool _mouseHintSet; // true if mouse hint is up. gToolBase() { - mouseWindow = nullptr; - activeWindow = nullptr; - mousePanel = nullptr; - activePanel = nullptr; - leftDrag = 0; - rightDrag = 0; - lastMouseMoveTime = 0; + _mouseWindow = nullptr; + _activeWindow = nullptr; + _mousePanel = nullptr; + _activePanel = nullptr; + _leftDrag = 0; + _rightDrag = 0; + _lastMouseMoveTime = 0; } private: void setMsgQ(gPanelMessage &msg_, gPanel *panel) { - if (panel == &panel->window) - msg_.pickPos = pickPos; + if (panel == &panel->_window) + msg_._pickPos = _pickPos; else { - msg.pickPos.x = (int16)(pickPos.x - panel->_extent.x); - msg.pickPos.y = (int16)(pickPos.y - panel->_extent.y); + _msg._pickPos.x = (int16)(_pickPos.x - panel->_extent.x); + _msg._pickPos.y = (int16)(_pickPos.y - panel->_extent.y); } } void setMsg(gPanelMessage &msg_, gPanel *panel) { setMsgQ(msg_, panel); - msg.inPanel = (msg_.pickPos.x >= 0 - && msg_.pickPos.y >= 0 - && msg_.pickPos.x < panel->_extent.width - && msg_.pickPos.y < panel->_extent.height); + _msg._inPanel = (msg_._pickPos.x >= 0 + && msg_._pickPos.y >= 0 + && msg_._pickPos.x < panel->_extent.width + && msg_._pickPos.y < panel->_extent.height); // panel->extent.ptInside( pickPos ); } @@ -531,19 +531,19 @@ public: void handleKeyStroke(Common::Event &event); void handleTimerTick(int32 tick); Common::List::iterator topWindowIterator() { - return windowList.end(); + return _windowList.end(); } Common::List::iterator bottomWindowIterator() { - return windowList.reverse_begin(); + return _windowList.reverse_begin(); } gWindow *topWindow() { - return windowList.front(); + return _windowList.front(); } gWindow *bottomWindow() { - return windowList.back(); + return _windowList.back(); } bool isMousePanel(gPanel *p) { - return (mousePanel != NULL) ? (p == mousePanel) : (p == topWindow()); + return (_mousePanel != NULL) ? (p == _mousePanel) : (p == topWindow()); } }; diff --git a/engines/saga2/tilemode.cpp b/engines/saga2/tilemode.cpp index f66191204e2..d33844d4fa5 100644 --- a/engines/saga2/tilemode.cpp +++ b/engines/saga2/tilemode.cpp @@ -676,7 +676,7 @@ void TileModeCleanup() { delete tileMapControl; // This Fixes the mousePanel That's not set up - g_vm->_toolBase->mousePanel = nullptr; + g_vm->_toolBase->_mousePanel = nullptr; mainWindow->removeDecorations(); } diff --git a/engines/saga2/uidialog.cpp b/engines/saga2/uidialog.cpp index 54fe3d0332d..739c57cf623 100644 --- a/engines/saga2/uidialog.cpp +++ b/engines/saga2/uidialog.cpp @@ -692,17 +692,17 @@ int16 FileDialog(int16 fileProcess) { // make the quit button new GfxCompButton(*win, *saveLoadButtonRects[0], pushBtnIm, numBtnImages, btnStrings[stringIndex][0], pal, 0, cmdDialogQuit); - //t->accelKey=0x1B; + //t->_accelKey=0x1B; // make the Save/Load button new GfxCompButton(*win, *saveLoadButtonRects[1], pushBtnIm, numBtnImages, btnStrings[stringIndex][1], pal, fileProcess, fileCommands[fileProcess]); - //t->accelKey=0x0D; + //t->_accelKey=0x0D; // make the up arrow new GfxCompButton(*win, *saveLoadButtonRects[2], arrowUpIm, numBtnImages, 0, cmdSaveDialogUp); - //t->accelKey=33+0x80; + //t->_accelKey=33+0x80; // make the down arrow new GfxCompButton(*win, *saveLoadButtonRects[3], arrowDnIm, numBtnImages, 0, cmdSaveDialogDown); - //t->accelKey=34+0x80; + //t->_accelKey=34+0x80; // attach the title new CPlaqText(*win, *saveLoadTextRects[0], textStrings[stringIndex][0], &Plate18Font, 0, pal, 0, nullptr); @@ -719,7 +719,7 @@ int16 FileDialog(int16 fileProcess) { ARRAYSIZE(saveWindowDecorations), decRes, 'S', 'L', 'D'); - win->userData = &rInfo; + win->_userData = &rInfo; win->open(); if (GameMode::_newmodeFlag) @@ -838,28 +838,28 @@ int16 OptionsDialog(bool disableSaveResume) { if (!disableSaveResume) { t = new GfxCompButton(*win, *optionsButtonRects[0], dialogPushImag, numBtnImages, btnStrings[0], pal, 0, cmdDialogQuit); - t->accelKey = 0x1B; + t->_accelKey = 0x1B; t = new GfxCompButton(*win, *optionsButtonRects[1], dialogPushImag, numBtnImages, btnStrings[1], pal, 0, cmdOptionsSaveGame); // make the quit button - t->accelKey = 'S'; + t->_accelKey = 'S'; } else { t = new GfxCompButton(*win, *optionsButtonRects[1], dialogPushImag, numBtnImages, OPTN_DIALOG_BUTTON6, pal, 0, cmdOptionsNewGame); - t->accelKey = 'N'; + t->_accelKey = 'N'; } t = new GfxCompButton(*win, *optionsButtonRects[2], dialogPushImag, numBtnImages, btnStrings[2], pal, 0, cmdOptionsLoadGame); // make the quit button - t->accelKey = 'L'; + t->_accelKey = 'L'; t = new GfxCompButton(*win, *optionsButtonRects[3], dialogPushImag, numBtnImages, btnStrings[3], pal, 0, cmdQuitGame); - t->accelKey = 'Q'; + t->_accelKey = 'Q'; t = new GfxCompButton(*win, *optionsButtonRects[4], dialogPushImag, numBtnImages, btnStrings[4], pal, 0, cmdCredits); - t->accelKey = 'C'; + t->_accelKey = 'C'; autoAggressBtn = new GfxOwnerSelCompButton(*win, *optionsButtonRects[5], checkImag, numBtnImages, 0, cmdAutoAggression); @@ -901,7 +901,7 @@ int16 OptionsDialog(bool disableSaveResume) { decRes, 'O', 'P', 'T'); - win->userData = &rInfo; + win->_userData = &rInfo; win->open(); EventLoop(rInfo.running, true); @@ -1016,7 +1016,7 @@ bool initUserDialog() { ARRAYSIZE(messageDecorations), udDecRes, 'M', 'E', 'S'); - udWin->userData = &udrInfo; + udWin->_userData = &udrInfo; if (udDecRes) resFile->disposeContext(udDecRes); udDecRes = nullptr; @@ -1191,21 +1191,21 @@ int16 userDialog(const char *title, const char *msg, const char *bMsg1, if (numBtns >= 1) { t = new GfxCompButton(*win, *messageButtonRects[0], dialogPushImag, numBtnImages, btnMsg1, pal, 10, cmdDialogQuit); - t->accelKey = k1; + t->_accelKey = k1; } // button two if (numBtns >= 2) { t = new GfxCompButton(*win, *messageButtonRects[1], dialogPushImag, numBtnImages, btnMsg2, pal, 11, cmdDialogQuit); - t->accelKey = k2; + t->_accelKey = k2; } // button three if (numBtns >= 3) { t = new GfxCompButton(*win, *messageButtonRects[2], dialogPushImag, numBtnImages, btnMsg3, pal, 12, cmdDialogQuit); - t->accelKey = k3; + t->_accelKey = k3; } // title for the box @@ -1219,7 +1219,7 @@ int16 userDialog(const char *title, const char *msg, const char *bMsg1, decRes, 'M', 'E', 'S'); - win->userData = &rInfo; + win->_userData = &rInfo; win->open(); @@ -1320,11 +1320,11 @@ bool CPlacardWindow::pointerHit(gPanelMessage &) { requestInfo *ri; win = getWindow(); // get the window pointer - ri = win ? (requestInfo *)win->userData : nullptr; + ri = win ? (requestInfo *)win->_userData : nullptr; if (ri) { ri->running = 0; - ri->result = id; + ri->result = _id; } //activate( gEventMouseDown ); @@ -1562,7 +1562,7 @@ void placardWindow(int8 type, char *text) { } - win->userData = &rInfo; + win->_userData = &rInfo; win->open(); @@ -1600,11 +1600,11 @@ APPFUNC(cmdDialogQuit) { if (ev.panel && isUserAction(ev) && ev.value) { win = ev.panel->getWindow(); // get the window pointer - ri = win ? (requestInfo *)win->userData : nullptr; + ri = win ? (requestInfo *)win->_userData : nullptr; if (ri) { ri->running = 0; - ri->result = ev.panel->id; + ri->result = ev.panel->_id; } } } @@ -1616,7 +1616,7 @@ APPFUNC(cmdFileSave) { if (ev.panel && isUserAction(ev) && ev.value) { // now close the window win = ev.panel->getWindow(); // get the window pointer - ri = win ? (requestInfo *)win->userData : nullptr; + ri = win ? (requestInfo *)win->_userData : nullptr; if (ri) { ri->running = 0; @@ -1653,7 +1653,7 @@ APPFUNC(cmdFileLoad) { // close window win = ev.panel->getWindow(); // get the window pointer - ri = win ? (requestInfo *)win->userData : nullptr; + ri = win ? (requestInfo *)win->_userData : nullptr; if (ri) { ri->running = 0; @@ -1696,11 +1696,11 @@ APPFUNC(cmdOptionsNewGame) { gWindow *win; requestInfo *ri; win = ev.panel->getWindow(); // get the window pointer - ri = win ? (requestInfo *)win->userData : nullptr; + ri = win ? (requestInfo *)win->_userData : nullptr; if (ri) { ri->running = 0; - ri->result = ev.panel->id; + ri->result = ev.panel->_id; deferredLoadID = 999; deferredLoadFlag = true; } @@ -1716,11 +1716,11 @@ APPFUNC(cmdOptionsLoadGame) { // if the fileDialog actually did loading if (FileDialog(typeLoad) == typeLoad) { win = ev.panel->getWindow(); // get the window pointer - ri = win ? (requestInfo *)win->userData : nullptr; + ri = win ? (requestInfo *)win->_userData : nullptr; if (ri) { ri->running = 0; - ri->result = ev.panel->id; + ri->result = ev.panel->_id; } } } @@ -1732,7 +1732,7 @@ APPFUNC(cmdQuitGame) { if (ev.panel && isUserAction(ev) && ev.value) { win = ev.panel->getWindow(); // get the window pointer - ri = win ? (requestInfo *)win->userData : nullptr; + ri = win ? (requestInfo *)win->_userData : nullptr; if (ri && userDialog( @@ -1743,7 +1743,7 @@ APPFUNC(cmdQuitGame) { endGame(); ri->running = false; - ri->result = ev.panel->id; + ri->result = ev.panel->_id; } } diff --git a/engines/saga2/videobox.cpp b/engines/saga2/videobox.cpp index 137602359ce..4f1a6906795 100644 --- a/engines/saga2/videobox.cpp +++ b/engines/saga2/videobox.cpp @@ -66,13 +66,13 @@ CVideoBox::~CVideoBox() { } void CVideoBox::deactivate() { - selected = 0; + _selected = 0; gPanel::deactivate(); } bool CVideoBox::activate(gEventType why) { if (why == gEventMouseDown) { // momentarily depress - selected = 1; + _selected = 1; notify(why, 0); // notify App of successful hit return true; } @@ -89,11 +89,11 @@ bool CVideoBox::pointerHit(gPanelMessage &) { requestInfo *ri; win = getWindow(); // get the window pointer - ri = win ? (requestInfo *)win->userData : nullptr; + ri = win ? (requestInfo *)win->_userData : nullptr; if (ri) { ri->running = 0; - ri->result = id; + ri->result = _id; } activate(gEventMouseDown); @@ -101,13 +101,13 @@ bool CVideoBox::pointerHit(gPanelMessage &) { } void CVideoBox::pointerDrag(gPanelMessage &) { - if (selected) { + if (_selected) { notify(gEventMouseDrag, 0); } } void CVideoBox::pointerRelease(gPanelMessage &) { - if (selected) notify(gEventMouseUp, 0); // notify App of successful hit + if (_selected) notify(gEventMouseUp, 0); // notify App of successful hit deactivate(); } @@ -145,7 +145,7 @@ void CVideoBox::init() { 'V', 'B', 'D'); // attach the result info struct to this window - userData = &rInfo; + _userData = &rInfo; } int16 CVideoBox::openVidBox(char *fileName) {