2011-12-20 10:05:24 +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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2012-05-31 04:16:10 +00:00
|
|
|
#include "dreamweb/sound.h"
|
2011-12-20 10:05:24 +00:00
|
|
|
#include "dreamweb/dreamweb.h"
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
namespace DreamWeb {
|
2011-12-20 10:05:24 +00:00
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::newPlace() {
|
2011-12-28 12:10:22 +00:00
|
|
|
if (_vars._needToTravel == 1) {
|
|
|
|
_vars._needToTravel = 0;
|
2011-12-20 10:05:24 +00:00
|
|
|
selectLocation();
|
2011-12-28 01:28:27 +00:00
|
|
|
} else if (_autoLocation != 0xFF) {
|
|
|
|
_newLocation = _autoLocation;
|
|
|
|
_autoLocation = 0xFF;
|
2011-12-20 10:05:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::selectLocation() {
|
2011-12-28 01:28:27 +00:00
|
|
|
_inMapArea = 0;
|
2011-12-20 10:05:24 +00:00
|
|
|
clearBeforeLoad();
|
2011-12-28 01:28:27 +00:00
|
|
|
_getBack = 0;
|
|
|
|
_pointerFrame = 22;
|
2011-12-20 10:05:24 +00:00
|
|
|
readCityPic();
|
|
|
|
showCity();
|
2012-02-22 18:06:29 +00:00
|
|
|
_cityGraphics.clear();
|
2011-12-20 10:05:24 +00:00
|
|
|
readDestIcon();
|
|
|
|
loadTravelText();
|
|
|
|
showPanel();
|
|
|
|
showMan();
|
|
|
|
showArrows();
|
|
|
|
showExit();
|
|
|
|
locationPic();
|
|
|
|
underTextLine();
|
2011-12-28 01:28:27 +00:00
|
|
|
_commandType = 255;
|
2011-12-20 10:05:24 +00:00
|
|
|
readMouse();
|
2011-12-28 01:28:27 +00:00
|
|
|
_pointerFrame = 0;
|
2011-12-20 10:05:24 +00:00
|
|
|
showPointer();
|
2011-12-25 23:59:04 +00:00
|
|
|
workToScreen();
|
2012-05-31 04:16:10 +00:00
|
|
|
_sound->playChannel0(9, 255);
|
2011-12-28 01:28:27 +00:00
|
|
|
_newLocation = 255;
|
2011-12-20 10:05:24 +00:00
|
|
|
|
2011-12-28 01:28:27 +00:00
|
|
|
while (_newLocation == 255) {
|
2011-12-27 03:08:43 +00:00
|
|
|
if (_quitRequested)
|
2011-12-20 10:05:24 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
delPointer();
|
|
|
|
readMouse();
|
|
|
|
showPointer();
|
2012-05-30 03:23:34 +00:00
|
|
|
waitForVSync();
|
2011-12-20 10:05:24 +00:00
|
|
|
dumpPointer();
|
|
|
|
dumpTextLine();
|
|
|
|
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_getBack == 1)
|
2011-12-20 10:05:24 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-28 15:55:03 +00:00
|
|
|
RectWithCallback destList[] = {
|
2011-12-28 13:07:17 +00:00
|
|
|
{ 238,258,4,44,&DreamWebEngine::nextDest },
|
|
|
|
{ 104,124,4,44,&DreamWebEngine::lastDest },
|
|
|
|
{ 280,308,4,44,&DreamWebEngine::lookAtPlace },
|
|
|
|
{ 104,216,138,192,&DreamWebEngine::destSelect },
|
|
|
|
{ 273,320,157,198,&DreamWebEngine::getBack1 },
|
|
|
|
{ 0,320,0,200,&DreamWebEngine::blank },
|
2011-12-20 10:05:24 +00:00
|
|
|
{ 0xFFFF,0,0,0,0 }
|
|
|
|
};
|
|
|
|
checkCoords(destList);
|
|
|
|
}
|
|
|
|
|
2011-12-28 12:10:22 +00:00
|
|
|
if (_quitRequested || _getBack == 1 || _newLocation == _vars._location) {
|
2011-12-28 01:28:27 +00:00
|
|
|
_newLocation = _realLocation;
|
|
|
|
_getBack = 0;
|
2011-12-20 10:05:24 +00:00
|
|
|
}
|
|
|
|
|
2012-02-22 18:06:29 +00:00
|
|
|
_newplaceGraphics.clear();
|
|
|
|
_newplaceGraphics2.clear();
|
|
|
|
_newplaceGraphics3.clear();
|
2011-12-27 17:34:23 +00:00
|
|
|
|
|
|
|
_travelText.clear();
|
2011-12-20 10:05:24 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::showCity() {
|
2011-12-20 10:05:24 +00:00
|
|
|
clearWork();
|
2012-02-22 18:06:29 +00:00
|
|
|
showFrame(_cityGraphics, 57, 32, 0, 0);
|
|
|
|
showFrame(_cityGraphics, 120+57, 32, 1, 0);
|
2011-12-20 10:05:24 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::lookAtPlace() {
|
2011-12-28 19:31:50 +00:00
|
|
|
commandOnlyCond(27, 224);
|
2011-12-20 10:05:24 +00:00
|
|
|
|
2011-12-28 01:28:27 +00:00
|
|
|
if (!(_mouseButton & 1) ||
|
|
|
|
_mouseButton == _oldButton ||
|
|
|
|
_destPos >= 15)
|
2011-12-20 10:05:24 +00:00
|
|
|
return; // noinfo
|
|
|
|
|
|
|
|
delPointer();
|
|
|
|
delTextLine();
|
|
|
|
getUnderCentre();
|
2012-02-22 18:06:29 +00:00
|
|
|
showFrame(_newplaceGraphics3, 60, 72, 0, 0);
|
|
|
|
showFrame(_newplaceGraphics3, 60, 72 + 55, 4, 0);
|
2011-12-27 04:12:16 +00:00
|
|
|
if (_foreignRelease)
|
2012-02-22 18:06:29 +00:00
|
|
|
showFrame(_newplaceGraphics3, 60, 72+55+21, 4, 0);
|
2011-12-20 10:05:24 +00:00
|
|
|
|
2011-12-28 01:28:27 +00:00
|
|
|
const uint8 *string = (const uint8 *)_travelText.getString(_destPos);
|
2011-12-20 10:05:24 +00:00
|
|
|
findNextColon(&string);
|
2011-12-27 04:12:16 +00:00
|
|
|
uint16 y = (_foreignRelease) ? 84 + 4 : 84;
|
2011-12-20 10:05:24 +00:00
|
|
|
printDirect(&string, 63, &y, 191, 191 & 1);
|
|
|
|
workToScreenM();
|
|
|
|
hangOnP(500);
|
2011-12-28 01:28:27 +00:00
|
|
|
_pointerMode = 0;
|
|
|
|
_pointerFrame = 0;
|
2011-12-20 10:05:24 +00:00
|
|
|
putUnderCentre();
|
|
|
|
workToScreenM();
|
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::getUnderCentre() {
|
2011-12-27 12:52:13 +00:00
|
|
|
multiGet(_mapStore, 58, 72, 254, 110);
|
2011-12-20 10:05:24 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::putUnderCentre() {
|
2011-12-27 12:52:13 +00:00
|
|
|
multiPut(_mapStore, 58, 72, 254, 110);
|
2011-12-20 10:05:24 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::locationPic() {
|
2011-12-25 19:00:30 +00:00
|
|
|
const int roomPics[] = { 5, 0, 3, 2, 4, 1, 10, 9, 8, 6, 11, 4, 7, 7, 0 };
|
2011-12-28 01:28:27 +00:00
|
|
|
byte picture = roomPics[_destPos];
|
2011-12-25 19:00:30 +00:00
|
|
|
|
|
|
|
if (picture >= 6)
|
2012-02-22 18:06:29 +00:00
|
|
|
showFrame(_newplaceGraphics2, 104, 138 + 14, picture - 6, 0); // Second slot
|
2011-12-25 17:48:49 +00:00
|
|
|
else
|
2012-02-22 18:06:29 +00:00
|
|
|
showFrame(_newplaceGraphics, 104, 138 + 14, picture + 4, 0);
|
2011-12-25 17:48:49 +00:00
|
|
|
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_destPos == _realLocation)
|
2012-02-22 18:06:29 +00:00
|
|
|
showFrame(_newplaceGraphics, 104, 140 + 14, 3, 0); // Currently in this location
|
2011-12-25 17:48:49 +00:00
|
|
|
|
2011-12-28 01:28:27 +00:00
|
|
|
const uint8 *string = (const uint8 *)_travelText.getString(_destPos);
|
2011-12-28 22:56:30 +00:00
|
|
|
printDirect(string, 50, 20, 241, 241 & 1);
|
2011-12-25 17:48:49 +00:00
|
|
|
}
|
2011-12-20 10:05:24 +00:00
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::showArrows() {
|
2012-02-22 18:06:29 +00:00
|
|
|
showFrame(_newplaceGraphics, 116 - 12, 16, 0, 0);
|
|
|
|
showFrame(_newplaceGraphics, 226 + 12, 16, 1, 0);
|
|
|
|
showFrame(_newplaceGraphics, 280, 14, 2, 0);
|
2011-12-20 10:05:24 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::nextDest() {
|
2011-12-28 19:31:50 +00:00
|
|
|
commandOnlyCond(28, 218);
|
2011-12-20 10:05:24 +00:00
|
|
|
|
2011-12-28 01:28:27 +00:00
|
|
|
if (!(_mouseButton & 1) || _oldButton == 1)
|
2011-12-20 10:05:24 +00:00
|
|
|
return; // nodu
|
|
|
|
|
|
|
|
do {
|
2011-12-28 01:28:27 +00:00
|
|
|
_destPos++;
|
|
|
|
if (_destPos == 15)
|
|
|
|
_destPos = 0; // last destination
|
|
|
|
} while (!getLocation(_destPos));
|
2011-12-20 10:05:24 +00:00
|
|
|
|
2011-12-28 01:28:27 +00:00
|
|
|
_newTextLine = 1;
|
2011-12-20 10:05:24 +00:00
|
|
|
delTextLine();
|
|
|
|
delPointer();
|
|
|
|
showPanel();
|
|
|
|
showMan();
|
|
|
|
showArrows();
|
|
|
|
locationPic();
|
|
|
|
underTextLine();
|
|
|
|
readMouse();
|
|
|
|
showPointer();
|
2011-12-25 23:59:04 +00:00
|
|
|
workToScreen();
|
2011-12-20 10:05:24 +00:00
|
|
|
delPointer();
|
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::lastDest() {
|
2011-12-28 19:31:50 +00:00
|
|
|
commandOnlyCond(29, 219);
|
2011-12-20 10:05:24 +00:00
|
|
|
|
2011-12-28 01:28:27 +00:00
|
|
|
if (!(_mouseButton & 1) || _oldButton == 1)
|
2011-12-20 10:05:24 +00:00
|
|
|
return; // nodd
|
|
|
|
|
|
|
|
do {
|
2011-12-28 01:28:27 +00:00
|
|
|
_destPos--;
|
|
|
|
if (_destPos == 0xFF)
|
|
|
|
_destPos = 15; // first destination
|
|
|
|
} while (!getLocation(_destPos));
|
2011-12-20 10:05:24 +00:00
|
|
|
|
2011-12-28 01:28:27 +00:00
|
|
|
_newTextLine = 1;
|
2011-12-20 10:05:24 +00:00
|
|
|
delTextLine();
|
|
|
|
delPointer();
|
|
|
|
showPanel();
|
|
|
|
showMan();
|
|
|
|
showArrows();
|
|
|
|
locationPic();
|
|
|
|
underTextLine();
|
|
|
|
readMouse();
|
|
|
|
showPointer();
|
2011-12-25 23:59:04 +00:00
|
|
|
workToScreen();
|
2011-12-20 10:05:24 +00:00
|
|
|
delPointer();
|
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::destSelect() {
|
2011-12-28 19:31:50 +00:00
|
|
|
commandOnlyCond(30, 222);
|
2011-12-20 10:05:24 +00:00
|
|
|
|
2011-12-28 01:28:27 +00:00
|
|
|
if (!(_mouseButton & 1) || _oldButton == 1)
|
2011-12-20 10:05:24 +00:00
|
|
|
return; // notrav
|
|
|
|
|
2011-12-28 01:28:27 +00:00
|
|
|
_newLocation = _destPos;
|
2011-12-20 10:05:24 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
uint8 DreamWebEngine::getLocation(uint8 index) {
|
2011-12-26 11:59:20 +00:00
|
|
|
return _roomsCanGo[index];
|
2011-12-20 10:05:24 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::setLocation(uint8 index) {
|
2011-12-26 11:59:20 +00:00
|
|
|
_roomsCanGo[index] = 1;
|
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::clearLocation(uint8 index) {
|
2011-12-26 11:59:20 +00:00
|
|
|
_roomsCanGo[index] = 0;
|
2011-12-20 10:05:24 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::resetLocation(uint8 index) {
|
2011-12-20 10:33:09 +00:00
|
|
|
if (index == 5) {
|
|
|
|
// delete hotel
|
|
|
|
purgeALocation(5);
|
|
|
|
purgeALocation(21);
|
|
|
|
purgeALocation(22);
|
|
|
|
purgeALocation(27);
|
|
|
|
} else if (index == 8) {
|
|
|
|
// delete TV studio
|
|
|
|
purgeALocation(8);
|
|
|
|
purgeALocation(28);
|
|
|
|
} else if (index == 6) {
|
|
|
|
// delete sarters
|
|
|
|
purgeALocation(6);
|
|
|
|
purgeALocation(20);
|
|
|
|
purgeALocation(25);
|
|
|
|
} else if (index == 13) {
|
|
|
|
// delete boathouse
|
|
|
|
purgeALocation(13);
|
|
|
|
purgeALocation(29);
|
|
|
|
}
|
|
|
|
|
2011-12-26 11:59:20 +00:00
|
|
|
clearLocation(index);
|
2011-12-20 10:33:09 +00:00
|
|
|
}
|
2011-12-20 10:05:24 +00:00
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::readDestIcon() {
|
2012-02-24 05:46:00 +00:00
|
|
|
loadGraphicsFile(_newplaceGraphics, "G05");
|
|
|
|
loadGraphicsFile(_newplaceGraphics2, "G06");
|
|
|
|
loadGraphicsFile(_newplaceGraphics3, "G08");
|
2011-12-20 10:05:24 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::readCityPic() {
|
2012-02-24 05:46:00 +00:00
|
|
|
loadGraphicsFile(_cityGraphics, "G04");
|
2011-12-20 10:05:24 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
} // End of namespace DreamWeb
|