diff options
author | Eugene Sandulenko | 2015-12-03 11:10:58 +0100 |
---|---|---|
committer | Willem Jan Palenstijn | 2015-12-23 21:33:48 +0100 |
commit | 4424463f0618b8ae4a8416cf76024644497a79ad (patch) | |
tree | 4d5a9cc621c7282cd008d46a4c599bab200774e9 /engines | |
parent | c67a9e867c2f40edcdecbc5077dfc2a6edcb443e (diff) | |
download | scummvm-rg350-4424463f0618b8ae4a8416cf76024644497a79ad.tar.gz scummvm-rg350-4424463f0618b8ae4a8416cf76024644497a79ad.tar.bz2 scummvm-rg350-4424463f0618b8ae4a8416cf76024644497a79ad.zip |
LAB: Moved CPtr to engine class
Diffstat (limited to 'engines')
-rw-r--r-- | engines/lab/engine.cpp | 97 | ||||
-rw-r--r-- | engines/lab/lab.h | 1 | ||||
-rw-r--r-- | engines/lab/map.cpp | 2 | ||||
-rw-r--r-- | engines/lab/processroom.cpp | 5 | ||||
-rw-r--r-- | engines/lab/special.cpp | 21 |
5 files changed, 61 insertions, 65 deletions
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index de9b567a1a..35672fbdbc 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -47,7 +47,6 @@ extern bool stopsound, DoNotDrawMessage; extern RoomData *_rooms; extern InventoryData *Inventory; extern uint16 NumInv, ManyRooms, HighestCondition, Direction; -CloseDataPtr CPtr; bool ispal = false, noupdatediff = false, MainDisplay = true, QuitLab = false; @@ -481,7 +480,7 @@ bool LabEngine::doUse(uint16 CurInv) { interfaceOff(); _anim->stopDiff(); _curFileName = " "; - CPtr = NULL; + _cptr = NULL; doMap(_roomNum); setPalette(initcolors, 8); drawMessage(NULL); @@ -491,7 +490,7 @@ bool LabEngine::doUse(uint16 CurInv) { interfaceOff(); _anim->stopDiff(); _curFileName = " "; - CPtr = NULL; + _cptr = NULL; doJournal(); drawPanel(); drawMessage(NULL); @@ -589,7 +588,7 @@ void LabEngine::mainGameLoop() { setPalette(initcolors, 8); - CPtr = NULL; + _cptr = NULL; _roomNum = 1; Direction = NORTH; @@ -623,8 +622,8 @@ void LabEngine::mainGameLoop() { _music->resumeBackMusic(); /* Sees what kind of close up we're in and does the appropriate stuff, if any. */ - if (doCloseUp(CPtr)) { - CPtr = NULL; + if (doCloseUp(_cptr)) { + _cptr = NULL; mayShowCrumbIndicator(); screenUpdate(); @@ -632,7 +631,7 @@ void LabEngine::mainGameLoop() { /* Sets the current picture properly on the screen */ if (MainDisplay) - _nextFileName = getPictName(&CPtr); + _nextFileName = getPictName(&_cptr); if (noupdatediff) { _roomsFound->inclElement(_roomNum); /* Potentially entered another room */ @@ -645,19 +644,19 @@ void LabEngine::mainGameLoop() { _roomsFound->inclElement(_roomNum); /* Potentially entered another room */ _curFileName = _nextFileName; - if (CPtr) { - if ((CPtr->CloseUpType == SPECIALLOCK) && MainDisplay) /* LAB: Labyrinth specific code */ + if (_cptr) { + if ((_cptr->CloseUpType == SPECIALLOCK) && MainDisplay) /* LAB: Labyrinth specific code */ showCombination(_curFileName); - else if (((CPtr->CloseUpType == SPECIALBRICK) || - (CPtr->CloseUpType == SPECIALBRICKNOMOUSE)) && + else if (((_cptr->CloseUpType == SPECIALBRICK) || + (_cptr->CloseUpType == SPECIALBRICKNOMOUSE)) && MainDisplay) /* LAB: Labyrinth specific code */ - showTile(_curFileName, (bool)(CPtr->CloseUpType == SPECIALBRICKNOMOUSE)); + showTile(_curFileName, (bool)(_cptr->CloseUpType == SPECIALBRICKNOMOUSE)); else readPict(_curFileName, false); } else readPict(_curFileName, false); - drawRoomMessage(curInv, CPtr); + drawRoomMessage(curInv, _cptr); forceDraw = false; mayShowCrumbIndicator(); @@ -668,7 +667,7 @@ void LabEngine::mainGameLoop() { } if (forceDraw) { - drawRoomMessage(curInv, CPtr); + drawRoomMessage(curInv, _cptr); forceDraw = false; screenUpdate(); } @@ -785,7 +784,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm MainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ drawPanel(); - drawRoomMessage(curInv, CPtr); + drawRoomMessage(curInv, _cptr); screenUpdate(); } } else { @@ -836,7 +835,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } else if (code == 9) { /* TAB key */ msgClass = DELTAMOVE; } else if (code == 27) { /* ESC key */ - CPtr = NULL; + _cptr = NULL; } eatMessages(); @@ -850,17 +849,17 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _longWinInFront = false; DoNotDrawMessage = false; drawPanel(); - drawRoomMessage(curInv, CPtr); + drawRoomMessage(curInv, _cptr); screenUpdate(); } } else if ((msgClass == GADGETUP) && !_alternate) { if (gadgetId <= 5) { - if ((actionMode == 4) && (gadgetId == 4) && (CPtr != NULL)) { - doMainView(&CPtr); + if ((actionMode == 4) && (gadgetId == 4) && (_cptr != NULL)) { + doMainView(&_cptr); _anim->_doBlack = true; hcptr = NULL; - CPtr = NULL; + _cptr = NULL; mayShowCrumbIndicator(); screenUpdate(); } else if (gadgetId == 5) { @@ -880,7 +879,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm decIncInv(&curInv, false); drawPanel(); - drawRoomMessage(curInv, CPtr); + drawRoomMessage(curInv, _cptr); mayShowCrumbIndicator(); screenUpdate(); @@ -912,7 +911,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm mayShowCrumbIndicator(); screenUpdate(); } else if (gadgetId >= 6) { /* Arrow Gadgets */ - CPtr = NULL; + _cptr = NULL; hcptr = NULL; if ((gadgetId == 6) || (gadgetId == 8)) { @@ -927,7 +926,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm NewDir = Direction; processArrow(&NewDir, gadgetId - 6); - doTurn(Direction, NewDir, &CPtr); + doTurn(Direction, NewDir, &_cptr); _anim->_doBlack = true; Direction = NewDir; forceDraw = true; @@ -937,7 +936,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } else if (gadgetId == 7) { OldRoomNum = _roomNum; - if (doGoForward(&CPtr)) { + if (doGoForward(&_cptr)) { if (OldRoomNum == _roomNum) _anim->_doBlack = true; } else { @@ -1012,7 +1011,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm MainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ drawPanel(); - drawRoomMessage(curInv, CPtr); + drawRoomMessage(curInv, _cptr); screenUpdate(); } @@ -1025,7 +1024,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm _curFileName = " "; doit = !saveRestoreGame(); - CPtr = NULL; + _cptr = NULL; MainDisplay = true; @@ -1078,14 +1077,14 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm decIncInv(&curInv, true); LastInv = curInv; DoNotDrawMessage = false; - drawRoomMessage(curInv, CPtr); + drawRoomMessage(curInv, _cptr); screenUpdate(); } else if (gadgetId == 4) { /* Right gadget */ decIncInv(&curInv, false); LastInv = curInv; DoNotDrawMessage = false; - drawRoomMessage(curInv, CPtr); + drawRoomMessage(curInv, _cptr); screenUpdate(); } else if (gadgetId == 5) { /* bread crumbs */ @@ -1111,7 +1110,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm MainDisplay = true; interfaceOn(); /* Sets the correct gadget list */ drawPanel(); - drawRoomMessage(curInv, CPtr); + drawRoomMessage(curInv, _cptr); screenUpdate(); } else { _breadCrumbs[0]._roomNum = 0; @@ -1129,10 +1128,10 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm doit = false; - if (CPtr) { - if ((CPtr->CloseUpType == SPECIALLOCK) && MainDisplay) /* LAB: Labyrinth specific code */ + if (_cptr) { + if ((_cptr->CloseUpType == SPECIALLOCK) && MainDisplay) /* LAB: Labyrinth specific code */ mouseCombination(curPos); - else if ((CPtr->CloseUpType == SPECIALBRICK) && MainDisplay) + else if ((_cptr->CloseUpType == SPECIALBRICK) && MainDisplay) mouseTile(curPos); else doit = true; @@ -1145,43 +1144,43 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm eatMessages(); if (actionMode == 0) { /* Take something. */ - if (doActionRule(Common::Point(curPos.x, curPos.y), actionMode, _roomNum, &CPtr)) + if (doActionRule(Common::Point(curPos.x, curPos.y), actionMode, _roomNum, &_cptr)) _curFileName = _newFileName; - else if (takeItem(curPos.x, curPos.y, &CPtr)) + else if (takeItem(curPos.x, curPos.y, &_cptr)) drawStaticMessage(kTextTakeItem); - else if (doActionRule(curPos, TAKEDEF - 1, _roomNum, &CPtr)) + else if (doActionRule(curPos, TAKEDEF - 1, _roomNum, &_cptr)) _curFileName = _newFileName; - else if (doActionRule(curPos, TAKE - 1, 0, &CPtr)) + else if (doActionRule(curPos, TAKE - 1, 0, &_cptr)) _curFileName = _newFileName; else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); } else if ((actionMode == 1) /* Manipulate an object */ || (actionMode == 2) /* Open up a "door" */ || (actionMode == 3)) { /* Close a "door" */ - if (doActionRule(curPos, actionMode, _roomNum, &CPtr)) + if (doActionRule(curPos, actionMode, _roomNum, &_cptr)) _curFileName = _newFileName; - else if (!doActionRule(curPos, actionMode, 0, &CPtr)) { + else if (!doActionRule(curPos, actionMode, 0, &_cptr)) { if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); } } else if (actionMode == 4) { /* Look at closeups */ - tempcptr = CPtr; + tempcptr = _cptr; setCurClose(curPos, &tempcptr); - if (CPtr == tempcptr) { + if (_cptr == tempcptr) { if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); } else if (tempcptr->GraphicName) { if (*(tempcptr->GraphicName)) { _anim->_doBlack = true; - CPtr = tempcptr; + _cptr = tempcptr; } else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); } else if (curPos.y < (VGAScaleY(149) + SVGACord(2))) drawStaticMessage(kTextNothing); } else if ((actionMode == 5) && _conditions->in(curInv)) { /* Use an item on something else */ - if (doOperateRule(curPos.x, curPos.y, curInv, &CPtr)) { + if (doOperateRule(curPos.x, curPos.y, curInv, &_cptr)) { _curFileName = _newFileName; if (!_conditions->in(curInv)) @@ -1198,14 +1197,14 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm oldcptr = VPtr->closeUps; if (hcptr == NULL) { - tempcptr = CPtr; + tempcptr = _cptr; setCurClose(curPos, &tempcptr); - if ((tempcptr == NULL) || (tempcptr == CPtr)) { - if (CPtr == NULL) + if ((tempcptr == NULL) || (tempcptr == _cptr)) { + if (_cptr == NULL) hcptr = oldcptr; else - hcptr = CPtr->SubCloseUps; + hcptr = _cptr->SubCloseUps; } else hcptr = tempcptr->NextCloseUp; } else @@ -1213,10 +1212,10 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm if (hcptr == NULL) { - if (CPtr == NULL) + if (_cptr == NULL) hcptr = oldcptr; else - hcptr = CPtr->SubCloseUps; + hcptr = _cptr->SubCloseUps; } if (hcptr) @@ -1237,7 +1236,7 @@ bool LabEngine::from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Comm } drawPanel(); - drawRoomMessage(curInv, CPtr); + drawRoomMessage(curInv, _cptr); mayShowCrumbIndicator(); screenUpdate(); diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 3e96d04241..44f8045c20 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -134,6 +134,7 @@ private: public: bool _longWinInFront; + CloseDataPtr _cptr; private: bool createScreen(bool HiRes); diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 05c60b1094..b5855eaf58 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -43,8 +43,6 @@ namespace Lab { extern uint16 Direction; -extern CloseDataPtr CPtr; - /*****************************************************************************/ /* Converts an Amiga palette (up to 16 colors) to a VGA palette, then sets */ /* the VGA palette. */ diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 30f26d4605..0d6b5e3bd3 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -49,7 +49,6 @@ InventoryData *Inventory; uint16 NumInv, ManyRooms, HighestCondition, Direction; extern bool DoNotDrawMessage, noupdatediff, QuitLab, MusicOn; -extern CloseDataPtr CPtr; /*****************************************************************************/ /* Generates a random number. */ @@ -554,9 +553,9 @@ static void doActions(Action *APtr, CloseDataPtr *lcptr) { if (APtr->Param1 == 0) g_lab->_anim->_doBlack = true; else if (APtr->Param1 == 1) - g_lab->_anim->_doBlack = (CPtr == NULL); + g_lab->_anim->_doBlack = (g_lab->_cptr == NULL); else if (APtr->Param1 == 2) - g_lab->_anim->_doBlack = (CPtr != NULL); + g_lab->_anim->_doBlack = (g_lab->_cptr != NULL); else if (APtr->Param1 == 5) { /* inverse the palette */ for (uint16 idx = (8 * 3); idx < (255 * 3); idx++) g_lab->_anim->_diffPalette[idx] = 255 - g_lab->_anim->_diffPalette[idx]; diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 946c8af9a8..18810566bf 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -83,7 +83,6 @@ uint16 CurTile[4][4] = { extern uint16 *FadePalette; extern BitMap *DispBitMap, *DrawBitMap; -extern CloseDataPtr CPtr; extern InventoryData *Inventory; extern uint16 Direction; @@ -892,20 +891,20 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera uint32 Class; uint16 Qualifier, Code, MouseX, MouseY; const char *Test = " ", *StartFileName = TextFileName; - CloseDataPtr startcptr = CPtr, testcptr, lastcptr[10]; + CloseDataPtr startcptr = _cptr, testcptr, lastcptr[10]; uint16 depth = 0; - lastcptr[0] = CPtr; + lastcptr[0] = _cptr; while (1) { if (isinteractive) { - if (CPtr == NULL) - CPtr = startcptr; + if (_cptr == NULL) + _cptr = startcptr; - if (CPtr == startcptr) + if (_cptr == startcptr) Test = StartFileName; else - Test = CPtr->GraphicName; + Test = _cptr->GraphicName; if (strcmp(Test, TextFileName)) { monitorPage = 0; @@ -955,7 +954,7 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera if (depth) { depth--; - CPtr = lastcptr[depth]; + _cptr = lastcptr[depth]; } } else if (monitorPage > 0) { monitorPage = 0; @@ -963,12 +962,12 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera } } } else if (isinteractive) { - testcptr = CPtr; + testcptr = _cptr; MouseY = 64 + (MouseY / MonGadHeight) * 42; MouseX = 101; - setCurClose(Common::Point(MouseX, MouseY), &CPtr, true); + setCurClose(Common::Point(MouseX, MouseY), &_cptr, true); - if (testcptr != CPtr) { + if (testcptr != _cptr) { lastcptr[depth] = testcptr; depth++; } |