diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index 5a9d525b72c..8ff6a61675c 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -335,16 +335,16 @@ void DisplayMan::setUpScreens() { // It's very convenient to have those shortcut, so I added them // for all versions. (Strangerke) uint16 y = _vm->_utils->vgaScaleY(173) - _vm->_utils->svgaCord(2); - moveButtonList->push_back(e->createButton( 1, y, 0, 't', moveImages[0], moveImages[1])); - moveButtonList->push_back(e->createButton( 33, y, 1, 'm', moveImages[2], moveImages[3])); - moveButtonList->push_back(e->createButton( 65, y, 2, 'o', moveImages[4], moveImages[5])); - moveButtonList->push_back(e->createButton( 97, y, 3, 'c', moveImages[6], moveImages[7])); - moveButtonList->push_back(e->createButton(129, y, 4, 'l', moveImages[8], moveImages[9])); - moveButtonList->push_back(e->createButton(161, y, 5, 'i', moveImages[12], moveImages[13])); - moveButtonList->push_back(e->createButton(193, y, 6, VKEY_LTARROW, moveImages[14], moveImages[15])); - moveButtonList->push_back(e->createButton(225, y, 7, VKEY_UPARROW, moveImages[16], moveImages[17])); - moveButtonList->push_back(e->createButton(257, y, 8, VKEY_RTARROW, moveImages[18], moveImages[19])); - moveButtonList->push_back(e->createButton(289, y, 9, 'p', moveImages[10], moveImages[11])); + moveButtonList->push_back(e->createButton( 1, y, 0, Common::KEYCODE_t, moveImages[0], moveImages[1])); + moveButtonList->push_back(e->createButton( 33, y, 1, Common::KEYCODE_m, moveImages[2], moveImages[3])); + moveButtonList->push_back(e->createButton( 65, y, 2, Common::KEYCODE_o, moveImages[4], moveImages[5])); + moveButtonList->push_back(e->createButton( 97, y, 3, Common::KEYCODE_c, moveImages[6], moveImages[7])); + moveButtonList->push_back(e->createButton(129, y, 4, Common::KEYCODE_l, moveImages[8], moveImages[9])); + moveButtonList->push_back(e->createButton(161, y, 5, Common::KEYCODE_i, moveImages[12], moveImages[13])); + moveButtonList->push_back(e->createButton(193, y, 6, Common::KEYCODE_LEFT, moveImages[14], moveImages[15])); + moveButtonList->push_back(e->createButton(225, y, 7, Common::KEYCODE_UP, moveImages[16], moveImages[17])); + moveButtonList->push_back(e->createButton(257, y, 8, Common::KEYCODE_RIGHT, moveImages[18], moveImages[19])); + moveButtonList->push_back(e->createButton(289, y, 9, Common::KEYCODE_p, moveImages[10], moveImages[11])); // TODO: The INV file is not present in the Amiga version Common::File *invFile = _vm->_resource->openDataFile("P:Inv"); @@ -355,18 +355,18 @@ void DisplayMan::setUpScreens() { for (int imgIdx = 0; imgIdx < 6; imgIdx++) _vm->_invImages[imgIdx] = new Image(invFile, _vm); } - invButtonList->push_back(e->createButton( 24, y, 0, 'm', invImages[0], invImages[1])); - invButtonList->push_back(e->createButton( 56, y, 1, 'g', invImages[2], invImages[3])); - invButtonList->push_back(e->createButton( 94, y, 2, 'u', invImages[4], invImages[5])); - invButtonList->push_back(e->createButton(126, y, 3, 'l', moveImages[8], moveImages[9])); - invButtonList->push_back(e->createButton(164, y, 4, VKEY_LTARROW, moveImages[14], moveImages[15])); - invButtonList->push_back(e->createButton(196, y, 5, VKEY_RTARROW, moveImages[18], moveImages[19])); + invButtonList->push_back(e->createButton( 24, y, 0, Common::KEYCODE_ESCAPE, invImages[0], invImages[1])); + invButtonList->push_back(e->createButton( 56, y, 1, Common::KEYCODE_g, invImages[2], invImages[3])); + invButtonList->push_back(e->createButton( 94, y, 2, Common::KEYCODE_u, invImages[4], invImages[5])); + invButtonList->push_back(e->createButton(126, y, 3, Common::KEYCODE_l, moveImages[8], moveImages[9])); + invButtonList->push_back(e->createButton(164, y, 4, Common::KEYCODE_LEFT, moveImages[14], moveImages[15])); + invButtonList->push_back(e->createButton(196, y, 5, Common::KEYCODE_RIGHT, moveImages[18], moveImages[19])); // The windows version has 2 extra buttons for breadcrumb trail // CHECKME: the game is really hard to play without those, maybe we could add something to enable that. if (_vm->getPlatform() == Common::kPlatformWindows) { - invButtonList->push_back(e->createButton(234, y, 6, 'b', invImages[6], invImages[7])); - invButtonList->push_back(e->createButton(266, y, 7, 'f', invImages[8], invImages[9])); + invButtonList->push_back(e->createButton(234, y, 6, Common::KEYCODE_b, invImages[6], invImages[7])); + invButtonList->push_back(e->createButton(266, y, 7, Common::KEYCODE_f, invImages[8], invImages[9])); } delete invFile; @@ -507,7 +507,7 @@ void DisplayMan::checkerboardEffect(uint16 penColor, uint16 x1, uint16 y1, uint1 } } -void DisplayMan::closeFont(TextFont **font) { +void DisplayMan::freeFont(TextFont **font) { if (*font) { if ((*font)->_data) delete[] (*font)->_data; diff --git a/engines/lab/dispman.h b/engines/lab/dispman.h index 57789526681..2cf58c379fb 100644 --- a/engines/lab/dispman.h +++ b/engines/lab/dispman.h @@ -239,7 +239,7 @@ public: /** * Closes a font and frees all memory associated with it. */ - void closeFont(TextFont **font); + void freeFont(TextFont **font); /** * Returns the length of a text in the specified font. diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index d2333f83811..a01df7ec264 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -77,19 +77,6 @@ enum Monitors { //kMonitorLevers = 82 }; -enum MainButtons { - kButtonPickup, - kButtonUse, - kButtonOpen, - kButtonClose, - kButtonLook, - kButtonInventory, - kButtonLeft, - kButtonForward, - kButtonRight, - kButtonMap -}; - enum AltButtons { kButtonMainDisplay, kButtonSaveLoad, @@ -505,24 +492,9 @@ void LabEngine::mainGameLoop() { _anim->diffNextFrame(); if (_followingCrumbs) { - int result = followCrumbs(); - - if (result != 0) { - uint16 code = 0; - switch (result) { - case VKEY_UPARROW: - code = kButtonForward; - break; - case VKEY_LTARROW: - code = kButtonLeft; - break; - case VKEY_RTARROW: - code = kButtonRight; - break; - default: - break; - } + MainButton code = followCrumbs(); + if (code == kButtonForward || code == kButtonLeft || code == kButtonRight) { gotMessage = true; mayShowCrumbIndicator(); _graphics->screenUpdate(); @@ -638,7 +610,7 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo mayShowCrumbIndicator(); _graphics->screenUpdate(); - } else if (msgClass == kMessageDeltaMove) { + } else if (msgClass == kMessageMoveCursorToCloseup) { CloseDataPtr tmpClosePtr = _closeDataPtr; // get next close-up in list after the one pointed to by curPos @@ -737,7 +709,7 @@ bool LabEngine::processKey(IntuiMessage *curMsg, uint32 &msgClass, uint16 &quali forceDraw = true; interfaceOn(); } else if (code == Common::KEYCODE_TAB) - msgClass = kMessageDeltaMove; + msgClass = kMessageMoveCursorToCloseup; else if (code == Common::KEYCODE_ESCAPE) _closeDataPtr = nullptr; @@ -1071,7 +1043,7 @@ void LabEngine::go() { _event->initMouse(); if (_msgFont) - _graphics->closeFont(&_msgFont); + _graphics->freeFont(&_msgFont); if (getPlatform() != Common::kPlatformAmiga) _msgFont = _resource->getFont("F:AvanteG.12"); @@ -1086,7 +1058,7 @@ void LabEngine::go() { _event->mouseShow(); mainGameLoop(); - _graphics->closeFont(&_msgFont); + _graphics->freeFont(&_msgFont); _graphics->freePict(); freeScreens(); @@ -1094,18 +1066,18 @@ void LabEngine::go() { _music->freeMusic(); } -int LabEngine::followCrumbs() { +MainButton LabEngine::followCrumbs() { // kDirectionNorth, kDirectionSouth, kDirectionEast, kDirectionWest - int movement[4][4] = { - { VKEY_UPARROW, VKEY_RTARROW, VKEY_RTARROW, VKEY_LTARROW }, - { VKEY_RTARROW, VKEY_UPARROW, VKEY_LTARROW, VKEY_RTARROW }, - { VKEY_LTARROW, VKEY_RTARROW, VKEY_UPARROW, VKEY_RTARROW }, - { VKEY_RTARROW, VKEY_LTARROW, VKEY_RTARROW, VKEY_UPARROW } + MainButton movement[4][4] = { + { kButtonForward, kButtonRight, kButtonRight, kButtonLeft }, + { kButtonRight, kButtonForward, kButtonLeft, kButtonRight }, + { kButtonLeft, kButtonRight, kButtonForward, kButtonRight }, + { kButtonRight, kButtonLeft, kButtonRight, kButtonForward } }; if (_isCrumbWaiting) { if (_system->getMillis() <= _crumbTimestamp) - return 0; + return kButtonNone; _isCrumbWaiting = false; } @@ -1119,10 +1091,10 @@ int LabEngine::followCrumbs() { _breadCrumbs[0]._roomNum = 0; _droppingCrumbs = false; _followingCrumbs = false; - return 0; + return kButtonNone; } - int exitDir; + Direction exitDir; // which direction is last crumb if (_breadCrumbs[_numCrumbs]._direction == kDirectionEast) exitDir = kDirectionWest; @@ -1133,7 +1105,7 @@ int LabEngine::followCrumbs() { else exitDir = kDirectionNorth; - int moveDir = movement[_direction][exitDir]; + MainButton moveDir = movement[_direction][exitDir]; if (_numCrumbs == 0) { _isCrumbTurning = false; @@ -1141,7 +1113,7 @@ int LabEngine::followCrumbs() { _droppingCrumbs = false; _followingCrumbs = false; } else { - _isCrumbTurning = (moveDir != VKEY_UPARROW); + _isCrumbTurning = (moveDir != kButtonForward); _isCrumbWaiting = true; int theDelay = (_followCrumbsFast ? 1000 / 4 : 1000); diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index 4947991b872..83c50b9771b 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -59,6 +59,17 @@ static const byte mouseData[] = { #define MOUSE_WIDTH 10 #define MOUSE_HEIGHT 15 +EventManager::EventManager(LabEngine *vm) : _vm(vm) { + _leftClick = false; + _rightClick = false; + + _lastButtonHit = nullptr; + _screenButtonList = nullptr; + _hitButton = nullptr; + _mousePos = Common::Point(0, 0); + _keyPressed = Common::KEYCODE_INVALID; +} + Button *EventManager::checkButtonHit(ButtonList *buttonList, Common::Point pos) { for (ButtonList::iterator buttonItr = buttonList->begin(); buttonItr != buttonList->end(); ++buttonItr) { Button *button = *buttonItr; @@ -104,47 +115,22 @@ Button *EventManager::getButton(uint16 id) { return nullptr; } -EventManager::EventManager(LabEngine *vm) : _vm(vm) { - _leftClick = false; - _rightClick = false; - - _mouseHidden = true; - _lastButtonHit = nullptr; - _screenButtonList = nullptr; - _hitButton = nullptr; - _mousePos = Common::Point(0, 0); - - _nextKeyIn = 0; - _nextKeyOut = 0; - - for (int i = 0; i < 64; i++) - _keyBuf[i] = Common::KEYCODE_INVALID; - -} - void EventManager::updateMouse() { - bool doUpdateDisplay = false; + if (!_hitButton) + return; - if (!_mouseHidden) - doUpdateDisplay = true; + mouseHide(); + _hitButton->_altImage->drawImage(_hitButton->_x, _hitButton->_y); + mouseShow(); - if (_hitButton) { - mouseHide(); - _hitButton->_altImage->drawImage(_hitButton->_x, _hitButton->_y); - mouseShow(); + for (int i = 0; i < 3; i++) + _vm->waitTOF(); - for (int i = 0; i < 3; i++) - _vm->waitTOF(); - - mouseHide(); - _hitButton->_image->drawImage(_hitButton->_x, _hitButton->_y); - mouseShow(); - doUpdateDisplay = true; - _hitButton = nullptr; - } - - if (doUpdateDisplay) - _vm->_graphics->screenUpdate(); + mouseHide(); + _hitButton->_image->drawImage(_hitButton->_x, _hitButton->_y); + mouseShow(); + _hitButton = nullptr; + _vm->_graphics->screenUpdate(); } void EventManager::initMouse() { @@ -155,20 +141,11 @@ void EventManager::initMouse() { } void EventManager::mouseShow() { - if (_mouseHidden) { - processInput(); - _mouseHidden = false; - } - _vm->_system->showMouse(true); } void EventManager::mouseHide() { - if (!_mouseHidden) { - _mouseHidden = true; - - _vm->_system->showMouse(false); - } + _vm->_system->showMouse(false); } Common::Point EventManager::getMousePos() { @@ -183,23 +160,6 @@ void EventManager::setMousePos(Common::Point pos) { _vm->_system->warpMouse(pos.x, pos.y); else _vm->_system->warpMouse(pos.x * 2, pos.y); - - if (!_mouseHidden) - processInput(); -} - -bool EventManager::keyPress(Common::KeyCode *keyCode) { - if (haveNextChar()) { - *keyCode = getNextChar(); - return true; - } - - return false; -} - -bool EventManager::haveNextChar() { - processInput(); - return _nextKeyIn != _nextKeyOut; } void EventManager::processInput() { @@ -241,13 +201,9 @@ void EventManager::processInput() { continue; } // Intentional fall through - default: { - int n = (_nextKeyIn + 1) % 64; - if (n != _nextKeyOut) { - _keyBuf[_nextKeyIn] = event.kbd.keycode; - _nextKeyIn = n; - } - } + default: + _keyPressed = event.kbd; + break; } break; case Common::EVENT_QUIT: @@ -262,18 +218,6 @@ void EventManager::processInput() { _vm->_system->updateScreen(); } -Common::KeyCode EventManager::getNextChar() { - Common::KeyCode chr = Common::KEYCODE_INVALID; - - processInput(); - if (_nextKeyIn != _nextKeyOut) { - chr = _keyBuf[_nextKeyOut]; - _nextKeyOut = (_nextKeyOut + 1) % 64; - } - - return chr; -} - Common::Point EventManager::updateAndGetMousePos() { processInput(); diff --git a/engines/lab/eventman.h b/engines/lab/eventman.h index 963972165df..ec8f824cb2a 100644 --- a/engines/lab/eventman.h +++ b/engines/lab/eventman.h @@ -43,14 +43,9 @@ enum MessageClasses { kMessageRightClick, kMessageButtonUp, kMessageRawKey, - kMessageDeltaMove + kMessageMoveCursorToCloseup }; -#define VKEY_UPARROW 273 -#define VKEY_DNARROW 274 -#define VKEY_RTARROW 275 -#define VKEY_LTARROW 276 - struct IntuiMessage { uint32 _msgClass; uint16 _code; // KeyCode or Button Id @@ -61,7 +56,7 @@ struct IntuiMessage { struct Button { uint16 _x, _y, _buttonId; - uint16 _keyEquiv; // if not zero, a key that activates button + Common::KeyCode _keyEquiv; // the key which activates this button bool _isEnabled; Image *_image, *_altImage; }; @@ -74,11 +69,9 @@ private: bool _leftClick; bool _rightClick; - bool _mouseHidden; uint16 _nextKeyIn; uint16 _nextKeyOut; - Common::KeyCode _keyBuf[64]; Button *_hitButton; Button *_lastButtonHit; @@ -93,18 +86,11 @@ private: */ Button *checkButtonHit(ButtonList *buttonList, Common::Point pos); - /** - * Checks whether or not a key has been pressed. - */ - bool keyPress(Common::KeyCode *keyCode); - bool haveNextChar(); - Common::KeyCode getNextChar(); - /** * Checks whether or not the coords fall within one of the buttons in a list * of buttons. */ - Button *checkNumButtonHit(ButtonList *buttonList, uint16 key); + Button *checkNumButtonHit(ButtonList *buttonList, Common::KeyCode key); /** * Make a key press have the right case for a button KeyEquiv value. @@ -115,7 +101,7 @@ public: EventManager (LabEngine *vm); void attachButtonList(ButtonList *buttonList); - Button *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *image, Image *altImage); + Button *createButton(uint16 x, uint16 y, uint16 id, Common::KeyCode key, Image *image, Image *altImage); void toggleButton(Button *button, uint16 penColor, bool enable); /** diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 60b32366405..507e0b27d5a 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -39,7 +39,7 @@ namespace Lab { -Button *EventManager::createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *image, Image *altImage) { +Button *EventManager::createButton(uint16 x, uint16 y, uint16 id, Common::KeyCode key, Image *image, Image *altImage) { Button *button = new Button(); if (button) { @@ -92,7 +92,7 @@ uint16 EventManager::makeButtonKeyEquiv(uint16 key) { return key; } -Button *EventManager::checkNumButtonHit(ButtonList *buttonList, uint16 key) { +Button *EventManager::checkNumButtonHit(ButtonList *buttonList, Common::KeyCode key) { uint16 gkey = key - '0'; if (!buttonList) @@ -100,9 +100,10 @@ Button *EventManager::checkNumButtonHit(ButtonList *buttonList, uint16 key) { for (ButtonList::iterator buttonItr = buttonList->begin(); buttonItr != buttonList->end(); ++buttonItr) { Button *button = *buttonItr; - if (((gkey - 1 == button->_buttonId) || ((gkey == 0) && (button->_buttonId == 9)) - || ((button->_keyEquiv != 0) && (makeButtonKeyEquiv(key) == button->_keyEquiv))) - && button->_isEnabled) { + if (!button->_isEnabled) + continue; + + if ((gkey - 1 == button->_buttonId) || (gkey == 0 && button->_buttonId == 9) || (button->_keyEquiv != Common::KEYCODE_INVALID && key == button->_keyEquiv)) { button->_altImage->drawImage(button->_x, button->_y); _vm->_system->delayMillis(80); button->_image->drawImage(button->_x, button->_y); @@ -117,8 +118,7 @@ IntuiMessage *EventManager::getMsg() { static IntuiMessage message; updateMouse(); - - Common::KeyCode curKey; + processInput(); if (_lastButtonHit) { updateMouse(); @@ -135,18 +135,22 @@ IntuiMessage *EventManager::getMsg() { message._mouse.x /= 2; _leftClick = _rightClick = false; return &message; - } else if (keyPress(&curKey)) { - message._code = curKey; - message._mouse = _mousePos; - Button *curButton = checkNumButtonHit(_screenButtonList, message._code); + } else if (_keyPressed.keycode != Common::KEYCODE_INVALID) { + Button *curButton = checkNumButtonHit(_screenButtonList, _keyPressed.keycode); if (curButton) { message._msgClass = kMessageButtonUp; message._code = curButton->_buttonId; - } else + } else { message._msgClass = kMessageRawKey; + message._code = _keyPressed.keycode; + } message._qualifier = _keyPressed.flags; + message._mouse = _mousePos; + + _keyPressed.keycode = Common::KEYCODE_INVALID; + return &message; } else return nullptr; diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 5ed604c2385..8971c967864 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -47,7 +47,7 @@ Intro::Intro(LabEngine *vm) : _vm(vm) { } Intro::~Intro() { - _vm->_graphics->closeFont(&_font); + _vm->_graphics->freeFont(&_font); } void Intro::introEatMessages() { diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 76397b953c7..0a2e407d926 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -97,6 +97,20 @@ enum Direction { kDirectionWest }; +enum MainButton { + kButtonNone = -1, + kButtonPickup, + kButtonUse, + kButtonOpen, + kButtonClose, + kButtonLook, + kButtonInventory, + kButtonLeft, + kButtonForward, + kButtonRight, + kButtonMap +}; + class LabEngine : public Engine { private: bool _interfaceOff; @@ -307,7 +321,7 @@ private: /** * Draws the map */ - void drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fadeOut, bool fadeIn); + void drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fadeIn); /** * Draws the text for the monitor. @@ -346,7 +360,7 @@ private: /** * New code to allow quick(er) return navigation in game. */ - int followCrumbs(); + MainButton followCrumbs(); void freeMapData(); void freeScreens(); bool fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Common::Point tmpPos, diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index d84f8528d05..21a08309131 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -75,9 +75,9 @@ void LabEngine::loadMapData() { _imgPath = new Image(mapImages, this); _imgBridge = new Image(mapImages, this); - _mapButtonList.push_back(_event->createButton( 8, _utils->vgaScaleY(105), 0, VKEY_LTARROW, new Image(mapImages, this), new Image(mapImages, this))); // back - _mapButtonList.push_back(_event->createButton( 55, _utils->vgaScaleY(105), 1, VKEY_UPARROW, new Image(mapImages, this), new Image(mapImages, this))); // up - _mapButtonList.push_back(_event->createButton(101, _utils->vgaScaleY(105), 2, VKEY_DNARROW, new Image(mapImages, this), new Image(mapImages, this))); // down + _mapButtonList.push_back(_event->createButton( 8, _utils->vgaScaleY(105), 0, Common::KEYCODE_ESCAPE, new Image(mapImages, this), new Image(mapImages, this))); // back + _mapButtonList.push_back(_event->createButton( 55, _utils->vgaScaleY(105), 1, Common::KEYCODE_UP, new Image(mapImages, this), new Image(mapImages, this))); // up + _mapButtonList.push_back(_event->createButton(101, _utils->vgaScaleY(105), 2, Common::KEYCODE_DOWN, new Image(mapImages, this), new Image(mapImages, this))); // down delete mapImages; @@ -329,14 +329,10 @@ uint16 LabEngine::getLowerFloor(uint16 floorNum) { return kFloorNone; } -void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fadeOut, bool fadeIn) { +void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fadeIn) { _event->mouseHide(); - if (fadeOut) - _graphics->fade(false); - _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1, 0); - _imgMap->drawImage(0, 0); _event->drawButtonList(&_mapButtonList); @@ -447,7 +443,7 @@ void LabEngine::processMap(uint16 curRoom) { if (upperFloor != kFloorNone) { curFloor = upperFloor; _graphics->fade(false); - drawMap(curRoom, curMsg, curFloor, false, false); + drawMap(curRoom, curMsg, curFloor, false); _graphics->fade(true); } } else if (msgCode == 2) { @@ -456,7 +452,7 @@ void LabEngine::processMap(uint16 curRoom) { if (lowerFloor != kFloorNone) { curFloor = lowerFloor; _graphics->fade(false); - drawMap(curRoom, curMsg, curFloor, false, false); + drawMap(curRoom, curMsg, curFloor, false); _graphics->fade(true); } } @@ -466,28 +462,28 @@ void LabEngine::processMap(uint16 curRoom) { curFloor = kFloorSurMaze; _graphics->fade(false); - drawMap(curRoom, curMsg, curFloor, false, false); + drawMap(curRoom, curMsg, curFloor, false); _graphics->fade(true); } else if ((curFloor == kFloorMiddle) && _utils->mapRectScale(358, 71, 452, 147).contains(mouseX, mouseY) && floorVisited(kFloorCarnival)) { curFloor = kFloorCarnival; _graphics->fade(false); - drawMap(curRoom, curMsg, curFloor, false, false); + drawMap(curRoom, curMsg, curFloor, false); _graphics->fade(true); } else if ((curFloor == kFloorMiddle) && _utils->mapRectScale(557, 325, 653, 401).contains(mouseX, mouseY) && floorVisited(kFloorMedMaze)) { curFloor = kFloorMedMaze; _graphics->fade(false); - drawMap(curRoom, curMsg, curFloor, false, false); + drawMap(curRoom, curMsg, curFloor, false); _graphics->fade(true); } else if ((curFloor == kFloorUpper) && _utils->mapRectScale(524, 97, 645, 207).contains(mouseX, mouseY) && floorVisited(kFloorHedgeMaze)) { curFloor = kFloorHedgeMaze; _graphics->fade(false); - drawMap(curRoom, curMsg, curFloor, false, false); + drawMap(curRoom, curMsg, curFloor, false); _graphics->fade(true); } else if (mouseX > _utils->mapScaleX(314)) { uint16 oldMsg = curMsg; @@ -550,7 +546,7 @@ void LabEngine::doMap(uint16 curRoom) { loadMapData(); _graphics->blackAllScreen(); _event->attachButtonList(&_mapButtonList); - drawMap(curRoom, curRoom, _maps[curRoom]._pageNumber, false, true); + drawMap(curRoom, curRoom, _maps[curRoom]._pageNumber, true); _event->mouseShow(); _graphics->screenUpdate(); processMap(curRoom); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index dd2ee1cf4e6..e15561d9fbd 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -49,7 +49,7 @@ void LabEngine::doNotes() { Common::Rect textRect = Common::Rect(_utils->vgaScaleX(25) + _utils->svgaCord(15), _utils->vgaScaleY(50), _utils->vgaScaleX(295) - _utils->svgaCord(15), _utils->vgaScaleY(148)); _graphics->flowText(noteFont, -2 + _utils->svgaCord(1), 0, 0, false, false, true, true, textRect, noteText.c_str()); _graphics->setPalette(_anim->_diffPalette, 256); - _graphics->closeFont(¬eFont); + _graphics->freeFont(¬eFont); } void LabEngine::doWestPaper() { @@ -58,7 +58,7 @@ void LabEngine::doWestPaper() { Common::Rect textRect = Common::Rect(_utils->vgaScaleX(57), _utils->vgaScaleY(77) + _utils->svgaCord(2), _utils->vgaScaleX(262), _utils->vgaScaleY(91)); _graphics->flowText(paperFont, 0, 0, 0, false, true, false, true, textRect, paperText.c_str()); - _graphics->closeFont(&paperFont); + _graphics->freeFont(&paperFont); paperFont = _resource->getFont("F:News32.fon"); paperText = _resource->getText("Lab:Rooms/Headline"); @@ -76,7 +76,7 @@ void LabEngine::doWestPaper() { } else y = 115 - _utils->svgaCord(5); - _graphics->closeFont(&paperFont); + _graphics->freeFont(&paperFont); paperFont = _resource->getFont("F:Note.fon"); paperText = _resource->getText("Lab:Rooms/Col1"); @@ -85,13 +85,13 @@ void LabEngine::doWestPaper() { paperText = _resource->getText("Lab:Rooms/Col2"); _graphics->flowText(paperFont, -4, 0, 0, false, false, false, true, _utils->vgaRectScale(162, y, 275, 148), paperText.c_str()); - _graphics->closeFont(&paperFont); + _graphics->freeFont(&paperFont); _graphics->setPalette(_anim->_diffPalette, 256); } void LabEngine::loadJournalData() { if (_journalFont) - _graphics->closeFont(&_journalFont); + _graphics->freeFont(&_journalFont); _journalFont = _resource->getFont("F:Journal.fon"); updateMusicAndEvents(); @@ -128,9 +128,9 @@ void LabEngine::loadJournalData() { _journalTextTitle = _resource->getText("Lab:Rooms/jt"); Common::File *journalFile = _resource->openDataFile("P:JImage"); - _journalButtonList.push_back(_event->createButton( 80, _utils->vgaScaleY(162) + _utils->svgaCord(1), 0, VKEY_LTARROW, new Image(journalFile, this), new Image(journalFile, this))); // back - _journalButtonList.push_back(_event->createButton(194, _utils->vgaScaleY(162) + _utils->svgaCord(1), 2, 0, new Image(journalFile, this), new Image(journalFile, this))); // cancel - _journalButtonList.push_back(_event->createButton(144, _utils->vgaScaleY(164) - _utils->svgaCord(1), 1, VKEY_RTARROW, new Image(journalFile, this), new Image(journalFile, this))); // forward + _journalButtonList.push_back(_event->createButton( 80, _utils->vgaScaleY(162) + _utils->svgaCord(1), 0, Common::KEYCODE_LEFT, new Image(journalFile, this), new Image(journalFile, this))); // back + _journalButtonList.push_back(_event->createButton(194, _utils->vgaScaleY(162) + _utils->svgaCord(1), 2, Common::KEYCODE_ESCAPE, new Image(journalFile, this), new Image(journalFile, this))); // cancel + _journalButtonList.push_back(_event->createButton(144, _utils->vgaScaleY(164) - _utils->svgaCord(1), 1, Common::KEYCODE_RIGHT, new Image(journalFile, this), new Image(journalFile, this))); // forward delete journalFile; _anim->_noPalChange = true; @@ -280,7 +280,7 @@ void LabEngine::doJournal() { _blankJournal = _journalBackImage->_imageData = nullptr; _event->freeButtonList(&_journalButtonList); - _graphics->closeFont(&_journalFont); + _graphics->freeFont(&_journalFont); _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1, 0); _graphics->blackScreen(); @@ -457,7 +457,7 @@ void LabEngine::doMonitor(const Common::String background, const Common::String processMonitor(ntext.c_str(), monitorFont, isinteractive, scaledRect); _graphics->fade(false); _event->mouseHide(); - _graphics->closeFont(&monitorFont); + _graphics->freeFont(&monitorFont); _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1, 0); _graphics->blackAllScreen();