mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-16 06:39:17 +00:00
LAB: Reduce passing around of pointers to the near-global _closeDataPtr
This commit is contained in:
parent
f72de724e9
commit
01d99d213d
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user