diff options
-rw-r--r-- | engines/lab/engine.cpp | 8 | ||||
-rw-r--r-- | engines/lab/lab.h | 19 | ||||
-rw-r--r-- | engines/lab/processroom.cpp | 34 | ||||
-rw-r--r-- | engines/lab/special.cpp | 4 |
4 files changed, 32 insertions, 33 deletions
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 34db2c5a92..46f346372b 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -103,7 +103,7 @@ void LabEngine::setQuarters(uint16 quarters) { _inventory[kItemQuarter]._quantity = quarters; } -void LabEngine::drawRoomMessage(uint16 curInv, CloseDataPtr closePtr) { +void LabEngine::drawRoomMessage(uint16 curInv, const CloseData *closePtr) { if (_lastTooLong) { _lastTooLong = false; return; @@ -165,7 +165,7 @@ void LabEngine::eatMessages() { } while (msg && !shouldQuit()); } -bool LabEngine::doCloseUp(CloseDataPtr closePtr) { +bool LabEngine::doCloseUp(const CloseData *closePtr) { if (!closePtr) return false; @@ -598,7 +598,7 @@ bool LabEngine::processEvent(MessageClass tmpClass, uint16 code, uint16 qualifie mayShowCrumbIndicator(); _graphics->screenUpdate(); } else if (code == Common::KEYCODE_TAB) { - CloseDataPtr tmpClosePtr = _closeDataPtr; + const CloseData *tmpClosePtr = _closeDataPtr; // get next close-up in list after the one pointed to by curPos setCurrentClose(curPos, &tmpClosePtr, true, true); @@ -979,7 +979,7 @@ void LabEngine::performAction(uint16 actionMode, Common::Point curPos, uint16 &c case 4: { // Look at closeups - CloseDataPtr tmpClosePtr = _closeDataPtr; + const CloseData *tmpClosePtr = _closeDataPtr; setCurrentClose(curPos, &tmpClosePtr, true); if (_closeDataPtr == tmpClosePtr) { diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 8e8255f6c3..8f20538963 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -87,7 +87,6 @@ struct CrumbData { #define MAX_CRUMBS 128 -typedef CloseData *CloseDataPtr; typedef Common::List<Rule> RuleList; typedef Common::List<Action> ActionList; typedef Common::List<CloseData> CloseDataList; @@ -150,7 +149,7 @@ private: Common::String _newFileName; Common::String _monitorTextFilename; - CloseDataPtr _closeDataPtr; + const CloseData *_closeDataPtr; ButtonList _journalButtonList; ButtonList _mapButtonList; Image *_imgMap, *_imgRoom, *_imgUpArrowRoom, *_imgDownArrowRoom, *_imgBridge; @@ -250,12 +249,12 @@ private: /** * Does the work for doActionRule. */ - bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, bool allowDefaults); + bool doActionRuleSub(int16 action, int16 roomNum, const CloseData *closePtr, bool allowDefaults); /** * Checks whether the close up is one of the special case closeups. */ - bool doCloseUp(CloseDataPtr closePtr); + bool doCloseUp(const CloseData *closePtr); /** * Goes through the rules if the user tries to go forward. @@ -290,7 +289,7 @@ private: /** * Does the work for doActionRule. */ - bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr closePtr, bool allowDefaults); + bool doOperateRuleSub(int16 itemNum, int16 roomNum, const CloseData *closePtr, bool allowDefaults); /** * Goes through the rules if the user tries to operate an item on an object. @@ -316,7 +315,7 @@ private: /** * Draws the current direction to the screen. */ - void drawDirection(CloseDataPtr closePtr); + void drawDirection(const CloseData *closePtr); /** * Draws the journal from page x. @@ -346,7 +345,7 @@ private: /** * Draws the message for the room. */ - void drawRoomMessage(uint16 curInv, CloseDataPtr closePtr); + void drawRoomMessage(uint16 curInv, const CloseData *closePtr); void drawStaticMessage(byte index); /** @@ -360,7 +359,7 @@ private: * some of the closeups have the same hit boxes, then this returns the first * occurrence of the object with the same hit box. */ - CloseDataPtr findClosePtrMatch(CloseDataPtr closePtr, CloseDataList &list); + const CloseData *findClosePtrMatch(const CloseData *closePtr, const CloseDataList &list); /** * Checks if a floor has been visited. @@ -390,7 +389,7 @@ private: /** * Gets an object, if any, from the user's click on the screen. */ - CloseData *getObject(Common::Point pos, CloseDataPtr closePtr); + const CloseData *getObject(Common::Point pos, const CloseData *closePtr); /** * Returns the floor to show when the up arrow is pressed @@ -465,7 +464,7 @@ private: /** * Sets the current close up data. */ - void setCurrentClose(Common::Point pos, CloseDataPtr *closePtrList, bool useAbsoluteCoords, bool next=false); + void setCurrentClose(Common::Point pos, const CloseData **closePtrList, bool useAbsoluteCoords, bool next=false); /** * Takes the currently selected item. diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 813642e193..e0faa612ab 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -67,14 +67,14 @@ ViewData *LabEngine::getViewData(uint16 roomNum, uint16 direction) { error("No view with matching condition found"); } -CloseData *LabEngine::getObject(Common::Point pos, CloseDataPtr closePtr) { - CloseDataList *list; +const CloseData *LabEngine::getObject(Common::Point pos, const CloseData *closePtr) { + const CloseDataList *list; if (!closePtr) list = &(getViewData(_roomNum, _direction)->_closeUps); else list = &(closePtr->_subCloseUps); - CloseDataList::iterator wrkClosePtr; + CloseDataList::const_iterator wrkClosePtr; for (wrkClosePtr = list->begin(); wrkClosePtr != list->end(); ++wrkClosePtr) { Common::Rect objRect; @@ -86,8 +86,8 @@ CloseData *LabEngine::getObject(Common::Point pos, CloseDataPtr closePtr) { return nullptr; } -CloseDataPtr LabEngine::findClosePtrMatch(CloseDataPtr closePtr, CloseDataList &list) { - CloseDataList::iterator i; +const CloseData *LabEngine::findClosePtrMatch(const CloseData *closePtr, const CloseDataList &list) { + CloseDataList::const_iterator i; for (i = list.begin(); i != list.end(); ++i) { if ((closePtr->_x1 == i->_x1) && (closePtr->_x2 == i->_x2) && @@ -95,7 +95,7 @@ CloseDataPtr LabEngine::findClosePtrMatch(CloseDataPtr closePtr, CloseDataList & (closePtr->_depth == i->_depth)) return &(*i); - CloseDataPtr resClosePtr = findClosePtrMatch(closePtr, i->_subCloseUps); + const CloseData *resClosePtr = findClosePtrMatch(closePtr, i->_subCloseUps); if (resClosePtr) return resClosePtr; @@ -117,7 +117,7 @@ Common::String LabEngine::getPictName(bool useClose) { return viewPtr->_graphicName; } -void LabEngine::drawDirection(CloseDataPtr closePtr) { +void LabEngine::drawDirection(const CloseData *closePtr) { if (closePtr && !closePtr->_message.empty()) { _graphics->drawMessage(closePtr->_message, false); return; @@ -171,15 +171,15 @@ uint16 LabEngine::processArrow(uint16 curDirection, uint16 arrow) { return curDirection; } -void LabEngine::setCurrentClose(Common::Point pos, CloseDataPtr *closePtrList, bool useAbsoluteCoords, bool next) { - CloseDataList *list; +void LabEngine::setCurrentClose(Common::Point pos, const CloseData **closePtrList, bool useAbsoluteCoords, bool next) { + const CloseDataList *list; if (!*closePtrList) list = &(getViewData(_roomNum, _direction)->_closeUps); else list = &((*closePtrList)->_subCloseUps); - CloseDataList::iterator closePtr; + CloseDataList::const_iterator closePtr; for (closePtr = list->begin(); closePtr != list->end(); ++closePtr) { Common::Rect target; if (!useAbsoluteCoords) @@ -210,7 +210,7 @@ void LabEngine::setCurrentClose(Common::Point pos, CloseDataPtr *closePtrList, b } bool LabEngine::takeItem(Common::Point pos) { - CloseDataList *list; + const CloseDataList *list; if (!_closeDataPtr) { list = &(getViewData(_roomNum, _direction)->_closeUps); } else if (_closeDataPtr->_closeUpType < 0) { @@ -219,7 +219,7 @@ bool LabEngine::takeItem(Common::Point pos) { } else list = &(_closeDataPtr->_subCloseUps); - CloseDataList::iterator closePtr; + CloseDataList::const_iterator closePtr; for (closePtr = list->begin(); closePtr != list->end(); ++closePtr) { Common::Rect objRect; objRect = _utils->rectScale(closePtr->_x1, closePtr->_y1, closePtr->_x2, closePtr->_y2); @@ -335,7 +335,7 @@ void LabEngine::doActions(const ActionList &actionList) { case kActionSetCloseup: { Common::Point curPos = Common::Point(_utils->scaleX(action->_param1), _utils->scaleY(action->_param2)); - CloseDataPtr tmpClosePtr = getObject(curPos, _closeDataPtr); + const CloseData *tmpClosePtr = getObject(curPos, _closeDataPtr); if (tmpClosePtr) _closeDataPtr = tmpClosePtr; @@ -469,7 +469,7 @@ void LabEngine::doActions(const ActionList &actionList) { _music->stopSoundEffect(); } -bool LabEngine::doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, bool allowDefaults) { +bool LabEngine::doActionRuleSub(int16 action, int16 roomNum, const CloseData *closePtr, bool allowDefaults) { action++; if (closePtr) { @@ -504,7 +504,7 @@ bool LabEngine::doActionRule(Common::Point pos, int16 action, int16 roomNum) { else _newFileName = _curFileName; - CloseDataPtr curClosePtr = getObject(pos, _closeDataPtr); + const CloseData *curClosePtr = getObject(pos, _closeDataPtr); if (doActionRuleSub(action, roomNum, curClosePtr, false)) return true; @@ -518,7 +518,7 @@ bool LabEngine::doActionRule(Common::Point pos, int16 action, int16 roomNum) { return false; } -bool LabEngine::doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr closePtr, bool allowDefaults) { +bool LabEngine::doOperateRuleSub(int16 itemNum, int16 roomNum, const CloseData *closePtr, bool allowDefaults) { if (closePtr) if (closePtr->_closeUpType > 0) { RuleList *rules = &(_rooms[roomNum]._rules); @@ -545,7 +545,7 @@ bool LabEngine::doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr clos bool LabEngine::doOperateRule(Common::Point pos, int16 ItemNum) { _newFileName = NOFILE; - CloseDataPtr closePtr = getObject(pos, _closeDataPtr); + const CloseData *closePtr = getObject(pos, _closeDataPtr); if (doOperateRuleSub(ItemNum, _roomNum, closePtr, false)) return true; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index e15561d9fb..e99c4dffa3 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -339,7 +339,7 @@ void LabEngine::drawMonText(const char *text, TextFont *monitorFont, Common::Rec void LabEngine::processMonitor(const char *ntext, TextFont *monitorFont, bool isInteractive, Common::Rect textRect) { Common::String startFileName = _monitorTextFilename; - CloseDataPtr startClosePtr = _closeDataPtr, lastClosePtr[10]; + const CloseData *startClosePtr = _closeDataPtr, *lastClosePtr[10]; uint16 depth = 0; lastClosePtr[0] = _closeDataPtr; @@ -414,7 +414,7 @@ void LabEngine::processMonitor(const char *ntext, TextFont *monitorFont, bool is drawMonText(ntext, monitorFont, textRect, isInteractive); } } else if (isInteractive) { - CloseDataPtr tmpClosePtr = _closeDataPtr; + const CloseData *tmpClosePtr = _closeDataPtr; mouseY = 64 + (mouseY / _monitorButtonHeight) * 42; mouseX = 101; setCurrentClose(Common::Point(mouseX, mouseY), &_closeDataPtr, false); |