aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/voyeur/animation.cpp6
-rw-r--r--engines/voyeur/animation.h1
-rw-r--r--engines/voyeur/files_threads.cpp2
-rw-r--r--engines/voyeur/sound.cpp2
-rw-r--r--engines/voyeur/staticres.cpp2
-rw-r--r--engines/voyeur/staticres.h2
-rw-r--r--engines/voyeur/voyeur.cpp53
-rw-r--r--engines/voyeur/voyeur.h3
-rw-r--r--engines/voyeur/voyeur_game.cpp10
9 files changed, 74 insertions, 7 deletions
diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index c771f04f80..ce1fc9e2b5 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -21,6 +21,7 @@
*/
#include "voyeur/animation.h"
+#include "voyeur/staticres.h"
#include "common/memstream.h"
#include "common/system.h"
#include "audio/decoders/raw.h"
@@ -35,6 +36,11 @@ RL2Decoder::~RL2Decoder() {
close();
}
+bool RL2Decoder::loadVideo(int videoId) {
+ Common::String filename = Common::String::format("%s.rl2", ::Voyeur::SZ_FILENAMES[videoId]);
+ return loadFile(filename);
+}
+
bool RL2Decoder::loadStream(Common::SeekableReadStream *stream) {
close();
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index 53d24fc0c3..b06e3cb5d9 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -73,6 +73,7 @@ public:
virtual ~RL2Decoder();
bool loadStream(Common::SeekableReadStream *stream);
+ bool loadVideo(int videoId);
const Common::List<Common::Rect> *getDirtyRects() const;
void clearDirtyRects();
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 15f2e96125..26e4b5987b 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -1098,7 +1098,7 @@ int ThreadResource::doApt() {
// Loop through the hotspot list
hotspotId = -1;
pt = _vm->_eventsManager.getMousePos();
- for (int idx = 0; idx < hotspots.size(); ++idx) {
+ for (int idx = 0; idx < (int)hotspots.size(); ++idx) {
if (pt.x > hotspots[idx].left && pt.x < hotspots[idx].right &&
pt.y > hotspots[idx].top && pt.y < hotspots[idx].bottom) {
// Cursor is within hotspot area
diff --git a/engines/voyeur/sound.cpp b/engines/voyeur/sound.cpp
index e53716a70c..bf6374fce3 100644
--- a/engines/voyeur/sound.cpp
+++ b/engines/voyeur/sound.cpp
@@ -61,7 +61,7 @@ void SoundManager::setVOCOffset(int offset) {
}
Common::String SoundManager::getVOCFileName(int idx) {
- return Common::String::format("%s.voc", VOC_FILENAMES[idx]);
+ return Common::String::format("%s.voc", SZ_FILENAMES[idx]);
}
void SoundManager::startVOCPlay(const Common::String &filename) {
diff --git a/engines/voyeur/staticres.cpp b/engines/voyeur/staticres.cpp
index 0108dac66c..294a1676b4 100644
--- a/engines/voyeur/staticres.cpp
+++ b/engines/voyeur/staticres.cpp
@@ -74,7 +74,7 @@ const int COMP_BUT_TABLE[] = {
68, 79, 98, 102
};
-const char *const VOC_FILENAMES[] = {
+const char *const SZ_FILENAMES[] = {
"A2110100", nullptr, "A2300100", nullptr, "B1220100", nullptr, "C1220100", nullptr,
"C1290100", nullptr, "D1220100", nullptr, "D1270100", nullptr, "E1210100", nullptr,
"E1260100", nullptr, "E1280100", nullptr, "E1325100", nullptr, "F1200100", nullptr,
diff --git a/engines/voyeur/staticres.h b/engines/voyeur/staticres.h
index ae970b8537..8c97af72a8 100644
--- a/engines/voyeur/staticres.h
+++ b/engines/voyeur/staticres.h
@@ -39,7 +39,7 @@ extern const int BLIND_TABLE[];
extern const int COMP_BUT_TABLE[];
-extern const char *const VOC_FILENAMES[];
+extern const char *const SZ_FILENAMES[];
extern const char *const SATURDAY;
extern const char *const SUNDAY;
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index ab8f3cf6a0..1e09a8f965 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -560,6 +560,59 @@ void VoyeurEngine::playRL2Video(const Common::String &filename) {
}
}
+void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
+ byte *dataP = NULL;
+ int totalFrames = duration * 10;
+
+ if (videoId != -1)
+ return;
+
+ if (videoId != 42) {
+ _eventsManager._videoDead = 0;
+ dataP = _bVoy->memberAddr(0xE00);
+ }
+
+ ::Video::RL2Decoder decoder;
+ decoder.loadVideo(videoId);
+
+ decoder.start();
+ decoder.seek(Audio::Timestamp(_voy._vocSecondsOffset * 1000));
+ int endFrame = decoder.getCurFrame() + totalFrames;
+
+ while (!shouldQuit() && !decoder.endOfVideo() && !_voy._incriminate &&
+ (decoder.getCurFrame() < endFrame)) {
+ if (decoder.hasDirtyPalette()) {
+ const byte *palette = decoder.getPalette();
+ _graphicsManager.setPalette(palette, 0, 256);
+ }
+
+ if (decoder.needsUpdate()) {
+ const Graphics::Surface *frame = decoder.decodeNextFrame();
+
+ Common::copy((const byte *)frame->getPixels(), (const byte *)frame->getPixels() + 320 * 200,
+ (byte *)_graphicsManager._screenSurface.getPixels());
+ }
+
+ _eventsManager.pollEvents();
+ g_system->delayMillis(10);
+ }
+
+ // RL2 finished
+ _graphicsManager.screenReset();
+ _voy._field478 &= ~0x10;
+
+ if (_voy._field478 & 8) {
+ // TODO: Figure out resource type for the data resource
+ /*
+ byte *imgData = (*_graphicsManager._vPort)->_currentPic->_imgData;
+ (*_graphicsManager._vPort)->_currentPic->_imgData = dataP[12 and 14];
+ imgData[12 and 14] = imgData;
+ _voy._field478 &= ~8;
+ */
+ warning("TODO: playAVideoDuration - %x", dataP);
+ }
+}
+
void VoyeurEngine::doTransitionCard(const Common::String &time, const Common::String &location) {
_graphicsManager.setColor(128, 16, 16, 16);
_graphicsManager.setColor(224, 220, 220, 220);
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index e0a354989f..7f900df001 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -89,7 +89,8 @@ private:
void doTapePlaying();
bool checkForMurder();
bool checkForIncriminate();
- void playAVideoEvent(int eventId);
+ void playAVideoEvent(int eventIndex);
+ void playAVideoDuration(int v1, int v2);
int getChooseButton();
protected:
// Engine APIs
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index cce07eb497..fc0168d68a 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -691,8 +691,14 @@ bool VoyeurEngine::checkForIncriminate() {
_voy._videoEventId = -1;
}
-void VoyeurEngine::playAVideoEvent(int eventId) {
- warning("TODO");
+void VoyeurEngine::playAVideoEvent(int eventIndex) {
+ VoyeurEvent &evt = _voy._events[eventIndex];
+ _eventsManager._videoComputerBut4 = evt._field8;
+ _voy._vocSecondsOffset = evt._computerOn;
+ _eventsManager._videoDead = evt._dead;
+ _voy._field478 &= ~1;
+
+ playAVideoDuration(_eventsManager._videoComputerBut4, evt._computerOff);
}
int VoyeurEngine::getChooseButton() {