[Scummvm-cvs-logs] scummvm master -> ae519716a207b134e3c287dc53cadb4ef55a389a

wjp wjp at usecode.org
Sat Dec 26 16:04:39 CET 2015


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

Summary:
6daf92cbf4 LAB: Reduce passing around of pointers to the near-global _closeDataPtr
e3ce65cce8 LAB: Reduce passing around of pointers to the near-global _closeDataPtr
f72de724e9 LAB: Reduce passing around of pointers to the near-global _closeDataPtr
01d99d213d LAB: Reduce passing around of pointers to the near-global _closeDataPtr
ae519716a2 Merge branch 'master' of github.com:scummvm/scummvm


Commit: 6daf92cbf41bb152c77312b692474fb44b5a7aee
    https://github.com/scummvm/scummvm/commit/6daf92cbf41bb152c77312b692474fb44b5a7aee
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2015-12-26T13:58:07+01:00

Commit Message:
LAB: Reduce passing around of pointers to the near-global _closeDataPtr

Changed paths:
    engines/lab/engine.cpp
    engines/lab/lab.h
    engines/lab/processroom.cpp



diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp
index 91388ea..b88a000 100644
--- a/engines/lab/engine.cpp
+++ b/engines/lab/engine.cpp
@@ -698,7 +698,7 @@ void LabEngine::processMainButton(uint16 &curInv, uint16 &lastInv, uint16 &oldDi
 	case kButtonClose:
 	case kButtonLook:
 		if ((actionMode == 4) && (buttonId == kButtonLook) && _closeDataPtr) {
-			doMainView(&_closeDataPtr);
+			doMainView();
 
 			_anim->_doBlack = true;
 			_closeDataPtr = nullptr;
@@ -748,7 +748,7 @@ void LabEngine::processMainButton(uint16 &curInv, uint16 &lastInv, uint16 &oldDi
 		oldDirection = _direction;
 
 		newDir = processArrow(_direction, buttonId - 6);
-		doTurn(_direction, newDir, &_closeDataPtr);
+		doTurn(_direction, newDir);
 		_anim->_doBlack = true;
 		_direction = newDir;
 		forceDraw = true;
@@ -759,7 +759,7 @@ void LabEngine::processMainButton(uint16 &curInv, uint16 &lastInv, uint16 &oldDi
 		_closeDataPtr = nullptr;
 		oldRoomNum = _roomNum;
 
-		if (doGoForward(&_closeDataPtr)) {
+		if (doGoForward()) {
 			if (oldRoomNum == _roomNum)
 				_anim->_doBlack = true;
 		} else {
@@ -996,7 +996,7 @@ void LabEngine::performAction(uint16 actionMode, Common::Point curPos, uint16 &c
 	case 5:
 		if (_conditions->in(curInv)) {
 			// Use an item on something else
-			if (doOperateRule(curPos, curInv, &_closeDataPtr)) {
+			if (doOperateRule(curPos, curInv)) {
 				_curFileName = _newFileName;
 
 				if (!_conditions->in(curInv))
diff --git a/engines/lab/lab.h b/engines/lab/lab.h
index 958f159..9a6ddc9 100644
--- a/engines/lab/lab.h
+++ b/engines/lab/lab.h
@@ -260,7 +260,7 @@ private:
 	/**
 	 * Goes through the rules if the user tries to go forward.
 	 */
-	bool doGoForward(CloseDataPtr *closePtrList);
+	bool doGoForward();
 
 	/**
 	 * Does the journal processing.
@@ -270,7 +270,7 @@ private:
 	/**
 	 * Goes through the rules if the user tries to go to the main view
 	 */
-	bool doMainView(CloseDataPtr *closePtrList);
+	bool doMainView();
 
 	/**
 	 * Does the map processing.
@@ -295,12 +295,12 @@ private:
 	/**
 	 * Goes through the rules if the user tries to operate an item on an object.
 	 */
-	bool doOperateRule(Common::Point pos, int16 ItemNum, CloseDataPtr *closePtrList);
+	bool doOperateRule(Common::Point pos, int16 ItemNum);
 
 	/**
 	 * Goes through the rules if the user tries to turn.
 	 */
-	bool doTurn(uint16 from, uint16 to, CloseDataPtr *closePtrList);
+	bool doTurn(uint16 from, uint16 to);
 
 	/**
 	 * If the user hits the "Use" button; things that can get used on themselves.
diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp
index 4d42f96..a7a1ee0 100644
--- a/engines/lab/processroom.cpp
+++ b/engines/lab/processroom.cpp
@@ -560,41 +560,41 @@ bool LabEngine::doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr clos
 	return false;
 }
 
-bool LabEngine::doOperateRule(Common::Point pos, int16 ItemNum, CloseDataPtr *closePtrList) {
+bool LabEngine::doOperateRule(Common::Point pos, int16 ItemNum) {
 	_newFileName = NOFILE;
-	CloseDataPtr closePtr = getObject(pos, *closePtrList);
+	CloseDataPtr closePtr = getObject(pos, _closeDataPtr);
 
-	if (doOperateRuleSub(ItemNum, _roomNum, closePtr, closePtrList, false))
+	if (doOperateRuleSub(ItemNum, _roomNum, closePtr, &_closeDataPtr, false))
 		return true;
-	else if (doOperateRuleSub(ItemNum, _roomNum, *closePtrList, closePtrList, false))
+	else if (doOperateRuleSub(ItemNum, _roomNum, _closeDataPtr, &_closeDataPtr, false))
 		return true;
-	else if (doOperateRuleSub(ItemNum, _roomNum, closePtr, closePtrList, true))
+	else if (doOperateRuleSub(ItemNum, _roomNum, closePtr, &_closeDataPtr, true))
 		return true;
-	else if (doOperateRuleSub(ItemNum, _roomNum, *closePtrList, closePtrList, true))
+	else if (doOperateRuleSub(ItemNum, _roomNum, _closeDataPtr, &_closeDataPtr, true))
 		return true;
 	else {
 		_newFileName = _curFileName;
 
-		if (doOperateRuleSub(ItemNum, 0, closePtr, closePtrList, false))
+		if (doOperateRuleSub(ItemNum, 0, closePtr, &_closeDataPtr, false))
 			return true;
-		else if (doOperateRuleSub(ItemNum, 0, *closePtrList, closePtrList, false))
+		else if (doOperateRuleSub(ItemNum, 0, _closeDataPtr, &_closeDataPtr, false))
 			return true;
-		else if (doOperateRuleSub(ItemNum, 0, closePtr, closePtrList, true))
+		else if (doOperateRuleSub(ItemNum, 0, closePtr, &_closeDataPtr, true))
 			return true;
-		else if (doOperateRuleSub(ItemNum, 0, *closePtrList, closePtrList, true))
+		else if (doOperateRuleSub(ItemNum, 0, _closeDataPtr, &_closeDataPtr, true))
 			return true;
 	}
 
 	return false;
 }
 
-bool LabEngine::doGoForward(CloseDataPtr *closePtrList) {
+bool LabEngine::doGoForward() {
 	RuleList &rules = _rooms[_roomNum]._rules;
 
 	for (RuleList::iterator rule = rules.begin(); rule != rules.end(); ++rule) {
 		if ((rule->_ruleType == kRuleTypeGoForward) && (rule->_param1 == (_direction + 1))) {
 			if (checkConditions(rule->_condition)) {
-				doActions(rule->_actionList, closePtrList);
+				doActions(rule->_actionList, &_closeDataPtr);
 				return true;
 			}
 		}
@@ -603,7 +603,7 @@ bool LabEngine::doGoForward(CloseDataPtr *closePtrList) {
 	return false;
 }
 
-bool LabEngine::doTurn(uint16 from, uint16 to, CloseDataPtr *closePtrList) {
+bool LabEngine::doTurn(uint16 from, uint16 to) {
 	from++;
 	to++;
 
@@ -614,7 +614,7 @@ bool LabEngine::doTurn(uint16 from, uint16 to, CloseDataPtr *closePtrList) {
 			  ((rule->_ruleType == kRuleTypeTurnFromTo) &&
 			  (rule->_param1 == from) && (rule->_param2 == to))) {
 			if (checkConditions(rule->_condition)) {
-				doActions(rule->_actionList, closePtrList);
+				doActions(rule->_actionList, &_closeDataPtr);
 				return true;
 			}
 		}
@@ -623,12 +623,12 @@ bool LabEngine::doTurn(uint16 from, uint16 to, CloseDataPtr *closePtrList) {
 	return false;
 }
 
-bool LabEngine::doMainView(CloseDataPtr *closePtrList) {
+bool LabEngine::doMainView() {
 	RuleList &rules = _rooms[_roomNum]._rules;
 	for (RuleList::iterator rule = rules.begin(); rule != rules.end(); ++rule) {
 		if (rule->_ruleType == kRuleTypeGoMainView) {
 			if (checkConditions(rule->_condition)) {
-				doActions(rule->_actionList, closePtrList);
+				doActions(rule->_actionList, &_closeDataPtr);
 				return true;
 			}
 		}


Commit: e3ce65cce86c9ae82e00d215cc9f59c5386633c6
    https://github.com/scummvm/scummvm/commit/e3ce65cce86c9ae82e00d215cc9f59c5386633c6
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2015-12-26T14:04:39+01:00

Commit Message:
LAB: Reduce passing around of pointers to the near-global _closeDataPtr

Changed paths:
    engines/lab/engine.cpp
    engines/lab/lab.h
    engines/lab/processroom.cpp



diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp
index b88a000..8c95f96 100644
--- a/engines/lab/engine.cpp
+++ b/engines/lab/engine.cpp
@@ -952,13 +952,13 @@ void LabEngine::performAction(uint16 actionMode, Common::Point curPos, uint16 &c
 	switch (actionMode) {
 	case 0:
 		// Take something.
-		if (doActionRule(curPos, actionMode, _roomNum, &_closeDataPtr))
+		if (doActionRule(curPos, actionMode, _roomNum))
 			_curFileName = _newFileName;
 		else if (takeItem(curPos, &_closeDataPtr))
 			drawStaticMessage(kTextTakeItem);
-		else if (doActionRule(curPos, kRuleActionTakeDef, _roomNum, &_closeDataPtr))
+		else if (doActionRule(curPos, kRuleActionTakeDef, _roomNum))
 			_curFileName = _newFileName;
-		else if (doActionRule(curPos, kRuleActionTake, 0, &_closeDataPtr))
+		else if (doActionRule(curPos, kRuleActionTake, 0))
 			_curFileName = _newFileName;
 		else if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2)))
 			drawStaticMessage(kTextNothing);
@@ -969,9 +969,9 @@ void LabEngine::performAction(uint16 actionMode, Common::Point curPos, uint16 &c
 	case 2:
 	case 3:
 		// Manipulate an object, Open up a "door" or Close a "door"
-		if (doActionRule(curPos, actionMode, _roomNum, &_closeDataPtr))
+		if (doActionRule(curPos, actionMode, _roomNum))
 			_curFileName = _newFileName;
-		else if (!doActionRule(curPos, actionMode, 0, &_closeDataPtr)) {
+		else if (!doActionRule(curPos, actionMode, 0)) {
 			if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2)))
 				drawStaticMessage(kTextNothing);
 		}
diff --git a/engines/lab/lab.h b/engines/lab/lab.h
index 9a6ddc9..f0849f2 100644
--- a/engines/lab/lab.h
+++ b/engines/lab/lab.h
@@ -245,12 +245,12 @@ private:
 	/**
 	 * Goes through the rules if an action is taken.
 	 */
-	bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *closePtrList);
+	bool doActionRule(Common::Point pos, int16 action, int16 roomNum);
 
 	/**
 	 * Does the work for doActionRule.
 	 */
-	bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults);
+	bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, bool allowDefaults);
 
 	/**
 	 * Checks whether the close up is one of the special case closeups.
@@ -290,7 +290,7 @@ private:
 	/**
 	 * Does the work for doActionRule.
 	 */
-	bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults);
+	bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr closePtr, bool allowDefaults);
 
 	/**
 	 * Goes through the rules if the user tries to operate an item on an object.
diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp
index a7a1ee0..9db9dbb 100644
--- a/engines/lab/processroom.cpp
+++ b/engines/lab/processroom.cpp
@@ -486,7 +486,7 @@ void LabEngine::doActions(const ActionList &actionList, CloseDataPtr *closePtrLi
 	}
 }
 
-bool LabEngine::doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults) {
+bool LabEngine::doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, bool allowDefaults) {
 	action++;
 
 	if (closePtr) {
@@ -504,7 +504,7 @@ bool LabEngine::doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closeP
 					  ((rule->_param2 == 0) && allowDefaults)) ||
 					  ((action == 1) && (rule->_param2 == -closePtr->_closeUpType))) {
 					if (checkConditions(rule->_condition)) {
-						doActions(rule->_actionList, setCloseList);
+						doActions(rule->_actionList, &_closeDataPtr);
 						return true;
 					}
 				}
@@ -515,27 +515,27 @@ bool LabEngine::doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closeP
 	return false;
 }
 
-bool LabEngine::doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *closePtrList) {
+bool LabEngine::doActionRule(Common::Point pos, int16 action, int16 roomNum) {
 	if (roomNum)
 		_newFileName = NOFILE;
 	else
 		_newFileName = _curFileName;
 
-	CloseDataPtr curClosePtr = getObject(pos, *closePtrList);
+	CloseDataPtr curClosePtr = getObject(pos, _closeDataPtr);
 
-	if (doActionRuleSub(action, roomNum, curClosePtr, closePtrList, false))
+	if (doActionRuleSub(action, roomNum, curClosePtr, false))
 		return true;
-	else if (doActionRuleSub(action, roomNum, *closePtrList, closePtrList, false))
+	else if (doActionRuleSub(action, roomNum, _closeDataPtr, false))
 		return true;
-	else if (doActionRuleSub(action, roomNum, curClosePtr, closePtrList, true))
+	else if (doActionRuleSub(action, roomNum, curClosePtr, true))
 		return true;
-	else if (doActionRuleSub(action, roomNum, *closePtrList, closePtrList, true))
+	else if (doActionRuleSub(action, roomNum, _closeDataPtr, true))
 		return true;
 
 	return false;
 }
 
-bool LabEngine::doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults) {
+bool LabEngine::doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr closePtr, bool allowDefaults) {
 	if (closePtr)
 		if (closePtr->_closeUpType > 0) {
 			RuleList *rules = &(_rooms[roomNum]._rules);
@@ -550,7 +550,7 @@ bool LabEngine::doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr clos
 					  ((rule->_param1 == itemNum) || ((rule->_param1 == 0) && allowDefaults)) &&
 						((rule->_param2 == closePtr->_closeUpType) || ((rule->_param2 == 0) && allowDefaults))) {
 					if (checkConditions(rule->_condition)) {
-						doActions(rule->_actionList, setCloseList);
+						doActions(rule->_actionList, &_closeDataPtr);
 						return true;
 					}
 				}
@@ -564,24 +564,24 @@ bool LabEngine::doOperateRule(Common::Point pos, int16 ItemNum) {
 	_newFileName = NOFILE;
 	CloseDataPtr closePtr = getObject(pos, _closeDataPtr);
 
-	if (doOperateRuleSub(ItemNum, _roomNum, closePtr, &_closeDataPtr, false))
+	if (doOperateRuleSub(ItemNum, _roomNum, closePtr, false))
 		return true;
-	else if (doOperateRuleSub(ItemNum, _roomNum, _closeDataPtr, &_closeDataPtr, false))
+	else if (doOperateRuleSub(ItemNum, _roomNum, _closeDataPtr, false))
 		return true;
-	else if (doOperateRuleSub(ItemNum, _roomNum, closePtr, &_closeDataPtr, true))
+	else if (doOperateRuleSub(ItemNum, _roomNum, closePtr, true))
 		return true;
-	else if (doOperateRuleSub(ItemNum, _roomNum, _closeDataPtr, &_closeDataPtr, true))
+	else if (doOperateRuleSub(ItemNum, _roomNum, _closeDataPtr, true))
 		return true;
 	else {
 		_newFileName = _curFileName;
 
-		if (doOperateRuleSub(ItemNum, 0, closePtr, &_closeDataPtr, false))
+		if (doOperateRuleSub(ItemNum, 0, closePtr, false))
 			return true;
-		else if (doOperateRuleSub(ItemNum, 0, _closeDataPtr, &_closeDataPtr, false))
+		else if (doOperateRuleSub(ItemNum, 0, _closeDataPtr, false))
 			return true;
-		else if (doOperateRuleSub(ItemNum, 0, closePtr, &_closeDataPtr, true))
+		else if (doOperateRuleSub(ItemNum, 0, closePtr, true))
 			return true;
-		else if (doOperateRuleSub(ItemNum, 0, _closeDataPtr, &_closeDataPtr, true))
+		else if (doOperateRuleSub(ItemNum, 0, _closeDataPtr, true))
 			return true;
 	}
 


Commit: f72de724e90aa9f79cc08a029c508559dde383ae
    https://github.com/scummvm/scummvm/commit/f72de724e90aa9f79cc08a029c508559dde383ae
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2015-12-26T14:07:46+01:00

Commit Message:
LAB: Reduce passing around of pointers to the near-global _closeDataPtr

Changed paths:
    engines/lab/lab.h
    engines/lab/processroom.cpp



diff --git a/engines/lab/lab.h b/engines/lab/lab.h
index f0849f2..57fc8fe 100644
--- a/engines/lab/lab.h
+++ b/engines/lab/lab.h
@@ -240,7 +240,7 @@ private:
 	/**
 	 * Processes the action list.
 	 */
-	void doActions(const ActionList &actionList, CloseDataPtr *closePtrList);
+	void doActions(const ActionList &actionList);
 
 	/**
 	 * Goes through the rules if an action is taken.
diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp
index 9db9dbb..854c629 100644
--- a/engines/lab/processroom.cpp
+++ b/engines/lab/processroom.cpp
@@ -232,7 +232,7 @@ bool LabEngine::takeItem(Common::Point pos, CloseDataPtr *closePtrList) {
 	return false;
 }
 
-void LabEngine::doActions(const ActionList &actionList, CloseDataPtr *closePtrList) {
+void LabEngine::doActions(const ActionList &actionList) {
 	ActionList::const_iterator action;
 	for (action = actionList.begin(); action != actionList.end(); ++action) {
 		updateMusicAndEvents();
@@ -274,7 +274,7 @@ void LabEngine::doActions(const ActionList &actionList, CloseDataPtr *closePtrLi
 			error("Unused opcode kActionShowBitmap has been called");
 
 		case kActionTransition:
-			_graphics->doTransition((TransitionType)action->_param1, closePtrList, action->_messages[0].c_str());
+			_graphics->doTransition((TransitionType)action->_param1, &_closeDataPtr, action->_messages[0].c_str());
 			break;
 
 		case kActionNoUpdate:
@@ -287,7 +287,7 @@ void LabEngine::doActions(const ActionList &actionList, CloseDataPtr *closePtrLi
 			break;
 
 		case kActionShowCurPict: {
-			Common::String test = getPictName(closePtrList);
+			Common::String test = getPictName(&_closeDataPtr);
 
 			if (test != _curFileName) {
 				_curFileName = test;
@@ -312,7 +312,7 @@ void LabEngine::doActions(const ActionList &actionList, CloseDataPtr *closePtrLi
 			break;
 
 		case kActionCShowMessage:
-			if (!*closePtrList)
+			if (!_closeDataPtr)
 				_graphics->drawMessage(action->_messages[0], true);
 			break;
 
@@ -324,7 +324,7 @@ void LabEngine::doActions(const ActionList &actionList, CloseDataPtr *closePtrLi
 			if (action->_param1 & 0x8000) {
 				// This is a Wyrmkeep Windows trial version, thus stop at this
 				// point, since we can't check for game payment status
-				_graphics->readPict(getPictName(closePtrList));
+				_graphics->readPict(getPictName(&_closeDataPtr));
 				GUI::MessageDialog trialMessage("This is the end of the trial version. You can play the full game using the original interpreter from Wyrmkeep");
 				trialMessage.runModal();
 				break;
@@ -332,21 +332,21 @@ void LabEngine::doActions(const ActionList &actionList, CloseDataPtr *closePtrLi
 
 			_roomNum   = action->_param1;
 			_direction = action->_param2 - 1;
-			*closePtrList = nullptr;
+			_closeDataPtr = nullptr;
 			_anim->_doBlack = true;
 			break;
 
 		case kActionSetCloseup: {
 			Common::Point curPos = Common::Point(_utils->scaleX(action->_param1), _utils->scaleY(action->_param2));
-				CloseDataPtr tmpClosePtr = getObject(curPos, *closePtrList);
+				CloseDataPtr tmpClosePtr = getObject(curPos, _closeDataPtr);
 
 				if (tmpClosePtr)
-					*closePtrList = tmpClosePtr;
+					_closeDataPtr = tmpClosePtr;
 			}
 			break;
 
 		case kActionMainView:
-			*closePtrList = nullptr;
+			_closeDataPtr = nullptr;
 			break;
 
 		case kActionSubInv:
@@ -504,7 +504,7 @@ bool LabEngine::doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closeP
 					  ((rule->_param2 == 0) && allowDefaults)) ||
 					  ((action == 1) && (rule->_param2 == -closePtr->_closeUpType))) {
 					if (checkConditions(rule->_condition)) {
-						doActions(rule->_actionList, &_closeDataPtr);
+						doActions(rule->_actionList);
 						return true;
 					}
 				}
@@ -550,7 +550,7 @@ bool LabEngine::doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr clos
 					  ((rule->_param1 == itemNum) || ((rule->_param1 == 0) && allowDefaults)) &&
 						((rule->_param2 == closePtr->_closeUpType) || ((rule->_param2 == 0) && allowDefaults))) {
 					if (checkConditions(rule->_condition)) {
-						doActions(rule->_actionList, &_closeDataPtr);
+						doActions(rule->_actionList);
 						return true;
 					}
 				}
@@ -594,7 +594,7 @@ bool LabEngine::doGoForward() {
 	for (RuleList::iterator rule = rules.begin(); rule != rules.end(); ++rule) {
 		if ((rule->_ruleType == kRuleTypeGoForward) && (rule->_param1 == (_direction + 1))) {
 			if (checkConditions(rule->_condition)) {
-				doActions(rule->_actionList, &_closeDataPtr);
+				doActions(rule->_actionList);
 				return true;
 			}
 		}
@@ -614,7 +614,7 @@ bool LabEngine::doTurn(uint16 from, uint16 to) {
 			  ((rule->_ruleType == kRuleTypeTurnFromTo) &&
 			  (rule->_param1 == from) && (rule->_param2 == to))) {
 			if (checkConditions(rule->_condition)) {
-				doActions(rule->_actionList, &_closeDataPtr);
+				doActions(rule->_actionList);
 				return true;
 			}
 		}
@@ -628,7 +628,7 @@ bool LabEngine::doMainView() {
 	for (RuleList::iterator rule = rules.begin(); rule != rules.end(); ++rule) {
 		if (rule->_ruleType == kRuleTypeGoMainView) {
 			if (checkConditions(rule->_condition)) {
-				doActions(rule->_actionList, &_closeDataPtr);
+				doActions(rule->_actionList);
 				return true;
 			}
 		}


Commit: 01d99d213dae8731c3c9a19cbd98f5fbfb9ee1fc
    https://github.com/scummvm/scummvm/commit/01d99d213dae8731c3c9a19cbd98f5fbfb9ee1fc
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2015-12-26T14:18:44+01:00

Commit Message:
LAB: Reduce passing around of pointers to the near-global _closeDataPtr

Changed paths:
    engines/lab/dispman.cpp
    engines/lab/dispman.h
    engines/lab/engine.cpp
    engines/lab/lab.h
    engines/lab/processroom.cpp
    engines/lab/savegame.cpp



diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp
index 8ff6a61..65bb7c4 100644
--- a/engines/lab/dispman.cpp
+++ b/engines/lab/dispman.cpp
@@ -738,7 +738,7 @@ void DisplayMan::doScrollBounce() {
 	_vm->_event->mouseShow();
 }
 
-void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, const Common::String filename) {
+void DisplayMan::doTransWipe(const Common::String filename) {
 	uint16 lastY, linesLast;
 
 	if (_vm->_isHiRes) {
@@ -773,11 +773,11 @@ void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, const Common::String fi
 	}	// for j
 
 	if (filename.empty())
-		_vm->_curFileName = _vm->getPictName(closePtrList);
+		_vm->_curFileName = _vm->getPictName(true);
 	else if (filename[0] > ' ')
 		_vm->_curFileName = filename;
 	else
-		_vm->_curFileName = _vm->getPictName(closePtrList);
+		_vm->_curFileName = _vm->getPictName(true);
 
 	byte *bitMapBuffer = new byte[_screenWidth * (lastY + 5)];
 	readPict(_vm->_curFileName, true, false, bitMapBuffer);
@@ -826,11 +826,11 @@ void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, const Common::String fi
 	// bitMapBuffer will be deleted by the Image destructor
 }
 
-void DisplayMan::doTransition(TransitionType transitionType, CloseDataPtr *closePtrList, const Common::String filename) {
+void DisplayMan::doTransition(TransitionType transitionType, const Common::String filename) {
 	switch (transitionType) {
 	case kTransitionWipe:
 	case kTransitionTransporter:
-		doTransWipe(closePtrList, filename);
+		doTransWipe(filename);
 		break;
 	case kTransitionScrollWipe:
 		doScrollWipe(filename);
diff --git a/engines/lab/dispman.h b/engines/lab/dispman.h
index 2cf58c3..19d40b9 100644
--- a/engines/lab/dispman.h
+++ b/engines/lab/dispman.h
@@ -106,12 +106,12 @@ public:
 	/**
 	 * Does the transporter wipe.
 	 */
-	void doTransWipe(CloseDataPtr *closePtrList, const Common::String filename);
+	void doTransWipe(const Common::String filename);
 
 	/**
 	 * Does a certain number of pre-programmed wipes.
 	 */
-	void doTransition(TransitionType transitionType, CloseDataPtr *closePtrList, const Common::String filename);
+	void doTransition(TransitionType transitionType, const Common::String filename);
 
 	/**
 	 * Changes the front screen to black.
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp
index 8c95f96..34db2c5 100644
--- a/engines/lab/engine.cpp
+++ b/engines/lab/engine.cpp
@@ -425,7 +425,7 @@ void LabEngine::mainGameLoop() {
 
 			// Sets the current picture properly on the screen
 			if (_mainDisplay)
-				_nextFileName = getPictName(&_closeDataPtr);
+				_nextFileName = getPictName(true);
 
 			if (_noUpdateDiff) {
 				// Potentially entered another room
@@ -954,7 +954,7 @@ void LabEngine::performAction(uint16 actionMode, Common::Point curPos, uint16 &c
 		// Take something.
 		if (doActionRule(curPos, actionMode, _roomNum))
 			_curFileName = _newFileName;
-		else if (takeItem(curPos, &_closeDataPtr))
+		else if (takeItem(curPos))
 			drawStaticMessage(kTextTakeItem);
 		else if (doActionRule(curPos, kRuleActionTakeDef, _roomNum))
 			_curFileName = _newFileName;
diff --git a/engines/lab/lab.h b/engines/lab/lab.h
index 57fc8fe..8e8255f 100644
--- a/engines/lab/lab.h
+++ b/engines/lab/lab.h
@@ -219,7 +219,7 @@ public:
 	/**
 	 * Returns the current picture name.
 	 */
-	Common::String getPictName(CloseDataPtr *closePtrList);
+	Common::String getPictName(bool useClose);
 	uint16 getQuarters();
 	void setDirection(uint16 direction) { _direction = direction; };
 	void setQuarters(uint16 quarters);
@@ -470,7 +470,7 @@ private:
 	/**
 	 * Takes the currently selected item.
 	 */
-	bool takeItem(Common::Point pos, CloseDataPtr *closePtrList);
+	bool takeItem(Common::Point pos);
 
 	/**
 	 * Does the turn page wipe.
diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp
index 854c629..d54a7fc 100644
--- a/engines/lab/processroom.cpp
+++ b/engines/lab/processroom.cpp
@@ -104,14 +104,14 @@ CloseDataPtr LabEngine::findClosePtrMatch(CloseDataPtr closePtr, CloseDataList &
 	return nullptr;
 }
 
-Common::String LabEngine::getPictName(CloseDataPtr *closePtrList) {
+Common::String LabEngine::getPictName(bool useClose) {
 	ViewData *viewPtr = getViewData(_roomNum, _direction);
 
-	if (*closePtrList) {
-		*closePtrList = findClosePtrMatch(*closePtrList, viewPtr->_closeUps);
+	if (useClose && _closeDataPtr) {
+		_closeDataPtr = findClosePtrMatch(_closeDataPtr, viewPtr->_closeUps);
 
-		if (*closePtrList)
-			return (*closePtrList)->_graphicName;
+		if (_closeDataPtr)
+			return _closeDataPtr->_graphicName;
 	}
 
 	return viewPtr->_graphicName;
@@ -209,15 +209,15 @@ void LabEngine::setCurrentClose(Common::Point pos, CloseDataPtr *closePtrList, b
 	}
 }
 
-bool LabEngine::takeItem(Common::Point pos, CloseDataPtr *closePtrList) {
+bool LabEngine::takeItem(Common::Point pos) {
 	CloseDataList *list;
-	if (!*closePtrList) {
+	if (!_closeDataPtr) {
 		list = &(getViewData(_roomNum, _direction)->_closeUps);
-	} else if ((*closePtrList)->_closeUpType < 0) {
-		_conditions->inclElement(abs((*closePtrList)->_closeUpType));
+	} else if (_closeDataPtr->_closeUpType < 0) {
+		_conditions->inclElement(abs(_closeDataPtr->_closeUpType));
 		return true;
 	} else
-		list = &((*closePtrList)->_subCloseUps);
+		list = &(_closeDataPtr->_subCloseUps);
 
 	CloseDataList::iterator closePtr;
 	for (closePtr = list->begin(); closePtr != list->end(); ++closePtr) {
@@ -274,7 +274,7 @@ void LabEngine::doActions(const ActionList &actionList) {
 			error("Unused opcode kActionShowBitmap has been called");
 
 		case kActionTransition:
-			_graphics->doTransition((TransitionType)action->_param1, &_closeDataPtr, action->_messages[0].c_str());
+			_graphics->doTransition((TransitionType)action->_param1, action->_messages[0].c_str());
 			break;
 
 		case kActionNoUpdate:
@@ -287,7 +287,7 @@ void LabEngine::doActions(const ActionList &actionList) {
 			break;
 
 		case kActionShowCurPict: {
-			Common::String test = getPictName(&_closeDataPtr);
+			Common::String test = getPictName(true);
 
 			if (test != _curFileName) {
 				_curFileName = test;
@@ -324,7 +324,7 @@ void LabEngine::doActions(const ActionList &actionList) {
 			if (action->_param1 & 0x8000) {
 				// This is a Wyrmkeep Windows trial version, thus stop at this
 				// point, since we can't check for game payment status
-				_graphics->readPict(getPictName(&_closeDataPtr));
+				_graphics->readPict(getPictName(true));
 				GUI::MessageDialog trialMessage("This is the end of the trial version. You can play the full game using the original interpreter from Wyrmkeep");
 				trialMessage.runModal();
 				break;
diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp
index 0bdaf74..beeae8d 100644
--- a/engines/lab/savegame.cpp
+++ b/engines/lab/savegame.cpp
@@ -128,8 +128,8 @@ bool LabEngine::saveGame(int slot, const Common::String desc) {
 		return false;
 
 	// Load scene pic
-	CloseDataPtr closePtr = nullptr;
-	_graphics->readPict(getPictName(&closePtr));
+	_graphics->readPict(getPictName(false));
+
 
 	writeSaveGameHeader(file, desc);
 	file->writeUint16LE(_roomNum);


Commit: ae519716a207b134e3c287dc53cadb4ef55a389a
    https://github.com/scummvm/scummvm/commit/ae519716a207b134e3c287dc53cadb4ef55a389a
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2015-12-26T14:20:15+01:00

Commit Message:
Merge branch 'master' of github.com:scummvm/scummvm

Changed paths:
  A dists/scummvm_logo.bmp
  A engines/logo_data.h
    engines/engine.cpp
    engines/lab/anim.cpp
    engines/lab/anim.h
    engines/lab/detection.cpp
    engines/lab/dispman.cpp
    engines/lab/eventman.cpp
    engines/lab/lab.cpp
    engines/lab/map.cpp
    engines/lab/music.cpp
    engines/lab/music.h
    engines/lab/processroom.cpp
    gui/gui-manager.cpp
    gui/gui-manager.h
    gui/launcher.cpp



diff --cc engines/lab/dispman.cpp
index 65bb7c4,0b41193..a2c83f8
--- a/engines/lab/dispman.cpp
+++ b/engines/lab/dispman.cpp
@@@ -830,21 -825,21 +825,21 @@@ void DisplayMan::doTransition(Transitio
  	switch (transitionType) {
  	case kTransitionWipe:
  	case kTransitionTransporter:
 -		doTransWipe(closePtrList, filename);
 +		doTransWipe(filename);
  		break;
- 	case kTransitionScrollWipe:
+ 	case kTransitionScrollWipe:		// only used in scene 7 (street, when teleporting to the surreal maze)
  		doScrollWipe(filename);
  		break;
- 	case kTransitionScrollBlack:
+ 	case kTransitionScrollBlack:	// only used in scene 7 (street, when teleporting to the surreal maze)
  		doScrollBlack();
  		break;
- 	case kTransitionScrollBounce:
+ 	case kTransitionScrollBounce:	// only used in scene 7 (street, when teleporting to the surreal maze)
  		doScrollBounce();
  		break;
- 	case kTransitionReadFirstFrame:
+ 	case kTransitionReadFirstFrame:	// only used in scene 7 (street, when teleporting to the surreal maze)
  		readPict(filename, false);
  		break;
- 	case kTransitionReadNextFrame:
+ 	case kTransitionReadNextFrame:	// only used in scene 7 (street, when teleporting to the surreal maze)
  		_vm->_anim->diffNextFrame();
  		break;
  	case kTransitionNone:
diff --cc engines/lab/processroom.cpp
index d54a7fc,b955306..813642e
--- a/engines/lab/processroom.cpp
+++ b/engines/lab/processroom.cpp
@@@ -474,19 -466,10 +466,10 @@@ void LabEngine::doActions(const ActionL
  		}
  	}
  
- 	if (_music->_loopSoundEffect) {
- 		_music->_loopSoundEffect = false;
- 		_music->stopSoundEffect();
- 	} else {
- 		while (_music->isSoundEffectActive()) {
- 			updateMusicAndEvents();
- 			_anim->diffNextFrame();
- 			waitTOF();
- 		}
- 	}
+ 	_music->stopSoundEffect();
  }
  
 -bool LabEngine::doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults) {
 +bool LabEngine::doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, bool allowDefaults) {
  	action++;
  
  	if (closePtr) {






More information about the Scummvm-git-logs mailing list