2013-05-18 02:40:43 +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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "voyeur/voyeur.h"
|
2013-06-22 15:57:51 +00:00
|
|
|
#include "voyeur/animation.h"
|
2013-05-23 13:13:28 +00:00
|
|
|
#include "voyeur/graphics.h"
|
2013-12-05 03:25:34 +00:00
|
|
|
#include "voyeur/staticres.h"
|
2013-06-13 02:13:52 +00:00
|
|
|
#include "voyeur/utils.h"
|
2013-05-18 02:40:43 +00:00
|
|
|
#include "common/scummsys.h"
|
|
|
|
#include "common/config-manager.h"
|
|
|
|
#include "common/debug-channels.h"
|
|
|
|
|
|
|
|
namespace Voyeur {
|
|
|
|
|
|
|
|
VoyeurEngine *g_vm;
|
|
|
|
|
|
|
|
VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc) : Engine(syst),
|
2013-12-02 13:29:51 +00:00
|
|
|
_gameDescription(gameDesc), _randomSource("Voyeur"), _soundManager(_mixer),
|
2013-06-15 15:39:28 +00:00
|
|
|
_defaultFontInfo(3, 0xff, 0xff, 0, 0, ALIGN_LEFT, 0, Common::Point(), 1, 1,
|
|
|
|
Common::Point(1, 1), 1, 0, 0) {
|
2013-05-18 02:40:43 +00:00
|
|
|
DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
|
2013-05-25 13:58:03 +00:00
|
|
|
_bVoy = NULL;
|
|
|
|
|
|
|
|
initialiseManagers();
|
2013-05-18 02:40:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VoyeurEngine::~VoyeurEngine() {
|
2013-05-25 13:58:03 +00:00
|
|
|
delete _bVoy;
|
2013-05-18 02:40:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Common::String VoyeurEngine::generateSaveName(int slot) {
|
|
|
|
return Common::String::format("%s.%03d", _targetName.c_str(), slot);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if it is currently okay to restore a game
|
|
|
|
*/
|
|
|
|
bool VoyeurEngine::canLoadGameStateCurrently() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if it is currently okay to save the game
|
|
|
|
*/
|
|
|
|
bool VoyeurEngine::canSaveGameStateCurrently() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Load the savegame at the specified slot index
|
|
|
|
*/
|
|
|
|
Common::Error VoyeurEngine::loadGameState(int slot) {
|
|
|
|
return Common::kNoError;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Save the game to the given slot index, and with the given name
|
|
|
|
*/
|
|
|
|
Common::Error VoyeurEngine::saveGameState(int slot, const Common::String &desc) {
|
|
|
|
//TODO
|
|
|
|
return Common::kNoError;
|
|
|
|
}
|
|
|
|
|
|
|
|
Common::Error VoyeurEngine::run() {
|
2013-05-18 03:13:48 +00:00
|
|
|
ESP_Init();
|
2013-05-20 02:45:54 +00:00
|
|
|
globalInitBolt();
|
2013-05-23 13:13:28 +00:00
|
|
|
|
2013-05-25 13:58:03 +00:00
|
|
|
_eventsManager.resetMouse();
|
2013-12-05 03:25:34 +00:00
|
|
|
if (doHeadTitle()) {
|
|
|
|
if (_game._iForceDeath >= 1 && _game._iForceDeath <= 4)
|
|
|
|
_voy._eCursorOff[58] |= 0x80;
|
|
|
|
|
|
|
|
_game.playStamp();
|
|
|
|
}
|
2013-05-20 02:45:54 +00:00
|
|
|
|
|
|
|
//doHeadTitle();
|
|
|
|
|
2013-05-18 02:40:43 +00:00
|
|
|
return Common::kNoError;
|
|
|
|
}
|
|
|
|
|
2013-05-20 02:45:54 +00:00
|
|
|
|
2013-05-18 02:40:43 +00:00
|
|
|
int VoyeurEngine::getRandomNumber(int maxNumber) {
|
|
|
|
return _randomSource.getRandomNumber(maxNumber);
|
|
|
|
}
|
|
|
|
|
2013-05-20 02:45:54 +00:00
|
|
|
void VoyeurEngine::initialiseManagers() {
|
2013-06-02 02:14:59 +00:00
|
|
|
_debugger.setVm(this);
|
2013-05-25 13:58:03 +00:00
|
|
|
_eventsManager.setVm(this);
|
2013-05-26 00:51:53 +00:00
|
|
|
_filesManager.setVm(this);
|
2013-06-23 18:55:27 +00:00
|
|
|
_game.setVm(this);
|
2013-05-25 01:54:40 +00:00
|
|
|
_graphicsManager.setVm(this);
|
2013-06-13 02:13:52 +00:00
|
|
|
_soundManager.setVm(this);
|
2013-06-15 15:39:28 +00:00
|
|
|
|
2013-05-20 02:45:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void VoyeurEngine::ESP_Init() {
|
|
|
|
}
|
|
|
|
|
|
|
|
void VoyeurEngine::globalInitBolt() {
|
2013-05-23 13:13:28 +00:00
|
|
|
initBolt();
|
|
|
|
|
2013-05-25 13:58:03 +00:00
|
|
|
_filesManager.openBoltLib("bvoy.blt", _bVoy);
|
|
|
|
_bVoy->getBoltGroup(0x10000);
|
|
|
|
_bVoy->getBoltGroup(0x10100);
|
2013-06-15 15:39:28 +00:00
|
|
|
|
|
|
|
_graphicsManager._fontPtr = &_defaultFontInfo;
|
|
|
|
_graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x101)._fontResource;
|
|
|
|
assert(_graphicsManager._fontPtr->_curFont);
|
2013-05-18 03:13:48 +00:00
|
|
|
|
2013-05-22 12:29:24 +00:00
|
|
|
// Setup default flags
|
|
|
|
Common::fill((byte *)&_voy, (byte *)&_voy + sizeof(SVoy), 0);
|
|
|
|
_voy._eCursorOff[0x74 / 2] = 1;
|
|
|
|
_voy._eCursorOff[0x68 / 2] = 0;
|
2013-06-13 02:13:52 +00:00
|
|
|
_voy._eventTable[998]._data = NULL; // Original set 63h:63h
|
2013-05-22 12:29:24 +00:00
|
|
|
_voy._evidence[19] = 0;
|
|
|
|
_voy._evidence[17] = 0;
|
|
|
|
_voy._evidence[18] = 9999;
|
|
|
|
|
2013-05-25 13:58:03 +00:00
|
|
|
_voy._curICF0 = _graphicsManager._palFlag ? 0xFFFFA5E0 : 0x5F90;
|
2013-06-08 14:31:37 +00:00
|
|
|
_eventsManager.addFadeInt();
|
2013-05-18 03:13:48 +00:00
|
|
|
}
|
|
|
|
|
2013-05-23 13:13:28 +00:00
|
|
|
void VoyeurEngine::initBolt() {
|
|
|
|
vInitInterrupts();
|
|
|
|
_graphicsManager.sInitGraphics();
|
2013-06-08 14:31:37 +00:00
|
|
|
_eventsManager.vInitColor();
|
2013-05-23 13:13:28 +00:00
|
|
|
initInput();
|
|
|
|
}
|
|
|
|
|
|
|
|
void VoyeurEngine::vInitInterrupts() {
|
2013-06-06 01:28:51 +00:00
|
|
|
_eventsManager._intPtr._palette = &_graphicsManager._VGAColors[0];
|
2013-05-23 13:13:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void VoyeurEngine::initInput() {
|
|
|
|
}
|
|
|
|
|
2013-06-23 18:55:27 +00:00
|
|
|
bool VoyeurEngine::doHeadTitle() {
|
2013-06-01 16:35:50 +00:00
|
|
|
// char dest[144];
|
2013-05-25 13:58:03 +00:00
|
|
|
|
|
|
|
_eventsManager.startMainClockInt();
|
2013-06-06 01:28:51 +00:00
|
|
|
|
|
|
|
// Show starting screen
|
2013-06-11 01:29:12 +00:00
|
|
|
if (_bVoy->getBoltGroup(0x10500))
|
|
|
|
showConversionScreen();
|
|
|
|
if (shouldQuit())
|
2013-06-23 18:55:27 +00:00
|
|
|
return false;
|
2013-06-11 01:29:12 +00:00
|
|
|
|
2013-06-22 15:57:51 +00:00
|
|
|
if (ConfMan.getBool("copy_protection")) {
|
|
|
|
bool result = doLock();
|
|
|
|
if (!result || shouldQuit())
|
2013-06-23 18:55:27 +00:00
|
|
|
return false;
|
2013-06-22 15:57:51 +00:00
|
|
|
}
|
2013-06-11 01:29:12 +00:00
|
|
|
|
2013-12-03 03:09:21 +00:00
|
|
|
// showTitleScreen();
|
2013-06-23 18:55:27 +00:00
|
|
|
|
|
|
|
// Opening
|
|
|
|
if (!_voy._incriminate) {
|
|
|
|
doOpening();
|
|
|
|
_game.doTransitionCard("Saturday Afternoon", "Player's Apartment");
|
|
|
|
_eventsManager.delay(90);
|
|
|
|
} else {
|
|
|
|
_voy._incriminate = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_voy._eCursorOff[58] & 0x80) {
|
2013-12-05 03:25:34 +00:00
|
|
|
// TODO: Check when these are called, and the two different loops.
|
|
|
|
// Also, comptuerNu isn't an array in IDB?
|
|
|
|
/*
|
2013-06-23 18:55:27 +00:00
|
|
|
if (_voy._evidence[19] == 0) {
|
2013-12-05 03:25:34 +00:00
|
|
|
Common::copy(&COMPUTER_DEFAULTS[0], &COMPUTER_DEFAULTS[9 * 8], &_voy._computerNum[0]);
|
|
|
|
_voy._evidence[19] = 9;
|
2013-06-23 18:55:27 +00:00
|
|
|
} else {
|
2013-12-05 03:25:34 +00:00
|
|
|
error("_computerNum loaded with uninitialized list here");
|
2013-06-23 18:55:27 +00:00
|
|
|
}
|
2013-12-05 03:25:34 +00:00
|
|
|
*/
|
2013-06-23 18:55:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_voy._eCursorOff[55] = 140;
|
|
|
|
return true;
|
2013-06-11 01:29:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void VoyeurEngine::showConversionScreen() {
|
2013-06-15 15:39:28 +00:00
|
|
|
_graphicsManager._backgroundPage = _bVoy->boltEntry(0x502)._picResource;
|
2013-06-11 01:29:12 +00:00
|
|
|
(*_graphicsManager._vPort)->setupViewPort();
|
2013-06-18 02:41:58 +00:00
|
|
|
(*_graphicsManager._vPort)->_flags |= DISPFLAG_8;
|
2013-06-11 01:29:12 +00:00
|
|
|
|
|
|
|
_graphicsManager.flipPage();
|
|
|
|
_eventsManager.sWaitFlip();
|
|
|
|
|
|
|
|
// Immediate palette load to show the initial screen
|
2013-06-15 15:39:28 +00:00
|
|
|
CMapResource *cMap = _bVoy->getCMapResource(0x503);
|
2013-06-11 01:29:12 +00:00
|
|
|
assert(cMap);
|
|
|
|
cMap->_steps = 0;
|
|
|
|
cMap->startFade();
|
|
|
|
|
|
|
|
// Wait briefly
|
|
|
|
_eventsManager.delay(150);
|
|
|
|
if (shouldQuit())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Fade out the screen
|
|
|
|
cMap = _bVoy->getCMapResource(0x5040000);
|
|
|
|
cMap->_steps = 30;
|
|
|
|
cMap->startFade();
|
|
|
|
if (shouldQuit())
|
|
|
|
return;
|
|
|
|
|
2013-06-18 02:41:58 +00:00
|
|
|
(*_graphicsManager._vPort)->_flags |= DISPFLAG_8;
|
2013-06-11 01:29:12 +00:00
|
|
|
_graphicsManager.flipPage();
|
|
|
|
_eventsManager.sWaitFlip();
|
|
|
|
|
|
|
|
while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
|
|
|
|
_eventsManager.delay(1);
|
|
|
|
|
|
|
|
_graphicsManager.screenReset();
|
|
|
|
_bVoy->freeBoltGroup(0x10500);
|
2013-06-22 15:57:51 +00:00
|
|
|
|
|
|
|
|
2013-06-11 01:29:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool VoyeurEngine::doLock() {
|
2013-06-13 02:13:52 +00:00
|
|
|
bool result = true;
|
|
|
|
bool flag = false;
|
|
|
|
int buttonVocSize, wrongVocSize;
|
|
|
|
byte *buttonVoc = _filesManager.fload("button.voc", &buttonVocSize);
|
|
|
|
byte *wrongVoc = _filesManager.fload("wrong.voc", &wrongVocSize);
|
|
|
|
LockClass lock;
|
2013-06-20 12:38:38 +00:00
|
|
|
PictureResource *cursorPic;
|
2013-06-13 02:13:52 +00:00
|
|
|
byte *keyData;
|
|
|
|
int keyCount;
|
|
|
|
int key;
|
2013-06-11 01:29:12 +00:00
|
|
|
|
|
|
|
if (_bVoy->getBoltGroup(0x10700)) {
|
2013-06-13 02:13:52 +00:00
|
|
|
lock.getSysDate();
|
|
|
|
lock.getThePassword();
|
|
|
|
|
|
|
|
_voy._eventTable[999]._type = lock.fieldC;
|
|
|
|
_voy._eventTable[999]._data = _bVoy->memberAddr(0x704);
|
|
|
|
|
|
|
|
Common::String password = lock._password;
|
2013-06-20 12:38:38 +00:00
|
|
|
cursorPic = _bVoy->getPictureResource(0x702);
|
|
|
|
assert(cursorPic);
|
2013-06-13 02:13:52 +00:00
|
|
|
|
|
|
|
// Get the mappings of keys on the keypad
|
|
|
|
keyData = _bVoy->memberAddr(0x705);
|
|
|
|
keyCount = READ_LE_UINT16(keyData);
|
|
|
|
|
|
|
|
_graphicsManager._backColors = _bVoy->getCMapResource(0x7010000);
|
|
|
|
_graphicsManager._backgroundPage = _bVoy->getPictureResource(0x700);
|
|
|
|
(*_graphicsManager._vPort)->setupViewPort();
|
|
|
|
|
|
|
|
_graphicsManager._backColors->startFade();
|
2013-06-18 02:41:58 +00:00
|
|
|
(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
|
2013-06-13 02:13:52 +00:00
|
|
|
_graphicsManager.flipPage();
|
|
|
|
_eventsManager.sWaitFlip();
|
2013-06-24 12:51:42 +00:00
|
|
|
|
2013-06-13 02:13:52 +00:00
|
|
|
while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
|
|
|
|
_eventsManager.delay(1);
|
|
|
|
|
2013-06-21 04:18:19 +00:00
|
|
|
_eventsManager.setCursorColor(127, 0);
|
2013-06-21 02:08:01 +00:00
|
|
|
_graphicsManager.setColor(1, 64, 64, 64);
|
|
|
|
_graphicsManager.setColor(2, 96, 96, 96);
|
|
|
|
_graphicsManager.setColor(3, 160, 160, 160);
|
|
|
|
_graphicsManager.setColor(4, 224, 224, 224);
|
2013-06-13 02:13:52 +00:00
|
|
|
|
2013-06-21 04:18:19 +00:00
|
|
|
// Set up the cursor
|
|
|
|
_eventsManager.setCursor(cursorPic);
|
|
|
|
_eventsManager.mouseOn();
|
|
|
|
|
2013-06-15 15:39:28 +00:00
|
|
|
_eventsManager._intPtr. field38 = 1;
|
2013-06-13 02:13:52 +00:00
|
|
|
_eventsManager._intPtr._hasPalette = true;
|
|
|
|
|
2013-06-15 15:39:28 +00:00
|
|
|
_graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x708)._fontResource;
|
2013-06-13 02:13:52 +00:00
|
|
|
_graphicsManager._fontPtr->_fontSaveBack = 0;
|
|
|
|
_graphicsManager._fontPtr->_fontFlags = 0;
|
|
|
|
|
|
|
|
Common::String dateString = lock.getDateString();
|
2013-06-21 02:08:01 +00:00
|
|
|
Common::String displayString = Common::String::format("Last Play %s", dateString.c_str());
|
2013-06-13 02:13:52 +00:00
|
|
|
|
2013-06-21 02:08:01 +00:00
|
|
|
bool firstLoop = true;
|
2013-06-13 02:13:52 +00:00
|
|
|
bool breakFlag = false;
|
|
|
|
while (!breakFlag && !shouldQuit()) {
|
|
|
|
(*_graphicsManager._vPort)->setupViewPort();
|
2013-06-18 02:41:58 +00:00
|
|
|
(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
|
2013-06-13 02:13:52 +00:00
|
|
|
_graphicsManager.flipPage();
|
|
|
|
_eventsManager.sWaitFlip();
|
|
|
|
|
|
|
|
// Display the last play time
|
|
|
|
_graphicsManager._fontPtr->_pos = Common::Point(0, 97);
|
2013-06-15 02:01:59 +00:00
|
|
|
_graphicsManager._fontPtr->_justify = ALIGN_CENTRE;
|
2013-06-13 02:13:52 +00:00
|
|
|
_graphicsManager._fontPtr->_justifyWidth = 384;
|
|
|
|
_graphicsManager._fontPtr->_justifyHeight = 97;
|
|
|
|
|
2013-06-21 02:08:01 +00:00
|
|
|
(*_graphicsManager._vPort)->drawText(displayString);
|
2013-06-18 02:41:58 +00:00
|
|
|
(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
|
2013-06-13 02:13:52 +00:00
|
|
|
_graphicsManager.flipPage();
|
|
|
|
_eventsManager.sWaitFlip();
|
|
|
|
|
2013-06-21 02:08:01 +00:00
|
|
|
if (firstLoop) {
|
|
|
|
firstLoop = false;
|
|
|
|
displayString = "";
|
|
|
|
}
|
|
|
|
|
2013-06-13 02:13:52 +00:00
|
|
|
// Loop for getting key presses
|
|
|
|
do {
|
|
|
|
do {
|
|
|
|
// Scan through the list of key rects to check if a keypad key is highlighted
|
|
|
|
key = -1;
|
2013-06-21 04:18:19 +00:00
|
|
|
Common::Point mousePos = _eventsManager.getMousePos() +
|
|
|
|
Common::Point(30, 20);
|
2013-06-13 02:13:52 +00:00
|
|
|
|
|
|
|
for (int keyIndex = 0; keyIndex < keyCount; ++keyIndex) {
|
|
|
|
int x1 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 1) << 1));
|
|
|
|
int x2 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 3) << 1));
|
|
|
|
int y1 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 2) << 1));
|
2013-06-15 02:01:59 +00:00
|
|
|
int y2 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 4) << 1));
|
2013-06-13 02:13:52 +00:00
|
|
|
|
|
|
|
if (mousePos.x >= x1 && mousePos.x <= x2 && mousePos.y >= y1 && mousePos.y <= y2) {
|
|
|
|
key = keyIndex;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-21 04:18:19 +00:00
|
|
|
_eventsManager.setCursorColor(127, (key == -1) ? 0 : 1);
|
2013-06-13 02:13:52 +00:00
|
|
|
_eventsManager._intPtr.field38 = 1;
|
|
|
|
_eventsManager._intPtr._hasPalette = true;
|
|
|
|
|
|
|
|
_eventsManager.delay(1);
|
|
|
|
} while (!shouldQuit() && !_voy._incriminate);
|
2013-06-21 01:42:48 +00:00
|
|
|
_voy._incriminate = false;
|
2013-06-13 02:13:52 +00:00
|
|
|
} while (!shouldQuit() && key == -1);
|
|
|
|
|
|
|
|
_soundManager.abortVOCMap();
|
|
|
|
_soundManager.playVOCMap(buttonVoc, buttonVocSize);
|
|
|
|
|
|
|
|
while (_soundManager.vocMapStatus()) {
|
|
|
|
if (shouldQuit())
|
|
|
|
break;
|
|
|
|
|
|
|
|
_soundManager.continueVocMap();
|
|
|
|
_eventsManager.delay(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Process the key
|
|
|
|
if (key < 10) {
|
2013-06-21 02:08:01 +00:00
|
|
|
// Numeric key
|
|
|
|
if (displayString.size() < 10) {
|
|
|
|
displayString += '0' + key;
|
2013-06-13 02:13:52 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else if (key == 10) {
|
2013-06-21 02:08:01 +00:00
|
|
|
// Accept key
|
2013-06-13 02:13:52 +00:00
|
|
|
if (!flag) {
|
2013-06-21 02:08:01 +00:00
|
|
|
if ((password.empty() && displayString.empty()) || (password == displayString)) {
|
2013-06-13 02:13:52 +00:00
|
|
|
breakFlag = true;
|
|
|
|
result = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
2013-06-21 02:08:01 +00:00
|
|
|
if (displayString.size() > 0) {
|
|
|
|
result = true;
|
2013-06-13 02:13:52 +00:00
|
|
|
breakFlag = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (key == 11) {
|
2013-06-21 02:08:01 +00:00
|
|
|
// New code
|
|
|
|
if ((password.empty() && displayString.empty()) || (password != displayString)) {
|
2013-06-13 02:13:52 +00:00
|
|
|
(*_graphicsManager._vPort)->setupViewPort();
|
|
|
|
flag = true;
|
2013-06-21 02:08:01 +00:00
|
|
|
displayString = "";
|
2013-06-13 02:13:52 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else if (key == 12) {
|
2013-06-21 02:08:01 +00:00
|
|
|
// Exit keyword
|
2013-06-13 02:13:52 +00:00
|
|
|
breakFlag = true;
|
|
|
|
result = false;
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
_soundManager.playVOCMap(wrongVoc, wrongVocSize);
|
|
|
|
}
|
|
|
|
|
|
|
|
_graphicsManager.fillPic(*_graphicsManager._vPort);
|
2013-06-18 02:41:58 +00:00
|
|
|
(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
|
2013-06-13 02:13:52 +00:00
|
|
|
_graphicsManager.flipPage();
|
|
|
|
_eventsManager.sWaitFlip();
|
|
|
|
_graphicsManager.resetPalette();
|
|
|
|
|
|
|
|
if (flag && result)
|
2013-06-21 02:08:01 +00:00
|
|
|
lock._password = displayString;
|
2013-06-13 02:13:52 +00:00
|
|
|
lock.saveThePassword();
|
|
|
|
|
|
|
|
_voy._eventTable[999]._data = NULL;
|
|
|
|
_bVoy->freeBoltGroup(0x10700);
|
2013-05-25 13:58:03 +00:00
|
|
|
}
|
2013-06-11 01:29:12 +00:00
|
|
|
|
2013-06-22 15:57:51 +00:00
|
|
|
_eventsManager.mouseOff();
|
|
|
|
|
2013-06-11 01:29:12 +00:00
|
|
|
delete[] buttonVoc;
|
|
|
|
delete[] wrongVoc;
|
|
|
|
|
|
|
|
return result;
|
2013-05-25 13:58:03 +00:00
|
|
|
}
|
|
|
|
|
2013-06-23 01:09:20 +00:00
|
|
|
void VoyeurEngine::showTitleScreen() {
|
|
|
|
if (_bVoy->getBoltGroup(0x10500)) {
|
|
|
|
_graphicsManager._backgroundPage = _bVoy->getPictureResource(0x500);
|
|
|
|
|
|
|
|
(*_graphicsManager._vPort)->setupViewPort();
|
|
|
|
(*_graphicsManager._vPort)->_flags |= DISPFLAG_8;
|
|
|
|
_graphicsManager.flipPage();
|
|
|
|
_eventsManager.sWaitFlip();
|
|
|
|
|
|
|
|
// Immediate palette load to show the initial screen
|
|
|
|
CMapResource *cMap = _bVoy->getCMapResource(0x501);
|
|
|
|
assert(cMap);
|
|
|
|
cMap->_steps = 60;
|
|
|
|
cMap->startFade();
|
|
|
|
|
|
|
|
// Wait briefly
|
|
|
|
_eventsManager.delay(200);
|
|
|
|
if (shouldQuit())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Fade out the screen
|
|
|
|
cMap = _bVoy->getCMapResource(0x504);
|
|
|
|
cMap->_steps = 30;
|
|
|
|
cMap->startFade();
|
|
|
|
|
|
|
|
(*_graphicsManager._vPort)->_flags |= DISPFLAG_8;
|
|
|
|
_graphicsManager.flipPage();
|
|
|
|
_eventsManager.sWaitFlip();
|
|
|
|
|
|
|
|
while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
|
|
|
|
_eventsManager.delay(1);
|
|
|
|
if (shouldQuit())
|
|
|
|
return;
|
|
|
|
|
|
|
|
_graphicsManager.screenReset();
|
|
|
|
_eventsManager.delay(200);
|
|
|
|
|
2013-06-23 18:55:27 +00:00
|
|
|
// Voyeur title
|
2013-06-23 01:09:20 +00:00
|
|
|
playRL2Video("a1100100.rl2");
|
|
|
|
_graphicsManager.screenReset();
|
2013-06-23 15:31:54 +00:00
|
|
|
|
|
|
|
_bVoy->freeBoltGroup(0x10500);
|
2013-06-23 01:09:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-23 18:55:27 +00:00
|
|
|
void VoyeurEngine::doOpening() {
|
2013-06-24 12:51:42 +00:00
|
|
|
_graphicsManager.screenReset();
|
|
|
|
|
|
|
|
if (!_bVoy->getBoltGroup(0x10200))
|
|
|
|
return;
|
2013-06-23 18:55:27 +00:00
|
|
|
|
2013-06-24 12:51:42 +00:00
|
|
|
byte *frameTable = _bVoy->memberAddr(0x215);
|
|
|
|
byte *xyTable = _bVoy->memberAddr(0x216);
|
|
|
|
byte *whTable = _bVoy->memberAddr(0x217);
|
|
|
|
int frmaeIndex = 0;
|
|
|
|
int creditShow = 1;
|
|
|
|
_game._v2A098 = 1;
|
|
|
|
_voy._eCursorOff[52] = 0;
|
|
|
|
_voy._RTVNum = 0;
|
|
|
|
_voy._eCursorOff[50] = _voy._RTVNum;
|
|
|
|
_game._v2A0A6 = 4;
|
|
|
|
_game._v2A0A4 = 0;
|
|
|
|
_voy._eCursorOff[58] = 16;
|
|
|
|
_game._v2A09A = -1;
|
|
|
|
_game.addVideoEventStart();
|
|
|
|
_voy._eCursorOff[58] &= ~1;
|
|
|
|
|
|
|
|
for (int i = 0; i < 256; ++i)
|
|
|
|
_graphicsManager.setColor(i, 8, 8, 8);
|
|
|
|
|
|
|
|
_eventsManager._intPtr.field38 = 1;
|
|
|
|
_eventsManager._intPtr._hasPalette = true;
|
|
|
|
(*_graphicsManager._vPort)->setupViewPort();
|
|
|
|
(*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
|
|
|
|
_graphicsManager.flipPage();
|
|
|
|
_eventsManager.sWaitFlip();
|
|
|
|
|
|
|
|
::Video::RL2Decoder decoder;
|
|
|
|
decoder.loadFile("a2300100.rl2");
|
|
|
|
decoder.start();
|
|
|
|
|
|
|
|
while (!shouldQuit() && !decoder.endOfVideo() && !_voy._incriminate) {
|
|
|
|
if (decoder.hasDirtyPalette()) {
|
|
|
|
const byte *palette = decoder.getPalette();
|
|
|
|
_graphicsManager.setPalette(palette, 0, 256);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (decoder.needsUpdate()) {
|
|
|
|
const Graphics::Surface *frame = decoder.decodeNextFrame();
|
|
|
|
|
2013-12-01 01:44:23 +00:00
|
|
|
Common::copy((byte *)frame->getPixels(), (byte *)frame->getPixels() + 320 * 200,
|
|
|
|
(byte *)_graphicsManager._screenSurface.getPixels());
|
2013-06-24 12:51:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_eventsManager.pollEvents();
|
|
|
|
g_system->delayMillis(10);
|
|
|
|
}
|
2013-06-23 18:55:27 +00:00
|
|
|
}
|
|
|
|
|
2013-06-22 15:57:51 +00:00
|
|
|
void VoyeurEngine::playRL2Video(const Common::String &filename) {
|
|
|
|
::Video::RL2Decoder decoder;
|
|
|
|
decoder.loadFile(filename);
|
|
|
|
decoder.start();
|
|
|
|
|
|
|
|
while (!shouldQuit() && !decoder.endOfVideo() && !_voy._incriminate) {
|
|
|
|
if (decoder.hasDirtyPalette()) {
|
|
|
|
const byte *palette = decoder.getPalette();
|
|
|
|
_graphicsManager.setPalette(palette, 0, 256);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (decoder.needsUpdate()) {
|
|
|
|
const Graphics::Surface *frame = decoder.decodeNextFrame();
|
|
|
|
|
2013-12-01 01:44:23 +00:00
|
|
|
Common::copy((byte *)frame->getPixels(), (byte *)frame->getPixels() + 320 * 200,
|
|
|
|
(byte *)_graphicsManager._screenSurface.getPixels());
|
2013-06-22 15:57:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_eventsManager.pollEvents();
|
|
|
|
g_system->delayMillis(10);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-18 02:40:43 +00:00
|
|
|
} // End of namespace Voyeur
|