diff options
author | Strangerke | 2015-12-06 17:24:25 +0100 |
---|---|---|
committer | Willem Jan Palenstijn | 2015-12-23 21:33:51 +0100 |
commit | 438e7a24f5f362c383269cca41ced901a98f284e (patch) | |
tree | 6ac7e5747cf0ceb0788b48e6a692eef639a5b5cd | |
parent | f48cf343c2761b7918924cc4af923f9503de102c (diff) | |
download | scummvm-rg350-438e7a24f5f362c383269cca41ced901a98f284e.tar.gz scummvm-rg350-438e7a24f5f362c383269cca41ced901a98f284e.tar.bz2 scummvm-rg350-438e7a24f5f362c383269cca41ced901a98f284e.zip |
LAB: Get rid of some global variables
-rw-r--r-- | engines/lab/engine.cpp | 114 | ||||
-rw-r--r-- | engines/lab/graphics.cpp | 6 | ||||
-rw-r--r-- | engines/lab/graphics.h | 1 | ||||
-rw-r--r-- | engines/lab/lab.cpp | 11 | ||||
-rw-r--r-- | engines/lab/lab.h | 7 | ||||
-rw-r--r-- | engines/lab/map.cpp | 10 | ||||
-rw-r--r-- | engines/lab/processroom.cpp | 43 | ||||
-rw-r--r-- | engines/lab/resource.cpp | 17 | ||||
-rw-r--r-- | engines/lab/special.cpp | 5 |
9 files changed, 109 insertions, 105 deletions
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index ed4908bb25..158286fdfb 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -40,14 +40,10 @@ namespace Lab { -extern bool DoNotDrawMessage; - /* Global parser data */ - extern RoomData *_rooms; -extern uint16 NumInv, ManyRooms, HighestCondition, Direction; -bool ispal = false, noupdatediff = false, MainDisplay = true, QuitLab = false; +bool ispal = false, MainDisplay = true; /* LAB: Labyrinth specific code for the special puzzles */ #define SPECIALLOCK 100 @@ -103,7 +99,7 @@ void LabEngine::drawRoomMessage(uint16 curInv, CloseDataPtr closePtr) { } if (_alternate) { - if ((curInv <= NumInv) && _conditions->in(curInv) && _inventory[curInv].BInvName) { + if ((curInv <= _numInv) && _conditions->in(curInv) && _inventory[curInv].BInvName) { if ((curInv == LAMPNUM) && _conditions->in(LAMPON)) /* LAB: Labyrinth specific */ drawStaticMessage(kTextLampOn); else if (_inventory[curInv].Many > 1) { @@ -358,7 +354,7 @@ void LabEngine::decIncInv(uint16 *CurInv, bool dec) { else (*CurInv)++; - while (*CurInv && (*CurInv <= NumInv)) { + while (*CurInv && (*CurInv <= _numInv)) { if (_conditions->in(*CurInv) && _inventory[*CurInv].BInvName) { _nextFileName = getInvName(*CurInv); break; @@ -370,13 +366,13 @@ void LabEngine::decIncInv(uint16 *CurInv, bool dec) { (*CurInv)++; } - if ((*CurInv == 0) || (*CurInv > NumInv)) { + if ((*CurInv == 0) || (*CurInv > _numInv)) { if (dec) - *CurInv = NumInv; + *CurInv = _numInv; else *CurInv = 1; - while (*CurInv && (*CurInv <= NumInv)) { + while (*CurInv && (*CurInv <= _numInv)) { if (_conditions->in(*CurInv) && _inventory[*CurInv].BInvName) { _nextFileName = getInvName(*CurInv); break; @@ -404,16 +400,16 @@ void LabEngine::mainGameLoop() { _cptr = NULL; _roomNum = 1; - Direction = NORTH; + _direction = NORTH; _resource->readRoomData("LAB:Doors"); if (!(_inventory = _resource->readInventory("LAB:Inventor"))) return; - if (!(_conditions = new LargeSet(HighestCondition + 1, this))) + if (!(_conditions = new LargeSet(_highestCondition + 1, this))) return; - if (!(_roomsFound = new LargeSet(ManyRooms + 1, this))) + if (!(_roomsFound = new LargeSet(_manyRooms + 1, this))) return; _conditions->readInitialConditions("LAB:Conditio"); @@ -429,7 +425,7 @@ void LabEngine::mainGameLoop() { _event->processInput(true); if (GotMessage) { - if (QuitLab || g_engine->shouldQuit()) { + if (_quitLab || g_engine->shouldQuit()) { _anim->stopDiff(); break; } @@ -448,11 +444,11 @@ void LabEngine::mainGameLoop() { if (MainDisplay) _nextFileName = getPictName(&_cptr); - if (noupdatediff) { + if (_noUpdateDiff) { _roomsFound->inclElement(_roomNum); /* Potentially entered another room */ forceDraw |= (strcmp(_nextFileName, _curFileName) != 0); - noupdatediff = false; + _noUpdateDiff = false; _curFileName = _nextFileName; } else if (strcmp(_nextFileName, _curFileName) != 0) { interfaceOff(); @@ -542,7 +538,7 @@ void LabEngine::mainGameLoop() { } if (_inventory) { - for (int i = 1; i <= NumInv; i++) { + for (int i = 1; i <= _numInv; i++) { if (_inventory[i].name) free(_inventory[i].name); @@ -558,8 +554,8 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm uint32 msgClass = tmpClass; Common::Point curPos = tmpPos; - uint16 OldRoomNum, OldDirection = 0; - uint16 LastInv = MAPNUM, Old; + uint16 oldDirection = 0; + uint16 lastInv = MAPNUM; CloseDataPtr oldcptr, tempcptr, hcptr = NULL; ViewData *VPtr; bool doit; @@ -593,7 +589,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm eatMessages(); _alternate = false; _anim->_doBlack = true; - DoNotDrawMessage = false; + _graphics->_doNotDrawMessage = false; MainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ @@ -612,7 +608,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } } else if ((code == 315) || (code == 'x') || (code == 'X') || (code == 'q') || (code == 'Q')) { /* Quit? */ - DoNotDrawMessage = false; + _graphics->_doNotDrawMessage = false; _graphics->drawMessage("Do you want to quit? (Y/N)"); doit = false; eatMessages(); @@ -661,7 +657,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm ((IEQUALIFIER_LEFTBUTTON & Qualifier) || (IEQUALIFIER_RBUTTON & Qualifier)))) { _graphics->_longWinInFront = false; - DoNotDrawMessage = false; + _graphics->_doNotDrawMessage = false; _graphics->drawPanel(); drawRoomMessage(curInv, _cptr); _graphics->screenUpdate(); @@ -681,13 +677,13 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _alternate = true; _anim->_doBlack = true; - DoNotDrawMessage = false; + _graphics->_doNotDrawMessage = false; interfaceOn(); /* Sets the correct gadget list */ MainDisplay = false; - if (LastInv && _conditions->in(LastInv)) { - curInv = LastInv; + if (lastInv && _conditions->in(lastInv)) { + curInv = lastInv; _nextFileName = getInvName(curInv); } else decIncInv(&curInv, false); @@ -698,11 +694,11 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm mayShowCrumbIndicator(); _graphics->screenUpdate(); } else { - Old = actionMode; + uint16 oldActionMode = actionMode; actionMode = gadgetId; - if (Old < 5) - perFlipGadget(Old); + if (oldActionMode < 5) + perFlipGadget(oldActionMode); perFlipGadget(actionMode); @@ -727,28 +723,28 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _curFileName = " "; - OldDirection = Direction; + oldDirection = _direction; - NewDir = Direction; + NewDir = _direction; processArrow(&NewDir, gadgetId - 6); - doTurn(Direction, NewDir, &_cptr); + doTurn(_direction, NewDir, &_cptr); _anim->_doBlack = true; - Direction = NewDir; + _direction = NewDir; forceDraw = true; mayShowCrumbIndicator(); _graphics->screenUpdate(); } else if (gadgetId == 7) { - OldRoomNum = _roomNum; + uint16 oldRoomNum = _roomNum; if (doGoForward(&_cptr)) { - if (OldRoomNum == _roomNum) + if (oldRoomNum == _roomNum) _anim->_doBlack = true; } else { _anim->_doBlack = true; - processArrow(&Direction, gadgetId - 6); + processArrow(&_direction, gadgetId - 6); - if (OldRoomNum != _roomNum) { + if (oldRoomNum != _roomNum) { drawStaticMessage(kTextGoForward); _roomsFound->inclElement(_roomNum); /* Potentially entered a new room */ _curFileName = " "; @@ -761,15 +757,15 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (_followingCrumbs) { if (_isCrumbTurning) { - if (Direction == OldDirection) { + if (_direction == oldDirection) { _followingCrumbs = false; } } else { - if (_roomNum == OldRoomNum) { // didn't get there? + if (_roomNum == oldRoomNum) { // didn't get there? _followingCrumbs = false; } } - } else if (_droppingCrumbs && OldRoomNum != _roomNum) { + } else if (_droppingCrumbs && oldRoomNum != _roomNum) { // If in surreal maze, turn off DroppingCrumbs. // Note: These numbers were generated by parsing the // "Maps" file, which is why they are hard-coded. Bleh! @@ -795,7 +791,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } _breadCrumbs[_numCrumbs]._roomNum = _roomNum; - _breadCrumbs[_numCrumbs++]._direction = Direction; + _breadCrumbs[_numCrumbs++]._direction = _direction; } } } @@ -811,7 +807,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm eatMessages(); _alternate = false; _anim->_doBlack = true; - DoNotDrawMessage = false; + _graphics->_doNotDrawMessage = false; MainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ @@ -834,7 +830,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm MainDisplay = true; curInv = MAPNUM; - LastInv = MAPNUM; + lastInv = MAPNUM; _nextFileName = getInvName(curInv); @@ -848,11 +844,11 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _graphics->screenUpdate(); } else if (gadgetId == 1) { if (!doUse(curInv)) { - Old = actionMode; + uint16 oldActionMode = actionMode; actionMode = 5; /* Use button */ - if (Old < 5) - perFlipGadget(Old); + if (oldActionMode < 5) + perFlipGadget(oldActionMode); drawStaticMessage(kTextUseOnWhat); MainDisplay = true; @@ -862,29 +858,29 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } else if (gadgetId == 2) { MainDisplay = !MainDisplay; - if ((curInv == 0) || (curInv > NumInv)) { + if ((curInv == 0) || (curInv > _numInv)) { curInv = 1; - while ((curInv <= NumInv) && (!_conditions->in(curInv))) + while ((curInv <= _numInv) && (!_conditions->in(curInv))) curInv++; } - if ((curInv <= NumInv) && _conditions->in(curInv) && + if ((curInv <= _numInv) && _conditions->in(curInv) && _inventory[curInv].BInvName) _nextFileName = getInvName(curInv); _graphics->screenUpdate(); } else if (gadgetId == 3) { /* Left gadget */ decIncInv(&curInv, true); - LastInv = curInv; - DoNotDrawMessage = false; + lastInv = curInv; + _graphics->_doNotDrawMessage = false; drawRoomMessage(curInv, _cptr); _graphics->screenUpdate(); } else if (gadgetId == 4) { /* Right gadget */ decIncInv(&curInv, false); - LastInv = curInv; - DoNotDrawMessage = false; + lastInv = curInv; + _graphics->_doNotDrawMessage = false; drawRoomMessage(curInv, _cptr); _graphics->screenUpdate(); @@ -906,7 +902,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm eatMessages(); _alternate = false; _anim->_doBlack = true; - DoNotDrawMessage = false; + _graphics->_doNotDrawMessage = false; MainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ @@ -994,7 +990,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm mayShowCrumbIndicator(); _graphics->screenUpdate(); } else if (msgClass == DELTAMOVE) { - VPtr = getViewData(_roomNum, Direction); + VPtr = getViewData(_roomNum, _direction); oldcptr = VPtr->closeUps; if (hcptr == NULL) { @@ -1025,13 +1021,13 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm eatMessages(); _alternate = !_alternate; _anim->_doBlack = true; - DoNotDrawMessage = false; + _graphics->_doNotDrawMessage = false; MainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ if (_alternate) { - if (LastInv && _conditions->in(LastInv)) - curInv = LastInv; + if (lastInv && _conditions->in(lastInv)) + curInv = lastInv; else decIncInv(&curInv, false); } @@ -1064,7 +1060,7 @@ void LabEngine::go() { _event->mouseShow(); mainGameLoop(); - if (QuitLab) { /* Won the game */ + if (_quitLab) { /* Won the game */ _graphics->blackAllScreen(); _graphics->readPict("P:End/L2In.1", true); @@ -1141,7 +1137,7 @@ int LabEngine::followCrumbs() { else exitDir = NORTH; - int moveDir = movement[Direction][exitDir]; + int moveDir = movement[_direction][exitDir]; if (_numCrumbs == 0) { _isCrumbTurning = false; diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index a10512df55..babc5502dd 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -45,6 +45,7 @@ BitMap bit1, bit2, *DispBitMap = &bit1, *DrawBitMap = &bit1; DisplayMan::DisplayMan(LabEngine *vm) : _vm(vm) { _longWinInFront = false; _lastMessageLong = false; + _doNotDrawMessage = false; _screenBytesPerPage = 65536; _curapen = 0; @@ -199,7 +200,6 @@ bool readMusic(const char *filename, bool waitTillFinished) { /*---------------------------------------------------------------------------*/ /*------------ Does all the text rendering to the message boxes. ------------*/ /*---------------------------------------------------------------------------*/ -bool DoNotDrawMessage = false; /*----- The flowText routines -----*/ @@ -404,8 +404,8 @@ int32 DisplayMan::longDrawMessage(const char *str) { /* Draws a message to the message box. */ /******************************************************************************/ void DisplayMan::drawMessage(const char *str) { - if (DoNotDrawMessage) { - DoNotDrawMessage = false; + if (_doNotDrawMessage) { + _doNotDrawMessage = false; return; } diff --git a/engines/lab/graphics.h b/engines/lab/graphics.h index 4a69a599dd..979d73ff17 100644 --- a/engines/lab/graphics.h +++ b/engines/lab/graphics.h @@ -133,6 +133,7 @@ public: int _screenHeight; byte *_displayBuffer; byte *_currentDisplayBuffer; + bool _doNotDrawMessage; }; } // End of namespace Lab diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index 6781a8acc0..f9de51b41f 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -70,6 +70,13 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _followCrumbsFast = false; _isCrumbTurning = false; _isCrumbWaiting = false; + _noUpdateDiff = false; + _quitLab = false; + _numInv = 0; + _manyRooms = 0; + _direction = 0; + _highestCondition = 0; + _crumbSecs = 0; _crumbMicros = 0; @@ -98,8 +105,8 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc) _newFileName = nullptr; _curFileName = " "; - _msgFont = 0; - _inventory = 0; + _msgFont = nullptr; + _inventory = nullptr; initTilePuzzle(); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 06e4b7480a..5675a0ccaf 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -88,6 +88,8 @@ public: private: uint32 _extraGameFeatures; bool _interfaceOff; + bool _noUpdateDiff; + bool _quitLab; // timing.cpp void microDelay(uint32 secs, uint32 micros); @@ -110,6 +112,11 @@ public: bool _isCrumbWaiting; bool _alternate; bool _isHiRes; + uint16 _numInv; + uint16 _manyRooms; + uint16 _direction; + uint16 _highestCondition; + const char *_curFileName; const char *_nextFileName; const char *_newFileName; /* When ProcessRoom.c decides to change the filename diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 3f20feae8f..8281a498d2 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -41,8 +41,6 @@ namespace Lab { -extern uint16 Direction; - /*---------------------------------------------------------------------------*/ /*------------------------------ The Map stuff ------------------------------*/ /*---------------------------------------------------------------------------*/ @@ -713,13 +711,13 @@ void LabEngine::doMap(uint16 CurRoom) { loadMapData(); _graphics->blackAllScreen(); - if (Direction == NORTH) + if (_direction == NORTH) XMark = MapNorth; - else if (Direction == SOUTH) + else if (_direction == SOUTH) XMark = MapSouth; - else if (Direction == EAST) + else if (_direction == EAST) XMark = MapEast; - else if (Direction == WEST) + else if (_direction == WEST) XMark = MapWest; drawMap(CurRoom, CurRoom, Maps[CurRoom].PageNumber, false, true); diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 45d5584f83..a4d3da293d 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -45,9 +45,6 @@ namespace Lab { #define NOFILE "no file" RoomData *_rooms; -uint16 NumInv, ManyRooms, HighestCondition, Direction; - -extern bool DoNotDrawMessage, noupdatediff, QuitLab, MusicOn; /*****************************************************************************/ /* Generates a random number. */ @@ -104,7 +101,7 @@ ViewData *getViewData(uint16 roomNum, uint16 direction) { /*****************************************************************************/ static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr lcptr) { if (lcptr == NULL) { - lcptr = getViewData(g_lab->_roomNum, Direction)->closeUps; + lcptr = getViewData(g_lab->_roomNum, g_lab->_direction)->closeUps; } else { lcptr = lcptr->SubCloseUps; } @@ -150,7 +147,7 @@ static CloseDataPtr findCPtrMatch(CloseDataPtr cpmain, CloseDataPtr list) { /* Returns the current picture name. */ /*****************************************************************************/ char *getPictName(CloseDataPtr *lcptr) { - ViewData *viewPtr = getViewData(g_lab->_roomNum, Direction); + ViewData *viewPtr = getViewData(g_lab->_roomNum, g_lab->_direction); if (*lcptr != NULL) { *lcptr = findCPtrMatch(*lcptr, viewPtr->closeUps); @@ -178,13 +175,13 @@ void LabEngine::drawDirection(CloseDataPtr lcptr) { message += ", "; } - if (Direction == NORTH) + if (_direction == NORTH) message += _resource->getStaticText(kTextFacingNorth); - else if (Direction == EAST) + else if (_direction == EAST) message += _resource->getStaticText(kTextFacingEast); - else if (Direction == SOUTH) + else if (_direction == SOUTH) message += _resource->getStaticText(kTextFacingSouth); - else if (Direction == WEST) + else if (_direction == WEST) message += _resource->getStaticText(kTextFacingWest); _graphics->drawMessage(message.c_str()); @@ -241,7 +238,7 @@ void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords) uint16 x1, y1, x2, y2; if (*cptr == NULL) { - lcptr = getViewData(g_lab->_roomNum, Direction)->closeUps; + lcptr = getViewData(g_lab->_roomNum, g_lab->_direction)->closeUps; } else lcptr = (*cptr)->SubCloseUps; @@ -274,7 +271,7 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) { CloseDataPtr lcptr; if (*cptr == NULL) { - lcptr = getViewData(g_lab->_roomNum, Direction)->closeUps; + lcptr = getViewData(g_lab->_roomNum, g_lab->_direction)->closeUps; } else if ((*cptr)->CloseUpType < 0) { g_lab->_conditions->inclElement(abs((*cptr)->CloseUpType)); return true; @@ -342,7 +339,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; case NOUPDATE: - noupdatediff = true; + _noUpdateDiff = true; _anim->_doBlack = false; break; @@ -369,30 +366,30 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; case SHOWMESSAGE: - DoNotDrawMessage = false; + _graphics->_doNotDrawMessage = false; if (_graphics->_longWinInFront) _graphics->longDrawMessage((char *)aptr->Data); else _graphics->drawMessage((char *)aptr->Data); - DoNotDrawMessage = true; + _graphics->_doNotDrawMessage = true; break; case CSHOWMESSAGE: if (*lcptr == NULL) { - DoNotDrawMessage = false; + _graphics->_doNotDrawMessage = false; _graphics->drawMessage((char *)aptr->Data); - DoNotDrawMessage = true; + _graphics->_doNotDrawMessage = true; } break; case SHOWMESSAGES: { char **str = (char **)aptr->Data; - DoNotDrawMessage = false; + _graphics->_doNotDrawMessage = false; _graphics->drawMessage(str[getRandom(aptr->Param1)]); - DoNotDrawMessage = true; + _graphics->_doNotDrawMessage = true; } break; @@ -408,7 +405,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { } _roomNum = aptr->Param1; - Direction = aptr->Param2 - 1; + _direction = aptr->Param2 - 1; *lcptr = NULL; _anim->_doBlack = true; break; @@ -440,7 +437,7 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; case SHOWDIR: - DoNotDrawMessage = false; + _graphics->_doNotDrawMessage = false; break; case WAITSECS: { @@ -509,11 +506,11 @@ void LabEngine::doActions(Action *aptr, CloseDataPtr *lcptr) { break; case WINGAME: - QuitLab = true; + _quitLab = true; break; case LOSTGAME: - QuitLab = true; + _quitLab = true; break; case RESETBUFFER: @@ -695,7 +692,7 @@ bool doGoForward(CloseDataPtr *lcptr) { RuleList *rules = _rooms[g_lab->_roomNum]._rules; for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { - if (((*rule)->RuleType == GOFORWARD) && ((*rule)->Param1 == (Direction + 1))) { + if (((*rule)->RuleType == GOFORWARD) && ((*rule)->Param1 == (g_lab->_direction + 1))) { if (checkConditions((*rule)->Condition)) { g_lab->doActions((*rule)->ActionList, lcptr); return true; diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index aaac1cd261..654ce97b24 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -35,7 +35,6 @@ namespace Lab { extern RoomData *_rooms; -extern uint16 NumInv, ManyRooms, HighestCondition; Resource::Resource(LabEngine *vm) : _vm(vm) { readStaticText(); @@ -92,12 +91,12 @@ char *Resource::getText(const char *fileName) { bool Resource::readRoomData(const char *fileName) { Common::File *dataFile = openDataFile(fileName, MKTAG('D', 'O', 'R', '1')); - ManyRooms = dataFile->readUint16LE(); - HighestCondition = dataFile->readUint16LE(); - _rooms = (RoomData *)malloc((ManyRooms + 1) * sizeof(RoomData)); - memset(_rooms, 0, (ManyRooms + 1) * sizeof(RoomData)); + _vm->_manyRooms = dataFile->readUint16LE(); + _vm->_highestCondition = dataFile->readUint16LE(); + _rooms = (RoomData *)malloc((_vm->_manyRooms + 1) * sizeof(RoomData)); + memset(_rooms, 0, (_vm->_manyRooms + 1) * sizeof(RoomData)); - for (uint16 i = 1; i <= ManyRooms; i++) { + for (uint16 i = 1; i <= _vm->_manyRooms; i++) { _rooms[i]._northDoor = dataFile->readUint16LE(); _rooms[i]._southDoor = dataFile->readUint16LE(); _rooms[i]._eastDoor = dataFile->readUint16LE(); @@ -119,10 +118,10 @@ bool Resource::readRoomData(const char *fileName) { InventoryData *Resource::readInventory(const char *fileName) { Common::File *dataFile = openDataFile(fileName, MKTAG('I', 'N', 'V', '1')); - NumInv = dataFile->readUint16LE(); - InventoryData *inventory = (InventoryData *)malloc((NumInv + 1) * sizeof(InventoryData)); + _vm->_numInv = dataFile->readUint16LE(); + InventoryData *inventory = (InventoryData *)malloc((_vm->_numInv + 1) * sizeof(InventoryData)); - for (uint16 i = 1; i <= NumInv; i++) { + for (uint16 i = 1; i <= _vm->_numInv; i++) { inventory[i].Many = dataFile->readUint16LE(); inventory[i].name = readString(dataFile); inventory[i].BInvName = readString(dataFile); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 7c7dcb1477..01b114fede 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -63,7 +63,6 @@ Image *MonButton; extern uint16 *FadePalette; extern BitMap *DispBitMap, *DrawBitMap; -extern uint16 Direction; #define INCL(BITSET,BIT) ((BITSET) |= (BIT)) #define SETBIT(BITSET,BITNUM) INCL(BITSET, (1 << (BITNUM))) @@ -431,14 +430,14 @@ bool LabEngine::saveRestoreGame() { desc = dialog->createDefaultSaveDescription(slot); } - isOK = saveGame(Direction, _inventory[QUARTERNUM].Many, slot, desc); + isOK = saveGame(_direction, _inventory[QUARTERNUM].Many, slot, desc); } } else { // Restore GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); int slot = dialog->runModalWithCurrentTarget(); if (slot >= 0) { - isOK = loadGame(&Direction, &(_inventory[QUARTERNUM].Many), slot); + isOK = loadGame(&_direction, &(_inventory[QUARTERNUM].Many), slot); if (isOK) _music->resetMusic(); } |