2014-10-06 12:50:05 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This code is based on Labyrinth of Time code with assistance of
|
|
|
|
*
|
|
|
|
* Copyright (c) 1993 Terra Nova Development
|
|
|
|
* Copyright (c) 2004 The Wyrmkeep Entertainment Co.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2014-12-25 18:13:52 +00:00
|
|
|
#include "lab/lab.h"
|
2015-12-08 20:10:54 +00:00
|
|
|
|
2015-12-08 20:35:31 +00:00
|
|
|
#include "lab/anim.h"
|
2015-12-08 20:19:41 +00:00
|
|
|
#include "lab/dispman.h"
|
|
|
|
#include "lab/eventman.h"
|
2015-12-08 20:00:50 +00:00
|
|
|
#include "lab/image.h"
|
2015-11-20 19:17:30 +00:00
|
|
|
#include "lab/intro.h"
|
2015-12-08 20:00:50 +00:00
|
|
|
#include "lab/labsets.h"
|
2015-12-08 19:36:05 +00:00
|
|
|
#include "lab/music.h"
|
2015-12-08 20:47:36 +00:00
|
|
|
#include "lab/processroom.h"
|
2015-12-08 20:10:54 +00:00
|
|
|
#include "lab/resource.h"
|
2015-12-12 01:28:06 +00:00
|
|
|
#include "lab/tilepuzzle.h"
|
2015-12-08 20:00:50 +00:00
|
|
|
#include "lab/utils.h"
|
2014-10-06 12:50:05 +00:00
|
|
|
|
|
|
|
namespace Lab {
|
|
|
|
|
2015-12-08 10:27:34 +00:00
|
|
|
// LAB: Labyrinth specific code for the special puzzles
|
2014-10-06 12:50:05 +00:00
|
|
|
#define SPECIALLOCK 100
|
|
|
|
#define SPECIALBRICK 101
|
|
|
|
#define SPECIALBRICKNOMOUSE 102
|
|
|
|
|
2015-12-12 17:11:30 +00:00
|
|
|
enum Items {
|
|
|
|
kItemHelmet = 1,
|
|
|
|
kItemBelt = 3,
|
|
|
|
kItemPithHelmet = 7,
|
|
|
|
kItemJournal = 9,
|
|
|
|
kItemNotes = 12,
|
|
|
|
kItemWestPaper = 18,
|
|
|
|
kItemWhiskey = 25,
|
|
|
|
kItemLamp = 27,
|
|
|
|
kItemMap = 28,
|
|
|
|
kItemQuarter = 30
|
|
|
|
};
|
|
|
|
|
|
|
|
enum Monitors {
|
|
|
|
kMonitorMuseum = 71,
|
|
|
|
kMonitorGramophone = 72,
|
|
|
|
kMonitorUnicycle = 73,
|
|
|
|
kMonitorStatue = 74,
|
|
|
|
kMonitorTalisman = 75,
|
|
|
|
kMonitorLute = 76,
|
|
|
|
kMonitorClock = 77,
|
|
|
|
kMonitorWindow = 78,
|
|
|
|
//kMonitorBelt = 79,
|
|
|
|
kMonitorLibrary = 80,
|
|
|
|
kMonitorTerminal = 81
|
|
|
|
//kMonitorLevers = 82
|
|
|
|
};
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-14 23:01:44 +00:00
|
|
|
enum AltButtons {
|
|
|
|
kButtonMainDisplay,
|
|
|
|
kButtonSaveLoad,
|
|
|
|
kButtonUseItem,
|
|
|
|
kButtonLookAtItem,
|
|
|
|
kButtonPrevItem,
|
|
|
|
kButtonNextItem,
|
|
|
|
kButtonBreadCrumbs,
|
|
|
|
kButtonFollowCrumbs
|
|
|
|
};
|
|
|
|
|
2015-12-23 20:10:33 +00:00
|
|
|
static char initColors[] = { '\x00', '\x00', '\x00', '\x30',
|
2014-10-06 12:50:05 +00:00
|
|
|
'\x30', '\x30', '\x10', '\x10',
|
|
|
|
'\x10', '\x14', '\x14', '\x14',
|
|
|
|
'\x20', '\x20', '\x20', '\x24',
|
|
|
|
'\x24', '\x24', '\x2c', '\x2c',
|
2015-12-08 21:00:19 +00:00
|
|
|
'\x2c', '\x08', '\x08', '\x08' };
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-12 17:11:30 +00:00
|
|
|
uint16 LabEngine::getQuarters() {
|
2015-12-19 11:46:57 +00:00
|
|
|
return _inventory[kItemQuarter]._quantity;
|
2015-12-12 17:11:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void LabEngine::setQuarters(uint16 quarters) {
|
2015-12-19 11:46:57 +00:00
|
|
|
_inventory[kItemQuarter]._quantity = quarters;
|
2015-12-12 17:11:30 +00:00
|
|
|
}
|
|
|
|
|
2015-12-03 00:06:04 +00:00
|
|
|
void LabEngine::drawRoomMessage(uint16 curInv, CloseDataPtr closePtr) {
|
2015-12-01 09:35:31 +00:00
|
|
|
if (_lastTooLong) {
|
|
|
|
_lastTooLong = false;
|
2014-10-06 12:50:05 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-12-03 00:06:04 +00:00
|
|
|
if (_alternate) {
|
2015-12-21 00:27:50 +00:00
|
|
|
if ((curInv <= _numInv) && _conditions->in(curInv) && !_inventory[curInv]._bitmapName.empty()) {
|
2015-12-12 17:11:30 +00:00
|
|
|
if ((curInv == kItemLamp) && _conditions->in(kCondLampOn))
|
2015-12-08 10:27:34 +00:00
|
|
|
// LAB: Labyrinth specific
|
2015-12-12 17:11:30 +00:00
|
|
|
drawStaticMessage(kTextkLampOn);
|
2015-12-19 11:46:57 +00:00
|
|
|
else if (_inventory[curInv]._quantity > 1) {
|
|
|
|
Common::String roomMessage = _inventory[curInv]._name + " (" + Common::String::format("%d", _inventory[curInv]._quantity) + ")";
|
2015-12-23 02:19:59 +00:00
|
|
|
_graphics->drawMessage(roomMessage.c_str(), false);
|
2014-10-06 12:50:05 +00:00
|
|
|
} else
|
2015-12-23 02:19:59 +00:00
|
|
|
_graphics->drawMessage(_inventory[curInv]._name.c_str(), false);
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
} else
|
2015-12-03 00:06:04 +00:00
|
|
|
drawDirection(closePtr);
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-04 12:32:08 +00:00
|
|
|
_lastTooLong = _graphics->_lastMessageLong;
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
|
2015-12-02 19:32:06 +00:00
|
|
|
void LabEngine::freeScreens() {
|
2015-12-23 19:44:48 +00:00
|
|
|
for (int i = 0; i < 20; i++) {
|
2015-12-02 19:32:06 +00:00
|
|
|
delete _moveImages[i];
|
2015-12-04 15:52:13 +00:00
|
|
|
_moveImages[i] = nullptr;
|
|
|
|
}
|
2015-12-02 19:32:06 +00:00
|
|
|
|
2015-12-23 19:44:48 +00:00
|
|
|
for (int imgIdx = 0; imgIdx < 10; imgIdx++) {
|
2015-12-04 15:52:13 +00:00
|
|
|
delete _invImages[imgIdx];
|
2015-12-12 01:28:06 +00:00
|
|
|
_invImages[imgIdx] = nullptr;
|
2015-12-02 19:32:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-13 17:36:56 +00:00
|
|
|
void LabEngine::perFlipButton(uint16 buttonId) {
|
|
|
|
for (ButtonList::iterator button = _moveButtonList.begin(); button != _moveButtonList.end(); ++button) {
|
|
|
|
Button *topButton = *button;
|
2015-12-16 21:27:32 +00:00
|
|
|
if (topButton->_buttonId == buttonId) {
|
2015-12-13 17:36:56 +00:00
|
|
|
Image *tmpImage = topButton->_image;
|
|
|
|
topButton->_image = topButton->_altImage;
|
|
|
|
topButton->_altImage = tmpImage;
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-03 00:06:04 +00:00
|
|
|
if (!_alternate) {
|
2015-11-29 17:10:06 +00:00
|
|
|
_event->mouseHide();
|
2015-12-13 19:15:24 +00:00
|
|
|
topButton->_image->drawImage(topButton->_x, topButton->_y);
|
2015-11-29 17:10:06 +00:00
|
|
|
_event->mouseShow();
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
|
2015-12-06 20:50:41 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-29 17:10:06 +00:00
|
|
|
void LabEngine::eatMessages() {
|
2015-12-03 00:06:04 +00:00
|
|
|
IntuiMessage *msg;
|
2014-10-06 12:50:05 +00:00
|
|
|
|
|
|
|
do {
|
2015-12-13 13:37:39 +00:00
|
|
|
msg = _event->getMsg();
|
2015-12-24 00:21:40 +00:00
|
|
|
} while (msg && !shouldQuit());
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
|
2015-12-03 00:06:04 +00:00
|
|
|
bool LabEngine::doCloseUp(CloseDataPtr closePtr) {
|
2015-12-09 10:22:41 +00:00
|
|
|
if (!closePtr)
|
2014-10-06 12:50:05 +00:00
|
|
|
return false;
|
|
|
|
|
2015-12-17 17:35:53 +00:00
|
|
|
int luteRight;
|
|
|
|
Common::Rect textRect;
|
2014-12-27 13:18:40 +00:00
|
|
|
|
2015-11-29 22:34:35 +00:00
|
|
|
if (getPlatform() != Common::kPlatformWindows) {
|
2015-12-17 17:35:53 +00:00
|
|
|
textRect.left = 0;
|
|
|
|
textRect.right = 319;
|
|
|
|
textRect.top = 0;
|
|
|
|
textRect.bottom = 165;
|
|
|
|
luteRight = 124;
|
2014-12-27 13:18:40 +00:00
|
|
|
} else {
|
2015-12-17 17:35:53 +00:00
|
|
|
textRect.left = 2;
|
|
|
|
textRect.right = 317;
|
|
|
|
textRect.top = 2;
|
|
|
|
textRect.bottom = 165;
|
|
|
|
luteRight = 128;
|
2014-12-27 13:18:40 +00:00
|
|
|
}
|
|
|
|
|
2015-12-06 20:53:57 +00:00
|
|
|
switch (closePtr->_closeUpType) {
|
2015-12-12 17:11:30 +00:00
|
|
|
case kMonitorMuseum:
|
|
|
|
case kMonitorLibrary:
|
|
|
|
case kMonitorWindow:
|
2015-12-20 16:20:53 +00:00
|
|
|
doMonitor(closePtr->_graphicName, closePtr->_message, false, textRect);
|
2015-07-21 19:13:28 +00:00
|
|
|
break;
|
2015-12-12 17:11:30 +00:00
|
|
|
case kMonitorGramophone:
|
2015-12-17 17:35:53 +00:00
|
|
|
textRect.right = 171;
|
|
|
|
doMonitor(closePtr->_graphicName, closePtr->_message, false, textRect);
|
2015-07-21 19:13:28 +00:00
|
|
|
break;
|
2015-12-12 17:11:30 +00:00
|
|
|
case kMonitorUnicycle:
|
2015-12-17 17:35:53 +00:00
|
|
|
textRect.left = 100;
|
|
|
|
doMonitor(closePtr->_graphicName, closePtr->_message, false, textRect);
|
2015-07-21 19:13:28 +00:00
|
|
|
break;
|
2015-12-12 17:11:30 +00:00
|
|
|
case kMonitorStatue:
|
2015-12-17 17:35:53 +00:00
|
|
|
textRect.left = 117;
|
|
|
|
doMonitor(closePtr->_graphicName, closePtr->_message, false, textRect);
|
2015-07-21 19:13:28 +00:00
|
|
|
break;
|
2015-12-12 17:11:30 +00:00
|
|
|
case kMonitorTalisman:
|
2015-12-17 17:35:53 +00:00
|
|
|
textRect.right = 184;
|
|
|
|
doMonitor(closePtr->_graphicName, closePtr->_message, false, textRect);
|
2015-07-21 19:13:28 +00:00
|
|
|
break;
|
2015-12-12 17:11:30 +00:00
|
|
|
case kMonitorLute:
|
2015-12-17 17:35:53 +00:00
|
|
|
textRect.right = luteRight;
|
|
|
|
doMonitor(closePtr->_graphicName, closePtr->_message, false, textRect);
|
2015-07-21 19:13:28 +00:00
|
|
|
break;
|
2015-12-12 17:11:30 +00:00
|
|
|
case kMonitorClock:
|
2015-12-17 17:35:53 +00:00
|
|
|
textRect.right = 206;
|
|
|
|
doMonitor(closePtr->_graphicName, closePtr->_message, false, textRect);
|
2015-07-21 19:13:28 +00:00
|
|
|
break;
|
2015-12-12 17:11:30 +00:00
|
|
|
case kMonitorTerminal:
|
2015-12-17 17:35:53 +00:00
|
|
|
doMonitor(closePtr->_graphicName, closePtr->_message, true, textRect);
|
2015-07-21 19:13:28 +00:00
|
|
|
break;
|
|
|
|
default:
|
2014-10-06 12:50:05 +00:00
|
|
|
return false;
|
2015-07-21 19:13:28 +00:00
|
|
|
}
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-03 00:06:04 +00:00
|
|
|
_curFileName = " ";
|
2015-12-04 12:32:08 +00:00
|
|
|
_graphics->drawPanel();
|
2014-10-06 12:50:05 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-12-19 00:12:42 +00:00
|
|
|
Common::String LabEngine::getInvName(uint16 curInv) {
|
2015-12-06 20:39:41 +00:00
|
|
|
if (_mainDisplay)
|
2015-12-06 20:53:57 +00:00
|
|
|
return _inventory[curInv]._bitmapName;
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-12 17:11:30 +00:00
|
|
|
if ((curInv == kItemLamp) && _conditions->in(kCondLampOn))
|
2014-10-06 12:50:05 +00:00
|
|
|
return "P:Mines/120";
|
|
|
|
|
2015-12-12 17:11:30 +00:00
|
|
|
if ((curInv == kItemBelt) && _conditions->in(kCondBeltGlowing))
|
|
|
|
return "P:Future/kCondBeltGlowing";
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-12 17:11:30 +00:00
|
|
|
if (curInv == kItemWestPaper) {
|
2015-12-06 20:53:57 +00:00
|
|
|
_curFileName = _inventory[curInv]._bitmapName;
|
2015-12-04 12:32:08 +00:00
|
|
|
_anim->_noPalChange = true;
|
|
|
|
_graphics->readPict(_curFileName, false);
|
|
|
|
_anim->_noPalChange = false;
|
2014-10-06 12:50:05 +00:00
|
|
|
doWestPaper();
|
2015-12-12 17:11:30 +00:00
|
|
|
} else if (curInv == kItemNotes) {
|
2015-12-06 20:53:57 +00:00
|
|
|
_curFileName = _inventory[curInv]._bitmapName;
|
2015-12-04 12:32:08 +00:00
|
|
|
_anim->_noPalChange = true;
|
|
|
|
_graphics->readPict(_curFileName, false);
|
|
|
|
_anim->_noPalChange = false;
|
2014-10-06 12:50:05 +00:00
|
|
|
doNotes();
|
|
|
|
}
|
|
|
|
|
2015-12-06 20:53:57 +00:00
|
|
|
return _inventory[curInv]._bitmapName;
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
|
2015-11-29 17:10:06 +00:00
|
|
|
void LabEngine::interfaceOff() {
|
2015-12-03 00:06:04 +00:00
|
|
|
if (!_interfaceOff) {
|
2015-12-13 17:36:56 +00:00
|
|
|
_event->attachButtonList(nullptr);
|
2015-11-29 17:10:06 +00:00
|
|
|
_event->mouseHide();
|
2015-12-03 00:06:04 +00:00
|
|
|
_interfaceOff = true;
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-29 17:10:06 +00:00
|
|
|
void LabEngine::interfaceOn() {
|
2015-12-03 00:06:04 +00:00
|
|
|
if (_interfaceOff) {
|
|
|
|
_interfaceOff = false;
|
2015-11-29 17:10:06 +00:00
|
|
|
_event->mouseShow();
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
|
2015-12-04 12:32:08 +00:00
|
|
|
if (_graphics->_longWinInFront)
|
2015-12-13 17:36:56 +00:00
|
|
|
_event->attachButtonList(nullptr);
|
2015-12-03 00:06:04 +00:00
|
|
|
else if (_alternate)
|
2015-12-13 17:36:56 +00:00
|
|
|
_event->attachButtonList(&_invButtonList);
|
2014-10-06 12:50:05 +00:00
|
|
|
else
|
2015-12-13 17:36:56 +00:00
|
|
|
_event->attachButtonList(&_moveButtonList);
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
|
2015-12-06 20:39:41 +00:00
|
|
|
bool LabEngine::doUse(uint16 curInv) {
|
2015-12-12 14:33:01 +00:00
|
|
|
switch (curInv) {
|
2015-12-12 17:11:30 +00:00
|
|
|
case kItemMap:
|
2015-10-08 03:39:59 +00:00
|
|
|
drawStaticMessage(kTextUseMap);
|
2014-10-06 12:50:05 +00:00
|
|
|
interfaceOff();
|
2015-12-01 19:10:42 +00:00
|
|
|
_anim->stopDiff();
|
2015-12-03 00:06:04 +00:00
|
|
|
_curFileName = " ";
|
2015-12-09 10:22:41 +00:00
|
|
|
_closeDataPtr = nullptr;
|
2015-11-30 00:42:12 +00:00
|
|
|
doMap(_roomNum);
|
2015-12-23 20:10:33 +00:00
|
|
|
_graphics->setPalette(initColors, 8);
|
2015-12-23 21:01:17 +00:00
|
|
|
_graphics->drawMessage("", false);
|
2015-12-04 12:32:08 +00:00
|
|
|
_graphics->drawPanel();
|
2015-12-12 14:33:01 +00:00
|
|
|
return true;
|
2015-12-12 17:11:30 +00:00
|
|
|
case kItemJournal:
|
2015-10-08 03:39:59 +00:00
|
|
|
drawStaticMessage(kTextUseJournal);
|
2014-10-06 12:50:05 +00:00
|
|
|
interfaceOff();
|
2015-12-01 19:10:42 +00:00
|
|
|
_anim->stopDiff();
|
2015-12-03 00:06:04 +00:00
|
|
|
_curFileName = " ";
|
2015-12-09 10:22:41 +00:00
|
|
|
_closeDataPtr = nullptr;
|
2014-12-25 18:13:52 +00:00
|
|
|
doJournal();
|
2015-12-04 12:32:08 +00:00
|
|
|
_graphics->drawPanel();
|
2015-12-23 21:01:17 +00:00
|
|
|
_graphics->drawMessage("", false);
|
2015-12-12 14:33:01 +00:00
|
|
|
return true;
|
2015-12-12 17:11:30 +00:00
|
|
|
case kItemLamp:
|
2014-10-06 12:50:05 +00:00
|
|
|
interfaceOff();
|
|
|
|
|
2015-12-12 17:11:30 +00:00
|
|
|
if (_conditions->in(kCondLampOn)) {
|
2015-10-08 03:39:59 +00:00
|
|
|
drawStaticMessage(kTextTurnLampOff);
|
2015-12-12 17:11:30 +00:00
|
|
|
_conditions->exclElement(kCondLampOn);
|
2015-12-14 14:27:14 +00:00
|
|
|
} else {
|
2015-12-12 17:11:30 +00:00
|
|
|
drawStaticMessage(kTextTurnkLampOn);
|
|
|
|
_conditions->inclElement(kCondLampOn);
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
|
2015-12-01 23:34:51 +00:00
|
|
|
_anim->_doBlack = false;
|
|
|
|
_anim->_waitForEffect = true;
|
2015-12-20 15:52:49 +00:00
|
|
|
_graphics->readPict("Music:Click");
|
2015-12-01 23:34:51 +00:00
|
|
|
_anim->_waitForEffect = false;
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-01 23:34:51 +00:00
|
|
|
_anim->_doBlack = false;
|
2015-12-06 20:39:41 +00:00
|
|
|
_nextFileName = getInvName(curInv);
|
2015-12-12 14:33:01 +00:00
|
|
|
return true;
|
2015-12-12 17:11:30 +00:00
|
|
|
case kItemBelt:
|
|
|
|
if (!_conditions->in(kCondBeltGlowing))
|
|
|
|
_conditions->inclElement(kCondBeltGlowing);
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-01 23:34:51 +00:00
|
|
|
_anim->_doBlack = false;
|
2015-12-06 20:39:41 +00:00
|
|
|
_nextFileName = getInvName(curInv);
|
2015-12-12 14:33:01 +00:00
|
|
|
return true;
|
2015-12-12 17:11:30 +00:00
|
|
|
case kItemWhiskey:
|
|
|
|
_conditions->inclElement(kCondUsedHelmet);
|
2015-10-08 03:39:59 +00:00
|
|
|
drawStaticMessage(kTextUseWhiskey);
|
2015-12-12 14:33:01 +00:00
|
|
|
return true;
|
2015-12-12 17:11:30 +00:00
|
|
|
case kItemPithHelmet:
|
|
|
|
_conditions->inclElement(kCondUsedHelmet);
|
2015-10-08 03:39:59 +00:00
|
|
|
drawStaticMessage(kTextUsePith);
|
2015-12-12 14:33:01 +00:00
|
|
|
return true;
|
2015-12-12 17:11:30 +00:00
|
|
|
case kItemHelmet:
|
|
|
|
_conditions->inclElement(kCondUsedHelmet);
|
2015-10-08 03:39:59 +00:00
|
|
|
drawStaticMessage(kTextUseHelmet);
|
2015-12-12 14:33:01 +00:00
|
|
|
return true;
|
|
|
|
default:
|
2014-10-06 12:50:05 +00:00
|
|
|
return false;
|
2015-12-12 14:33:01 +00:00
|
|
|
}
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
|
2015-12-06 20:39:41 +00:00
|
|
|
void LabEngine::decIncInv(uint16 *curInv, bool decreaseFl) {
|
2015-12-18 02:04:46 +00:00
|
|
|
int8 step = (decreaseFl) ? -1 : 1;
|
2015-12-19 00:07:33 +00:00
|
|
|
uint newInv = *curInv + step;
|
|
|
|
|
|
|
|
// Handle wrapping
|
|
|
|
if (newInv < 1)
|
|
|
|
newInv = _numInv;
|
|
|
|
if (newInv > _numInv)
|
|
|
|
newInv = 1;
|
|
|
|
|
2014-10-06 12:50:05 +00:00
|
|
|
interfaceOff();
|
2015-12-18 02:04:46 +00:00
|
|
|
|
2015-12-19 00:07:33 +00:00
|
|
|
while (newInv && (newInv <= _numInv)) {
|
2015-12-21 00:27:50 +00:00
|
|
|
if (_conditions->in(newInv) && !_inventory[newInv]._bitmapName.empty()) {
|
2015-12-19 00:07:33 +00:00
|
|
|
_nextFileName = getInvName(newInv);
|
|
|
|
*curInv = newInv;
|
2014-10-06 12:50:05 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-12-19 00:07:33 +00:00
|
|
|
newInv += step;
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-19 00:07:33 +00:00
|
|
|
// Handle wrapping
|
|
|
|
if (newInv < 1)
|
|
|
|
newInv = _numInv;
|
|
|
|
if (newInv > _numInv)
|
|
|
|
newInv = 1;
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-24 22:59:30 +00:00
|
|
|
void LabEngine::mainGameLoop() {
|
2015-11-30 12:09:36 +00:00
|
|
|
uint16 actionMode = 4;
|
2015-12-12 17:11:30 +00:00
|
|
|
uint16 curInv = kItemMap;
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-06 20:39:41 +00:00
|
|
|
bool forceDraw = false;
|
|
|
|
bool gotMessage = true;
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-23 20:10:33 +00:00
|
|
|
_graphics->setPalette(initColors, 8);
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-09 10:22:41 +00:00
|
|
|
_closeDataPtr = nullptr;
|
2015-11-30 00:42:12 +00:00
|
|
|
_roomNum = 1;
|
2015-12-23 20:59:59 +00:00
|
|
|
_direction = kDirectionNorth;
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-11-29 23:34:43 +00:00
|
|
|
_resource->readRoomData("LAB:Doors");
|
2015-12-03 18:49:55 +00:00
|
|
|
if (!(_inventory = _resource->readInventory("LAB:Inventor")))
|
|
|
|
return;
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-06 16:24:25 +00:00
|
|
|
if (!(_conditions = new LargeSet(_highestCondition + 1, this)))
|
2014-10-06 12:50:05 +00:00
|
|
|
return;
|
|
|
|
|
2015-12-06 16:24:25 +00:00
|
|
|
if (!(_roomsFound = new LargeSet(_manyRooms + 1, this)))
|
2014-10-06 12:50:05 +00:00
|
|
|
return;
|
|
|
|
|
2015-11-29 22:34:35 +00:00
|
|
|
_conditions->readInitialConditions("LAB:Conditio");
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-04 12:32:08 +00:00
|
|
|
_graphics->_longWinInFront = false;
|
|
|
|
_graphics->drawPanel();
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-13 17:36:56 +00:00
|
|
|
perFlipButton(actionMode);
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-08 10:27:34 +00:00
|
|
|
// Set up initial picture.
|
2014-10-06 12:50:05 +00:00
|
|
|
while (1) {
|
2015-12-16 22:13:53 +00:00
|
|
|
_event->processInput();
|
2015-12-23 17:56:35 +00:00
|
|
|
_system->delayMillis(10);
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-06 20:39:41 +00:00
|
|
|
if (gotMessage) {
|
2015-12-24 00:21:40 +00:00
|
|
|
if (_quitLab || shouldQuit()) {
|
2015-12-01 19:10:42 +00:00
|
|
|
_anim->stopDiff();
|
2014-10-06 12:50:05 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-11-30 00:17:05 +00:00
|
|
|
_music->resumeBackMusic();
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-08 10:27:34 +00:00
|
|
|
// Sees what kind of close up we're in and does the appropriate stuff, if any.
|
2015-12-09 10:22:41 +00:00
|
|
|
if (doCloseUp(_closeDataPtr)) {
|
|
|
|
_closeDataPtr = nullptr;
|
2014-10-06 12:50:05 +00:00
|
|
|
mayShowCrumbIndicator();
|
2015-12-04 12:32:08 +00:00
|
|
|
_graphics->screenUpdate();
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
|
2015-12-08 10:27:34 +00:00
|
|
|
// Sets the current picture properly on the screen
|
2015-12-06 20:39:41 +00:00
|
|
|
if (_mainDisplay)
|
2015-12-26 13:18:44 +00:00
|
|
|
_nextFileName = getPictName(true);
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-06 16:24:25 +00:00
|
|
|
if (_noUpdateDiff) {
|
2015-12-08 10:27:34 +00:00
|
|
|
// Potentially entered another room
|
|
|
|
_roomsFound->inclElement(_roomNum);
|
2015-12-19 00:12:42 +00:00
|
|
|
forceDraw |= (_nextFileName != _curFileName);
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-06 16:24:25 +00:00
|
|
|
_noUpdateDiff = false;
|
2015-12-03 00:06:04 +00:00
|
|
|
_curFileName = _nextFileName;
|
2015-12-19 00:12:42 +00:00
|
|
|
} else if (_nextFileName != _curFileName) {
|
2014-10-06 12:50:05 +00:00
|
|
|
interfaceOff();
|
2015-12-08 10:27:34 +00:00
|
|
|
// Potentially entered another room
|
|
|
|
_roomsFound->inclElement(_roomNum);
|
2015-12-03 00:06:04 +00:00
|
|
|
_curFileName = _nextFileName;
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-09 10:22:41 +00:00
|
|
|
if (_closeDataPtr) {
|
2015-12-12 14:33:01 +00:00
|
|
|
switch (_closeDataPtr->_closeUpType) {
|
|
|
|
case SPECIALLOCK:
|
|
|
|
if (_mainDisplay)
|
2015-12-20 15:52:49 +00:00
|
|
|
_tilePuzzle->showCombination(_curFileName);
|
2015-12-12 14:33:01 +00:00
|
|
|
break;
|
|
|
|
case SPECIALBRICK:
|
|
|
|
case SPECIALBRICKNOMOUSE:
|
|
|
|
if (_mainDisplay)
|
2015-12-20 15:46:45 +00:00
|
|
|
_tilePuzzle->showTile(_curFileName, (_closeDataPtr->_closeUpType == SPECIALBRICKNOMOUSE));
|
2015-12-12 14:33:01 +00:00
|
|
|
break;
|
|
|
|
default:
|
2015-12-20 15:52:49 +00:00
|
|
|
_graphics->readPict(_curFileName, false);
|
2015-12-12 14:33:01 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-10-06 12:50:05 +00:00
|
|
|
} else
|
2015-12-20 15:52:49 +00:00
|
|
|
_graphics->readPict(_curFileName, false);
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-09 10:22:41 +00:00
|
|
|
drawRoomMessage(curInv, _closeDataPtr);
|
2015-11-30 12:09:36 +00:00
|
|
|
forceDraw = false;
|
2014-10-06 12:50:05 +00:00
|
|
|
|
|
|
|
mayShowCrumbIndicator();
|
2015-12-04 12:32:08 +00:00
|
|
|
_graphics->screenUpdate();
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-11-30 06:13:09 +00:00
|
|
|
if (!_followingCrumbs)
|
2014-10-06 12:50:05 +00:00
|
|
|
eatMessages();
|
|
|
|
}
|
|
|
|
|
2015-11-30 12:09:36 +00:00
|
|
|
if (forceDraw) {
|
2015-12-09 10:22:41 +00:00
|
|
|
drawRoomMessage(curInv, _closeDataPtr);
|
2015-11-30 12:09:36 +00:00
|
|
|
forceDraw = false;
|
2015-12-04 12:32:08 +00:00
|
|
|
_graphics->screenUpdate();
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-08 10:27:34 +00:00
|
|
|
// Make sure we check the music at least after every message
|
2015-12-22 18:40:34 +00:00
|
|
|
updateMusicAndEvents();
|
2014-10-06 12:50:05 +00:00
|
|
|
interfaceOn();
|
2015-12-13 13:37:39 +00:00
|
|
|
IntuiMessage *curMsg = _event->getMsg();
|
2015-12-24 00:21:40 +00:00
|
|
|
if (shouldQuit()) {
|
2015-12-15 23:07:31 +00:00
|
|
|
_quitLab = true;
|
|
|
|
return;
|
|
|
|
}
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-09 10:22:41 +00:00
|
|
|
if (!curMsg) {
|
2015-12-08 10:27:34 +00:00
|
|
|
// Does music load and next animation frame when you've run out of messages
|
2015-12-06 20:39:41 +00:00
|
|
|
gotMessage = false;
|
2015-11-30 00:17:05 +00:00
|
|
|
_music->checkRoomMusic();
|
2015-12-22 18:40:34 +00:00
|
|
|
updateMusicAndEvents();
|
2015-12-01 19:10:42 +00:00
|
|
|
_anim->diffNextFrame();
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-11-30 06:13:09 +00:00
|
|
|
if (_followingCrumbs) {
|
2015-12-24 17:12:02 +00:00
|
|
|
MainButton code = followCrumbs();
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-24 17:12:02 +00:00
|
|
|
if (code == kButtonForward || code == kButtonLeft || code == kButtonRight) {
|
2015-12-06 20:39:41 +00:00
|
|
|
gotMessage = true;
|
2014-10-06 12:50:05 +00:00
|
|
|
mayShowCrumbIndicator();
|
2015-12-04 12:32:08 +00:00
|
|
|
_graphics->screenUpdate();
|
2015-12-25 12:11:39 +00:00
|
|
|
if (!processEvent(kMessageButtonUp, code, 0, _event->updateAndGetMousePos(), curInv, curMsg, forceDraw, code, actionMode))
|
2015-11-30 12:09:36 +00:00
|
|
|
break;
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mayShowCrumbIndicator();
|
2015-12-04 12:32:08 +00:00
|
|
|
_graphics->screenUpdate();
|
2014-10-06 12:50:05 +00:00
|
|
|
} else {
|
2015-12-06 20:39:41 +00:00
|
|
|
gotMessage = true;
|
2015-11-30 06:13:09 +00:00
|
|
|
_followingCrumbs = false;
|
2015-12-25 12:11:39 +00:00
|
|
|
if (!processEvent(curMsg->_msgClass, curMsg->_code, curMsg->_qualifier, curMsg->_mouse, curInv, curMsg, forceDraw, curMsg->_code, actionMode))
|
2015-11-30 12:09:36 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-13 17:27:34 +00:00
|
|
|
void LabEngine::showLab2Teaser() {
|
|
|
|
_graphics->blackAllScreen();
|
2015-12-20 15:52:49 +00:00
|
|
|
_graphics->readPict("P:End/L2In.1");
|
2015-12-13 17:27:34 +00:00
|
|
|
|
2015-12-23 19:44:48 +00:00
|
|
|
for (int i = 0; i < 120; i++) {
|
2015-12-22 18:40:34 +00:00
|
|
|
updateMusicAndEvents();
|
2015-12-13 17:27:34 +00:00
|
|
|
waitTOF();
|
|
|
|
}
|
|
|
|
|
2015-12-20 15:52:49 +00:00
|
|
|
_graphics->readPict("P:End/L2In.9");
|
|
|
|
_graphics->readPict("P:End/Lost");
|
2015-12-13 17:27:34 +00:00
|
|
|
|
2015-12-19 11:46:57 +00:00
|
|
|
while (!_event->getMsg() && !shouldQuit()) {
|
2015-12-22 18:40:34 +00:00
|
|
|
updateMusicAndEvents();
|
2015-12-13 17:27:34 +00:00
|
|
|
_anim->diffNextFrame();
|
|
|
|
waitTOF();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-25 12:11:39 +00:00
|
|
|
bool LabEngine::processEvent(MessageClass tmpClass, uint16 code, uint16 qualifier, Common::Point tmpPos,
|
2015-12-13 17:36:56 +00:00
|
|
|
uint16 &curInv, IntuiMessage *curMsg, bool &forceDraw, uint16 buttonId, uint16 &actionMode) {
|
2015-12-25 12:11:39 +00:00
|
|
|
MessageClass msgClass = tmpClass;
|
2015-11-30 12:09:36 +00:00
|
|
|
Common::Point curPos = tmpPos;
|
2015-12-06 16:24:25 +00:00
|
|
|
uint16 oldDirection = 0;
|
2015-12-12 17:11:30 +00:00
|
|
|
uint16 lastInv = kItemMap;
|
2015-12-25 12:11:39 +00:00
|
|
|
|
|
|
|
if (code == Common::KEYCODE_RETURN)
|
|
|
|
msgClass = kMessageLeftClick;
|
|
|
|
|
|
|
|
bool leftButtonClick = (msgClass == kMessageLeftClick);
|
|
|
|
bool rightButtonClick = (msgClass == kMessageRightClick);
|
2015-11-30 12:09:36 +00:00
|
|
|
|
2015-12-01 23:34:51 +00:00
|
|
|
_anim->_doBlack = false;
|
2015-11-30 12:09:36 +00:00
|
|
|
|
2015-12-24 00:21:40 +00:00
|
|
|
if (shouldQuit())
|
2015-12-15 23:07:31 +00:00
|
|
|
return false;
|
|
|
|
|
2015-12-25 12:11:39 +00:00
|
|
|
if (msgClass == kMessageRawKey && !_graphics->_longWinInFront) {
|
2015-12-14 21:59:24 +00:00
|
|
|
if (!processKey(curMsg, msgClass, qualifier, curPos, curInv, forceDraw, code))
|
|
|
|
return false;
|
2015-12-25 12:11:39 +00:00
|
|
|
} else if ((msgClass == kMessageRawKey || leftButtonClick || rightButtonClick) && _graphics->_longWinInFront) {
|
|
|
|
_graphics->_longWinInFront = false;
|
|
|
|
_graphics->drawPanel();
|
|
|
|
drawRoomMessage(curInv, _closeDataPtr);
|
|
|
|
_graphics->screenUpdate();
|
|
|
|
} else if (msgClass == kMessageButtonUp) {
|
|
|
|
if (!_alternate)
|
|
|
|
processMainButton(curInv, lastInv, oldDirection, forceDraw, buttonId, actionMode);
|
|
|
|
else
|
|
|
|
processAltButton(curInv, lastInv, buttonId, actionMode);
|
2015-12-14 21:59:24 +00:00
|
|
|
} else if (leftButtonClick && _mainDisplay) {
|
2015-11-30 12:09:36 +00:00
|
|
|
interfaceOff();
|
2015-12-06 20:39:41 +00:00
|
|
|
_mainDisplay = true;
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-25 12:11:39 +00:00
|
|
|
if (_closeDataPtr && _closeDataPtr->_closeUpType == SPECIALLOCK)
|
|
|
|
_tilePuzzle->mouseCombination(curPos);
|
|
|
|
else if (_closeDataPtr && _closeDataPtr->_closeUpType == SPECIALBRICK)
|
|
|
|
_tilePuzzle->mouseTile(curPos);
|
|
|
|
else
|
2015-12-18 09:27:47 +00:00
|
|
|
performAction(actionMode, curPos, curInv);
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-14 21:59:24 +00:00
|
|
|
mayShowCrumbIndicator();
|
|
|
|
_graphics->screenUpdate();
|
|
|
|
} else if (rightButtonClick) {
|
|
|
|
eatMessages();
|
|
|
|
_alternate = !_alternate;
|
|
|
|
_anim->_doBlack = true;
|
|
|
|
_mainDisplay = true;
|
|
|
|
// Sets the correct button list
|
|
|
|
interfaceOn();
|
|
|
|
|
|
|
|
if (_alternate) {
|
|
|
|
if (lastInv && _conditions->in(lastInv))
|
|
|
|
curInv = lastInv;
|
|
|
|
else
|
|
|
|
decIncInv(&curInv, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
_graphics->drawPanel();
|
|
|
|
drawRoomMessage(curInv, _closeDataPtr);
|
|
|
|
|
2015-11-30 12:09:36 +00:00
|
|
|
mayShowCrumbIndicator();
|
2015-12-04 12:32:08 +00:00
|
|
|
_graphics->screenUpdate();
|
2015-12-25 12:11:39 +00:00
|
|
|
} else if (code == Common::KEYCODE_TAB) {
|
2015-12-18 09:34:09 +00:00
|
|
|
CloseDataPtr tmpClosePtr = _closeDataPtr;
|
2015-11-30 12:09:36 +00:00
|
|
|
|
2015-12-24 18:27:00 +00:00
|
|
|
// get next close-up in list after the one pointed to by curPos
|
|
|
|
setCurrentClose(curPos, &tmpClosePtr, true, true);
|
|
|
|
|
2015-12-25 10:18:22 +00:00
|
|
|
if (tmpClosePtr != _closeDataPtr)
|
2015-12-24 18:27:00 +00:00
|
|
|
_event->setMousePos(Common::Point(_utils->scaleX((tmpClosePtr->_x1 + tmpClosePtr->_x2) / 2), _utils->scaleY((tmpClosePtr->_y1 + tmpClosePtr->_y2) / 2)));
|
2015-12-14 21:59:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-12-25 12:11:39 +00:00
|
|
|
bool LabEngine::processKey(IntuiMessage *curMsg, uint32 msgClass, uint16 &qualifier, Common::Point &curPos, uint16 &curInv, bool &forceDraw, uint16 code) {
|
|
|
|
if ((getPlatform() == Common::kPlatformWindows) && (code == Common::KEYCODE_b)) {
|
2015-12-14 21:59:24 +00:00
|
|
|
// Start bread crumbs
|
|
|
|
_breadCrumbs[0]._roomNum = 0;
|
|
|
|
_numCrumbs = 0;
|
|
|
|
_droppingCrumbs = true;
|
|
|
|
mayShowCrumbIndicator();
|
|
|
|
_graphics->screenUpdate();
|
2015-12-16 00:34:22 +00:00
|
|
|
} else if ((code == Common::KEYCODE_f) || (code == Common::KEYCODE_r)) {
|
2015-12-14 21:59:24 +00:00
|
|
|
// Follow bread crumbs
|
|
|
|
if (_droppingCrumbs) {
|
|
|
|
if (_numCrumbs > 0) {
|
|
|
|
_followingCrumbs = true;
|
2015-12-16 00:34:22 +00:00
|
|
|
_followCrumbsFast = (code == Common::KEYCODE_r);
|
2015-12-14 21:59:24 +00:00
|
|
|
_isCrumbTurning = false;
|
|
|
|
_isCrumbWaiting = false;
|
2015-12-23 17:56:35 +00:00
|
|
|
_crumbTimestamp = _system->getMillis();
|
2015-12-14 21:59:24 +00:00
|
|
|
|
|
|
|
if (_alternate) {
|
|
|
|
eatMessages();
|
|
|
|
_alternate = false;
|
|
|
|
_anim->_doBlack = true;
|
|
|
|
|
|
|
|
_mainDisplay = true;
|
|
|
|
// Sets the correct button list
|
|
|
|
interfaceOn();
|
|
|
|
_graphics->drawPanel();
|
|
|
|
drawRoomMessage(curInv, _closeDataPtr);
|
|
|
|
_graphics->screenUpdate();
|
|
|
|
}
|
2015-12-15 20:20:44 +00:00
|
|
|
} else {
|
2015-12-14 21:59:24 +00:00
|
|
|
_breadCrumbs[0]._roomNum = 0;
|
|
|
|
_droppingCrumbs = false;
|
|
|
|
|
|
|
|
// Need to hide indicator!!!!
|
|
|
|
mayShowCrumbIndicatorOff();
|
|
|
|
_graphics->screenUpdate();
|
|
|
|
}
|
|
|
|
}
|
2015-12-16 00:34:22 +00:00
|
|
|
} else if ((code == Common::KEYCODE_x) || (code == Common::KEYCODE_q)) {
|
2015-12-14 21:59:24 +00:00
|
|
|
// Quit?
|
2015-12-23 02:19:59 +00:00
|
|
|
_graphics->drawMessage("Do you want to quit? (Y/N)", false);
|
2015-11-30 12:09:36 +00:00
|
|
|
eatMessages();
|
2015-12-14 21:59:24 +00:00
|
|
|
interfaceOff();
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
// Make sure we check the music at least after every message
|
2015-12-22 18:40:34 +00:00
|
|
|
updateMusicAndEvents();
|
2015-12-14 21:59:24 +00:00
|
|
|
curMsg = _event->getMsg();
|
|
|
|
|
2015-12-24 00:21:40 +00:00
|
|
|
if (shouldQuit())
|
2015-12-15 23:07:31 +00:00
|
|
|
return false;
|
|
|
|
|
2015-12-14 21:59:24 +00:00
|
|
|
if (!curMsg) {
|
|
|
|
// Does music load and next animation frame when you've run out of messages
|
2015-12-22 18:40:34 +00:00
|
|
|
updateMusicAndEvents();
|
2015-12-14 21:59:24 +00:00
|
|
|
_anim->diffNextFrame();
|
2015-12-17 22:41:24 +00:00
|
|
|
} else if (curMsg->_msgClass == kMessageRawKey) {
|
2015-12-16 00:34:22 +00:00
|
|
|
if ((curMsg->_code == Common::KEYCODE_y) || (curMsg->_code == Common::KEYCODE_q)) {
|
2015-12-15 23:07:31 +00:00
|
|
|
_anim->stopDiff();
|
|
|
|
return false;
|
|
|
|
} else if (curMsg->_code < 128)
|
2015-12-14 21:59:24 +00:00
|
|
|
break;
|
2015-12-17 22:41:24 +00:00
|
|
|
} else if ((curMsg->_msgClass == kMessageLeftClick) || (curMsg->_msgClass == kMessageRightClick))
|
2015-12-15 23:07:31 +00:00
|
|
|
break;
|
2015-12-14 21:59:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
forceDraw = true;
|
|
|
|
interfaceOn();
|
2015-12-25 12:11:39 +00:00
|
|
|
} else if (code == Common::KEYCODE_ESCAPE)
|
2015-12-14 21:59:24 +00:00
|
|
|
_closeDataPtr = nullptr;
|
|
|
|
|
|
|
|
eatMessages();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-12-18 09:27:47 +00:00
|
|
|
void LabEngine::processMainButton(uint16 &curInv, uint16 &lastInv, uint16 &oldDirection, bool &forceDraw, uint16 buttonId, uint16 &actionMode) {
|
2015-12-14 21:59:24 +00:00
|
|
|
uint16 newDir;
|
2015-12-14 23:03:05 +00:00
|
|
|
uint16 oldRoomNum;
|
2015-12-14 21:59:24 +00:00
|
|
|
|
|
|
|
switch (buttonId) {
|
2015-12-14 23:01:44 +00:00
|
|
|
case kButtonPickup:
|
|
|
|
case kButtonUse:
|
|
|
|
case kButtonOpen:
|
|
|
|
case kButtonClose:
|
|
|
|
case kButtonLook:
|
2015-12-16 01:02:58 +00:00
|
|
|
if ((actionMode == 4) && (buttonId == kButtonLook) && _closeDataPtr) {
|
2015-12-26 12:58:07 +00:00
|
|
|
doMainView();
|
2015-12-14 21:59:24 +00:00
|
|
|
|
|
|
|
_anim->_doBlack = true;
|
|
|
|
_closeDataPtr = nullptr;
|
|
|
|
mayShowCrumbIndicator();
|
2015-12-15 20:20:44 +00:00
|
|
|
} else {
|
2015-12-14 21:59:24 +00:00
|
|
|
uint16 oldActionMode = actionMode;
|
|
|
|
actionMode = buttonId;
|
|
|
|
|
|
|
|
if (oldActionMode < 5)
|
|
|
|
perFlipButton(oldActionMode);
|
|
|
|
|
|
|
|
perFlipButton(actionMode);
|
|
|
|
drawStaticMessage(kTextTakeWhat + buttonId);
|
|
|
|
}
|
|
|
|
break;
|
2015-12-25 12:11:39 +00:00
|
|
|
|
2015-12-14 23:01:44 +00:00
|
|
|
case kButtonInventory:
|
2015-12-14 21:59:24 +00:00
|
|
|
eatMessages();
|
|
|
|
|
|
|
|
_alternate = true;
|
2015-12-01 23:34:51 +00:00
|
|
|
_anim->_doBlack = true;
|
2015-12-13 17:36:56 +00:00
|
|
|
// Sets the correct button list
|
2015-12-08 10:27:34 +00:00
|
|
|
interfaceOn();
|
2015-12-14 21:59:24 +00:00
|
|
|
_mainDisplay = false;
|
2015-11-30 12:09:36 +00:00
|
|
|
|
2015-12-14 21:59:24 +00:00
|
|
|
if (lastInv && _conditions->in(lastInv)) {
|
|
|
|
curInv = lastInv;
|
|
|
|
_nextFileName = getInvName(curInv);
|
2015-12-15 20:20:44 +00:00
|
|
|
} else
|
2015-12-14 21:59:24 +00:00
|
|
|
decIncInv(&curInv, false);
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-04 12:32:08 +00:00
|
|
|
_graphics->drawPanel();
|
2015-12-09 10:22:41 +00:00
|
|
|
drawRoomMessage(curInv, _closeDataPtr);
|
2015-11-30 12:09:36 +00:00
|
|
|
|
|
|
|
mayShowCrumbIndicator();
|
2015-12-14 21:59:24 +00:00
|
|
|
break;
|
|
|
|
|
2015-12-14 23:01:44 +00:00
|
|
|
case kButtonLeft:
|
|
|
|
case kButtonRight:
|
2015-12-14 21:59:24 +00:00
|
|
|
_closeDataPtr = nullptr;
|
2015-12-16 01:02:58 +00:00
|
|
|
if (buttonId == kButtonLeft)
|
2015-12-14 21:59:24 +00:00
|
|
|
drawStaticMessage(kTextTurnLeft);
|
|
|
|
else
|
|
|
|
drawStaticMessage(kTextTurnRight);
|
|
|
|
|
|
|
|
_curFileName = " ";
|
|
|
|
oldDirection = _direction;
|
|
|
|
|
|
|
|
newDir = processArrow(_direction, buttonId - 6);
|
2015-12-26 12:58:07 +00:00
|
|
|
doTurn(_direction, newDir);
|
2015-12-14 21:59:24 +00:00
|
|
|
_anim->_doBlack = true;
|
|
|
|
_direction = newDir;
|
|
|
|
forceDraw = true;
|
|
|
|
mayShowCrumbIndicator();
|
|
|
|
break;
|
|
|
|
|
2015-12-14 23:01:44 +00:00
|
|
|
case kButtonForward:
|
2015-12-14 21:59:24 +00:00
|
|
|
_closeDataPtr = nullptr;
|
2015-12-14 23:03:05 +00:00
|
|
|
oldRoomNum = _roomNum;
|
2015-12-14 21:59:24 +00:00
|
|
|
|
2015-12-26 12:58:07 +00:00
|
|
|
if (doGoForward()) {
|
2015-12-14 21:59:24 +00:00
|
|
|
if (oldRoomNum == _roomNum)
|
|
|
|
_anim->_doBlack = true;
|
2015-12-15 20:20:44 +00:00
|
|
|
} else {
|
2015-12-14 21:59:24 +00:00
|
|
|
_anim->_doBlack = true;
|
|
|
|
_direction = processArrow(_direction, buttonId - 6);
|
|
|
|
|
|
|
|
if (oldRoomNum != _roomNum) {
|
|
|
|
drawStaticMessage(kTextGoForward);
|
|
|
|
// Potentially entered a new room
|
|
|
|
_roomsFound->inclElement(_roomNum);
|
|
|
|
_curFileName = " ";
|
|
|
|
forceDraw = true;
|
2015-12-15 20:20:44 +00:00
|
|
|
} else {
|
2015-12-14 21:59:24 +00:00
|
|
|
_anim->_doBlack = true;
|
|
|
|
drawStaticMessage(kTextNoPath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_followingCrumbs) {
|
|
|
|
if (_isCrumbTurning) {
|
2015-12-15 20:20:44 +00:00
|
|
|
if (_direction == oldDirection)
|
2015-12-14 21:59:24 +00:00
|
|
|
_followingCrumbs = false;
|
2015-12-15 20:20:44 +00:00
|
|
|
} else if (_roomNum == oldRoomNum) { // didn't get there?
|
|
|
|
_followingCrumbs = false;
|
2015-12-14 21:59:24 +00:00
|
|
|
}
|
2015-12-16 16:03:42 +00:00
|
|
|
} else if (_droppingCrumbs && (oldRoomNum != _roomNum)) {
|
2015-12-14 21:59:24 +00:00
|
|
|
// If in surreal maze, turn off DroppingCrumbs.
|
2015-12-16 16:03:42 +00:00
|
|
|
if ((_roomNum >= 245) && (_roomNum <= 280)) {
|
2015-12-14 21:59:24 +00:00
|
|
|
_followingCrumbs = false;
|
|
|
|
_droppingCrumbs = false;
|
|
|
|
_numCrumbs = 0;
|
|
|
|
_breadCrumbs[0]._roomNum = 0;
|
2015-12-15 20:20:44 +00:00
|
|
|
} else {
|
2015-12-14 21:59:24 +00:00
|
|
|
bool intersect = false;
|
|
|
|
for (int idx = 0; idx < _numCrumbs; idx++) {
|
|
|
|
if (_breadCrumbs[idx]._roomNum == _roomNum) {
|
|
|
|
_numCrumbs = idx + 1;
|
|
|
|
_breadCrumbs[_numCrumbs]._roomNum = 0;
|
|
|
|
intersect = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!intersect) {
|
|
|
|
if (_numCrumbs == MAX_CRUMBS) {
|
|
|
|
_numCrumbs = MAX_CRUMBS - 1;
|
|
|
|
memcpy(&_breadCrumbs[0], &_breadCrumbs[1], _numCrumbs * sizeof _breadCrumbs[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
_breadCrumbs[_numCrumbs]._roomNum = _roomNum;
|
|
|
|
_breadCrumbs[_numCrumbs++]._direction = _direction;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-14 23:01:44 +00:00
|
|
|
mayShowCrumbIndicator();
|
|
|
|
break;
|
2015-12-25 12:11:39 +00:00
|
|
|
|
2015-12-14 23:01:44 +00:00
|
|
|
case kButtonMap:
|
|
|
|
doUse(kItemMap);
|
|
|
|
|
2015-12-14 21:59:24 +00:00
|
|
|
mayShowCrumbIndicator();
|
|
|
|
break;
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
2015-12-14 23:01:44 +00:00
|
|
|
|
2015-12-14 21:59:24 +00:00
|
|
|
_graphics->screenUpdate();
|
|
|
|
}
|
|
|
|
|
|
|
|
void LabEngine::processAltButton(uint16 &curInv, uint16 &lastInv, uint16 buttonId, uint16 &actionMode) {
|
2015-12-23 20:21:34 +00:00
|
|
|
bool saveRestoreSuccessful = true;
|
2015-12-14 21:59:24 +00:00
|
|
|
|
|
|
|
_anim->_doBlack = true;
|
|
|
|
|
|
|
|
switch (buttonId) {
|
2015-12-14 23:01:44 +00:00
|
|
|
case kButtonMainDisplay:
|
2015-12-14 21:59:24 +00:00
|
|
|
eatMessages();
|
|
|
|
_alternate = false;
|
|
|
|
_anim->_doBlack = true;
|
|
|
|
|
|
|
|
_mainDisplay = true;
|
|
|
|
// Sets the correct button list
|
|
|
|
interfaceOn();
|
|
|
|
_graphics->drawPanel();
|
|
|
|
drawRoomMessage(curInv, _closeDataPtr);
|
|
|
|
break;
|
|
|
|
|
2015-12-14 23:01:44 +00:00
|
|
|
case kButtonSaveLoad:
|
2015-12-14 21:59:24 +00:00
|
|
|
interfaceOff();
|
|
|
|
_anim->stopDiff();
|
|
|
|
_curFileName = " ";
|
|
|
|
|
2015-12-23 20:21:34 +00:00
|
|
|
saveRestoreSuccessful = saveRestoreGame();
|
2015-12-14 21:59:24 +00:00
|
|
|
_closeDataPtr = nullptr;
|
|
|
|
_mainDisplay = true;
|
|
|
|
|
2015-12-16 14:36:21 +00:00
|
|
|
curInv = lastInv = kItemMap;
|
2015-12-14 21:59:24 +00:00
|
|
|
_nextFileName = getInvName(curInv);
|
|
|
|
|
|
|
|
_graphics->drawPanel();
|
|
|
|
|
2015-12-23 20:21:34 +00:00
|
|
|
if (!saveRestoreSuccessful) {
|
|
|
|
_graphics->drawMessage("Save/restore aborted", false);
|
2015-12-23 20:10:33 +00:00
|
|
|
_graphics->setPalette(initColors, 8);
|
2015-12-23 17:56:35 +00:00
|
|
|
_system->delayMillis(1000);
|
2015-12-14 21:59:24 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2015-12-14 23:01:44 +00:00
|
|
|
case kButtonUseItem:
|
2015-12-14 21:59:24 +00:00
|
|
|
if (!doUse(curInv)) {
|
|
|
|
uint16 oldActionMode = actionMode;
|
|
|
|
// Use button
|
|
|
|
actionMode = 5;
|
|
|
|
|
|
|
|
if (oldActionMode < 5)
|
|
|
|
perFlipButton(oldActionMode);
|
|
|
|
|
|
|
|
drawStaticMessage(kTextUseOnWhat);
|
|
|
|
_mainDisplay = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2015-12-14 23:01:44 +00:00
|
|
|
case kButtonLookAtItem:
|
2015-12-14 21:59:24 +00:00
|
|
|
_mainDisplay = !_mainDisplay;
|
|
|
|
|
|
|
|
if ((curInv == 0) || (curInv > _numInv)) {
|
|
|
|
curInv = 1;
|
|
|
|
|
2015-12-16 16:03:42 +00:00
|
|
|
while ((curInv <= _numInv) && !_conditions->in(curInv))
|
2015-12-14 21:59:24 +00:00
|
|
|
curInv++;
|
|
|
|
}
|
|
|
|
|
2015-12-21 00:27:50 +00:00
|
|
|
if ((curInv <= _numInv) && _conditions->in(curInv) && !_inventory[curInv]._bitmapName.empty())
|
2015-12-14 21:59:24 +00:00
|
|
|
_nextFileName = getInvName(curInv);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2015-12-14 23:01:44 +00:00
|
|
|
case kButtonPrevItem:
|
2015-12-14 21:59:24 +00:00
|
|
|
decIncInv(&curInv, true);
|
|
|
|
lastInv = curInv;
|
|
|
|
drawRoomMessage(curInv, _closeDataPtr);
|
|
|
|
break;
|
|
|
|
|
2015-12-14 23:01:44 +00:00
|
|
|
case kButtonNextItem:
|
2015-12-14 21:59:24 +00:00
|
|
|
decIncInv(&curInv, false);
|
|
|
|
lastInv = curInv;
|
|
|
|
drawRoomMessage(curInv, _closeDataPtr);
|
|
|
|
break;
|
|
|
|
|
2015-12-14 23:01:44 +00:00
|
|
|
case kButtonBreadCrumbs:
|
2015-12-14 21:59:24 +00:00
|
|
|
_breadCrumbs[0]._roomNum = 0;
|
|
|
|
_numCrumbs = 0;
|
|
|
|
_droppingCrumbs = true;
|
|
|
|
mayShowCrumbIndicator();
|
|
|
|
break;
|
|
|
|
|
2015-12-14 23:01:44 +00:00
|
|
|
case kButtonFollowCrumbs:
|
2015-12-14 21:59:24 +00:00
|
|
|
if (_droppingCrumbs) {
|
|
|
|
if (_numCrumbs > 0) {
|
|
|
|
_followingCrumbs = true;
|
|
|
|
_followCrumbsFast = false;
|
|
|
|
_isCrumbTurning = false;
|
|
|
|
_isCrumbWaiting = false;
|
2015-12-23 17:56:35 +00:00
|
|
|
_crumbTimestamp = _system->getMillis();
|
2015-12-14 21:59:24 +00:00
|
|
|
|
|
|
|
eatMessages();
|
|
|
|
_alternate = false;
|
|
|
|
_anim->_doBlack = true;
|
|
|
|
|
|
|
|
_mainDisplay = true;
|
|
|
|
// Sets the correct button list
|
|
|
|
interfaceOn();
|
|
|
|
_graphics->drawPanel();
|
|
|
|
drawRoomMessage(curInv, _closeDataPtr);
|
2015-12-15 20:20:44 +00:00
|
|
|
} else {
|
2015-12-14 21:59:24 +00:00
|
|
|
_breadCrumbs[0]._roomNum = 0;
|
|
|
|
_droppingCrumbs = false;
|
|
|
|
|
|
|
|
// Need to hide indicator!!!!
|
|
|
|
mayShowCrumbIndicatorOff();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2015-12-14 23:01:44 +00:00
|
|
|
|
2015-12-14 21:59:24 +00:00
|
|
|
_graphics->screenUpdate();
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
|
2015-12-18 09:27:47 +00:00
|
|
|
void LabEngine::performAction(uint16 actionMode, Common::Point curPos, uint16 &curInv) {
|
2015-12-18 02:04:46 +00:00
|
|
|
eatMessages();
|
|
|
|
|
|
|
|
switch (actionMode) {
|
|
|
|
case 0:
|
|
|
|
// Take something.
|
2015-12-26 13:01:45 +00:00
|
|
|
if (doActionRule(curPos, actionMode, _roomNum))
|
2015-12-18 02:04:46 +00:00
|
|
|
_curFileName = _newFileName;
|
2015-12-26 13:18:44 +00:00
|
|
|
else if (takeItem(curPos))
|
2015-12-18 02:04:46 +00:00
|
|
|
drawStaticMessage(kTextTakeItem);
|
2015-12-26 13:01:45 +00:00
|
|
|
else if (doActionRule(curPos, kRuleActionTakeDef, _roomNum))
|
2015-12-18 02:04:46 +00:00
|
|
|
_curFileName = _newFileName;
|
2015-12-26 13:01:45 +00:00
|
|
|
else if (doActionRule(curPos, kRuleActionTake, 0))
|
2015-12-18 02:04:46 +00:00
|
|
|
_curFileName = _newFileName;
|
|
|
|
else if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2)))
|
|
|
|
drawStaticMessage(kTextNothing);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
case 2:
|
|
|
|
case 3:
|
|
|
|
// Manipulate an object, Open up a "door" or Close a "door"
|
2015-12-26 13:01:45 +00:00
|
|
|
if (doActionRule(curPos, actionMode, _roomNum))
|
2015-12-18 02:04:46 +00:00
|
|
|
_curFileName = _newFileName;
|
2015-12-26 13:01:45 +00:00
|
|
|
else if (!doActionRule(curPos, actionMode, 0)) {
|
2015-12-18 02:04:46 +00:00
|
|
|
if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2)))
|
|
|
|
drawStaticMessage(kTextNothing);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4: {
|
|
|
|
// Look at closeups
|
|
|
|
CloseDataPtr tmpClosePtr = _closeDataPtr;
|
|
|
|
setCurrentClose(curPos, &tmpClosePtr, true);
|
|
|
|
|
|
|
|
if (_closeDataPtr == tmpClosePtr) {
|
|
|
|
if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2)))
|
|
|
|
drawStaticMessage(kTextNothing);
|
2015-12-21 00:27:50 +00:00
|
|
|
} else if (!tmpClosePtr->_graphicName.empty()) {
|
2015-12-19 00:12:42 +00:00
|
|
|
_anim->_doBlack = true;
|
|
|
|
_closeDataPtr = tmpClosePtr;
|
|
|
|
} else if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2)))
|
2015-12-18 02:04:46 +00:00
|
|
|
drawStaticMessage(kTextNothing);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
if (_conditions->in(curInv)) {
|
|
|
|
// Use an item on something else
|
2015-12-26 12:58:07 +00:00
|
|
|
if (doOperateRule(curPos, curInv)) {
|
2015-12-18 02:04:46 +00:00
|
|
|
_curFileName = _newFileName;
|
|
|
|
|
|
|
|
if (!_conditions->in(curInv))
|
|
|
|
decIncInv(&curInv, false);
|
|
|
|
}
|
|
|
|
else if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2)))
|
|
|
|
drawStaticMessage(kTextNothing);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-27 13:18:40 +00:00
|
|
|
void LabEngine::go() {
|
2015-11-29 23:12:01 +00:00
|
|
|
_isHiRes = ((getFeatures() & GF_LOWRES) == 0);
|
2015-12-08 15:19:08 +00:00
|
|
|
_graphics->setUpScreens();
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-11-29 17:10:06 +00:00
|
|
|
_event->initMouse();
|
2015-12-19 12:08:54 +00:00
|
|
|
if (_msgFont)
|
2015-12-24 16:30:54 +00:00
|
|
|
_graphics->freeFont(&_msgFont);
|
2015-12-19 12:08:54 +00:00
|
|
|
|
2015-12-18 03:42:26 +00:00
|
|
|
if (getPlatform() != Common::kPlatformAmiga)
|
|
|
|
_msgFont = _resource->getFont("F:AvanteG.12");
|
|
|
|
else
|
|
|
|
_msgFont = _resource->getFont("F:Map.fon");
|
2015-11-29 17:10:06 +00:00
|
|
|
_event->mouseHide();
|
2015-02-24 22:37:07 +00:00
|
|
|
|
2015-12-04 20:10:07 +00:00
|
|
|
Intro *intro = new Intro(this);
|
2015-12-24 00:47:53 +00:00
|
|
|
intro->play();
|
2015-12-04 20:10:07 +00:00
|
|
|
delete intro;
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-04 19:18:41 +00:00
|
|
|
_event->mouseShow();
|
|
|
|
mainGameLoop();
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-24 16:30:54 +00:00
|
|
|
_graphics->freeFont(&_msgFont);
|
2015-12-04 19:18:41 +00:00
|
|
|
_graphics->freePict();
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-02 19:32:06 +00:00
|
|
|
freeScreens();
|
|
|
|
|
2015-11-30 00:17:05 +00:00
|
|
|
_music->freeMusic();
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
|
2015-12-24 17:12:02 +00:00
|
|
|
MainButton LabEngine::followCrumbs() {
|
2015-12-23 20:59:59 +00:00
|
|
|
// kDirectionNorth, kDirectionSouth, kDirectionEast, kDirectionWest
|
2015-12-24 17:12:02 +00:00
|
|
|
MainButton movement[4][4] = {
|
|
|
|
{ kButtonForward, kButtonRight, kButtonRight, kButtonLeft },
|
|
|
|
{ kButtonRight, kButtonForward, kButtonLeft, kButtonRight },
|
|
|
|
{ kButtonLeft, kButtonRight, kButtonForward, kButtonRight },
|
|
|
|
{ kButtonRight, kButtonLeft, kButtonRight, kButtonForward }
|
2014-10-06 12:50:05 +00:00
|
|
|
};
|
|
|
|
|
2015-11-30 06:13:09 +00:00
|
|
|
if (_isCrumbWaiting) {
|
2015-12-23 17:56:35 +00:00
|
|
|
if (_system->getMillis() <= _crumbTimestamp)
|
2015-12-24 17:12:02 +00:00
|
|
|
return kButtonNone;
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-11-30 06:13:09 +00:00
|
|
|
_isCrumbWaiting = false;
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
|
2015-11-30 06:13:09 +00:00
|
|
|
if (!_isCrumbTurning)
|
|
|
|
_breadCrumbs[_numCrumbs--]._roomNum = 0;
|
2014-10-06 12:50:05 +00:00
|
|
|
|
|
|
|
// Is the current crumb this room? If not, logic error.
|
2015-12-06 17:31:57 +00:00
|
|
|
if (_roomNum != _breadCrumbs[_numCrumbs]._roomNum) {
|
2015-11-30 06:13:09 +00:00
|
|
|
_numCrumbs = 0;
|
|
|
|
_breadCrumbs[0]._roomNum = 0;
|
|
|
|
_droppingCrumbs = false;
|
|
|
|
_followingCrumbs = false;
|
2015-12-24 17:12:02 +00:00
|
|
|
return kButtonNone;
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
|
2015-12-24 17:12:02 +00:00
|
|
|
Direction exitDir;
|
2014-10-06 12:50:05 +00:00
|
|
|
// which direction is last crumb
|
2015-12-23 20:59:59 +00:00
|
|
|
if (_breadCrumbs[_numCrumbs]._direction == kDirectionEast)
|
|
|
|
exitDir = kDirectionWest;
|
|
|
|
else if (_breadCrumbs[_numCrumbs]._direction == kDirectionWest)
|
|
|
|
exitDir = kDirectionEast;
|
|
|
|
else if (_breadCrumbs[_numCrumbs]._direction == kDirectionNorth)
|
|
|
|
exitDir = kDirectionSouth;
|
2014-10-06 12:50:05 +00:00
|
|
|
else
|
2015-12-23 20:59:59 +00:00
|
|
|
exitDir = kDirectionNorth;
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-24 17:12:02 +00:00
|
|
|
MainButton moveDir = movement[_direction][exitDir];
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-11-30 06:13:09 +00:00
|
|
|
if (_numCrumbs == 0) {
|
|
|
|
_isCrumbTurning = false;
|
|
|
|
_breadCrumbs[0]._roomNum = 0;
|
|
|
|
_droppingCrumbs = false;
|
|
|
|
_followingCrumbs = false;
|
2014-10-06 12:50:05 +00:00
|
|
|
} else {
|
2015-12-24 17:12:02 +00:00
|
|
|
_isCrumbTurning = (moveDir != kButtonForward);
|
2015-11-30 06:13:09 +00:00
|
|
|
_isCrumbWaiting = true;
|
2014-10-06 12:50:05 +00:00
|
|
|
|
2015-12-13 18:27:34 +00:00
|
|
|
int theDelay = (_followCrumbsFast ? 1000 / 4 : 1000);
|
2015-12-23 17:56:35 +00:00
|
|
|
_crumbTimestamp = theDelay + _system->getMillis();
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
|
2015-11-30 06:13:09 +00:00
|
|
|
return moveDir;
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
|
2015-12-01 20:42:44 +00:00
|
|
|
|
2015-11-24 22:59:30 +00:00
|
|
|
void LabEngine::mayShowCrumbIndicator() {
|
2015-12-18 12:19:58 +00:00
|
|
|
static Image dropCrumbsImage(24, 24, nullptr, this);
|
2015-11-24 22:59:30 +00:00
|
|
|
if (getPlatform() != Common::kPlatformWindows)
|
2014-12-27 13:18:40 +00:00
|
|
|
return;
|
|
|
|
|
2015-12-06 20:39:41 +00:00
|
|
|
if (_droppingCrumbs && _mainDisplay) {
|
2015-11-29 17:10:06 +00:00
|
|
|
_event->mouseHide();
|
2015-12-01 20:42:44 +00:00
|
|
|
dropCrumbsImage.drawMaskImage(612, 4);
|
2015-11-29 17:10:06 +00:00
|
|
|
_event->mouseShow();
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-24 22:59:30 +00:00
|
|
|
void LabEngine::mayShowCrumbIndicatorOff() {
|
2015-12-18 12:19:58 +00:00
|
|
|
static Image dropCrumbsOffImage(24, 24, nullptr, this);
|
2015-12-13 21:51:23 +00:00
|
|
|
|
2015-11-24 22:59:30 +00:00
|
|
|
if (getPlatform() != Common::kPlatformWindows)
|
2014-12-27 13:18:40 +00:00
|
|
|
return;
|
|
|
|
|
2015-12-06 20:39:41 +00:00
|
|
|
if (_mainDisplay) {
|
2015-11-29 17:10:06 +00:00
|
|
|
_event->mouseHide();
|
2015-12-01 20:42:44 +00:00
|
|
|
dropCrumbsOffImage.drawMaskImage(612, 4);
|
2015-11-29 17:10:06 +00:00
|
|
|
_event->mouseShow();
|
2014-10-06 12:50:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // End of namespace Lab
|