From 1fb73446e3358a2fe045647c8cb5d1b621d43ce7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 5 Jan 2014 20:56:14 -0500 Subject: VOYEUR: Clean up of some of the startup code --- engines/voyeur/events.cpp | 15 +++++++++ engines/voyeur/events.h | 14 +++++++++ engines/voyeur/voyeur.cpp | 80 ++++++++++++++++++++++++++++++----------------- 3 files changed, 81 insertions(+), 28 deletions(-) (limited to 'engines') diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp index 95e3047f8d..b96ce6796e 100644 --- a/engines/voyeur/events.cpp +++ b/engines/voyeur/events.cpp @@ -66,6 +66,21 @@ IntData::IntData() { /*------------------------------------------------------------------------*/ +void SVoy::addEvent(int hour, int minute, VoyeurEventType type, int videoId, + int on, int off, int dead) { + VoyeurEvent &e = _events[_eventCount++]; + + e._hour = hour; + e._minute = minute; + e._isAM = hour < 12; + e._videoId = videoId; + e._computerOn = on; + e._computerOff = off; + e._dead = dead; +} + +/*------------------------------------------------------------------------*/ + EventsManager::EventsManager(): _intPtr(_gameData), _fadeIntNode(0, 0, 3), _cycleIntNode(0, 0, 3) { _cycleStatus = 0; diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h index e7aedd5218..bd119f2fb8 100644 --- a/engines/voyeur/events.h +++ b/engines/voyeur/events.h @@ -101,7 +101,15 @@ public: int _field4EE; int _field4F0; int _field4F2; + + /** + * Total number of game events that have occurred + */ int _eventCount; + + /** + * List of game events that have occurred + */ VoyeurEvent _events[TOTAL_EVENTS]; int _timeStart; @@ -126,6 +134,12 @@ public: int _curICF1; int _fadeICF0; int _policeEvent; +public: + /** + * Add an event to the list of game events that have occurred + */ + void addEvent(int hour, int minute, VoyeurEventType type, int videoId, int on, + int off, int dead); }; class IntData { diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp index a6ad25f618..0238651c4c 100644 --- a/engines/voyeur/voyeur.cpp +++ b/engines/voyeur/voyeur.cpp @@ -171,44 +171,60 @@ void VoyeurEngine::initInput() { bool VoyeurEngine::doHeadTitle() { // char dest[144]; - + _eventsManager.startMainClockInt(); - + /* // Show starting screen -// if (_bVoy->getBoltGroup(0x500)) -// showConversionScreen(); - if (shouldQuit()) - return false; + if (_bVoy->getBoltGroup(0x500)) { + showConversionScreen(); + _bVoy->freeBoltGroup(0x500); + + if (shouldQuit()) + return false; + } if (ConfMan.getBool("copy_protection")) { + // Display lock screen bool result = doLock(); if (!result || shouldQuit()) return false; } -// showTitleScreen(); + // Show the title screen + showTitleScreen(); + if (shouldQuit()) + return false; // Opening if (!_eventsManager._mouseClicked) { -// doOpening(); -// doTransitionCard("Saturday Afternoon", "Player's Apartment"); + doOpening(); + doTransitionCard("Saturday Afternoon", "Player's Apartment"); _eventsManager.delayClick(90); } else { _eventsManager._mouseClicked = false; } - + */ if (_voy._field478 & 0x80) { - // TODO: Check when these are called, and the two different loops. - // Also, comptuerNu isn't an array in IDB? - /* - if (_voy._evidence[19] == 0) { - Common::copy(&COMPUTER_DEFAULTS[0], &COMPUTER_DEFAULTS[9 * 8], &_voy._computerNum[0]); - _voy._evidence[19] = 9; - } else { - error("_computerNum loaded with uninitialized list here"); - } - */ - } + // Add initial game event set + if (_voy._eventCount <= 1) + _voy.addEvent(18, 1, EVTYPE_VIDEO, 33, 0, 998, -1); + if (_voy._eventCount <= 2) + _voy.addEvent(18, 2, EVTYPE_VIDEO, 41, 0, 998, -1); + if (_voy._eventCount <= 3) + _voy.addEvent(18, 3, EVTYPE_VIDEO, 47, 0, 998, -1); + if (_voy._eventCount <= 4) + _voy.addEvent(18, 4, EVTYPE_VIDEO, 53, 0, 998, -1); + if (_voy._eventCount <= 5) + _voy.addEvent(18, 5, EVTYPE_VIDEO, 46, 0, 998, -1); + if (_voy._eventCount <= 6) + _voy.addEvent(18, 6, EVTYPE_VIDEO, 50, 0, 998, -1); + if (_voy._eventCount <= 7) + _voy.addEvent(18, 7, EVTYPE_VIDEO, 40, 0, 998, -1); + if (_voy._eventCount <= 8) + _voy.addEvent(18, 8, EVTYPE_VIDEO, 43, 0, 998, -1); + if (_voy._eventCount <= 9) + _voy.addEvent(19, 1, EVTYPE_AUDIO, 20, 0, 998, -1); + } _voy._field472 = 140; return true; @@ -240,7 +256,6 @@ void VoyeurEngine::showConversionScreen() { flipPageAndWaitForFade(); _graphicsManager.screenReset(); - _bVoy->freeBoltGroup(0x500); } bool VoyeurEngine::doLock() { @@ -462,7 +477,7 @@ void VoyeurEngine::showTitleScreen() { } void VoyeurEngine::doOpening() { -/* + /* _graphicsManager.screenReset(); if (!_bVoy->getBoltGroup(0x200, true)) @@ -478,11 +493,11 @@ void VoyeurEngine::doOpening() { _voy._RTVNum = 0; _voy._field468 = _voy._RTVNum; _voy._field478 = 16; - _eventsManager._gameHour = 4; - _eventsManager._gameMinute = 0; + _gameHour = 4; + _gameMinute = 0; _videoId = 1; _eventsManager._videoDead = -1; - addVideoEventStart(); + _eventsManager.addVideoEventStart(); _voy._field478 &= ~1; @@ -497,7 +512,7 @@ void VoyeurEngine::doOpening() { ::Video::RL2Decoder decoder; decoder.loadFile("a2300100.rl2"); decoder.start(); - + decoder.play(this); while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager._mouseClicked) { if (decoder.hasDirtyPalette()) { const byte *palette = decoder.getPalette(); @@ -514,6 +529,15 @@ void VoyeurEngine::doOpening() { _eventsManager.pollEvents(); g_system->delayMillis(10); } + + if ((_voy._RTVNum - _voy._field468) < 2) + _eventsManager.delay(60); + + _voy._field478 |= 1; + _eventsManager.addVideoEventEnd(); + _voy._field478 &= 0x10; + + _bVoy->freeBoltGroup(0x200); */ } @@ -535,7 +559,7 @@ void VoyeurEngine::playRL2Video(const Common::String &filename) { (byte *)_graphicsManager._screenSurface.getPixels()); } - _eventsManager.pollEvents(); + _eventsManager.getMouseInfo(); g_system->delayMillis(10); } } -- cgit v1.2.3