mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-02 17:03:13 +00:00
VOYEUR: Implemented playAVideoDuration
This commit is contained in:
parent
6e1a7abeef
commit
88c9dac8c0
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user