diff options
author | Willem Jan Palenstijn | 2015-12-26 14:18:44 +0100 |
---|---|---|
committer | Willem Jan Palenstijn | 2015-12-26 14:18:44 +0100 |
commit | 01d99d213dae8731c3c9a19cbd98f5fbfb9ee1fc (patch) | |
tree | fd8833447d6d6ccf5c05e8a2977e03e661ab9802 | |
parent | f72de724e90aa9f79cc08a029c508559dde383ae (diff) | |
download | scummvm-rg350-01d99d213dae8731c3c9a19cbd98f5fbfb9ee1fc.tar.gz scummvm-rg350-01d99d213dae8731c3c9a19cbd98f5fbfb9ee1fc.tar.bz2 scummvm-rg350-01d99d213dae8731c3c9a19cbd98f5fbfb9ee1fc.zip |
LAB: Reduce passing around of pointers to the near-global _closeDataPtr
-rw-r--r-- | engines/lab/dispman.cpp | 10 | ||||
-rw-r--r-- | engines/lab/dispman.h | 4 | ||||
-rw-r--r-- | engines/lab/engine.cpp | 4 | ||||
-rw-r--r-- | engines/lab/lab.h | 4 | ||||
-rw-r--r-- | engines/lab/processroom.cpp | 26 | ||||
-rw-r--r-- | engines/lab/savegame.cpp | 4 |
6 files changed, 26 insertions, 26 deletions
diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index 8ff6a61675..65bb7c4398 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 2cf58c379f..19d40b9227 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 8c95f9631f..34db2c5a92 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 57fc8fea1e..8e8255f6c3 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 854c629e93..d54a7fc2fc 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 0bdaf74865..beeae8dae0 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); |