diff options
Diffstat (limited to 'engines/lab/map.cpp')
-rw-r--r-- | engines/lab/map.cpp | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index f7b2cfe9ea..5c6bb07814 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -33,6 +33,7 @@ #include "lab/dispman.h" #include "lab/eventman.h" #include "lab/image.h" +#include "lab/interface.h" #include "lab/labsets.h" #include "lab/music.h" #include "lab/processroom.h" @@ -75,14 +76,14 @@ void LabEngine::loadMapData() { _imgPath = new Image(mapImages, this); _imgBridge = new Image(mapImages, this); - _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 + _mapButtonList.push_back(_interface->createButton( 8, _utils->vgaScaleY(105), 0, Common::KEYCODE_ESCAPE, new Image(mapImages, this), new Image(mapImages, this))); // back + _mapButtonList.push_back(_interface->createButton( 55, _utils->vgaScaleY(105), 1, Common::KEYCODE_UP, new Image(mapImages, this), new Image(mapImages, this))); // up + _mapButtonList.push_back(_interface->createButton(101, _utils->vgaScaleY(105), 2, Common::KEYCODE_DOWN, new Image(mapImages, this), new Image(mapImages, this))); // down delete mapImages; Common::File *mapFile = _resource->openDataFile("Lab:Maps", MKTAG('M', 'A', 'P', '0')); - updateMusicAndEvents(); + updateEvents(); _maxRooms = mapFile->readUint16LE(); _maps = new MapData[_maxRooms + 1]; // will be freed when the user exits the map @@ -98,7 +99,7 @@ void LabEngine::loadMapData() { } void LabEngine::freeMapData() { - _event->freeButtonList(&_mapButtonList); + _interface->freeButtonList(&_mapButtonList); delete _imgMap; delete _imgRoom; @@ -328,11 +329,9 @@ uint16 LabEngine::getLowerFloor(uint16 floorNum) { } void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fadeIn) { - _event->mouseHide(); - _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1, 0); _imgMap->drawImage(0, 0); - _event->drawButtonList(&_mapButtonList); + _interface->drawButtonList(&_mapButtonList); for (int i = 1; i <= _maxRooms; i++) { if ((_maps[i]._pageNumber == floorNum) && _roomsFound->in(i) && _maps[i]._x) { @@ -340,7 +339,7 @@ void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fad } } - updateMusicAndEvents(); + updateEvents(); // Makes sure the X is drawn in corridors // NOTE: this here on purpose just in case there's some weird @@ -348,8 +347,8 @@ void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fad if ((_maps[curRoom]._pageNumber == floorNum) && _roomsFound->in(curRoom) && _maps[curRoom]._x) drawRoomMap(curRoom, true); - _event->toggleButton(_event->getButton(1), 12, (getUpperFloor(floorNum) != kFloorNone)); // up button - _event->toggleButton(_event->getButton(2), 12, (getLowerFloor(floorNum) != kFloorNone)); // down button + _interface->toggleButton(_interface->getButton(1), 12, (getUpperFloor(floorNum) != kFloorNone)); // up button + _interface->toggleButton(_interface->getButton(2), 12, (getLowerFloor(floorNum) != kFloorNone)); // down button // Labyrinth specific code if (floorNum == kFloorLower) { @@ -380,8 +379,6 @@ void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fad if (fadeIn) _graphics->fade(true); - - _event->mouseShow(); } void LabEngine::processMap(uint16 curRoom) { @@ -390,16 +387,18 @@ void LabEngine::processMap(uint16 curRoom) { uint16 curFloor = _maps[curRoom]._pageNumber; while (1) { - // Make sure we check the music at least after every message - updateMusicAndEvents(); IntuiMessage *msg = _event->getMsg(); if (shouldQuit()) { _quitLab = true; return; } + updateEvents(); + _graphics->screenUpdate(); + _system->delayMillis(10); + if (!msg) { - updateMusicAndEvents(); + updateEvents(); byte newcolor[3]; @@ -415,7 +414,7 @@ void LabEngine::processMap(uint16 curRoom) { waitTOF(); _graphics->writeColorRegs(newcolor, 1, 1); - _event->updateMouse(); + _interface->handlePressedButton(); waitTOF(); place++; @@ -503,7 +502,6 @@ void LabEngine::processMap(uint16 curRoom) { const char *sptr; if ((sptr = _rooms[curMsg]._roomMsg.c_str())) { - _event->mouseHide(); _graphics->rectFillScaled(13, 148, 135, 186, 3); _graphics->flowText(_msgFont, 0, 5, 3, true, true, true, true, _utils->vgaRectScale(14, 148, 134, 186), sptr); @@ -516,11 +514,8 @@ void LabEngine::processMap(uint16 curRoom) { int top, bottom; top = bottom = (curCoords.top + curCoords.bottom) / 2; - if ((curMsg != curRoom) && (_maps[curMsg]._pageNumber == curFloor)) { + if ((curMsg != curRoom) && (_maps[curMsg]._pageNumber == curFloor)) _graphics->rectFill(left, top, right, bottom, 1); - } - - _event->mouseShow(); } } } @@ -528,10 +523,10 @@ void LabEngine::processMap(uint16 curRoom) { _graphics->screenUpdate(); } - } + } // while } -void LabEngine::doMap(uint16 curRoom) { +void LabEngine::doMap() { static uint16 amigaMapPalette[] = { 0x0BA8, 0x0C11, 0x0A74, 0x0076, 0x0A96, 0x0DCB, 0x0CCA, 0x0222, @@ -541,21 +536,20 @@ void LabEngine::doMap(uint16 curRoom) { _graphics->_fadePalette = amigaMapPalette; - updateMusicAndEvents(); + updateEvents(); loadMapData(); _graphics->blackAllScreen(); - _event->attachButtonList(&_mapButtonList); - drawMap(curRoom, curRoom, _maps[curRoom]._pageNumber, true); + _interface->attachButtonList(&_mapButtonList); + drawMap(_roomNum, _roomNum, _maps[_roomNum]._pageNumber, true); _event->mouseShow(); _graphics->screenUpdate(); - processMap(curRoom); - _event->attachButtonList(nullptr); + processMap(_roomNum); + _event->mouseHide(); + _interface->attachButtonList(nullptr); _graphics->fade(false); _graphics->blackAllScreen(); - _event->mouseHide(); _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1, 0); freeMapData(); - _graphics->blackAllScreen(); _event->mouseShow(); _graphics->screenUpdate(); } |