[Scummvm-git-logs] scummvm master -> 9f5bcec6c809e9655426798c698571054f5c8b7b

sev- noreply at scummvm.org
Thu Sep 4 19:03:25 UTC 2025


This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
b44fb1ef80 MACVENTURE: Use correct ref in MacVentureEngine::handleObjectSelect()
b8c5f1f42a MACVENTURE: Fix all objects being draggable
e202ad1ac0 MACVENTURE: Draw draggable objects only when moved
204f83b0b2 MACVENTURE: Make background a selectable object
9f5bcec6c8 MACVENTURE: Fix objects being dragged after mouse button release


Commit: b44fb1ef80dbc6b3d59f48d6d3cce1844dc743ee
    https://github.com/scummvm/scummvm/commit/b44fb1ef80dbc6b3d59f48d6d3cce1844dc743ee
Author: Alikhan Balpykov (luxrage1990 at gmail.com)
Date: 2025-09-04T21:03:19+02:00

Commit Message:
MACVENTURE: Use correct ref in MacVentureEngine::handleObjectSelect()

Changed paths:
    engines/macventure/macventure.cpp


diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp
index c9fb7dc7a7d..c0e8f0f6e05 100644
--- a/engines/macventure/macventure.cpp
+++ b/engines/macventure/macventure.cpp
@@ -377,7 +377,7 @@ void MacVentureEngine::handleObjectSelect(ObjID objID, WindowReference win, bool
 		} else {
 			if (objID == 0) {
 				unselectAll();
-				objID = win;
+				objID = windata.objRef;
 			}
 			if (objID > 0) {
 				int currentObjectIndex = findObjectInArray(objID, _currentSelection);


Commit: b8c5f1f42a28020c0f2708086ed0c1c6882a8731
    https://github.com/scummvm/scummvm/commit/b8c5f1f42a28020c0f2708086ed0c1c6882a8731
Author: Alikhan Balpykov (luxrage1990 at gmail.com)
Date: 2025-09-04T21:03:19+02:00

Commit Message:
MACVENTURE: Fix all objects being draggable

Changed paths:
    engines/macventure/gui.cpp
    engines/macventure/macventure.cpp
    engines/macventure/macventure.h
    engines/macventure/world.h


diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index 63b7c8309c6..4652d12b02b 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -1231,17 +1231,19 @@ void Gui::selectDraggable(ObjID child, WindowReference origin, Common::Point cli
 		}
 
 		for (auto &selObj: _engine->getSelectedObjects()) {
-			DraggedObj obj;
-			obj.hasMoved = false;
-			obj.id = selObj;
-			obj.startWin = origin;
-			Common::Point localizedClick = click - getGlobalScrolledSurfacePosition(origin);
-			obj.mouseOffset = _engine->getObjPosition(selObj) - localizedClick;
-			obj.pos = click + obj.mouseOffset;
-			obj.startPos = obj.pos;
-
-			_draggedObjects.push_back(obj);
-			_draggedSurfaces.push_back(Graphics::ManagedSurface());
+			if (_engine->isObjDraggable(selObj)) {
+				DraggedObj obj;
+				obj.hasMoved = false;
+				obj.id = selObj;
+				obj.startWin = origin;
+				Common::Point localizedClick = click - getGlobalScrolledSurfacePosition(origin);
+				obj.mouseOffset = _engine->getObjPosition(selObj) - localizedClick;
+				obj.pos = click + obj.mouseOffset;
+				obj.startPos = obj.pos;
+
+				_draggedObjects.push_back(obj);
+				_draggedSurfaces.push_back(Graphics::ManagedSurface());
+			}
 		}
 		_engine->getSelectedObjects().clear();
 	}
@@ -1277,11 +1279,19 @@ void Gui::handleDragRelease(bool shiftPressed, bool isDoubleClick) {
 			return;
 		}
 		if (isDoubleClick) {
-			// WORKAROUND: Make windows to be selectable as objects to
-			// trigger certain events when double clicking.
-			// TODO: Make object selection, dragging done with single click.
-			// Handle this in a single click as well.
-			_engine->handleObjectSelect(0, destinationWindow, shiftPressed, isDoubleClick);
+			WindowData &data = findWindowData((WindowReference)destinationWindow);
+			Graphics::MacWindow *win = findWindow(destinationWindow);
+
+			ObjID child = 0;
+			Common::Rect clickRect = calculateClickRect(_cursor->getPos() + data.scrollPos, win->getInnerDimensions());
+
+			for (Common::Array<DrawableObject>::const_iterator it = data.children.begin(); it != data.children.end(); it++) {
+				if (canBeSelected((*it).obj, clickRect, destinationWindow)) {
+					child = (*it).obj;
+				}
+			}
+
+			_engine->handleObjectSelect(child, destinationWindow, shiftPressed, isDoubleClick);
 		}
 	}
 }
diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp
index c0e8f0f6e05..fc334c25997 100644
--- a/engines/macventure/macventure.cpp
+++ b/engines/macventure/macventure.cpp
@@ -1184,6 +1184,10 @@ bool MacVentureEngine::isObjClickable(ObjID objID) {
 	return _world->getObjAttr(objID, kAttrUnclickable) == 0;
 }
 
+bool MacVentureEngine::isObjDraggable(ObjID objID) {
+	return _world->isObjDraggable(objID);
+}
+
 bool MacVentureEngine::isObjSelected(ObjID objID) {
 	int idx = findObjectInArray(objID, _currentSelection);
 	return idx != -1;
diff --git a/engines/macventure/macventure.h b/engines/macventure/macventure.h
index 83f66a03158..48fe84c8f7a 100644
--- a/engines/macventure/macventure.h
+++ b/engines/macventure/macventure.h
@@ -310,6 +310,7 @@ public:
 	Common::Point getObjPosition(ObjID objID);
 	bool isObjVisible(ObjID objID);
 	bool isObjClickable(ObjID objID);
+	bool isObjDraggable(ObjID objID);
 	bool isObjSelected(ObjID objID);
 	bool isObjExit(ObjID objID);
 	bool isHiddenExit(ObjID objID);
diff --git a/engines/macventure/world.h b/engines/macventure/world.h
index 1895f0c5441..a7b445eaa9e 100644
--- a/engines/macventure/world.h
+++ b/engines/macventure/world.h
@@ -112,6 +112,7 @@ public:
 	Common::String getText(ObjID objID, ObjID source, ObjID target);
 
 	bool isObjActive(ObjID objID);
+	bool isObjDraggable(ObjID objID);
 
 	ObjID getAncestor(ObjID objID);
 	Common::Array<ObjID> getFamily(ObjID objID, bool recursive);
@@ -121,7 +122,6 @@ public:
 	void saveGameInto(Common::OutSaveFile *file);
 
 private:
-	bool isObjDraggable(ObjID objID);
 	bool intersects(ObjID objID, Common::Rect rect);
 
 	void calculateObjectRelations();


Commit: e202ad1ac04628f687565b35068ec1d73ee6cb94
    https://github.com/scummvm/scummvm/commit/e202ad1ac04628f687565b35068ec1d73ee6cb94
Author: Alikhan Balpykov (luxrage1990 at gmail.com)
Date: 2025-09-04T21:03:19+02:00

Commit Message:
MACVENTURE: Draw draggable objects only when moved

Changed paths:
    engines/macventure/gui.cpp


diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index 4652d12b02b..8a4279b857e 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -848,7 +848,7 @@ void Gui::drawWindowTitle(WindowReference target, Graphics::ManagedSurface *surf
 void Gui::drawDraggedObjects() {
 	for (uint i = 0; i < _draggedObjects.size(); i++) {
 		if (_draggedObjects[i].id != 0 &&
-			_engine->isObjVisible(_draggedObjects[i].id)) {
+			_engine->isObjVisible(_draggedObjects[i].id) && _draggedObjects[i].hasMoved) {
 			ensureAssetLoaded(_draggedObjects[i].id);
 			ImageAsset *asset = _assets[_draggedObjects[i].id];
 


Commit: 204f83b0b2eb8080bc11281dd345f63eda6738fb
    https://github.com/scummvm/scummvm/commit/204f83b0b2eb8080bc11281dd345f63eda6738fb
Author: Alikhan Balpykov (luxrage1990 at gmail.com)
Date: 2025-09-04T21:03:19+02:00

Commit Message:
MACVENTURE: Make background a selectable object

Changed paths:
    engines/macventure/gui.cpp
    engines/macventure/gui.h
    engines/macventure/macventure.cpp


diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index 8a4279b857e..3ba93b5ced4 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -289,9 +289,6 @@ void Gui::initWindows() {
 	_exitsWindow->setActive(false);
 	_exitsWindow->setCallback(exitsWindowCallback, this);
 	_exitsWindow->setTitle(findWindowData(kExitsWindow).title);
-	// TODO: In the original, the background is actually a clickable
-	// object that can be used to refer to the room itself. In that case,
-	// the background should be kPatternDarkGray.
 	_exitsWindow->setBackgroundPattern(kPatternLightGray);
 }
 
@@ -761,8 +758,6 @@ void Gui::drawInventories() {
 }
 
 void Gui::drawExitsWindow() {
-	_exitsWindow->setBackgroundPattern(kPatternLightGray);
-
 	Graphics::ManagedSurface *srf = _exitsWindow->getWindowSurface();
 
 	Common::Array<CommandButton>::const_iterator it = _exitsData->begin();
@@ -995,6 +990,12 @@ void Gui::updateExit(ObjID obj) {
 	}
 }
 
+void Gui::resetExitBackgroundPattern() {
+	if (!_exitsWindow)
+		return;
+	_exitsWindow->setBackgroundPattern(kPatternLightGray);
+}
+
 Common::String Gui::getConsoleText() const {
 	return Common::String(_outConsoleWindow->getTextChunk(0, 0, -1, -1));
 }
@@ -1197,7 +1198,7 @@ void Gui::checkSelect(const WindowData &data, Common::Point pos, const Common::R
 			child = (*it).obj;
 		}
 	}
-	if (child != 0) {
+	if (child != 0 || data.refcon == kMainGameWindow) {
 		if (!isDoubleClick)
 			selectDraggable(child, ref, pos);
 		_engine->handleObjectSelect(child, ref, shiftPressed, isDoubleClick);
@@ -1510,6 +1511,11 @@ void Gui::highlightExitButton(ObjID objID) {
 		else
 			it->unselect();
 	}
+	if (objID == _engine->getParent(1)) {
+		_exitsWindow->setBackgroundPattern(kPatternDarkGray);
+	} else {
+		_exitsWindow->setBackgroundPattern(kPatternLightGray);
+	}
 }
 
 Common::Point Gui::getObjMeasures(ObjID obj) {
diff --git a/engines/macventure/gui.h b/engines/macventure/gui.h
index 64f136ea95e..36fd249015c 100644
--- a/engines/macventure/gui.h
+++ b/engines/macventure/gui.h
@@ -156,6 +156,7 @@ public:
 	void clearExits();
 	void unselectExits();
 	void updateExit(ObjID id);
+	void resetExitBackgroundPattern();
 
 	Common::String getConsoleText() const;
 	void setConsoleText(const Common::String &text);
diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp
index fc334c25997..99f81a6ea5a 100644
--- a/engines/macventure/macventure.cpp
+++ b/engines/macventure/macventure.cpp
@@ -892,6 +892,7 @@ void MacVentureEngine::updateExits() {
 	for (uint i = 0; i < exits.size(); i++)
 		_gui->updateExit(exits[i]);
 
+	_gui->resetExitBackgroundPattern();
 }
 
 int MacVentureEngine::findObjectInArray(ObjID objID, const Common::Array<ObjID> &list) {


Commit: 9f5bcec6c809e9655426798c698571054f5c8b7b
    https://github.com/scummvm/scummvm/commit/9f5bcec6c809e9655426798c698571054f5c8b7b
Author: Alikhan Balpykov (luxrage1990 at gmail.com)
Date: 2025-09-04T21:03:19+02:00

Commit Message:
MACVENTURE: Fix objects being dragged after mouse button release

Changed paths:
    engines/macventure/gui.cpp


diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index 3ba93b5ced4..a5093b6d78d 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -1539,6 +1539,8 @@ bool Gui::processEvent(Common::Event &event) {
 			moveDraggedObjects(event.mouse);
 		}
 		processed = true;
+	} else if (event.type == Common::EVENT_LBUTTONUP) {
+		clearDraggedObjects();
 	}
 
 	processed |= _wm.processEvent(event);




More information about the Scummvm-git-logs mailing list