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.
|
2014-02-18 01:43:50 +00:00
|
|
|
*
|
2013-05-18 02:40:43 +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:43:50 +00:00
|
|
|
*
|
2013-05-18 02:40:43 +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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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-05-18 02:40:43 +00:00
|
|
|
#include "common/scummsys.h"
|
|
|
|
#include "common/config-manager.h"
|
|
|
|
#include "common/debug-channels.h"
|
2014-01-09 04:31:34 +00:00
|
|
|
#include "graphics/palette.h"
|
|
|
|
#include "graphics/scaler.h"
|
|
|
|
#include "graphics/thumbnail.h"
|
2013-05-18 02:40:43 +00:00
|
|
|
|
|
|
|
namespace Voyeur {
|
|
|
|
|
|
|
|
VoyeurEngine *g_vm;
|
|
|
|
|
|
|
|
VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc) : Engine(syst),
|
2014-02-27 06:12:10 +00:00
|
|
|
_gameDescription(gameDesc), _randomSource("Voyeur"),
|
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) {
|
2014-02-26 21:54:13 +00:00
|
|
|
_debugger = nullptr;
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager = nullptr;
|
2014-02-27 07:09:57 +00:00
|
|
|
_filesManager = nullptr;
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager = nullptr;
|
2014-02-27 06:12:10 +00:00
|
|
|
_soundManager = nullptr;
|
|
|
|
_voy = nullptr;
|
2013-05-25 13:58:03 +00:00
|
|
|
_bVoy = NULL;
|
2014-02-20 20:31:19 +00:00
|
|
|
|
|
|
|
_iForceDeath = ConfMan.getInt("boot_param");
|
|
|
|
if (_iForceDeath < 1 || _iForceDeath > 4)
|
|
|
|
_iForceDeath = -1;
|
|
|
|
|
2013-12-08 15:40:26 +00:00
|
|
|
_controlPtr = NULL;
|
2014-01-05 19:41:09 +00:00
|
|
|
_stampFlags = 0;
|
2014-01-05 19:54:55 +00:00
|
|
|
_playStampGroupId = _currentVocId = 0;
|
2014-01-31 03:10:59 +00:00
|
|
|
_audioVideoId = -1;
|
2013-12-19 02:26:26 +00:00
|
|
|
_checkTransitionId = -1;
|
|
|
|
_gameHour = 0;
|
|
|
|
_gameMinute = 0;
|
2013-12-19 14:25:40 +00:00
|
|
|
_flashTimeVal = 0;
|
|
|
|
_flashTimeFlag = false;
|
|
|
|
_timeBarVal = -1;
|
2013-12-21 03:51:31 +00:00
|
|
|
_checkPhoneVal = 0;
|
2014-01-05 21:47:03 +00:00
|
|
|
_voyeurArea = AREA_NONE;
|
2014-01-09 04:31:34 +00:00
|
|
|
_loadGameSlot = -1;
|
2013-05-25 13:58:03 +00:00
|
|
|
|
2014-02-03 05:07:29 +00:00
|
|
|
DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts");
|
|
|
|
|
2014-02-27 07:09:57 +00:00
|
|
|
_debugger = new Debugger(this);
|
|
|
|
_eventsManager = new EventsManager(this);
|
|
|
|
_filesManager = new FilesManager(this);
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager = new GraphicsManager(this);
|
2014-02-27 07:09:57 +00:00
|
|
|
_soundManager = new SoundManager(this, _mixer);
|
|
|
|
_voy = new SVoy(this);
|
|
|
|
}
|
|
|
|
|
2013-05-18 02:40:43 +00:00
|
|
|
VoyeurEngine::~VoyeurEngine() {
|
2013-05-25 13:58:03 +00:00
|
|
|
delete _bVoy;
|
2014-02-26 21:44:30 +00:00
|
|
|
delete _voy;
|
2014-02-27 06:12:10 +00:00
|
|
|
delete _soundManager;
|
2014-02-27 07:15:29 +00:00
|
|
|
delete _graphicsManager;
|
2014-02-27 07:09:57 +00:00
|
|
|
delete _filesManager;
|
2014-02-27 07:15:29 +00:00
|
|
|
delete _eventsManager;
|
2014-02-26 21:54:13 +00:00
|
|
|
delete _debugger;
|
2013-05-18 02:40:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
2014-02-05 14:00:43 +00:00
|
|
|
// The original allows the victim to be explicitly specified via the command line.
|
2014-02-20 22:34:56 +00:00
|
|
|
// This is possible in ScummVM by using a boot parameter.
|
2014-02-05 14:00:43 +00:00
|
|
|
if (_iForceDeath >= 1 && _iForceDeath <= 4)
|
2014-02-26 21:44:30 +00:00
|
|
|
_voy->_eventFlags |= EVTFLAG_VICTIM_PRESET;
|
2014-02-05 14:00:43 +00:00
|
|
|
|
2013-12-05 03:25:34 +00:00
|
|
|
if (doHeadTitle()) {
|
2013-12-06 02:49:12 +00:00
|
|
|
playStamp();
|
2014-01-01 02:08:00 +00:00
|
|
|
if (!shouldQuit())
|
|
|
|
doTailTitle();
|
2013-12-05 03:25:34 +00:00
|
|
|
}
|
2013-05-20 02:45:54 +00:00
|
|
|
|
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::ESP_Init() {
|
2013-12-14 16:39:15 +00:00
|
|
|
ThreadResource::init();
|
2014-01-09 04:31:34 +00:00
|
|
|
|
|
|
|
if (ConfMan.hasKey("save_slot"))
|
|
|
|
_loadGameSlot = ConfMan.getInt("save_slot");
|
2013-05-20 02:45:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void VoyeurEngine::globalInitBolt() {
|
2013-05-23 13:13:28 +00:00
|
|
|
initBolt();
|
|
|
|
|
2014-02-27 07:09:57 +00:00
|
|
|
_filesManager->openBoltLib("bvoy.blt", _bVoy);
|
2013-12-15 20:08:25 +00:00
|
|
|
_bVoy->getBoltGroup(0x000);
|
|
|
|
_bVoy->getBoltGroup(0x100);
|
2013-06-15 15:39:28 +00:00
|
|
|
|
2014-02-27 07:15:29 +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
|
2014-02-26 21:44:30 +00:00
|
|
|
_voy->_viewBounds = nullptr;
|
2014-02-12 06:36:37 +00:00
|
|
|
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->addFadeInt();
|
2013-05-18 03:13:48 +00:00
|
|
|
}
|
|
|
|
|
2013-05-23 13:13:28 +00:00
|
|
|
void VoyeurEngine::initBolt() {
|
|
|
|
vInitInterrupts();
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->sInitGraphics();
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->vInitColor();
|
2013-05-23 13:13:28 +00:00
|
|
|
initInput();
|
|
|
|
}
|
|
|
|
|
|
|
|
void VoyeurEngine::vInitInterrupts() {
|
2014-02-27 07:15:29 +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];
|
2014-01-06 01:56:14 +00:00
|
|
|
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->startMainClockInt();
|
2014-01-09 04:31:34 +00:00
|
|
|
|
|
|
|
if (_loadGameSlot == -1) {
|
|
|
|
// Show starting screen
|
|
|
|
if (_bVoy->getBoltGroup(0x500)) {
|
|
|
|
showConversionScreen();
|
|
|
|
_bVoy->freeBoltGroup(0x500);
|
2014-01-06 01:56:14 +00:00
|
|
|
|
2014-01-09 04:31:34 +00:00
|
|
|
if (shouldQuit())
|
|
|
|
return false;
|
|
|
|
}
|
2013-06-11 01:29:12 +00:00
|
|
|
|
2014-01-09 04:31:34 +00:00
|
|
|
if (ConfMan.getBool("copy_protection")) {
|
|
|
|
// Display lock screen
|
|
|
|
bool result = doLock();
|
|
|
|
if (!result || shouldQuit())
|
|
|
|
return false;
|
|
|
|
}
|
2013-06-11 01:29:12 +00:00
|
|
|
|
2014-01-09 04:31:34 +00:00
|
|
|
// Show the title screen
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->getMouseInfo();
|
2014-01-09 04:31:34 +00:00
|
|
|
showTitleScreen();
|
|
|
|
if (shouldQuit())
|
|
|
|
return false;
|
2013-06-23 18:55:27 +00:00
|
|
|
|
2014-01-09 04:31:34 +00:00
|
|
|
// Opening
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->getMouseInfo();
|
2014-02-05 13:41:33 +00:00
|
|
|
doOpening();
|
|
|
|
if (shouldQuit())
|
|
|
|
return false;
|
|
|
|
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->getMouseInfo();
|
2014-02-05 13:41:33 +00:00
|
|
|
doTransitionCard("Saturday Afternoon", "Player's Apartment");
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->delayClick(90);
|
2014-02-04 03:45:52 +00:00
|
|
|
|
2014-02-26 21:44:30 +00:00
|
|
|
if (_voy->_eventFlags & EVTFLAG_VICTIM_PRESET) {
|
2014-02-04 03:45:52 +00:00
|
|
|
// Preset victim turned on, so add a default set of incriminating videos
|
2014-02-26 21:44:30 +00:00
|
|
|
_voy->addEvent(18, 1, EVTYPE_VIDEO, 33, 0, 998, -1);
|
|
|
|
_voy->addEvent(18, 2, EVTYPE_VIDEO, 41, 0, 998, -1);
|
|
|
|
_voy->addEvent(18, 3, EVTYPE_VIDEO, 47, 0, 998, -1);
|
|
|
|
_voy->addEvent(18, 4, EVTYPE_VIDEO, 53, 0, 998, -1);
|
|
|
|
_voy->addEvent(18, 5, EVTYPE_VIDEO, 46, 0, 998, -1);
|
|
|
|
_voy->addEvent(18, 6, EVTYPE_VIDEO, 50, 0, 998, -1);
|
|
|
|
_voy->addEvent(18, 7, EVTYPE_VIDEO, 40, 0, 998, -1);
|
|
|
|
_voy->addEvent(18, 8, EVTYPE_VIDEO, 43, 0, 998, -1);
|
|
|
|
_voy->addEvent(19, 1, EVTYPE_AUDIO, 20, 0, 998, -1);
|
2014-01-09 04:31:34 +00:00
|
|
|
}
|
|
|
|
}
|
2013-06-23 18:55:27 +00:00
|
|
|
|
2014-02-26 21:44:30 +00:00
|
|
|
_voy->_aptLoadMode = 140;
|
2013-06-23 18:55:27 +00:00
|
|
|
return true;
|
2013-06-11 01:29:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void VoyeurEngine::showConversionScreen() {
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->_backgroundPage = _bVoy->boltEntry(0x502)._picResource;
|
|
|
|
(*_graphicsManager->_vPort)->setupViewPort();
|
2013-12-28 07:45:32 +00:00
|
|
|
flipPageAndWait();
|
2013-06-11 01:29:12 +00:00
|
|
|
|
|
|
|
// 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
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->delayClick(150);
|
2013-06-11 01:29:12 +00:00
|
|
|
if (shouldQuit())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Fade out the screen
|
|
|
|
cMap = _bVoy->getCMapResource(0x5040000);
|
|
|
|
cMap->_steps = 30;
|
|
|
|
cMap->startFade();
|
|
|
|
if (shouldQuit())
|
|
|
|
return;
|
|
|
|
|
2013-12-28 07:45:32 +00:00
|
|
|
flipPageAndWaitForFade();
|
2013-06-11 01:29:12 +00:00
|
|
|
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->screenReset();
|
2013-06-11 01:29:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool VoyeurEngine::doLock() {
|
2013-06-13 02:13:52 +00:00
|
|
|
bool result = true;
|
|
|
|
int buttonVocSize, wrongVocSize;
|
2014-02-27 07:09:57 +00:00
|
|
|
byte *buttonVoc = _filesManager->fload("button.voc", &buttonVocSize);
|
|
|
|
byte *wrongVoc = _filesManager->fload("wrong.voc", &wrongVocSize);
|
2013-06-11 01:29:12 +00:00
|
|
|
|
2013-12-15 20:08:25 +00:00
|
|
|
if (_bVoy->getBoltGroup(0x700)) {
|
2014-02-26 21:44:30 +00:00
|
|
|
_voy->_viewBounds = _bVoy->boltEntry(0x704)._rectResource;
|
2013-06-13 02:13:52 +00:00
|
|
|
|
2014-02-02 02:45:15 +00:00
|
|
|
Common::String password = "3333";
|
2014-01-07 07:17:06 +00:00
|
|
|
PictureResource *cursorPic = _bVoy->getPictureResource(0x702);
|
2013-06-20 12:38:38 +00:00
|
|
|
assert(cursorPic);
|
2013-06-13 02:13:52 +00:00
|
|
|
|
|
|
|
// Get the mappings of keys on the keypad
|
2014-01-07 07:17:06 +00:00
|
|
|
byte *keyData = _bVoy->memberAddr(0x705);
|
|
|
|
int keyCount = READ_LE_UINT16(keyData);
|
2013-06-13 02:13:52 +00:00
|
|
|
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->_backColors = _bVoy->getCMapResource(0x7010000);
|
|
|
|
_graphicsManager->_backgroundPage = _bVoy->getPictureResource(0x700);
|
|
|
|
(*_graphicsManager->_vPort)->setupViewPort();
|
2013-06-13 02:13:52 +00:00
|
|
|
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->_backColors->startFade();
|
|
|
|
(*_graphicsManager->_vPort)->_parent->_flags |= DISPFLAG_8;
|
|
|
|
_graphicsManager->flipPage();
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->sWaitFlip();
|
2013-06-24 12:51:42 +00:00
|
|
|
|
2014-02-27 06:29:49 +00:00
|
|
|
while (!shouldQuit() && (_eventsManager->_fadeStatus & 1))
|
|
|
|
_eventsManager->delay(1);
|
2013-06-13 02:13:52 +00:00
|
|
|
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->setCursorColor(127, 0);
|
2014-02-27 07:15:29 +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
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->setCursor(cursorPic);
|
|
|
|
_eventsManager->showCursor();
|
2013-06-21 04:18:19 +00:00
|
|
|
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->_intPtr._hasPalette = true;
|
2013-06-13 02:13:52 +00:00
|
|
|
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->_fontPtr->_curFont = _bVoy->boltEntry(0x708)._fontResource;
|
|
|
|
_graphicsManager->_fontPtr->_fontSaveBack = 0;
|
|
|
|
_graphicsManager->_fontPtr->_fontFlags = 0;
|
2013-06-13 02:13:52 +00:00
|
|
|
|
2014-02-02 02:45:15 +00:00
|
|
|
Common::String dateString = "ScummVM";
|
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;
|
2014-02-10 06:56:35 +00:00
|
|
|
bool flag = false;
|
2013-06-13 02:13:52 +00:00
|
|
|
while (!breakFlag && !shouldQuit()) {
|
2014-02-27 07:15:29 +00:00
|
|
|
(*_graphicsManager->_vPort)->setupViewPort();
|
2013-12-28 07:45:32 +00:00
|
|
|
flipPageAndWait();
|
2013-06-13 02:13:52 +00:00
|
|
|
|
|
|
|
// Display the last play time
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->_fontPtr->_pos = Common::Point(0, 97);
|
|
|
|
_graphicsManager->_fontPtr->_justify = ALIGN_CENTER;
|
|
|
|
_graphicsManager->_fontPtr->_justifyWidth = 384;
|
|
|
|
_graphicsManager->_fontPtr->_justifyHeight = 97;
|
2013-06-13 02:13:52 +00:00
|
|
|
|
2014-02-27 07:15:29 +00:00
|
|
|
(*_graphicsManager->_vPort)->drawText(displayString);
|
2013-12-28 07:45:32 +00:00
|
|
|
flipPageAndWait();
|
2013-06-13 02:13:52 +00:00
|
|
|
|
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
|
2014-01-07 07:17:06 +00:00
|
|
|
int key;
|
2013-06-13 02:13:52 +00:00
|
|
|
do {
|
|
|
|
do {
|
|
|
|
// Scan through the list of key rects to check if a keypad key is highlighted
|
|
|
|
key = -1;
|
2014-02-27 06:29:49 +00:00
|
|
|
Common::Point mousePos = _eventsManager->getMousePos() +
|
2013-06-21 04:18:19 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->setCursorColor(127, (key == -1) ? 0 : 1);
|
|
|
|
_eventsManager->_intPtr._hasPalette = true;
|
2013-06-13 02:13:52 +00:00
|
|
|
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->delay(1);
|
|
|
|
} while (!shouldQuit() && !_eventsManager->_mouseClicked);
|
|
|
|
_eventsManager->_mouseClicked = false;
|
2013-06-13 02:13:52 +00:00
|
|
|
} while (!shouldQuit() && key == -1);
|
|
|
|
|
2014-02-27 06:12:10 +00:00
|
|
|
_soundManager->abortVOCMap();
|
|
|
|
_soundManager->playVOCMap(buttonVoc, buttonVocSize);
|
2013-06-13 02:13:52 +00:00
|
|
|
|
2014-02-27 06:12:10 +00:00
|
|
|
while (_soundManager->getVOCStatus()) {
|
2013-06-13 02:13:52 +00:00
|
|
|
if (shouldQuit())
|
|
|
|
break;
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->delay(1);
|
2013-06-13 02:13:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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)) {
|
2014-02-27 07:15:29 +00:00
|
|
|
(*_graphicsManager->_vPort)->setupViewPort();
|
2013-06-13 02:13:52 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2014-02-27 06:12:10 +00:00
|
|
|
_soundManager->playVOCMap(wrongVoc, wrongVocSize);
|
2013-06-13 02:13:52 +00:00
|
|
|
}
|
|
|
|
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->fillPic(*_graphicsManager->_vPort);
|
2013-12-28 07:45:32 +00:00
|
|
|
flipPageAndWait();
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->resetPalette();
|
2013-06-13 02:13:52 +00:00
|
|
|
|
2014-02-26 21:44:30 +00:00
|
|
|
_voy->_viewBounds = nullptr;
|
2013-12-15 20:08:25 +00:00
|
|
|
_bVoy->freeBoltGroup(0x700);
|
2013-05-25 13:58:03 +00:00
|
|
|
}
|
2013-06-11 01:29:12 +00:00
|
|
|
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->hideCursor();
|
2013-06-22 15:57:51 +00:00
|
|
|
|
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() {
|
2013-12-15 20:08:25 +00:00
|
|
|
if (_bVoy->getBoltGroup(0x500)) {
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->_backgroundPage = _bVoy->getPictureResource(0x500);
|
2013-06-23 01:09:20 +00:00
|
|
|
|
2014-02-27 07:15:29 +00:00
|
|
|
(*_graphicsManager->_vPort)->setupViewPort();
|
2013-12-28 07:45:32 +00:00
|
|
|
flipPageAndWait();
|
2013-06-23 01:09:20 +00:00
|
|
|
|
|
|
|
// Immediate palette load to show the initial screen
|
|
|
|
CMapResource *cMap = _bVoy->getCMapResource(0x501);
|
|
|
|
assert(cMap);
|
|
|
|
cMap->_steps = 60;
|
|
|
|
cMap->startFade();
|
|
|
|
|
|
|
|
// Wait briefly
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->delayClick(200);
|
2013-06-23 01:09:20 +00:00
|
|
|
if (shouldQuit())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Fade out the screen
|
|
|
|
cMap = _bVoy->getCMapResource(0x504);
|
|
|
|
cMap->_steps = 30;
|
|
|
|
cMap->startFade();
|
|
|
|
|
2013-12-28 07:45:32 +00:00
|
|
|
flipPageAndWaitForFade();
|
2013-06-23 01:09:20 +00:00
|
|
|
if (shouldQuit())
|
|
|
|
return;
|
|
|
|
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->screenReset();
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->delayClick(200);
|
2013-06-23 01:09:20 +00:00
|
|
|
|
2013-06-23 18:55:27 +00:00
|
|
|
// Voyeur title
|
2013-06-23 01:09:20 +00:00
|
|
|
playRL2Video("a1100100.rl2");
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->screenReset();
|
2013-06-23 15:31:54 +00:00
|
|
|
|
2013-12-15 20:08:25 +00:00
|
|
|
_bVoy->freeBoltGroup(0x500);
|
2013-06-23 01:09:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-23 18:55:27 +00:00
|
|
|
void VoyeurEngine::doOpening() {
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->screenReset();
|
2013-06-24 12:51:42 +00:00
|
|
|
|
2013-12-15 20:08:25 +00:00
|
|
|
if (!_bVoy->getBoltGroup(0x200, true))
|
2013-06-24 12:51:42 +00:00
|
|
|
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);
|
2014-02-04 03:45:52 +00:00
|
|
|
// byte *whTable = _bVoy->memberAddr(0x217);
|
2014-01-18 22:32:59 +00:00
|
|
|
int frameIndex = 0;
|
2014-02-04 03:45:52 +00:00
|
|
|
bool creditShow = true;
|
|
|
|
PictureResource *textPic = nullptr;
|
|
|
|
Common::Point textPos;
|
2013-12-06 03:36:59 +00:00
|
|
|
|
2014-02-26 21:44:30 +00:00
|
|
|
_voy->_vocSecondsOffset = 0;
|
|
|
|
_voy->_RTVNum = 0;
|
|
|
|
_voy->_audioVisualStartTime = _voy->_RTVNum;
|
|
|
|
_voy->_eventFlags |= EVTFLAG_RECORDING;
|
2014-01-06 01:56:14 +00:00
|
|
|
_gameHour = 4;
|
|
|
|
_gameMinute = 0;
|
2014-01-31 03:10:59 +00:00
|
|
|
_audioVideoId = 1;
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->_videoDead = -1;
|
2014-02-26 21:44:30 +00:00
|
|
|
_voy->addVideoEventStart();
|
2013-12-06 03:36:59 +00:00
|
|
|
|
2014-02-26 21:44:30 +00:00
|
|
|
_voy->_eventFlags &= ~EVTFLAG_TIME_DISABLED;
|
2013-06-24 12:51:42 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < 256; ++i)
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->setColor(i, 8, 8, 8);
|
2013-06-24 12:51:42 +00:00
|
|
|
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->_intPtr._hasPalette = true;
|
2014-02-27 07:15:29 +00:00
|
|
|
(*_graphicsManager->_vPort)->setupViewPort();
|
2013-12-28 07:45:32 +00:00
|
|
|
flipPageAndWait();
|
2014-02-04 03:45:52 +00:00
|
|
|
|
2014-02-04 04:44:50 +00:00
|
|
|
RL2Decoder decoder;
|
2013-06-24 12:51:42 +00:00
|
|
|
decoder.loadFile("a2300100.rl2");
|
|
|
|
decoder.start();
|
2014-02-04 03:45:52 +00:00
|
|
|
|
2014-02-27 06:29:49 +00:00
|
|
|
while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager->_mouseClicked) {
|
2013-06-24 12:51:42 +00:00
|
|
|
if (decoder.hasDirtyPalette()) {
|
|
|
|
const byte *palette = decoder.getPalette();
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->setPalette(palette, 0, 256);
|
2013-06-24 12:51:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (decoder.needsUpdate()) {
|
|
|
|
const Graphics::Surface *frame = decoder.decodeNextFrame();
|
|
|
|
|
2013-12-14 22:38:01 +00:00
|
|
|
Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
|
2014-02-27 07:15:29 +00:00
|
|
|
(byte *)_graphicsManager->_screenSurface.getPixels());
|
2014-02-04 03:45:52 +00:00
|
|
|
|
2014-02-04 04:44:50 +00:00
|
|
|
if (decoder.getCurFrame() >= (int32)READ_LE_UINT32(frameTable + frameIndex * 4)) {
|
2014-02-04 03:45:52 +00:00
|
|
|
if (creditShow) {
|
|
|
|
// Show a credit
|
|
|
|
textPic = _bVoy->boltEntry(frameIndex / 2 + 0x202)._picResource;
|
|
|
|
textPos = Common::Point(READ_LE_UINT16(xyTable + frameIndex * 2),
|
|
|
|
READ_LE_UINT16(xyTable + (frameIndex + 1) * 2));
|
|
|
|
|
|
|
|
creditShow = false;
|
|
|
|
} else {
|
2014-02-04 04:00:59 +00:00
|
|
|
textPic = nullptr;
|
2014-02-04 03:45:52 +00:00
|
|
|
|
|
|
|
creditShow = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
++frameIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (textPic) {
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->sDrawPic(textPic, *_graphicsManager->_vPort, textPos);
|
2014-02-04 03:45:52 +00:00
|
|
|
flipPageAndWait();
|
|
|
|
}
|
2013-06-24 12:51:42 +00:00
|
|
|
}
|
|
|
|
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->getMouseInfo();
|
2014-02-08 01:46:02 +00:00
|
|
|
g_system->delayMillis(10);
|
2013-06-24 12:51:42 +00:00
|
|
|
}
|
2014-01-06 01:56:14 +00:00
|
|
|
|
2014-02-26 21:44:30 +00:00
|
|
|
if ((_voy->_RTVNum - _voy->_audioVisualStartTime) < 2)
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->delay(60);
|
2014-01-06 01:56:14 +00:00
|
|
|
|
2014-02-26 21:44:30 +00:00
|
|
|
_voy->_eventFlags |= EVTFLAG_TIME_DISABLED;
|
|
|
|
_voy->addVideoEventEnd();
|
|
|
|
_voy->_eventFlags &= ~EVTFLAG_RECORDING;
|
2014-01-06 01:56:14 +00:00
|
|
|
|
|
|
|
_bVoy->freeBoltGroup(0x200);
|
2013-06-23 18:55:27 +00:00
|
|
|
}
|
|
|
|
|
2013-06-22 15:57:51 +00:00
|
|
|
void VoyeurEngine::playRL2Video(const Common::String &filename) {
|
2014-02-04 04:44:50 +00:00
|
|
|
RL2Decoder decoder;
|
2013-06-22 15:57:51 +00:00
|
|
|
decoder.loadFile(filename);
|
|
|
|
decoder.start();
|
|
|
|
|
2014-02-27 06:29:49 +00:00
|
|
|
while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager->_mouseClicked) {
|
2013-06-22 15:57:51 +00:00
|
|
|
if (decoder.hasDirtyPalette()) {
|
|
|
|
const byte *palette = decoder.getPalette();
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->setPalette(palette, 0, 256);
|
2013-06-22 15:57:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (decoder.needsUpdate()) {
|
|
|
|
const Graphics::Surface *frame = decoder.decodeNextFrame();
|
|
|
|
|
2013-12-14 22:38:01 +00:00
|
|
|
Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
|
2014-02-27 07:15:29 +00:00
|
|
|
(byte *)_graphicsManager->_screenSurface.getPixels());
|
2013-06-22 15:57:51 +00:00
|
|
|
}
|
|
|
|
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->getMouseInfo();
|
2013-06-22 15:57:51 +00:00
|
|
|
g_system->delayMillis(10);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-29 10:12:03 +00:00
|
|
|
void VoyeurEngine::playAVideo(int videoId) {
|
|
|
|
playAVideoDuration(videoId, 9999);
|
|
|
|
}
|
|
|
|
|
2013-12-25 20:30:46 +00:00
|
|
|
void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
|
|
|
|
int totalFrames = duration * 10;
|
|
|
|
|
2013-12-29 10:12:03 +00:00
|
|
|
if (videoId == -1)
|
2013-12-25 20:30:46 +00:00
|
|
|
return;
|
|
|
|
|
2013-12-29 21:05:45 +00:00
|
|
|
PictureResource *pic = NULL;
|
2013-12-29 10:12:03 +00:00
|
|
|
if (videoId == 42) {
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->_videoDead = 0;
|
|
|
|
pic = _bVoy->boltEntry(0xE00 + _eventsManager->_videoDead)._picResource;
|
2013-12-25 20:30:46 +00:00
|
|
|
}
|
|
|
|
|
2014-02-04 04:44:50 +00:00
|
|
|
RL2Decoder decoder;
|
2013-12-25 20:30:46 +00:00
|
|
|
decoder.loadVideo(videoId);
|
|
|
|
|
2014-02-26 21:44:30 +00:00
|
|
|
decoder.seek(Audio::Timestamp(_voy->_vocSecondsOffset * 1000));
|
2013-12-25 20:30:46 +00:00
|
|
|
decoder.start();
|
|
|
|
int endFrame = decoder.getCurFrame() + totalFrames;
|
|
|
|
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->getMouseInfo();
|
|
|
|
_eventsManager->startCursorBlink();
|
2014-02-02 04:33:30 +00:00
|
|
|
|
2014-02-27 06:29:49 +00:00
|
|
|
while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager->_mouseClicked &&
|
2013-12-25 20:30:46 +00:00
|
|
|
(decoder.getCurFrame() < endFrame)) {
|
|
|
|
if (decoder.needsUpdate()) {
|
|
|
|
const Graphics::Surface *frame = decoder.decodeNextFrame();
|
|
|
|
|
|
|
|
Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
|
2014-02-27 07:15:29 +00:00
|
|
|
(byte *)_graphicsManager->_screenSurface.getPixels());
|
2014-02-26 21:44:30 +00:00
|
|
|
if (_voy->_eventFlags & EVTFLAG_RECORDING)
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->drawDot();
|
2013-12-25 20:30:46 +00:00
|
|
|
}
|
|
|
|
|
2014-01-04 04:09:19 +00:00
|
|
|
if (decoder.hasDirtyPalette()) {
|
|
|
|
const byte *palette = decoder.getPalette();
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->setPalette(palette, 0, decoder.getPaletteCount());
|
|
|
|
_graphicsManager->setOneColor(128, 220, 20, 20);
|
2014-01-04 04:09:19 +00:00
|
|
|
}
|
|
|
|
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->getMouseInfo();
|
2013-12-25 20:30:46 +00:00
|
|
|
g_system->delayMillis(10);
|
|
|
|
}
|
|
|
|
|
|
|
|
// RL2 finished
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->screenReset();
|
2014-02-26 21:44:30 +00:00
|
|
|
_voy->_eventFlags &= ~EVTFLAG_RECORDING;
|
2013-12-25 20:30:46 +00:00
|
|
|
|
2014-02-26 21:44:30 +00:00
|
|
|
if (_voy->_eventFlags & EVTFLAG_8) {
|
2013-12-29 21:05:45 +00:00
|
|
|
assert(pic);
|
2014-02-27 07:15:29 +00:00
|
|
|
byte *imgData = (*_graphicsManager->_vPort)->_currentPic->_imgData;
|
|
|
|
(*_graphicsManager->_vPort)->_currentPic->_imgData = pic->_imgData;
|
2013-12-29 21:05:45 +00:00
|
|
|
pic->_imgData = imgData;
|
2014-02-26 21:44:30 +00:00
|
|
|
_voy->_eventFlags &= ~EVTFLAG_8;
|
2013-12-25 20:30:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-01 16:29:49 +00:00
|
|
|
void VoyeurEngine::playAudio(int audioId) {
|
|
|
|
_bVoy->getBoltGroup(0x7F00);
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->_backgroundPage = _bVoy->boltEntry(0x7F00 +
|
2014-02-02 19:15:59 +00:00
|
|
|
BLIND_TABLE[audioId] * 2)._picResource;
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->_backColors = _bVoy->boltEntry(0x7F01 +
|
2014-02-02 19:15:59 +00:00
|
|
|
BLIND_TABLE[audioId] * 2)._cMapResource;
|
2014-02-01 16:29:49 +00:00
|
|
|
|
2014-02-27 07:15:29 +00:00
|
|
|
(*_graphicsManager->_vPort)->setupViewPort();
|
|
|
|
_graphicsManager->_backColors->startFade();
|
2014-02-01 16:29:49 +00:00
|
|
|
flipPageAndWaitForFade();
|
|
|
|
|
2014-02-26 21:44:30 +00:00
|
|
|
_voy->_eventFlags &= ~EVTFLAG_TIME_DISABLED;
|
2014-02-27 06:12:10 +00:00
|
|
|
_soundManager->setVOCOffset(_voy->_vocSecondsOffset);
|
|
|
|
Common::String filename = _soundManager->getVOCFileName(
|
2014-02-01 16:29:49 +00:00
|
|
|
audioId + 159);
|
2014-02-27 06:12:10 +00:00
|
|
|
_soundManager->startVOCPlay(filename);
|
2014-02-26 21:44:30 +00:00
|
|
|
_voy->_eventFlags |= EVTFLAG_RECORDING;
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->startCursorBlink();
|
2014-02-01 16:29:49 +00:00
|
|
|
|
2014-02-27 06:29:49 +00:00
|
|
|
while (!shouldQuit() && !_eventsManager->_mouseClicked &&
|
2014-02-27 06:12:10 +00:00
|
|
|
_soundManager->getVOCStatus())
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->delayClick(1);
|
2014-02-01 16:29:49 +00:00
|
|
|
|
2014-02-26 21:44:30 +00:00
|
|
|
_voy->_eventFlags |= EVTFLAG_TIME_DISABLED;
|
2014-02-27 06:12:10 +00:00
|
|
|
_soundManager->stopVOCPlay();
|
2014-02-01 16:29:49 +00:00
|
|
|
|
|
|
|
_bVoy->freeBoltGroup(0x7F00);
|
2014-02-27 07:15:29 +00:00
|
|
|
(*_graphicsManager->_vPort)->setupViewPort(NULL);
|
2014-02-01 16:29:49 +00:00
|
|
|
|
2014-02-26 21:44:30 +00:00
|
|
|
_voy->_eventFlags &= ~EVTFLAG_RECORDING;
|
|
|
|
_voy->_playStampMode = 129;
|
2014-02-01 16:29:49 +00:00
|
|
|
}
|
|
|
|
|
2013-12-06 02:49:12 +00:00
|
|
|
void VoyeurEngine::doTransitionCard(const Common::String &time, const Common::String &location) {
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->setColor(128, 16, 16, 16);
|
|
|
|
_graphicsManager->setColor(224, 220, 220, 220);
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->_intPtr._hasPalette = true;
|
2013-12-06 02:49:12 +00:00
|
|
|
|
2014-02-27 07:15:29 +00:00
|
|
|
(*_graphicsManager->_vPort)->setupViewPort(NULL);
|
|
|
|
(*_graphicsManager->_vPort)->fillPic(128);
|
|
|
|
_graphicsManager->flipPage();
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->sWaitFlip();
|
2013-12-06 02:49:12 +00:00
|
|
|
|
2013-12-28 07:45:32 +00:00
|
|
|
flipPageAndWait();
|
2014-02-27 07:15:29 +00:00
|
|
|
(*_graphicsManager->_vPort)->fillPic(128);
|
2013-12-06 02:49:12 +00:00
|
|
|
|
2014-02-27 07:15:29 +00:00
|
|
|
FontInfoResource &fi = *_graphicsManager->_fontPtr;
|
2013-12-06 02:49:12 +00:00
|
|
|
fi._curFont = _bVoy->boltEntry(257)._fontResource;
|
|
|
|
fi._foreColor = 224;
|
|
|
|
fi._fontSaveBack = 0;
|
|
|
|
fi._pos = Common::Point(0, 116);
|
2014-02-19 20:43:22 +00:00
|
|
|
fi._justify = ALIGN_CENTER;
|
2013-12-06 02:49:12 +00:00
|
|
|
fi._justifyWidth = 384;
|
|
|
|
fi._justifyHeight = 120;
|
|
|
|
|
2014-02-27 07:15:29 +00:00
|
|
|
(*_graphicsManager->_vPort)->drawText(time);
|
2013-12-06 02:49:12 +00:00
|
|
|
|
|
|
|
if (!location.empty()) {
|
|
|
|
fi._pos = Common::Point(0, 138);
|
2014-02-19 20:43:22 +00:00
|
|
|
fi._justify = ALIGN_CENTER;
|
2013-12-06 02:49:12 +00:00
|
|
|
fi._justifyWidth = 384;
|
|
|
|
fi._justifyHeight = 140;
|
|
|
|
|
2014-02-27 07:15:29 +00:00
|
|
|
(*_graphicsManager->_vPort)->drawText(location);
|
2013-12-06 02:49:12 +00:00
|
|
|
}
|
|
|
|
|
2013-12-28 07:45:32 +00:00
|
|
|
flipPageAndWait();
|
2013-12-06 02:49:12 +00:00
|
|
|
}
|
|
|
|
|
2013-12-11 05:11:02 +00:00
|
|
|
void VoyeurEngine::saveLastInplay() {
|
2014-02-02 02:45:15 +00:00
|
|
|
// No implementation in ScummVM version
|
2013-12-11 05:11:02 +00:00
|
|
|
}
|
|
|
|
|
2013-12-25 04:43:18 +00:00
|
|
|
void VoyeurEngine::flipPageAndWait() {
|
2014-02-27 07:15:29 +00:00
|
|
|
(*_graphicsManager->_vPort)->_flags |= DISPFLAG_8;
|
|
|
|
_graphicsManager->flipPage();
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->sWaitFlip();
|
2013-12-25 04:43:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void VoyeurEngine::flipPageAndWaitForFade() {
|
|
|
|
flipPageAndWait();
|
|
|
|
|
2014-02-27 06:29:49 +00:00
|
|
|
while (!shouldQuit() && (_eventsManager->_fadeStatus & 1))
|
|
|
|
_eventsManager->delay(1);
|
2013-12-25 04:43:18 +00:00
|
|
|
}
|
|
|
|
|
2014-02-02 22:33:42 +00:00
|
|
|
void VoyeurEngine::showEndingNews() {
|
2014-02-26 21:44:30 +00:00
|
|
|
_playStampGroupId = (_voy->_incriminatedVictimNumber - 1) * 256 + 0x7700;
|
|
|
|
_voy->_boltGroupId2 = (_controlPtr->_state->_victimIndex - 1) * 256 + 0x7B00;
|
2014-02-02 22:33:42 +00:00
|
|
|
|
|
|
|
_bVoy->getBoltGroup(_playStampGroupId);
|
2014-02-26 21:44:30 +00:00
|
|
|
_bVoy->getBoltGroup(_voy->_boltGroupId2);
|
2014-02-02 22:33:42 +00:00
|
|
|
|
|
|
|
PictureResource *pic = _bVoy->boltEntry(_playStampGroupId)._picResource;
|
|
|
|
CMapResource *pal = _bVoy->boltEntry(_playStampGroupId + 1)._cMapResource;
|
|
|
|
|
2014-02-27 07:15:29 +00:00
|
|
|
(*_graphicsManager->_vPort)->setupViewPort(pic);
|
2014-02-02 22:33:42 +00:00
|
|
|
pal->startFade();
|
|
|
|
flipPageAndWaitForFade();
|
|
|
|
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->getMouseInfo();
|
2014-02-02 22:33:42 +00:00
|
|
|
|
|
|
|
for (int idx = 1; idx < 4; ++idx) {
|
|
|
|
if (idx == 3) {
|
2014-02-26 21:44:30 +00:00
|
|
|
pic = _bVoy->boltEntry(_voy->_boltGroupId2)._picResource;
|
|
|
|
pal = _bVoy->boltEntry(_voy->_boltGroupId2 + 1)._cMapResource;
|
2014-02-02 22:33:42 +00:00
|
|
|
} else {
|
|
|
|
pic = _bVoy->boltEntry(_playStampGroupId + idx * 2)._picResource;
|
|
|
|
pal = _bVoy->boltEntry(_playStampGroupId + idx * 2 + 1)._cMapResource;
|
|
|
|
}
|
|
|
|
|
2014-02-27 07:15:29 +00:00
|
|
|
(*_graphicsManager->_vPort)->setupViewPort(pic);
|
2014-02-02 22:33:42 +00:00
|
|
|
pal->startFade();
|
|
|
|
flipPageAndWaitForFade();
|
|
|
|
|
|
|
|
_bVoy->freeBoltMember(_playStampGroupId + (idx - 1) * 2);
|
|
|
|
_bVoy->freeBoltMember(_playStampGroupId + (idx - 1) * 2 + 1);
|
|
|
|
|
|
|
|
Common::String fname = Common::String::format("news%d.voc", idx);
|
2014-02-27 06:12:10 +00:00
|
|
|
_soundManager->startVOCPlay(fname);
|
2014-02-02 22:33:42 +00:00
|
|
|
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->getMouseInfo();
|
|
|
|
while (!shouldQuit() && !_eventsManager->_mouseClicked &&
|
2014-02-27 06:12:10 +00:00
|
|
|
_soundManager->getVOCStatus()) {
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->delay(1);
|
|
|
|
_eventsManager->getMouseInfo();
|
2014-02-02 22:33:42 +00:00
|
|
|
}
|
|
|
|
|
2014-02-27 06:12:10 +00:00
|
|
|
_soundManager->stopVOCPlay();
|
2014-02-02 22:33:42 +00:00
|
|
|
if (idx == 3)
|
2014-02-27 06:29:49 +00:00
|
|
|
_eventsManager->delay(3);
|
2014-02-02 22:33:42 +00:00
|
|
|
|
2014-02-27 06:29:49 +00:00
|
|
|
if (shouldQuit() || _eventsManager->_mouseClicked)
|
2014-02-02 22:33:42 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
_bVoy->freeBoltGroup(_playStampGroupId);
|
2014-02-26 21:44:30 +00:00
|
|
|
_bVoy->freeBoltGroup(_voy->_boltGroupId2);
|
2014-02-02 22:33:42 +00:00
|
|
|
_playStampGroupId = -1;
|
2014-02-26 21:44:30 +00:00
|
|
|
_voy->_boltGroupId2 = -1;
|
2014-02-02 22:33:42 +00:00
|
|
|
}
|
|
|
|
|
2014-01-09 04:31:34 +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 _voyeurArea == AREA_APARTMENT;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if it is currently okay to save the game
|
|
|
|
*/
|
|
|
|
bool VoyeurEngine::canSaveGameStateCurrently() {
|
|
|
|
return _voyeurArea == AREA_APARTMENT;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Load the savegame at the specified slot index
|
|
|
|
*/
|
|
|
|
Common::Error VoyeurEngine::loadGameState(int slot) {
|
|
|
|
_loadGameSlot = slot;
|
|
|
|
return Common::kNoError;
|
|
|
|
}
|
|
|
|
|
|
|
|
void VoyeurEngine::loadGame(int slot) {
|
|
|
|
// Open up the save file
|
2014-01-19 04:47:04 +00:00
|
|
|
Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(generateSaveName(slot));
|
2014-01-09 04:31:34 +00:00
|
|
|
if (!saveFile)
|
|
|
|
return;
|
|
|
|
|
|
|
|
Common::Serializer serializer(saveFile, NULL);
|
2014-01-20 02:58:55 +00:00
|
|
|
|
|
|
|
// Store the current time index before the game is loaded
|
2014-02-26 21:44:30 +00:00
|
|
|
_checkTransitionId = _voy->_transitionId;
|
2014-01-09 04:31:34 +00:00
|
|
|
|
2014-01-20 02:58:55 +00:00
|
|
|
// Stop any playing sound
|
2014-02-27 06:12:10 +00:00
|
|
|
_soundManager->stopVOCPlay();
|
2014-01-20 02:58:55 +00:00
|
|
|
|
2014-01-09 04:31:34 +00:00
|
|
|
// Read in the savegame header
|
|
|
|
VoyeurSavegameHeader header;
|
|
|
|
if (!header.read(saveFile))
|
|
|
|
return;
|
|
|
|
if (header._thumbnail)
|
|
|
|
header._thumbnail->free();
|
|
|
|
delete header._thumbnail;
|
|
|
|
|
|
|
|
synchronize(serializer);
|
|
|
|
|
|
|
|
delete saveFile;
|
2014-01-15 02:49:26 +00:00
|
|
|
|
|
|
|
// Show a transition card if the time index has changed
|
|
|
|
checkTransition();
|
|
|
|
|
|
|
|
// Load the apartment
|
|
|
|
_mainThread->loadTheApt();
|
2014-01-09 04:31:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Save the game to the given slot index, and with the given name
|
|
|
|
*/
|
|
|
|
Common::Error VoyeurEngine::saveGameState(int slot, const Common::String &desc) {
|
|
|
|
// Open the save file for writing
|
|
|
|
Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(generateSaveName(slot));
|
|
|
|
if (!saveFile)
|
|
|
|
return Common::kCreatingFileFailed;
|
|
|
|
|
|
|
|
// Write out the header
|
|
|
|
VoyeurSavegameHeader header;
|
|
|
|
header.write(saveFile, this, desc);
|
|
|
|
|
|
|
|
// Set up a serializer
|
|
|
|
Common::Serializer serializer(NULL, saveFile);
|
|
|
|
|
|
|
|
// Synchronise the data
|
|
|
|
synchronize(serializer);
|
|
|
|
|
|
|
|
saveFile->finalize();
|
|
|
|
delete saveFile;
|
|
|
|
|
|
|
|
return Common::kNoError;
|
|
|
|
}
|
|
|
|
|
|
|
|
void VoyeurEngine::synchronize(Common::Serializer &s) {
|
2014-02-03 03:38:27 +00:00
|
|
|
s.syncAsSint16LE(_glGoState);
|
2014-01-09 04:31:34 +00:00
|
|
|
s.syncAsSint16LE(_glGoStack);
|
|
|
|
s.syncAsSint16LE(_stampFlags);
|
|
|
|
s.syncAsSint16LE(_playStampGroupId);
|
|
|
|
s.syncAsSint16LE(_currentVocId);
|
2014-01-31 03:10:59 +00:00
|
|
|
s.syncAsSint16LE(_audioVideoId);
|
2014-01-09 04:31:34 +00:00
|
|
|
|
|
|
|
s.syncAsSint16LE(_iForceDeath);
|
|
|
|
s.syncAsSint16LE(_gameHour);
|
|
|
|
s.syncAsSint16LE(_gameMinute);
|
|
|
|
s.syncAsSint16LE(_flashTimeVal);
|
|
|
|
s.syncAsSint16LE(_flashTimeFlag);
|
|
|
|
s.syncAsSint16LE(_timeBarVal);
|
|
|
|
s.syncAsSint16LE(_checkPhoneVal);
|
|
|
|
|
|
|
|
// Sub-systems
|
2014-02-26 21:44:30 +00:00
|
|
|
_voy->synchronize(s);
|
2014-02-27 07:15:29 +00:00
|
|
|
_graphicsManager->synchronize(s);
|
2014-01-09 04:31:34 +00:00
|
|
|
_mainThread->synchronize(s);
|
2014-02-05 03:23:15 +00:00
|
|
|
_controlPtr->_state->synchronize(s);
|
2014-01-09 04:31:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
bool VoyeurSavegameHeader::read(Common::InSaveFile *f) {
|
|
|
|
_thumbnail = NULL;
|
|
|
|
|
2014-02-17 21:16:37 +00:00
|
|
|
uint32 signature = f->readUint32BE();
|
|
|
|
if (signature != MKTAG('V', 'O', 'Y', 'R')) {
|
2014-01-09 04:31:34 +00:00
|
|
|
warning("Invalid savegame");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
_version = f->readByte();
|
|
|
|
if (_version > VOYEUR_SAVEGAME_VERSION)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
char c;
|
2014-02-03 05:38:10 +00:00
|
|
|
_saveName = "";
|
2014-01-09 04:31:34 +00:00
|
|
|
while ((c = f->readByte()) != 0)
|
|
|
|
_saveName += c;
|
|
|
|
|
|
|
|
// Get the thumbnail
|
|
|
|
_thumbnail = Graphics::loadThumbnail(*f);
|
|
|
|
if (!_thumbnail)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// Read in the save datet/ime
|
|
|
|
_saveYear = f->readSint16LE();
|
|
|
|
_saveMonth = f->readSint16LE();
|
|
|
|
_saveDay = f->readSint16LE();
|
|
|
|
_saveHour = f->readSint16LE();
|
|
|
|
_saveMinutes = f->readSint16LE();
|
|
|
|
_totalFrames = f->readUint32LE();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void VoyeurSavegameHeader::write(Common::OutSaveFile *f, VoyeurEngine *vm, const Common::String &saveName) {
|
|
|
|
// Write ident string
|
2014-02-17 21:16:37 +00:00
|
|
|
f->writeUint32BE(MKTAG('V', 'O', 'Y', 'R'));
|
2014-01-09 04:31:34 +00:00
|
|
|
|
|
|
|
// Write out savegame version
|
|
|
|
f->writeByte(VOYEUR_SAVEGAME_VERSION);
|
|
|
|
|
|
|
|
// Write out savegame name
|
|
|
|
f->write(saveName.c_str(), saveName.size());
|
|
|
|
f->writeByte(0);
|
|
|
|
|
|
|
|
// Create a thumbnail and save it
|
|
|
|
Graphics::Surface *thumb = new Graphics::Surface();
|
2014-02-27 07:15:29 +00:00
|
|
|
::createThumbnail(thumb, (byte *)vm->_graphicsManager->_screenSurface.getPixels(),
|
|
|
|
SCREEN_WIDTH, SCREEN_HEIGHT, vm->_graphicsManager->_VGAColors);
|
2014-01-09 04:31:34 +00:00
|
|
|
Graphics::saveThumbnail(*f, *thumb);
|
|
|
|
thumb->free();
|
|
|
|
delete thumb;
|
|
|
|
|
|
|
|
// Write the save datet/ime
|
|
|
|
TimeDate td;
|
|
|
|
g_system->getTimeAndDate(td);
|
|
|
|
f->writeSint16LE(td.tm_year + 1900);
|
|
|
|
f->writeSint16LE(td.tm_mon + 1);
|
|
|
|
f->writeSint16LE(td.tm_mday);
|
|
|
|
f->writeSint16LE(td.tm_hour);
|
|
|
|
f->writeSint16LE(td.tm_min);
|
2014-02-27 06:29:49 +00:00
|
|
|
f->writeUint32LE(vm->_eventsManager->getGameCounter());
|
2014-01-09 04:31:34 +00:00
|
|
|
}
|
|
|
|
|
2013-05-18 02:40:43 +00:00
|
|
|
} // End of namespace Voyeur
|