diff options
Diffstat (limited to 'engines/macventure/gui.cpp')
-rw-r--r-- | engines/macventure/gui.cpp | 97 |
1 files changed, 72 insertions, 25 deletions
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp index ac429d03d9..f4cb8eeb6f 100644 --- a/engines/macventure/gui.cpp +++ b/engines/macventure/gui.cpp @@ -267,7 +267,9 @@ void Gui::setWindowTitle(WindowReference winID, Common::String string) { } void Gui::updateWindowInfo(WindowReference ref, ObjID objID, const Common::Array<ObjID> &children) { - if (ref == kNoWindow) return; + if (ref == kNoWindow) { + return; + } WindowData &data = findWindowData(ref); data.children.clear(); data.objRef = objID; @@ -284,9 +286,15 @@ void Gui::updateWindowInfo(WindowReference ref, ObjID objID, const Common::Array data.children.push_back(DrawableObject(child, kBlitBIC)); } } - if (originx != 0x7fff) data.bounds.left = originx; - if (originy != 0x7fff) data.bounds.top = originy; - if (ref != kMainGameWindow) data.updateScroll = true; + if (originx != 0x7fff) { + data.bounds.left = originx; + } + if (originy != 0x7fff) { + data.bounds.top = originy; + } + if (ref != kMainGameWindow) { + data.updateScroll = true; + } } void Gui::addChild(WindowReference target, ObjID child) { @@ -297,7 +305,9 @@ void Gui::removeChild(WindowReference target, ObjID child) { WindowData &data = findWindowData(target); uint index = 0; for (;index < data.children.size(); index++) { - if (data.children[index].obj == child) break; + if (data.children[index].obj == child) { + break; + } } if (index < data.children.size()) @@ -602,7 +612,9 @@ void Gui::drawMainGameWindow() { void Gui::drawSelfWindow() { drawObjectsInWindow(getWindowData(kSelfWindow), _selfWindow->getSurface()); - if (_engine->isObjSelected(1)) invertWindowColors(kSelfWindow); + if (_engine->isObjSelected(1)) { + invertWindowColors(kSelfWindow); + } findWindow(kSelfWindow)->setDirty(true); } @@ -667,7 +679,9 @@ void Gui::drawObjectsInWindow(const WindowData &targetData, Graphics::ManagedSur ObjID child; BlitMode mode; - if (targetData.children.size() == 0) return; + if (targetData.children.size() == 0) { + return; + } Graphics::ManagedSurface composeSurface; createInnerSurface(&composeSurface, surface, border); @@ -736,12 +750,20 @@ void Gui::drawDraggedObject() { uint h = asset->getHeight() + MIN((int16)0, _draggedObj.pos.y); // In case of overflow from the bottom/left - if (_draggedObj.pos.x > 0 && _draggedObj.pos.x + w > kScreenWidth) { w = kScreenWidth - _draggedObj.pos.x; } - if (_draggedObj.pos.y > 0 && _draggedObj.pos.y + h > kScreenHeight) { h = kScreenHeight - _draggedObj.pos.y; } + if (_draggedObj.pos.x > 0 && _draggedObj.pos.x + w > kScreenWidth) { + w = kScreenWidth - _draggedObj.pos.x; + } + if (_draggedObj.pos.y > 0 && _draggedObj.pos.y + h > kScreenHeight) { + h = kScreenHeight - _draggedObj.pos.y; + } Common::Point target = _draggedObj.pos; - if (target.x < 0) { target.x = 0; } - if (target.y < 0) { target.y = 0; } + if (target.x < 0) { + target.x = 0; + } + if (target.y < 0) { + target.y = 0; + } _draggedSurface.create(w, h, _screen.format); _draggedSurface.blitFrom( @@ -766,11 +788,15 @@ void Gui::drawDraggedObject() { } void Gui::drawDialog() { - if (_dialog) _dialog->draw(); + if (_dialog) { + _dialog->draw(); + } } void Gui::updateWindow(WindowReference winID, bool containerOpen) { - if (winID == kNoWindow) return; + if (winID == kNoWindow) { + return; + } if (winID == kSelfWindow || containerOpen) { WindowData &data = findWindowData(winID); if (winID == kCommandsWindow) { @@ -822,8 +848,9 @@ void Gui::unselectExits() { } void Gui::updateExit(ObjID obj) { - if (!_engine->isObjExit(obj)) return; - + if (!_engine->isObjExit(obj)) { + return; + } BorderBounds border = borderBounds(getWindowData(kExitsWindow).type); int ctl = -1; @@ -943,7 +970,9 @@ Common::Point Gui::getGlobalScrolledSurfacePosition(WindowReference reference) { const WindowData &data = getWindowData(reference); BorderBounds border = borderBounds(data.type); Graphics::MacWindow *win = findWindow(reference); - if (!win) return Common::Point(0, 0); + if (!win) { + return Common::Point(0, 0); + } return Common::Point( win->getDimensions().left + border.leftOffset - data.scrollPos.x, win->getDimensions().top + border.topOffset - data.scrollPos.y); @@ -1010,12 +1039,16 @@ WindowReference Gui::findObjWindow(ObjID objID) { // This is a bit of a HACK, we take advantage of the consecutive nature of references for (uint i = kCommandsWindow; i <= kDiplomaWindow; i++) { const WindowData &data = getWindowData((WindowReference)i); - if (data.objRef == objID) { return data.refcon; } + if (data.objRef == objID) { + return data.refcon; + } } for (uint i = kInventoryStart; i < _inventoryWindows.size() + kInventoryStart; i++) { const WindowData &data = getWindowData((WindowReference)i); - if (data.objRef == objID) { return data.refcon; } + if (data.objRef == objID) { + return data.refcon; + } } return kNoWindow; @@ -1068,7 +1101,9 @@ void Gui::selectDraggable(ObjID child, WindowReference origin, Common::Point cli void Gui::handleDragRelease(bool shiftPressed, bool isDoubleClick) { if (_draggedObj.id != 0) { WindowReference destinationWindow = findWindowAtPoint(_draggedObj.pos); - if (destinationWindow == kNoWindow) return; + if (destinationWindow == kNoWindow) { + return; + } if (_draggedObj.hasMoved) { const WindowData &destinationWindowData = getWindowData(destinationWindow); ObjID destObject = destinationWindowData.objRef; @@ -1246,7 +1281,9 @@ bool Gui::processEvent(Common::Event &event) { processed |= _cursor->processEvent(event); - if (_dialog && _dialog->processEvent(event)) return true; + if (_dialog && _dialog->processEvent(event)) { + return true; + } if (event.type == Common::EVENT_MOUSEMOVE) { if (_draggedObj.id != 0) { @@ -1370,7 +1407,9 @@ bool MacVenture::Gui::processDiplomaEvents(WindowClick click, Common::Event & ev bool Gui::processInventoryEvents(WindowClick click, Common::Event & event) { if (event.type == Common::EVENT_LBUTTONDOWN && click == kBorderCloseButton) { WindowReference ref = findWindowAtPoint(event.mouse); - if (ref == kNoWindow) return false; + if (ref == kNoWindow) { + return false; + } if (click == kBorderCloseButton) { removeInventoryWindow(ref); @@ -1384,7 +1423,9 @@ bool Gui::processInventoryEvents(WindowClick click, Common::Event & event) { if (event.type == Common::EVENT_LBUTTONDOWN) { // Find the appropriate window WindowReference ref = findWindowAtPoint(event.mouse); - if (ref == kNoWindow) return false; + if (ref == kNoWindow) { + return false; + } WindowData &data = findWindowData((WindowReference) ref); @@ -1406,7 +1447,9 @@ bool Gui::processInventoryEvents(WindowClick click, Common::Event & event) { void Gui::selectForDrag(Common::Point cursorPosition) { WindowReference ref = findWindowAtPoint(cursorPosition); - if (ref == kNoWindow) return; + if (ref == kNoWindow) { + return; + } Graphics::MacWindow *win = findWindow(ref); WindowData &data = findWindowData((WindowReference) ref); @@ -1418,13 +1461,17 @@ void Gui::selectForDrag(Common::Point cursorPosition) { void Gui::handleSingleClick() { debugC(2, kMVDebugGUI, "Registered Single Click"); // HACK THERE HAS TO BE A MORE ELEGANT WAY - if (_dialog) return; + if (_dialog) { + return; + } handleDragRelease(false, false); } void Gui::handleDoubleClick() { debugC(2, kMVDebugGUI, "Registered Double Click"); - if (_dialog) return; + if (_dialog) { + return; + } handleDragRelease(false, true); } |