aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2013-12-11 00:11:02 -0500
committerPaul Gilbert2013-12-11 00:11:02 -0500
commitd08953ccd94b00c1e74cfb36fb230649c4e58bae (patch)
treed1b5b6d6b18219a27225fc5ccc1dbb45f524b6e5
parent10be9a527be4f6a0ac74cb8f916e93da712730c6 (diff)
downloadscummvm-rg350-d08953ccd94b00c1e74cfb36fb230649c4e58bae.tar.gz
scummvm-rg350-d08953ccd94b00c1e74cfb36fb230649c4e58bae.tar.bz2
scummvm-rg350-d08953ccd94b00c1e74cfb36fb230649c4e58bae.zip
VOYEUR: Implemented more of parsePlayCommands
-rw-r--r--engines/voyeur/events.h6
-rw-r--r--engines/voyeur/files.cpp375
-rw-r--r--engines/voyeur/files.h4
-rw-r--r--engines/voyeur/files_threads.cpp244
-rw-r--r--engines/voyeur/module.mk1
-rw-r--r--engines/voyeur/staticres.cpp25
-rw-r--r--engines/voyeur/staticres.h6
-rw-r--r--engines/voyeur/voyeur.cpp4
-rw-r--r--engines/voyeur/voyeur.h3
9 files changed, 296 insertions, 372 deletions
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 5c33beec61..97927e7d7d 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -82,8 +82,14 @@ public:
int _field470;
int _field472;
int _field474;
+ int _field476;
int _field478;
int _field47A;
+ int _field4E2;
+ Common::Rect _rect4E4;
+ int _field4EC;
+ int _field4EE;
+ int _field4F0;
int _field4F2;
int _timeStart;
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 4f2cfbf6c3..9b1a0b186a 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -242,7 +242,7 @@ BoltFile::~BoltFile() {
_state._curFd = NULL;
}
-bool BoltFile::getBoltGroup(uint32 id) {
+BoltGroup *BoltFile::getBoltGroup(uint32 id) {
++_state._fromGroupFlag;
_state._curLibPtr = this;
_state._curGroupPtr = &_groups[(id >> 8) & 0xff];
@@ -268,7 +268,8 @@ bool BoltFile::getBoltGroup(uint32 id) {
resolveAll();
--_state._fromGroupFlag;
- return true;
+
+ return _state._curGroupPtr;
}
void BoltFile::freeBoltGroup(uint32 id) {
@@ -929,6 +930,12 @@ void ViewPortResource::setupViewPort() {
&GraphicsManager::restoreMCGASaveRect);
}
+void ViewPortResource::setupViewPort(PictureResource *pic) {
+ setupViewPort(pic, NULL,
+ &GraphicsManager::setupMCGASaveRect, &GraphicsManager::addRectOptSaveRect,
+ &GraphicsManager::restoreMCGASaveRect);
+}
+
int ViewPortResource::drawText(const Common::String &msg) {
GraphicsManager &gfxManager = _state._vm->_graphicsManager;
assert(gfxManager._fontPtr);
@@ -1308,370 +1315,6 @@ VInitCyclResource::VInitCyclResource(BoltFilesState &state, const byte *src) {
/*------------------------------------------------------------------------*/
-int ThreadResource::_stampFlags = 0;
-int ThreadResource::_useCount[8];
-byte *ThreadResource::_threadDataPtr = NULL;
-
-ThreadResource::ThreadResource(BoltFilesState &state, const byte *src):
- _vm(state._vm) {
- _flags = src[8];
-}
-
-void ThreadResource::initThreadStruct(int idx, int id) {
- _controlIndex = -1;
- if (loadAStack(idx)) {
- _field4 = _field6 = -1;
- _threadId = id;
- _field3A = -1;
- _field3E = -1;
-
- doState();
- }
-}
-
-bool ThreadResource::loadAStack(int idx) {
- if (_stampFlags & 1) {
- unloadAStack(_controlIndex);
- if (!_useCount[idx]) {
- BoltEntry &boltEntry = _vm->_stampLibPtr->boltEntry(_vm->_controlPtr->_memberIds[idx]);
- if (!boltEntry._data)
- return false;
-
- _vm->_controlPtr->_entries[idx] = boltEntry._data;
- }
-
- ++_useCount[idx];
- }
-
- _ctlPtr = _vm->_controlPtr->_entries[idx];
- return true;
-}
-
-void ThreadResource::unloadAStack(int idx) {
- if ((_stampFlags & 1) && _useCount[idx]) {
- if (--_useCount[idx] == 0) {
- _vm->_stampLibPtr->freeBoltMember(_vm->_controlPtr->_memberIds[idx]);
- }
- }
-}
-
-bool ThreadResource::doState() {
- _flags |= 1;
-
- if (!getStateInfo())
- return false;
-
- getButtonsFlags();
- getField1CE();
-
- _vm->_glGoScene = -1;
- _vm->_glGoStack = -1;
-
- performOpenCard();
- if (_field40 & 1) {
- return chooseSTAMPButton(_vm->getRandomNumber(_field42 - 1));
- } else {
- return true;
- }
-}
-
-bool ThreadResource::getStateInfo() {
- _field9 = 0;
- int id = READ_LE_UINT16(_ctlPtr);
-
- if (id <= _threadId) {
- _field9 |= 0x80;
- return false;
- } else {
- uint32 fld = READ_LE_UINT32(_ctlPtr + 2);
- fld += _threadId << 3;
- _field46 = READ_LE_UINT32(_ctlPtr + fld + 4);
-
- fld = READ_LE_UINT32(_ctlPtr + fld);
- byte *baseP = _ctlPtr + fld;
- _field42 = READ_LE_UINT16(baseP);
- _field40 = READ_LE_UINT16(baseP + 2);
- _parseCount = READ_LE_UINT16(baseP + 4);
-
- _field28E = getDataOffset();
- _field28E += READ_LE_UINT32(baseP + 6) / 2;
-
- _field4A = baseP + 10;
-
- getButtonsText();
- return true;
- }
-}
-
-byte *ThreadResource::getDataOffset() {
- uint32 offset = READ_LE_UINT32(_ctlPtr + 10);
- _threadDataPtr = _ctlPtr + offset;
- return _threadDataPtr;
-}
-
-void ThreadResource::getButtonsText() {
- int idx = 0;
-
- for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) {
- if (*p == 0xC0) {
- ++p;
- if (*p++ & 0x80) {
- assert(idx < 63);
- _field8E[idx] = getRecordOffset(p);
- p += 4;
- }
-
- ++idx;
- _field8E[idx] = NULL;
- }
- }
-}
-
-void ThreadResource::getButtonsFlags() {
- int idx = 0;
-
- for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) {
- if (*p == 0xC0) {
- if (*++p & 0x20)
- _field40 |= 2;
-
- _field4E[idx] = *p++;
- _field18E[idx] = *p++;
-
- if (_field4E[idx] & 0x80)
- p += 4;
-
- ++idx;
- }
- }
-}
-
-void ThreadResource::getField1CE() {
- int idx = 0;
-
- for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) {
- assert(idx < 47);
- _field1CE[idx++] = getRecordOffset(p);
- _field1CE[idx] = NULL;
- }
-}
-
-void ThreadResource::unloadAllStacks(VoyeurEngine *vm) {
- if (_stampFlags & 1) {
- for (int i = 0; i < 8; ++i) {
- if (_useCount[i])
- vm->_stampLibPtr->freeBoltMember(vm->_controlPtr->_memberIds[i]);
- }
- }
-}
-
-void ThreadResource::performOpenCard() {
- for (const byte *p = _field4A; *p != 0x49; p = getNextRecord(p)) {
- if (*p == 0x47) {
- cardAction(p + 1);
- return;
- }
- }
-}
-
-void ThreadResource::initUseCount() {
- Common::fill(&_useCount[0], &_useCount[8], 0);
-}
-
-const byte *ThreadResource::getRecordOffset(const byte *p) {
- uint32 recSize = READ_LE_UINT32(p) + READ_LE_UINT32(p + 6);
- return _ctlPtr + recSize;
-}
-
-const byte *ThreadResource::getNextRecord(const byte *p) {
- byte v = *p++;
-
- switch (v) {
- case 2:
- case 4:
- case 6:
- case 8:
- case 10:
- return p + 8;
- case 1:
- case 3:
- case 5:
- case 7:
- case 9:
- case 11:
- case 21:
- case 22:
- case 25:
- case 26:
- return p + 5;
- case 17:
- case 23:
- case 24:
- case 27:
- case 28:
- return p + 2;
- case 19:
- case 41:
- return p + 6;
- case 18:
- case 51:
- case 52:
- return p + 1;
- case 74:
- return p + 4;
- case 192:
- if (*p * 0x80)
- p += 4;
- return p + 2;
- default:
- return p;
- }
-}
-
-void ThreadResource::cardAction(const byte *p) {
- warning("TODO: cardAction");
-}
-
-bool ThreadResource::chooseSTAMPButton(int idx) {
- warning("TODO: chooseSTAMPButton");
- return false;
-}
-
-#define GET_WORD READ_LE_UINT16(dataP); dataP += 2; {}
-
-void ThreadResource::parsePlayCommands() {
- Common::fill(&_vm->_voy._arr1[0][0], &_vm->_voy._arr1[8][20], 0);
- Common::fill(&_vm->_voy._arr2[0][0], &_vm->_voy._arr2[8][20], 0);
- Common::fill(&_vm->_voy._arr3[0][0], &_vm->_voy._arr3[3][20], 9999);
- Common::fill(&_vm->_voy._arr4[0][0], &_vm->_voy._arr4[3][20], 0);
- Common::fill(&_vm->_voy._arr5[0][0], &_vm->_voy._arr5[3][20], 9999);
- Common::fill(&_vm->_voy._arr6[0][0], &_vm->_voy._arr6[3][20], 0);
- Common::fill(&_vm->_voy._arr7[0], &_vm->_voy._arr7[20], 0);
-
- byte *dataP = _field28E;
- int v2;
-
- for (int parseIndex = 0; parseIndex < _parseCount; ++parseIndex) {
- uint16 id = GET_WORD;
-
- switch (id) {
- case 1:
- _vm->_playStamp2 = READ_LE_UINT16(dataP);
- dataP += 2;
- break;
-
- case 2:
- v2 = GET_WORD;
- if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
- _vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP);
- _vm->_voy._field468 = READ_LE_UINT16(dataP + 2);
- _vm->_voy._field46A = READ_LE_UINT16(dataP + 4);
-
- if (_vm->_voy._RTVNum < _vm->_voy._field468 ||
- (_vm->_voy._field468 + _vm->_voy._field46A) < _vm->_voy._RTVNum) {
- _vm->_eventsManager._videoComputerBut4 = -1;
- } else {
- _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468;
- addAudioEventStart();
-
- assert(_vm->_eventsManager._videoComputerBut4 < 38);
- _vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry(
- 0x7F00 + BLIND_TABLE[_vm->_eventsManager._videoComputerBut4])._picResource;
- _vm->_graphicsManager._backColors = _vm->_bVoy->boltEntry(0x7F01 +
- BLIND_TABLE[_vm->_eventsManager._videoComputerBut4])._cMapResource;
-
- (*_vm->_graphicsManager._vPort)->setupViewPort();
- _vm->_graphicsManager._backColors->startFade();
- (*_vm->_graphicsManager._vPort)->_flags |= 8;
- _vm->_graphicsManager.flipPage();
- _vm->_eventsManager.sWaitFlip();
-
- while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1))
- _vm->_eventsManager.delay(1);
-
- _vm->_voy._field478 = -2;
- _vm->_soundManager.setVOCOffset(_vm->_voy._vocSecondsOffset * 11025);
- Common::String filename = _vm->_soundManager.getVOCFileName(
- _vm->_eventsManager._videoComputerBut4 + 159);
- _vm->_soundManager.startVOCPlay(filename);
- _vm->_voy._field478 |= 16;
- _vm->_eventsManager.startCursorBlink();
-
- while (!_vm->shouldQuit() && !_vm->_voy._incriminate &&
- _vm->_soundManager.getVOCStatus())
- _vm->_eventsManager.delay(1);
-
- _vm->_voy._field478 |= 1;
- _vm->_soundManager.stopVOCPlay();
- addAudioEventEnd();
- _vm->_eventsManager.incrementTime(1);
- _vm->_eventsManager.incrementTime(1);
-
- _vm->_bVoy->freeBoltGroup(0x17F00);
- _vm->_voy._field478 = -17;
- _vm->_eventsManager._videoComputerBut4 = -1;
- _vm->_voy._field470 = 129;
- parseIndex = 999;
- }
- }
-
- dataP += 6;
- break;
-
- case 3:
- break;
-
- case 4:
- case 22:
- _vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP) - 1;
- dataP += 2;
-
- // TODO: Original had a block here that would never be executed
-
- _vm->_voy._vocSecondsOffset = 0;
- _vm->_voy._field468 = _vm->_voy._RTVNum;
- _vm->_voy._field478 &= ~0x11;
- _vm->playAVideo(_vm->_eventsManager._videoComputerBut4);
- _vm->_voy._field478 |= 1;
- _vm->_eventsManager._videoComputerBut4 = -1;
- parseIndex = 999;
- break;
-
- default:
- break;
- }
- }
-}
-
-#undef GET_WORD
-
-int ThreadResource::doApt() {
- warning("TODO: doApt");
- return 0;
-}
-
-void ThreadResource::doRoom() {
- warning("TODO: doRoom");
-}
-
-int ThreadResource::doInterface() {
- warning("TODO: doInterface");
- return 0;
-}
-
-void ThreadResource::addAudioEventStart() {
- _vm->_voy._events.push_back(VoyeurEvent(_vm->_eventsManager._videoComputerNum,
- _vm->_eventsManager._videoComputerBut1, _vm->_voy._delaySecs, 2,
- _vm->_eventsManager._videoComputerBut4, _vm->_voy._vocSecondsOffset,
- _vm->_eventsManager._videoDead));
-}
-
-void ThreadResource::addAudioEventEnd() {
- error("TODO: addAudioEventEnd");
-}
-
-/*------------------------------------------------------------------------*/
-
PtrResource::PtrResource(BoltFilesState &state, const byte *src) {
// Load pointer list
uint32 *idP = (uint32 *)&src[0];
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 4dc95fd7e7..5705608e71 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -119,7 +119,7 @@ public:
BoltFile(const Common::String &filename, BoltFilesState &state);
~BoltFile();
- bool getBoltGroup(uint32 id);
+ BoltGroup *getBoltGroup(uint32 id);
void freeBoltGroup(uint32 id);
void freeBoltMember(uint32 id);
byte *memberAddr(uint32 id);
@@ -299,6 +299,7 @@ public:
virtual ~ViewPortResource();
void setupViewPort();
+ void setupViewPort(PictureResource *pic);
int drawText(const Common::String &msg);
int textWidth(const Common::String &msg);
void addSaveRect(int pageIndex, const Common::Rect &r);
@@ -432,6 +433,7 @@ private:
void cardAction(const byte *p);
void addAudioEventStart();
void addAudioEventEnd();
+ void addVideoEventEnd();
public:
VoyeurEngine *_vm;
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index bb58bcd7bb..e89e603a7b 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -268,7 +268,7 @@ void ThreadResource::parsePlayCommands() {
Common::fill(&_vm->_voy._arr7[0], &_vm->_voy._arr7[20], 0);
byte *dataP = _field28E;
- int v2;
+ int v2, v3;
for (int parseIndex = 0; parseIndex < _parseCount; ++parseIndex) {
uint16 id = GET_WORD;
@@ -338,6 +338,50 @@ void ThreadResource::parsePlayCommands() {
break;
case 3:
+ v2 = GET_WORD;
+ if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+ _vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP);
+ _vm->_voy._field468 = READ_LE_UINT16(dataP + 2);
+ _vm->_voy._field46A = READ_LE_UINT16(dataP + 4);
+
+ if (_vm->_voy._RTVNum < _vm->_voy._field468 ||
+ (_vm->_voy._field468 + _vm->_voy._field46A) < _vm->_voy._RTVNum) {
+ _vm->_eventsManager._videoComputerBut4 = -1;
+ } else {
+ _vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468;
+ addAudioEventStart();
+ _vm->_voy._field478 &= ~1;
+ _vm->_voy._field478 |= 0x10;
+ _vm->playAVideo(_vm->_eventsManager._videoComputerBut4);
+
+ _vm->_voy._field478 &= ~0x10;
+ _vm->_voy._field478 |= 1;
+ addVideoEventEnd();
+ _vm->_eventsManager.incrementTime(1);
+
+ _vm->_eventsManager._videoComputerBut4 = -1;
+ _vm->_playStamp1 = -1;
+
+ if (_vm->_eventsManager._videoDead != -1) {
+ _vm->_bVoy->freeBoltGroup(0x10E00);
+ _vm->_eventsManager._videoDead = -1;
+ (*_vm->_graphicsManager._vPort)->_flags |= 8;
+
+ _vm->_graphicsManager.flipPage();
+ _vm->_eventsManager.sWaitFlip();
+ }
+
+ _vm->_eventsManager._videoDead = -1;
+ if (_field42 == 2 && _vm->_voy._incriminate == 0) {
+ _vm->_voy._field470 = 132;
+ parseIndex = 999;
+ } else {
+ _vm->_voy._field470 = 129;
+ }
+ }
+ }
+
+ dataP += 6;
break;
case 4:
@@ -345,17 +389,205 @@ void ThreadResource::parsePlayCommands() {
_vm->_eventsManager._videoComputerBut4 = READ_LE_UINT16(dataP) - 1;
dataP += 2;
- // TODO: Original had a block here that would never be executed
+ if (id == 22) {
+ int resolveIndex = GET_WORD;
+ _vm->_playStamp1 = _vm->_resolvePtr[resolveIndex];
+ }
_vm->_voy._vocSecondsOffset = 0;
_vm->_voy._field468 = _vm->_voy._RTVNum;
_vm->_voy._field478 &= ~0x11;
_vm->playAVideo(_vm->_eventsManager._videoComputerBut4);
_vm->_voy._field478 |= 1;
- _vm->_eventsManager._videoComputerBut4 = -1;
- parseIndex = 999;
+
+ if (id != 2) {
+ _vm->_eventsManager._videoComputerBut4 = -1;
+ parseIndex = 999;
+ } else {
+ // TODO: Double-check this
+ int count = _vm->_bVoy->getBoltGroup(_vm->_playStamp1)->_entries.size();
+ _vm->_soundManager.stopVOCPlay();
+ _vm->_eventsManager.getMouseInfo();
+
+ for (int i = 0; i < count; ++i) {
+ PictureResource *pic = _vm->_bVoy->boltEntry(_vm->_playStamp1 + i * 2)._picResource;
+ CMapResource *pal = _vm->_bVoy->boltEntry(_vm->_playStamp1 + i * 2 + 1)._cMapResource;
+
+ (*_vm->_graphicsManager._vPort)->setupViewPort(pic);
+ pal->startFade();
+
+ (*_vm->_graphicsManager._vPort)->_flags |= 8;
+ _vm->_graphicsManager.flipPage();
+ _vm->_eventsManager.sWaitFlip();
+
+ while (!_vm->shouldQuit() && (_vm->_eventsManager._fadeStatus & 1))
+ _vm->_eventsManager.delay(1);
+
+ if (i > 0) {
+ _vm->_bVoy->freeBoltMember(_vm->_playStamp1 + i * 2);
+ _vm->_bVoy->freeBoltMember(_vm->_playStamp1 + i * 2 + 1);
+ }
+
+ Common::String file = Common::String::format("news%d.voc", i + 1);
+ _vm->_soundManager.startVOCPlay(file);
+
+ while (!_vm->shouldQuit() && !_vm->_voy._incriminate &&
+ _vm->_soundManager.getVOCStatus()) {
+ _vm->_eventsManager.delay(1);
+ _vm->_eventsManager.getMouseInfo();
+ }
+
+ _vm->_soundManager.stopVOCPlay();
+
+ if (i == (count - 1))
+ _vm->_eventsManager.delay(480);
+
+ if (_vm->shouldQuit() || _vm->_voy._incriminate)
+ break;
+ }
+
+ _vm->_bVoy->freeBoltGroup(_vm->_playStamp1);
+ _vm->_playStamp1 = -1;
+ _vm->_eventsManager._videoComputerBut4 = -1;
+ parseIndex = 999;
+ }
break;
+ case 5:
+ v2 = READ_LE_UINT16(dataP);
+ if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+ _vm->_voy._field470 = 5;
+ int count = READ_LE_UINT16(dataP + 2);
+ _vm->_voy._field476 = READ_LE_UINT16(dataP + 4);
+
+ if (_vm->_voy._field474 != count) {
+ if (_vm->_voy._field474 > 1)
+ _vm->_voy._field478 &= ~0x100;
+
+ _vm->_voy._field474 = count;
+ _vm->_eventsManager._videoComputerBut1 = LEVEL_M[count - 1];
+ _vm->_eventsManager._videoComputerNum = LEVEL_H[count - 1];
+ //_vm->_v2A0A2 = 0;
+ _vm->_voy._RTVNum = 0;
+ _vm->_voy._RTANum = 255;
+ }
+
+ _vm->_voy._delaySecs = (_vm->_voy._field474 == 6) ? 1 : 0;
+ }
+
+ dataP += 6;
+ break;
+
+ case 6:
+ _vm->_voy._field470 = 6;
+ v2 = GET_WORD;
+ _vm->_playStamp1 = _vm->_resolvePtr[v2];
+ break;
+
+ case 7:
+ v2 = READ_LE_UINT16(dataP);
+ v3 = READ_LE_UINT16(dataP + 2) - 1;
+
+ if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+ int idx = 0;
+ while (_vm->_voy._arr1[idx][v3] != 9999)
+ ++idx;
+
+ _vm->_voy._arr1[idx][v3] = READ_LE_UINT16(dataP + 4) + READ_LE_UINT16(dataP + 6);
+ _vm->_voy._arr2[idx][v3] = v3;
+ }
+
+ dataP += 8;
+ break;
+
+ case 8:
+ v2 = READ_LE_UINT16(dataP);
+ v3 = READ_LE_UINT16(dataP + 2) - 1;
+
+ if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+ int idx = 0;
+ while (_vm->_voy._arr3[idx][v3] != 9999)
+ ++idx;
+
+ _vm->_voy._arr3[idx][v3] = READ_LE_UINT16(dataP + 4) + READ_LE_UINT16(dataP + 6);
+ _vm->_voy._arr4[idx][v3] = v3;
+ }
+
+ dataP += 8;
+ break;
+
+ case 9:
+ v2 = READ_LE_UINT16(dataP);
+ v3 = READ_LE_UINT16(dataP + 2) - 1;
+
+ if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+ int idx = 0;
+ while (_vm->_voy._arr5[idx][v3] != 9999)
+ ++idx;
+
+ _vm->_voy._arr5[idx][v3] = READ_LE_UINT16(dataP + 4) + READ_LE_UINT16(dataP + 6);
+ _vm->_voy._arr6[idx][v3] = v3;
+ }
+
+ dataP += 8;
+ break;
+
+ case 10:
+ if (_vm->_iForceDeath == -1) {
+ int randomVal;
+ do {
+ randomVal = _vm->getRandomNumber(3);
+ } while (randomVal == _vm->_voy._field4380);
+
+ _vm->_voy._field4380 = randomVal;
+ WRITE_LE_UINT16(_vm->_controlPtr->_ptr + 4, randomVal);
+ } else {
+ _vm->_voy._field4380 = _vm->_iForceDeath;
+ WRITE_LE_UINT16(_vm->_controlPtr->_ptr + 4, _vm->_iForceDeath);
+ }
+
+ _vm->saveLastInplay();
+ break;
+
+ case 11:
+ _vm->_voy._field478 = 2;
+ break;
+
+ case 12:
+ v2 = READ_LE_UINT16(dataP);
+
+ if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+ _vm->_voy._field47A = _vm->_resolvePtr[READ_LE_UINT16(dataP + 2)];
+ _vm->_voy._arr7[READ_LE_UINT16(dataP + 4) - 1] = 1;
+ }
+
+ dataP += 6;
+ break;
+
+ case 13:
+ v2 = READ_LE_UINT16(dataP);
+
+ if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == 0) {
+ _vm->_voy._field4E2 = READ_LE_UINT16(dataP + 2);
+ _vm->_voy._field4EC = READ_LE_UINT16(dataP + 4);
+ _vm->_voy._field4EE = READ_LE_UINT16(dataP + 6);
+
+ _vm->_voy._rect4E4.left = COMP_BUT_TABLE[_vm->_voy._field4E2 * 4];
+ _vm->_voy._rect4E4.top = COMP_BUT_TABLE[_vm->_voy._field4E2 * 4 + 1];
+ _vm->_voy._rect4E4.right = COMP_BUT_TABLE[_vm->_voy._field4E2 * 4 + 2];
+ _vm->_voy._rect4E4.bottom = COMP_BUT_TABLE[_vm->_voy._field4E2 * 4 + 3];
+ }
+
+ dataP += 8;
+ break;
+
+ case 14:
+ _vm->_playStamp1 = 2048;
+ _vm->_voy._field470 = 130;
+ break;
+
+ // TODO: More
+
default:
break;
}
@@ -389,4 +621,8 @@ void ThreadResource::addAudioEventEnd() {
error("TODO: addAudioEventEnd");
}
+void ThreadResource::addVideoEventEnd() {
+ error("TODO: addVideoEventEnd");
+}
+
} // End of namespace Voyeur
diff --git a/engines/voyeur/module.mk b/engines/voyeur/module.mk
index 1562624fbb..c52502d2e2 100644
--- a/engines/voyeur/module.mk
+++ b/engines/voyeur/module.mk
@@ -6,6 +6,7 @@ MODULE_OBJS := \
detection.o \
events.o \
files.o \
+ files_threads.o \
graphics.o \
sound.o \
staticres.o \
diff --git a/engines/voyeur/staticres.cpp b/engines/voyeur/staticres.cpp
index f64cbdcc45..f5dd561758 100644
--- a/engines/voyeur/staticres.cpp
+++ b/engines/voyeur/staticres.cpp
@@ -43,10 +43,35 @@ const int RESOLVE_TABLE[] = {
0x7500
};
+const int LEVEL_H[] = {
+ 4, 7, 7, 8, 9, 10, 2, 2, 4, 8, 8, 9, 9, 10, 10, 11, 11
+};
+
+const int LEVEL_M[] = {
+ 0, 0, 30, 0, 30, 0, 0, 0, 30, 0, 30, 0, 45, 0, 30, 0, 30
+};
+
const int BLIND_TABLE[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 9, 10, 11, 1, 11, 5, 12,
13, 16, 15, 16, 17, 18, 5, 6, 18, 17, 13, 13, 14, 14,
5, 12, 6, 6, 13, 14, 13
};
+const int COMP_BUT_TABLE[] = {
+ 269, 128, 307, 163,
+ 269, 128, 307, 163,
+ 68, 79, 98, 102,
+ 68, 79, 98, 102,
+ 68, 79, 98, 102,
+ 68, 79, 98, 102,
+ 248, 138, 291, 163,
+ 83, 132, 143, 156,
+ 248, 138, 291, 163,
+ 83, 132, 143, 156,
+ 83, 132, 143, 156,
+ 248, 138, 291, 163,
+ 68, 79, 98, 102,
+ 68, 79, 98, 102
+};
+
} // End of namespace Voyeur
diff --git a/engines/voyeur/staticres.h b/engines/voyeur/staticres.h
index 4cd00e4b7a..e9c4164848 100644
--- a/engines/voyeur/staticres.h
+++ b/engines/voyeur/staticres.h
@@ -31,8 +31,14 @@ extern const int COMPUTER_DEFAULTS[];
extern const int RESOLVE_TABLE[];
+extern const int LEVEL_H[];
+
+extern const int LEVEL_M[];
+
extern const int BLIND_TABLE[];
+extern const int COMP_BUT_TABLE[];
+
} // End of namespace Voyeur
#endif
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 6409bbbc0f..9d5c6a34e1 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -594,4 +594,8 @@ void VoyeurEngine::playAVideo(int id) {
warning("TODO: playAVideo");
}
+void VoyeurEngine::saveLastInplay() {
+ error("TODO: saveLastInplay");
+}
+
} // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 2619a5115d..7a585297a7 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -65,7 +65,6 @@ private:
Common::RandomSource _randomSource;
Common::Array<int> _resolves;
FontInfoResource _defaultFontInfo;
- int _iForceDeath;
void ESP_Init();
void initialiseManagers();
@@ -116,6 +115,7 @@ public:
int _playStamp1;
int _playStamp2;
const int *_resolvePtr;
+ int _iForceDeath;
public:
VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc);
virtual ~VoyeurEngine();
@@ -137,6 +137,7 @@ public:
void playRL2Video(const Common::String &filename);
void doTransitionCard(const Common::String &time, const Common::String &location);
void playAVideo(int id);
+ void saveLastInplay();
};
} // End of namespace Voyeur