2011-07-25 22:04:14 +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.
|
2014-02-18 01:34:19 +00:00
|
|
|
*
|
2011-07-25 22:04:14 +00:00
|
|
|
* 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.
|
2014-02-18 01:34:19 +00:00
|
|
|
*
|
2011-07-25 22:04:14 +00:00
|
|
|
* 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-07-25 22:04:14 +00:00
|
|
|
#include "dreamweb/dreamweb.h"
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
namespace DreamWeb {
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::printSprites() {
|
2012-11-30 12:08:55 +00:00
|
|
|
for (uint priority = 0; priority < 7; ++priority) {
|
2011-12-23 21:58:54 +00:00
|
|
|
Common::List<Sprite>::const_iterator i;
|
|
|
|
for (i = _spriteTable.begin(); i != _spriteTable.end(); ++i) {
|
|
|
|
const Sprite &sprite = *i;
|
2011-07-25 22:04:14 +00:00
|
|
|
if (priority != sprite.priority)
|
|
|
|
continue;
|
|
|
|
if (sprite.hidden == 1)
|
|
|
|
continue;
|
2011-12-01 19:43:43 +00:00
|
|
|
printASprite(&sprite);
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::printASprite(const Sprite *sprite) {
|
2011-07-25 22:56:24 +00:00
|
|
|
uint16 x, y;
|
|
|
|
if (sprite->y >= 220) {
|
2011-12-28 01:28:27 +00:00
|
|
|
y = _mapAdY - (256 - sprite->y);
|
2011-07-25 22:04:14 +00:00
|
|
|
} else {
|
2011-12-28 01:28:27 +00:00
|
|
|
y = sprite->y + _mapAdY;
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2011-07-25 22:56:24 +00:00
|
|
|
if (sprite->x >= 220) {
|
2011-12-28 01:28:27 +00:00
|
|
|
x = _mapAdX - (256 - sprite->x);
|
2011-07-25 22:04:14 +00:00
|
|
|
} else {
|
2011-12-28 01:28:27 +00:00
|
|
|
x = sprite->x + _mapAdX;
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
2012-09-26 02:17:31 +00:00
|
|
|
|
2011-07-25 22:04:14 +00:00
|
|
|
uint8 c;
|
2011-11-18 21:34:46 +00:00
|
|
|
if (sprite->walkFrame != 0)
|
2011-07-25 22:04:14 +00:00
|
|
|
c = 8;
|
|
|
|
else
|
|
|
|
c = 0;
|
2011-12-27 18:37:22 +00:00
|
|
|
showFrame(*sprite->_frameData, x, y, sprite->frameNumber, c);
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::clearSprites() {
|
2011-12-23 21:58:54 +00:00
|
|
|
_spriteTable.clear();
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 14:03:58 +00:00
|
|
|
Sprite *DreamWebEngine::makeSprite(uint8 x, uint8 y, bool mainManCallback, const GraphicsFile *frameData) {
|
2011-12-23 21:58:54 +00:00
|
|
|
// Note: the original didn't append sprites here, but filled up the
|
|
|
|
// first unused entry. This can change the order of entries, but since they
|
|
|
|
// are drawn based on the priority field, this shouldn't matter.
|
|
|
|
_spriteTable.push_back(Sprite());
|
|
|
|
Sprite *sprite = &_spriteTable.back();
|
|
|
|
|
|
|
|
memset(sprite, 0xff, sizeof(Sprite));
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-12-28 13:58:44 +00:00
|
|
|
sprite->_mainManCallback = mainManCallback;
|
2011-07-25 22:04:14 +00:00
|
|
|
sprite->x = x;
|
|
|
|
sprite->y = y;
|
2011-12-23 21:58:54 +00:00
|
|
|
sprite->_frameData = frameData;
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->frameNumber = 0;
|
2011-07-25 22:04:14 +00:00
|
|
|
sprite->delay = 0;
|
2011-12-27 21:58:06 +00:00
|
|
|
sprite->_objData = 0;
|
2011-07-25 22:04:14 +00:00
|
|
|
return sprite;
|
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::spriteUpdate() {
|
2011-12-23 21:58:54 +00:00
|
|
|
// During the intro the sprite table can be empty
|
|
|
|
if (!_spriteTable.empty())
|
2011-12-28 12:10:22 +00:00
|
|
|
_spriteTable.front().hidden = _vars._ryanOn;
|
2011-12-23 21:58:54 +00:00
|
|
|
|
|
|
|
Common::List<Sprite>::iterator i;
|
|
|
|
for (i = _spriteTable.begin(); i != _spriteTable.end(); ++i) {
|
|
|
|
Sprite &sprite = *i;
|
2011-12-28 13:58:44 +00:00
|
|
|
if (sprite._mainManCallback)
|
2011-12-23 21:58:54 +00:00
|
|
|
mainMan(&sprite);
|
|
|
|
else {
|
|
|
|
backObject(&sprite);
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
2012-09-26 02:17:31 +00:00
|
|
|
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_nowInNewRoom == 1)
|
2011-07-25 22:04:14 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::initMan() {
|
2011-12-28 14:03:58 +00:00
|
|
|
Sprite *sprite = makeSprite(_ryanX, _ryanY, true, &_mainSprites);
|
2011-07-25 22:04:14 +00:00
|
|
|
sprite->priority = 4;
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->speed = 0;
|
|
|
|
sprite->walkFrame = 0;
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::mainMan(Sprite *sprite) {
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_resetManXY == 1) {
|
|
|
|
_resetManXY = 0;
|
|
|
|
sprite->x = _ryanX;
|
|
|
|
sprite->y = _ryanY;
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->walkFrame = 0;
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
2011-12-18 15:20:17 +00:00
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
--sprite->speed;
|
2011-12-18 15:20:17 +00:00
|
|
|
if (sprite->speed != 0xff)
|
2011-07-25 22:04:14 +00:00
|
|
|
return;
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->speed = 0;
|
2011-12-18 15:20:17 +00:00
|
|
|
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_turnToFace != _facing) {
|
2011-12-01 19:43:43 +00:00
|
|
|
aboutTurn(sprite);
|
2011-07-25 22:04:14 +00:00
|
|
|
} else {
|
2011-12-28 01:28:27 +00:00
|
|
|
if ((_turnDirection != 0) && (_linePointer == 254)) {
|
|
|
|
_reAssesChanges = 1;
|
|
|
|
if (_facing == _leaveDirection)
|
2011-12-14 16:19:14 +00:00
|
|
|
checkForExit(sprite);
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
2011-12-28 01:28:27 +00:00
|
|
|
_turnDirection = 0;
|
|
|
|
if (_linePointer == 254) {
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->walkFrame = 0;
|
2011-07-25 22:04:14 +00:00
|
|
|
} else {
|
2011-11-18 21:34:46 +00:00
|
|
|
++sprite->walkFrame;
|
|
|
|
if (sprite->walkFrame == 11)
|
|
|
|
sprite->walkFrame = 1;
|
2011-07-25 22:04:14 +00:00
|
|
|
walking(sprite);
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_linePointer != 254) {
|
|
|
|
if ((_facing & 1) == 0)
|
2011-07-25 22:04:14 +00:00
|
|
|
walking(sprite);
|
2011-11-18 21:48:34 +00:00
|
|
|
else if ((sprite->walkFrame != 2) && (sprite->walkFrame != 7))
|
2011-07-25 22:04:14 +00:00
|
|
|
walking(sprite);
|
|
|
|
}
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_linePointer == 254) {
|
|
|
|
if (_turnToFace == _facing) {
|
|
|
|
_reAssesChanges = 1;
|
|
|
|
if (_facing == _leaveDirection)
|
2011-12-14 16:19:14 +00:00
|
|
|
checkForExit(sprite);
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static const uint8 facelist[] = { 0,60,33,71,11,82,22,93 };
|
2011-12-28 01:28:27 +00:00
|
|
|
sprite->frameNumber = sprite->walkFrame + facelist[_facing];
|
|
|
|
_ryanX = sprite->x;
|
|
|
|
_ryanY = sprite->y;
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::walking(Sprite *sprite) {
|
2011-07-25 22:04:14 +00:00
|
|
|
uint8 comp;
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_lineDirection != 0) {
|
|
|
|
--_linePointer;
|
2011-07-25 22:04:14 +00:00
|
|
|
comp = 200;
|
|
|
|
} else {
|
2011-12-28 01:28:27 +00:00
|
|
|
++_linePointer;
|
|
|
|
comp = _lineLength;
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_linePointer < comp) {
|
|
|
|
sprite->x = (uint8)_lineData[_linePointer].x;
|
|
|
|
sprite->y = (uint8)_lineData[_linePointer].y;
|
2011-07-25 22:04:14 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-12-28 01:28:27 +00:00
|
|
|
_linePointer = 254;
|
|
|
|
_mansPath = _destination;
|
|
|
|
if (_destination == _finalDest) {
|
2011-12-01 19:43:43 +00:00
|
|
|
faceRightWay();
|
2011-07-25 22:04:14 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-12-28 01:28:27 +00:00
|
|
|
_destination = _finalDest;
|
2011-12-01 19:43:43 +00:00
|
|
|
autoSetWalk();
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::aboutTurn(Sprite *sprite) {
|
2011-07-25 22:04:14 +00:00
|
|
|
bool incdir = true;
|
|
|
|
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_turnDirection == 1)
|
2011-07-25 22:04:14 +00:00
|
|
|
incdir = true;
|
2011-12-28 01:28:27 +00:00
|
|
|
else if ((int8)_turnDirection == -1)
|
2011-07-25 22:04:14 +00:00
|
|
|
incdir = false;
|
|
|
|
else {
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_facing < _turnToFace) {
|
|
|
|
uint8 delta = _turnToFace - _facing;
|
2011-07-25 22:04:14 +00:00
|
|
|
if (delta >= 4)
|
|
|
|
incdir = false;
|
|
|
|
else
|
|
|
|
incdir = true;
|
|
|
|
} else {
|
2011-12-28 01:28:27 +00:00
|
|
|
uint8 delta = _facing - _turnToFace;
|
2011-07-25 22:04:14 +00:00
|
|
|
if (delta >= 4)
|
|
|
|
incdir = true;
|
|
|
|
else
|
|
|
|
incdir = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (incdir) {
|
2011-12-28 01:28:27 +00:00
|
|
|
_turnDirection = 1;
|
|
|
|
_facing = (_facing + 1) & 7;
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->walkFrame = 0;
|
2011-07-25 22:04:14 +00:00
|
|
|
} else {
|
2011-12-28 01:28:27 +00:00
|
|
|
_turnDirection = (uint8)-1;
|
|
|
|
_facing = (_facing - 1) & 7;
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->walkFrame = 0;
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::backObject(Sprite *sprite) {
|
2011-12-27 21:58:06 +00:00
|
|
|
SetObject *objData = sprite->_objData;
|
2011-07-25 22:04:14 +00:00
|
|
|
|
|
|
|
if (sprite->delay != 0) {
|
|
|
|
--sprite->delay;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite->delay = objData->delay;
|
2011-12-28 15:23:16 +00:00
|
|
|
switch (objData->type) {
|
|
|
|
case 6:
|
2011-12-01 19:43:43 +00:00
|
|
|
wideDoor(sprite, objData);
|
2011-12-28 15:23:16 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
2011-12-04 14:08:17 +00:00
|
|
|
randomSprite(sprite, objData);
|
2011-12-28 15:23:16 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2011-12-01 19:43:43 +00:00
|
|
|
lockedDoorway(sprite, objData);
|
2011-12-28 15:23:16 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2011-12-01 19:43:43 +00:00
|
|
|
liftSprite(sprite, objData);
|
2011-12-28 15:23:16 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2011-07-25 22:04:14 +00:00
|
|
|
doorway(sprite, objData);
|
2011-12-28 15:23:16 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2011-07-25 22:04:14 +00:00
|
|
|
constant(sprite, objData);
|
2011-12-28 15:23:16 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-07-25 22:04:14 +00:00
|
|
|
steady(sprite, objData);
|
2011-12-28 15:23:16 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::constant(Sprite *sprite, SetObject *objData) {
|
2011-11-18 21:34:46 +00:00
|
|
|
++sprite->animFrame;
|
|
|
|
if (objData->frames[sprite->animFrame] == 255) {
|
|
|
|
sprite->animFrame = 0;
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
2011-11-18 21:34:46 +00:00
|
|
|
uint8 frame = objData->frames[sprite->animFrame];
|
|
|
|
objData->index = frame;
|
|
|
|
sprite->frameNumber = frame;
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::randomSprite(Sprite *sprite, SetObject *objData) {
|
2012-03-03 12:55:04 +00:00
|
|
|
uint8 r = _rnd.getRandomNumber(7);
|
|
|
|
sprite->frameNumber = objData->frames[r];
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::doorway(Sprite *sprite, SetObject *objData) {
|
2011-11-16 22:27:14 +00:00
|
|
|
Common::Rect check(-24, -30, 10, 10);
|
2011-12-01 19:43:43 +00:00
|
|
|
doDoor(sprite, objData, check);
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::wideDoor(Sprite *sprite, SetObject *objData) {
|
2011-11-16 22:27:14 +00:00
|
|
|
Common::Rect check(-24, -30, 24, 24);
|
2011-12-01 19:43:43 +00:00
|
|
|
doDoor(sprite, objData, check);
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::doDoor(Sprite *sprite, SetObject *objData, Common::Rect check) {
|
2011-12-28 01:28:27 +00:00
|
|
|
int ryanx = _ryanX;
|
|
|
|
int ryany = _ryanY;
|
2011-11-16 22:27:14 +00:00
|
|
|
|
|
|
|
// Automatically opening doors: check if Ryan is in range
|
|
|
|
|
|
|
|
check.translate(sprite->x, sprite->y);
|
|
|
|
bool openDoor = check.contains(ryanx, ryany);
|
|
|
|
|
|
|
|
if (openDoor) {
|
|
|
|
|
2011-12-28 12:10:22 +00:00
|
|
|
if ((_vars._throughDoor == 1) && (sprite->animFrame == 0))
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->animFrame = 6;
|
2011-11-16 22:27:14 +00:00
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
++sprite->animFrame;
|
|
|
|
if (sprite->animFrame == 1) { // doorsound2
|
2011-11-21 13:33:36 +00:00
|
|
|
uint8 soundIndex;
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_realLocation == 5) // hoteldoor2
|
2011-11-21 13:33:36 +00:00
|
|
|
soundIndex = 13;
|
2011-11-16 22:27:14 +00:00
|
|
|
else
|
2011-11-21 13:33:36 +00:00
|
|
|
soundIndex = 0;
|
2012-05-31 04:16:10 +00:00
|
|
|
_sound->playChannel1(soundIndex);
|
2011-11-16 22:27:14 +00:00
|
|
|
}
|
2011-11-18 21:34:46 +00:00
|
|
|
if (objData->frames[sprite->animFrame] == 255)
|
|
|
|
--sprite->animFrame;
|
2011-11-16 22:27:14 +00:00
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
|
2011-12-28 12:10:22 +00:00
|
|
|
_vars._throughDoor = 1;
|
2011-07-25 22:04:14 +00:00
|
|
|
|
|
|
|
} else {
|
2011-11-16 22:27:14 +00:00
|
|
|
// shut door
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
if (sprite->animFrame == 5) { // doorsound1;
|
2011-11-21 13:33:36 +00:00
|
|
|
uint8 soundIndex;
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_realLocation == 5) // hoteldoor1
|
2011-11-21 13:33:36 +00:00
|
|
|
soundIndex = 13;
|
2011-11-16 22:27:14 +00:00
|
|
|
else
|
2011-11-21 13:33:36 +00:00
|
|
|
soundIndex = 1;
|
2012-05-31 04:16:10 +00:00
|
|
|
_sound->playChannel1(soundIndex);
|
2011-11-16 22:27:14 +00:00
|
|
|
}
|
2011-11-18 21:34:46 +00:00
|
|
|
if (sprite->animFrame != 0)
|
|
|
|
--sprite->animFrame;
|
2011-11-16 22:27:14 +00:00
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
|
|
|
|
if (sprite->animFrame == 5) // nearly
|
2011-12-28 12:10:22 +00:00
|
|
|
_vars._throughDoor = 0;
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::steady(Sprite *sprite, SetObject *objData) {
|
2011-11-18 21:34:46 +00:00
|
|
|
uint8 frame = objData->frames[0];
|
|
|
|
objData->index = frame;
|
|
|
|
sprite->frameNumber = frame;
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::lockedDoorway(Sprite *sprite, SetObject *objData) {
|
2011-12-28 01:28:27 +00:00
|
|
|
int ryanx = _ryanX;
|
|
|
|
int ryany = _ryanY;
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-11-16 22:56:52 +00:00
|
|
|
Common::Rect check(-24, -30, 10, 12);
|
|
|
|
check.translate(sprite->x, sprite->y);
|
|
|
|
bool openDoor = check.contains(ryanx, ryany);
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-12-28 12:10:22 +00:00
|
|
|
if (_vars._throughDoor != 1 && _vars._lockStatus == 1)
|
2011-11-16 22:56:52 +00:00
|
|
|
openDoor = false;
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-11-16 22:56:52 +00:00
|
|
|
if (openDoor) {
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
if (sprite->animFrame == 1) {
|
2012-05-31 04:16:10 +00:00
|
|
|
_sound->playChannel1(0);
|
2011-11-16 22:56:52 +00:00
|
|
|
}
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
if (sprite->animFrame == 6)
|
2011-12-28 12:10:22 +00:00
|
|
|
turnPathOn(_vars._doorPath);
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-12-28 12:10:22 +00:00
|
|
|
if (_vars._throughDoor == 1 && sprite->animFrame == 0)
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->animFrame = 6;
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
++sprite->animFrame;
|
|
|
|
if (objData->frames[sprite->animFrame] == 255)
|
|
|
|
--sprite->animFrame;
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
|
|
|
|
if (sprite->animFrame == 5)
|
2011-12-28 12:10:22 +00:00
|
|
|
_vars._throughDoor = 1;
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-11-16 22:56:52 +00:00
|
|
|
} else {
|
|
|
|
// shut door
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
if (sprite->animFrame == 5) {
|
2012-05-31 04:16:10 +00:00
|
|
|
_sound->playChannel1(1);
|
2011-11-16 22:56:52 +00:00
|
|
|
}
|
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
if (sprite->animFrame != 0)
|
|
|
|
--sprite->animFrame;
|
2012-09-26 02:17:31 +00:00
|
|
|
|
2011-12-28 12:10:22 +00:00
|
|
|
_vars._throughDoor = 0;
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
|
2011-11-16 22:56:52 +00:00
|
|
|
|
2011-11-18 21:34:46 +00:00
|
|
|
if (sprite->animFrame == 0) {
|
2011-12-28 12:10:22 +00:00
|
|
|
turnPathOff(_vars._doorPath);
|
|
|
|
_vars._lockStatus = 1;
|
2011-11-16 22:56:52 +00:00
|
|
|
}
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::liftSprite(Sprite *sprite, SetObject *objData) {
|
2011-12-28 12:10:22 +00:00
|
|
|
uint8 liftFlag = _vars._liftFlag;
|
2011-07-25 22:04:14 +00:00
|
|
|
if (liftFlag == 0) { //liftclosed
|
2011-12-28 12:10:22 +00:00
|
|
|
turnPathOff(_vars._liftPath);
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-12-28 12:10:22 +00:00
|
|
|
if (_vars._countToOpen != 0) {
|
|
|
|
_vars._countToOpen--;
|
|
|
|
if (_vars._countToOpen == 0)
|
|
|
|
_vars._liftFlag = 3;
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->animFrame = 0;
|
|
|
|
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
else if (liftFlag == 1) { //liftopen
|
2011-12-28 12:10:22 +00:00
|
|
|
turnPathOn(_vars._liftPath);
|
2011-07-25 22:04:14 +00:00
|
|
|
|
2011-12-28 12:10:22 +00:00
|
|
|
if (_vars._countToClose != 0) {
|
|
|
|
_vars._countToClose--;
|
|
|
|
if (_vars._countToClose == 0)
|
|
|
|
_vars._liftFlag = 2;
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->animFrame = 12;
|
|
|
|
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
|
2012-09-26 02:17:31 +00:00
|
|
|
}
|
2011-07-25 22:04:14 +00:00
|
|
|
else if (liftFlag == 3) { //openlift
|
2011-11-18 21:34:46 +00:00
|
|
|
if (sprite->animFrame == 12) {
|
2011-12-28 12:10:22 +00:00
|
|
|
_vars._liftFlag = 1;
|
2011-07-25 22:04:14 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-11-18 21:34:46 +00:00
|
|
|
++sprite->animFrame;
|
|
|
|
if (sprite->animFrame == 1) {
|
2011-12-06 00:34:01 +00:00
|
|
|
liftNoise(2);
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
|
2011-07-25 22:04:14 +00:00
|
|
|
} else { //closeLift
|
|
|
|
assert(liftFlag == 2);
|
2011-11-18 21:34:46 +00:00
|
|
|
if (sprite->animFrame == 0) {
|
2011-12-28 12:10:22 +00:00
|
|
|
_vars._liftFlag = 0;
|
2011-07-25 22:04:14 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-11-18 21:34:46 +00:00
|
|
|
--sprite->animFrame;
|
|
|
|
if (sprite->animFrame == 11) {
|
2011-12-06 00:34:01 +00:00
|
|
|
liftNoise(3);
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
2011-11-18 21:34:46 +00:00
|
|
|
sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
|
2011-07-25 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
Reel *DreamWebEngine::getReelStart(uint16 reelPointer) {
|
2011-12-27 21:42:57 +00:00
|
|
|
Reel *reel = &_reelList[reelPointer * 8];
|
2011-08-11 11:29:33 +00:00
|
|
|
return reel;
|
|
|
|
}
|
|
|
|
|
2011-12-08 13:50:33 +00:00
|
|
|
// Locate the reel segment (reel1, reel2, reel3) this frame is stored in,
|
|
|
|
// and adjust the frame number relative to this segment.
|
2011-12-28 13:07:17 +00:00
|
|
|
const GraphicsFile *DreamWebEngine::findSource(uint16 &frame) {
|
2011-12-08 13:50:33 +00:00
|
|
|
if (frame < 160) {
|
2011-12-27 21:00:27 +00:00
|
|
|
return &_reel1;
|
2011-12-08 13:50:33 +00:00
|
|
|
} else if (frame < 320) {
|
|
|
|
frame -= 160;
|
2011-12-27 21:00:27 +00:00
|
|
|
return &_reel2;
|
2011-12-08 13:50:33 +00:00
|
|
|
} else {
|
|
|
|
frame -= 320;
|
2011-12-27 21:00:27 +00:00
|
|
|
return &_reel3;
|
2011-12-08 13:50:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::showReelFrame(Reel *reel) {
|
2011-12-28 01:28:27 +00:00
|
|
|
uint16 x = reel->x + _mapAdX;
|
|
|
|
uint16 y = reel->y + _mapAdY;
|
2011-12-08 13:50:33 +00:00
|
|
|
uint16 frame = reel->frame();
|
2011-12-27 21:00:27 +00:00
|
|
|
const GraphicsFile *base = findSource(frame);
|
|
|
|
showFrame(*base, x, y, frame, 8);
|
2011-07-30 13:25:28 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::showGameReel(ReelRoutine *routine) {
|
2011-12-01 19:43:43 +00:00
|
|
|
uint16 reelPointer = routine->reelPointer();
|
|
|
|
if (reelPointer >= 512)
|
2011-08-11 20:58:06 +00:00
|
|
|
return;
|
2011-12-08 09:22:45 +00:00
|
|
|
plotReel(reelPointer);
|
|
|
|
routine->setReelPointer(reelPointer);
|
2011-08-11 20:58:06 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
const Frame *DreamWebEngine::getReelFrameAX(uint16 frame) {
|
2011-12-27 21:00:27 +00:00
|
|
|
const GraphicsFile *base = findSource(frame);
|
|
|
|
return &base->_frames[frame];
|
2011-08-11 21:10:30 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::moveMap(uint8 param) {
|
2011-08-16 23:16:05 +00:00
|
|
|
switch (param) {
|
|
|
|
case 32:
|
2011-12-28 01:28:27 +00:00
|
|
|
_mapY -= 20;
|
2011-08-16 23:16:05 +00:00
|
|
|
break;
|
|
|
|
case 16:
|
2011-12-28 01:28:27 +00:00
|
|
|
_mapY -= 10;
|
2011-08-16 23:16:05 +00:00
|
|
|
break;
|
|
|
|
case 8:
|
2011-12-28 01:28:27 +00:00
|
|
|
_mapY += 10;
|
2011-08-16 23:16:05 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2011-12-28 01:28:27 +00:00
|
|
|
_mapX += 11;
|
2011-08-16 23:16:05 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-12-28 01:28:27 +00:00
|
|
|
_mapX -= 11;
|
2011-08-16 23:16:05 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-12-28 01:28:27 +00:00
|
|
|
_nowInNewRoom = 1;
|
2011-08-16 23:16:05 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY) {
|
2011-08-22 15:30:53 +00:00
|
|
|
*flagX = x / 16;
|
|
|
|
*flagY = y / 16;
|
2011-12-27 16:56:37 +00:00
|
|
|
const MapFlag &tileData = _mapFlags[*flagY * 11 + *flagX];
|
|
|
|
*flag = tileData._flag;
|
|
|
|
*flagEx = tileData._flagEx;
|
|
|
|
*type = tileData._type;
|
2011-08-22 15:30:53 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::intro1Text() {
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_introCount != 2 && _introCount != 4 && _introCount != 6)
|
2011-12-06 13:21:30 +00:00
|
|
|
return;
|
|
|
|
|
2012-05-31 04:16:10 +00:00
|
|
|
if (hasSpeech() && _sound->isChannel1Playing()) {
|
2011-12-28 01:28:27 +00:00
|
|
|
_introCount--;
|
2011-12-06 10:35:47 +00:00
|
|
|
} else {
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_introCount == 2)
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(40, 82, 34, 130, 90, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
else if (_introCount == 4)
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(41, 82, 34, 130, 90, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
else if (_introCount == 6)
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(42, 82, 34, 130, 90, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::intro2Text(uint16 nextReelPointer) {
|
2011-12-16 16:05:15 +00:00
|
|
|
if (nextReelPointer == 5)
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(43, 82, 34, 40, 90, 1);
|
2011-12-16 16:05:15 +00:00
|
|
|
else if (nextReelPointer == 15)
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(44, 82, 34, 40, 90, 1);
|
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::intro3Text(uint16 nextReelPointer) {
|
2011-12-16 16:05:15 +00:00
|
|
|
if (nextReelPointer == 107)
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(45, 82, 36, 56, 100, 1);
|
2011-12-28 16:53:45 +00:00
|
|
|
else if (nextReelPointer == (hasSpeech() ? 108 : 109))
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(46, 82, 36, 56, 100, 1);
|
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::monks2text() {
|
2011-12-28 16:53:45 +00:00
|
|
|
bool isGermanCD = hasSpeech() && getLanguage() == Common::DE_DEU;
|
2011-12-06 13:21:30 +00:00
|
|
|
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_introCount == 1)
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(8, 82, 36, 160, 120, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
else if (_introCount == (isGermanCD ? 5 : 4))
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(9, 82, 36, 160, 120, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
else if (_introCount == (isGermanCD ? 9 : 7))
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(10, 82, 36, 160, 120, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
else if (_introCount == 10 && !isGermanCD) {
|
2011-12-28 16:53:45 +00:00
|
|
|
if (hasSpeech())
|
2011-12-28 01:28:27 +00:00
|
|
|
_introCount = 12;
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(11, 82, 0, 105, 120, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
} else if (_introCount == 13 && isGermanCD) {
|
|
|
|
_introCount = 14;
|
2011-12-06 18:23:38 +00:00
|
|
|
setupTimedTemp(11, 82, 0, 105, 120, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
} else if (_introCount == 13 && !isGermanCD) {
|
2011-12-28 16:53:45 +00:00
|
|
|
if (hasSpeech())
|
2011-12-28 01:28:27 +00:00
|
|
|
_introCount = 17;
|
2011-12-06 18:23:38 +00:00
|
|
|
else
|
|
|
|
setupTimedTemp(12, 82, 0, 120, 120, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
} else if (_introCount == 16 && !isGermanCD)
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(13, 82, 0, 135, 120, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
else if (_introCount == 19)
|
2011-12-06 18:23:38 +00:00
|
|
|
setupTimedTemp(14, 82, 36, 160, 100, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
else if (_introCount == (isGermanCD ? 23 : 22))
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(15, 82, 36, 160, 120, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
else if (_introCount == (isGermanCD ? 27 : 25))
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(16, 82, 36, 160, 120, 1);
|
2011-12-28 16:53:45 +00:00
|
|
|
else if (_introCount == (hasSpeech() ? 27 : 28) && !isGermanCD)
|
2011-12-06 18:23:38 +00:00
|
|
|
setupTimedTemp(17, 82, 36, 160, 120, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
else if (_introCount == 30 && isGermanCD)
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(17, 82, 36, 160, 120, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
else if (_introCount == (isGermanCD ? 35 : 31))
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(18, 82, 36, 160, 120, 1);
|
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::textForEnd() {
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_introCount == 20)
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(0, 83, 34, 20, 60, 1);
|
2011-12-28 16:53:45 +00:00
|
|
|
else if (_introCount == (hasSpeech() ? 50 : 65))
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(1, 83, 34, 20, 60, 1);
|
2011-12-28 16:53:45 +00:00
|
|
|
else if (_introCount == (hasSpeech() ? 85 : 110))
|
2011-12-06 10:35:47 +00:00
|
|
|
setupTimedTemp(2, 83, 34, 20, 60, 1);
|
|
|
|
}
|
2011-11-16 19:48:16 +00:00
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::textForMonkHelper(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount) {
|
2012-05-31 04:16:10 +00:00
|
|
|
if (hasSpeech() && _sound->isChannel1Playing())
|
2011-12-28 01:28:27 +00:00
|
|
|
_introCount--;
|
2011-12-06 10:35:47 +00:00
|
|
|
else
|
|
|
|
setupTimedTemp(textIndex, voiceIndex, x, y, countToTimed, timeCount);
|
2011-11-16 17:48:03 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::textForMonk() {
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_introCount == 1)
|
2011-12-06 10:35:47 +00:00
|
|
|
textForMonkHelper(19, 82, 68, 154, 120, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
else if (_introCount == 5)
|
2011-12-06 10:35:47 +00:00
|
|
|
textForMonkHelper(20, 82, 68, 38, 120, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
else if (_introCount == 9)
|
2011-12-06 10:35:47 +00:00
|
|
|
textForMonkHelper(21, 82, 48, 154, 120, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
else if (_introCount == 13)
|
2011-12-06 10:35:47 +00:00
|
|
|
textForMonkHelper(22, 82, 68, 38, 120, 1);
|
2011-12-28 16:53:45 +00:00
|
|
|
else if (_introCount == (hasSpeech() ? 15 : 17))
|
2011-12-06 10:35:47 +00:00
|
|
|
textForMonkHelper(23, 82, 68, 154, 120, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
else if (_introCount == 21)
|
2011-12-06 10:35:47 +00:00
|
|
|
textForMonkHelper(24, 82, 68, 38, 120, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
else if (_introCount == 25)
|
2011-12-06 10:35:47 +00:00
|
|
|
textForMonkHelper(25, 82, 68, 154, 120, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
else if (_introCount == 29)
|
2011-12-06 10:35:47 +00:00
|
|
|
textForMonkHelper(26, 82, 68, 38, 120, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
else if (_introCount == 33)
|
2011-12-06 10:35:47 +00:00
|
|
|
textForMonkHelper(27, 82, 68, 154, 120, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
else if (_introCount == 37)
|
2011-12-06 10:35:47 +00:00
|
|
|
textForMonkHelper(28, 82, 68, 154, 120, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
else if (_introCount == 41)
|
2011-12-06 10:35:47 +00:00
|
|
|
textForMonkHelper(29, 82, 68, 38, 120, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
else if (_introCount == 45)
|
2011-12-06 10:35:47 +00:00
|
|
|
textForMonkHelper(30, 82, 68, 154, 120, 1);
|
2011-12-28 16:53:45 +00:00
|
|
|
else if (_introCount == (hasSpeech() ? 52 : 49))
|
2011-12-06 10:35:47 +00:00
|
|
|
textForMonkHelper(31, 82, 68, 154, 220, 1);
|
2011-12-28 01:28:27 +00:00
|
|
|
else if (_introCount == 53) {
|
2011-12-01 19:43:43 +00:00
|
|
|
fadeScreenDowns();
|
2011-12-28 16:53:45 +00:00
|
|
|
if (hasSpeech()) {
|
2012-05-31 04:16:10 +00:00
|
|
|
_sound->volumeChange(7, 1);
|
2011-11-16 19:48:16 +00:00
|
|
|
}
|
2011-11-16 19:26:52 +00:00
|
|
|
}
|
2011-11-16 17:48:03 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::reelsOnScreen() {
|
2011-11-23 10:13:41 +00:00
|
|
|
reconstruct();
|
2011-12-01 19:43:43 +00:00
|
|
|
updatePeople();
|
|
|
|
watchReel();
|
|
|
|
showRain();
|
|
|
|
useTimedText();
|
2011-11-23 10:13:41 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::reconstruct() {
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_haveDoneObs == 0)
|
2011-11-23 09:23:18 +00:00
|
|
|
return;
|
2011-12-28 12:10:22 +00:00
|
|
|
_vars._newObs = 1;
|
2011-12-01 19:43:43 +00:00
|
|
|
drawFloor();
|
|
|
|
spriteUpdate();
|
|
|
|
printSprites();
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_foreignRelease && (_realLocation == 20))
|
2011-12-01 19:43:43 +00:00
|
|
|
underTextLine();
|
2011-12-28 01:28:27 +00:00
|
|
|
_haveDoneObs = 0;
|
2011-11-23 09:23:18 +00:00
|
|
|
}
|
|
|
|
|
2011-12-03 21:09:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
struct ReelSound {
|
|
|
|
uint8 _sample;
|
|
|
|
uint16 _reelPointer;
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound0[] = {
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound1[] = {
|
|
|
|
{ 15, 257 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound2[] = {
|
|
|
|
{ 12, 5 },
|
|
|
|
{ 13, 21 },
|
|
|
|
{ 15, 35 }, // hitting floor?
|
|
|
|
{ 17, 50 },
|
|
|
|
{ 18, 103 },
|
|
|
|
{ 19, 108 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound6[] = {
|
|
|
|
{ 18, 19 },
|
|
|
|
{ 19, 23 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
static const ReelSound g_roomSound8[] = {
|
2012-09-26 02:17:31 +00:00
|
|
|
|
2011-12-03 21:09:21 +00:00
|
|
|
{ 12, 51 },
|
|
|
|
{ 13, 53 },
|
|
|
|
{ 14, 14 },
|
|
|
|
{ 15, 20 },
|
|
|
|
{ 0, 78 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
static const ReelSound g_roomSound9[] = {
|
|
|
|
|
|
|
|
{ 12, 119 },
|
|
|
|
{ 12, 145 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound10[] = {
|
|
|
|
{ 13, 16 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
2012-09-26 02:17:31 +00:00
|
|
|
|
2011-12-03 21:09:21 +00:00
|
|
|
static const ReelSound g_roomSound11[] = {
|
|
|
|
{ 13, 20 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound12[] = {
|
|
|
|
{ 14, 16 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound13[] = {
|
|
|
|
{ 15, 4 },
|
|
|
|
{ 16, 8 },
|
|
|
|
{ 17, 134 },
|
|
|
|
{ 18, 153 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound14[] = {
|
|
|
|
{ 13, 108 },
|
|
|
|
{ 15, 326 },
|
|
|
|
{ 15, 331 },
|
|
|
|
{ 15, 336 },
|
|
|
|
{ 15, 342 },
|
|
|
|
{ 15, 348 },
|
|
|
|
{ 15, 354 },
|
|
|
|
{ 18, 159 },
|
|
|
|
{ 18, 178 },
|
|
|
|
{ 19+128, 217 },
|
|
|
|
{ 20+64, 228 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound20[] = {
|
|
|
|
{ 13, 20 },
|
|
|
|
{ 13, 21 },
|
|
|
|
{ 15, 34 },
|
|
|
|
{ 13, 52 },
|
|
|
|
{ 13, 55 },
|
|
|
|
{ 25, 57 },
|
|
|
|
{ 21, 73 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound22[] = {
|
|
|
|
{ 13, 196 },
|
|
|
|
{ 13, 234 },
|
|
|
|
{ 13, 156 },
|
|
|
|
{ 14, 129 },
|
|
|
|
{ 13, 124 },
|
|
|
|
{ 15, 162 },
|
|
|
|
{ 15, 200 },
|
|
|
|
{ 15, 239 },
|
|
|
|
{ 17, 99 },
|
|
|
|
{ 12, 52 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound23[] = {
|
|
|
|
{ 15, 56 },
|
|
|
|
{ 16, 64 },
|
|
|
|
{ 19, 22 },
|
|
|
|
{ 20, 33 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound25[] = {
|
|
|
|
{ 20, 11 },
|
|
|
|
{ 20, 15 },
|
|
|
|
{ 15, 28 },
|
|
|
|
{ 13, 80 },
|
|
|
|
{ 21, 82 },
|
|
|
|
{ 19+128, 87 },
|
|
|
|
{ 23+64, 128 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound26[] = {
|
|
|
|
{ 12, 13 },
|
|
|
|
{ 14, 39 },
|
|
|
|
{ 12, 67 },
|
|
|
|
{ 12, 75 },
|
|
|
|
{ 12, 83 },
|
|
|
|
{ 12, 91 },
|
|
|
|
{ 15, 102 }, // was 90, should be mine cart
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
2012-09-26 02:17:31 +00:00
|
|
|
|
2011-12-03 21:09:21 +00:00
|
|
|
static const ReelSound g_roomSound27[] = {
|
|
|
|
{ 22, 36 },
|
|
|
|
{ 13, 125 },
|
|
|
|
{ 18, 88 },
|
|
|
|
{ 15, 107 },
|
|
|
|
{ 14, 127 },
|
|
|
|
{ 14, 154 },
|
|
|
|
{ 19+128, 170 },
|
|
|
|
{ 23+64, 232 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound28[] = {
|
|
|
|
{ 21, 16 },
|
|
|
|
{ 21, 72 },
|
|
|
|
{ 21, 205 },
|
|
|
|
{ 22, 63 }, // 65
|
|
|
|
{ 23+128, 99 },
|
|
|
|
{ 24+64, 158 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound29[] = {
|
|
|
|
{ 13, 21 },
|
|
|
|
{ 14, 24 },
|
|
|
|
{ 19+128, 50 },
|
|
|
|
{ 23+64, 75 },
|
|
|
|
{ 24, 128 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound29_German[] = {
|
|
|
|
{ 13, 21 },
|
|
|
|
{ 14, 24 },
|
|
|
|
{ 19+128, 50 },
|
|
|
|
{ 23+64, 75 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound45[] = {
|
|
|
|
{ 19+64, 46 },
|
|
|
|
{ 16, 167 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound46[] = {
|
|
|
|
{ 16, 19 },
|
|
|
|
{ 14, 36 },
|
|
|
|
{ 16, 50 },
|
|
|
|
{ 14, 65 },
|
|
|
|
{ 16, 81 },
|
|
|
|
{ 14, 96 },
|
|
|
|
{ 16, 114 },
|
|
|
|
{ 14, 129 },
|
|
|
|
{ 16, 147 },
|
|
|
|
{ 14, 162 },
|
|
|
|
{ 16, 177 },
|
|
|
|
{ 14, 191 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound47[] = {
|
|
|
|
{ 13, 48 },
|
|
|
|
{ 14, 41 },
|
|
|
|
{ 15, 78 },
|
|
|
|
{ 16, 92 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound52[] = {
|
|
|
|
{ 16, 115 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound53[] = {
|
|
|
|
{ 21, 103 },
|
|
|
|
{ 20, 199 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound g_roomSound55[] = {
|
|
|
|
{ 17, 53 },
|
|
|
|
{ 17, 54 },
|
|
|
|
{ 17, 55 },
|
|
|
|
{ 17, 56 },
|
|
|
|
{ 17, 57 },
|
|
|
|
{ 17, 58 },
|
|
|
|
{ 17, 59 },
|
|
|
|
{ 17, 61 },
|
|
|
|
{ 17, 63 },
|
|
|
|
{ 17, 64 },
|
|
|
|
{ 17, 65 },
|
|
|
|
{ 255,0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const ReelSound *g_roomByRoom[] = {
|
|
|
|
g_roomSound0,g_roomSound1,g_roomSound2,g_roomSound0,g_roomSound0,
|
|
|
|
g_roomSound0,g_roomSound6,g_roomSound0,g_roomSound8,g_roomSound9,
|
|
|
|
g_roomSound10,g_roomSound11,g_roomSound12,g_roomSound13,g_roomSound14,
|
|
|
|
g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,
|
|
|
|
g_roomSound20,g_roomSound0,g_roomSound22,g_roomSound23,g_roomSound0,
|
|
|
|
g_roomSound25,g_roomSound26,g_roomSound27,g_roomSound28,g_roomSound29,
|
|
|
|
g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,
|
|
|
|
g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,
|
|
|
|
g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,
|
|
|
|
g_roomSound45,g_roomSound46,g_roomSound47,g_roomSound0,g_roomSound0,
|
|
|
|
g_roomSound0,g_roomSound0,g_roomSound52,g_roomSound53,g_roomSound0,
|
|
|
|
g_roomSound55
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::soundOnReels(uint16 reelPointer) {
|
2011-12-28 01:28:27 +00:00
|
|
|
const ReelSound *r = g_roomByRoom[_realLocation];
|
2011-12-03 21:09:21 +00:00
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
if (getLanguage() == Common::DE_DEU && r == g_roomSound29)
|
2011-12-03 21:09:21 +00:00
|
|
|
r = g_roomSound29_German;
|
|
|
|
|
|
|
|
for (; r->_sample != 255; ++r) {
|
2011-12-08 09:22:45 +00:00
|
|
|
if (r->_reelPointer != reelPointer)
|
2011-12-03 21:09:21 +00:00
|
|
|
continue;
|
2011-12-28 01:28:27 +00:00
|
|
|
if (r->_reelPointer == _lastSoundReel)
|
2011-12-03 21:09:21 +00:00
|
|
|
continue;
|
2011-12-28 01:28:27 +00:00
|
|
|
_lastSoundReel = r->_reelPointer;
|
2011-12-03 21:09:21 +00:00
|
|
|
if (r->_sample < 64) {
|
2012-05-31 04:16:10 +00:00
|
|
|
_sound->playChannel1(r->_sample);
|
2011-12-03 21:09:21 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (r->_sample < 128) {
|
2012-05-31 04:16:10 +00:00
|
|
|
_sound->playChannel0(r->_sample & 63, 0);
|
2011-12-03 21:09:21 +00:00
|
|
|
return;
|
|
|
|
}
|
2012-05-31 04:16:10 +00:00
|
|
|
_sound->playChannel0(r->_sample & 63, 255);
|
2011-12-03 21:09:21 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_lastSoundReel != reelPointer)
|
|
|
|
_lastSoundReel = (uint16)-1;
|
2011-12-03 20:43:32 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::clearBeforeLoad() {
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_roomLoaded != 1)
|
2011-12-28 03:47:09 +00:00
|
|
|
return; // noclear
|
2011-12-05 22:46:06 +00:00
|
|
|
|
|
|
|
clearReels();
|
2011-12-07 18:00:05 +00:00
|
|
|
|
|
|
|
//clearRest
|
2011-12-28 10:15:23 +00:00
|
|
|
memset(_mapData, 0, kLengthOfMap);
|
2011-12-27 16:56:37 +00:00
|
|
|
delete[] _backdropBlocks;
|
2011-12-27 18:37:22 +00:00
|
|
|
_backdropBlocks = 0;
|
|
|
|
_setFrames.clear();
|
2011-12-27 21:42:57 +00:00
|
|
|
delete[] _reelList;
|
|
|
|
_reelList = 0;
|
2011-12-27 21:21:43 +00:00
|
|
|
_personText.clear();
|
|
|
|
_setDesc.clear();
|
|
|
|
_blockDesc.clear();
|
|
|
|
_roomDesc.clear();
|
2011-12-27 18:37:22 +00:00
|
|
|
_freeFrames.clear();
|
2011-12-27 21:21:43 +00:00
|
|
|
_freeDesc.clear();
|
2011-12-07 18:00:05 +00:00
|
|
|
|
2011-12-28 01:28:27 +00:00
|
|
|
_roomLoaded = 0;
|
2011-12-05 22:46:06 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::clearReels() {
|
2011-12-27 21:00:27 +00:00
|
|
|
_reel1.clear();
|
|
|
|
_reel2.clear();
|
|
|
|
_reel3.clear();
|
2011-12-05 22:46:06 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::getRidOfReels() {
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_roomLoaded)
|
2011-12-27 21:00:27 +00:00
|
|
|
clearReels();
|
2011-12-05 22:46:06 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::liftNoise(uint8 index) {
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_realLocation == 5 || _realLocation == 21)
|
2012-05-31 04:16:10 +00:00
|
|
|
_sound->playChannel1(13); // hiss noise
|
2011-12-06 00:34:01 +00:00
|
|
|
else
|
2012-05-31 04:16:10 +00:00
|
|
|
_sound->playChannel1(index);
|
2011-12-06 00:34:01 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
void DreamWebEngine::checkForExit(Sprite *sprite) {
|
2011-12-14 16:19:14 +00:00
|
|
|
uint8 flag, flagEx, type, flagX, flagY;
|
2011-12-28 01:28:27 +00:00
|
|
|
checkOne(_ryanX + 12, _ryanY + 12, &flag, &flagEx, &type, &flagX, &flagY);
|
|
|
|
_lastFlag = flag;
|
2011-12-14 16:19:14 +00:00
|
|
|
|
|
|
|
if (flag & 64) {
|
2011-12-28 01:28:27 +00:00
|
|
|
_autoLocation = flagEx;
|
2011-12-14 16:19:14 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(flag & 32)) {
|
|
|
|
if (flag & 4) {
|
|
|
|
// adjust left
|
2011-12-28 01:28:27 +00:00
|
|
|
_lastFlag = 0;
|
|
|
|
_mapX -= 11;
|
2011-12-14 16:19:14 +00:00
|
|
|
sprite->x = 16 * flagEx;
|
2011-12-28 01:28:27 +00:00
|
|
|
_nowInNewRoom = 1;
|
2011-12-14 16:19:14 +00:00
|
|
|
} else if (flag & 2) {
|
|
|
|
// adjust right
|
2011-12-28 01:28:27 +00:00
|
|
|
_mapX += 11;
|
2011-12-14 16:19:14 +00:00
|
|
|
sprite->x = 16 * flagEx - 2;
|
2011-12-28 01:28:27 +00:00
|
|
|
_nowInNewRoom = 1;
|
2011-12-14 16:19:14 +00:00
|
|
|
} else if (flag & 8) {
|
|
|
|
// adjust down
|
2011-12-28 01:28:27 +00:00
|
|
|
_mapY += 10;
|
2011-12-14 16:19:14 +00:00
|
|
|
sprite->y = 16 * flagEx;
|
2011-12-28 01:28:27 +00:00
|
|
|
_nowInNewRoom = 1;
|
2011-12-14 16:19:14 +00:00
|
|
|
} else if (flag & 16) {
|
|
|
|
// adjust up
|
2011-12-28 01:28:27 +00:00
|
|
|
_mapY -= 10;
|
2011-12-14 16:19:14 +00:00
|
|
|
sprite->y = 16 * flagEx;
|
2011-12-28 01:28:27 +00:00
|
|
|
_nowInNewRoom = 1;
|
2011-12-14 16:19:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-12-28 01:28:27 +00:00
|
|
|
if (_realLocation == 2) {
|
2011-12-14 16:19:14 +00:00
|
|
|
// Can't leave Louis' until you found shoes
|
|
|
|
|
|
|
|
int shoeCount = 0;
|
|
|
|
if (isRyanHolding("WETA")) shoeCount++;
|
|
|
|
if (isRyanHolding("WETB")) shoeCount++;
|
|
|
|
|
|
|
|
if (shoeCount < 2) {
|
|
|
|
uint8 text = shoeCount ? 43 : 42;
|
|
|
|
setupTimedUse(text, 80, 10, 68, 64);
|
|
|
|
|
2011-12-28 01:28:27 +00:00
|
|
|
_turnToFace = (_facing + 4) & 7;
|
2011-12-14 16:19:14 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-12-28 12:10:22 +00:00
|
|
|
_vars._needToTravel = 1;
|
2011-12-14 16:19:14 +00:00
|
|
|
}
|
|
|
|
|
2011-12-28 13:07:17 +00:00
|
|
|
} // End of namespace DreamWeb
|
2012-03-03 13:18:05 +00:00
|
|
|
|