aboutsummaryrefslogtreecommitdiff
path: root/engines/voyeur
diff options
context:
space:
mode:
Diffstat (limited to 'engines/voyeur')
-rw-r--r--engines/voyeur/data.cpp31
-rw-r--r--engines/voyeur/files.cpp41
-rw-r--r--engines/voyeur/files.h23
-rw-r--r--engines/voyeur/files_threads.cpp126
-rw-r--r--engines/voyeur/voyeur.cpp4
-rw-r--r--engines/voyeur/voyeur_game.cpp25
6 files changed, 153 insertions, 97 deletions
diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index ed308f4c2a..9f528c1a76 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -237,7 +237,7 @@ void SVoy::reviewComputerEvent(int eventIndex) {
}
bool SVoy::checkForKey() {
- WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 0);
+ _vm->_controlPtr->_state->_v2 = 0;
if (_vm->_voy._victimMurdered)
return false;
@@ -247,25 +247,25 @@ bool SVoy::checkForKey() {
switch (e._type) {
case EVTYPE_VIDEO:
- switch (READ_LE_UINT32(_vm->_controlPtr->_ptr + 4)) {
+ switch (_vm->_controlPtr->_state->_v1) {
case 1:
if (e._audioVideoId == 33 && e._computerOn < 2 && e._computerOff >= 38)
- WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 1);
+ _vm->_controlPtr->_state->_v2 = 1;
break;
case 2:
if (e._audioVideoId == 47 && e._computerOn < 2 && e._computerOff >= 9)
- WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 2);
+ _vm->_controlPtr->_state->_v2 = 2;
break;
case 3:
if (e._audioVideoId == 46 && e._computerOn < 2 && e._computerOff > 2)
- WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 3);
+ _vm->_controlPtr->_state->_v2 = 3;
break;
case 4:
if (e._audioVideoId == 40 && e._computerOn < 2 && e._computerOff > 6)
- WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 4);
+ _vm->_controlPtr->_state->_v2 = 4;
break;
default:
@@ -274,17 +274,17 @@ bool SVoy::checkForKey() {
break;
case EVTYPE_AUDIO:
- switch (READ_LE_UINT32(_vm->_controlPtr->_ptr + 4)) {
+ switch (_vm->_controlPtr->_state->_v1) {
case 1:
if (e._audioVideoId == 8 && e._computerOn < 2 && e._computerOff > 26)
- WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 1);
+ _vm->_controlPtr->_state->_v2 = 1;
break;
case 3:
if (e._audioVideoId == 20 && e._computerOn < 2 && e._computerOff > 28)
- WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 3);
+ _vm->_controlPtr->_state->_v2 = 3;
if (e._audioVideoId == 35 && e._computerOn < 2 && e._computerOff > 18)
- WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 3);
+ _vm->_controlPtr->_state->_v2 = 3;
break;
default:
@@ -293,10 +293,10 @@ bool SVoy::checkForKey() {
break;
case EVTYPE_EVID:
- switch (READ_LE_UINT32(_vm->_controlPtr->_ptr + 4)) {
+ switch (_vm->_controlPtr->_state->_v1) {
case 4:
if (e._audioVideoId == 0x2400 && e._computerOn == 0x4f00 && e._computerOff == 17)
- WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 4);
+ _vm->_controlPtr->_state->_v2 = 4;
default:
break;
@@ -304,10 +304,10 @@ bool SVoy::checkForKey() {
break;
case EVTYPE_COMPUTER:
- switch (READ_LE_UINT32(_vm->_controlPtr->_ptr + 4)) {
+ switch (_vm->_controlPtr->_state->_v1) {
case 2:
if (e._computerOn == 13 && e._computerOff > 76)
- WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 2);
+ _vm->_controlPtr->_state->_v2 = 2;
break;
default:
@@ -316,8 +316,7 @@ bool SVoy::checkForKey() {
break;
}
- if (READ_LE_UINT32(_vm->_controlPtr->_ptr + 8) ==
- READ_LE_UINT32(_vm->_controlPtr->_ptr + 4))
+ if (_vm->_controlPtr->_state->_v2 == _vm->_controlPtr->_state->_v1)
return true;
}
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index ce2ebc5985..e39c1613de 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -565,6 +565,9 @@ void StampBoltFile::initResource(int resType) {
case 0:
initThread();
break;
+ case 4:
+ initState();
+ break;
case 6:
initPtr();
break;
@@ -591,6 +594,9 @@ void StampBoltFile::initPtr() {
_state._curMemberPtr->_data);
}
+ void initControlData();
+
+
void StampBoltFile::initControl() {
initDefault();
@@ -602,6 +608,14 @@ void StampBoltFile::initControl() {
_state._vm->_controlPtr = res;
}
+void StampBoltFile::initState() {
+ initDefault();
+
+ assert(_state._curMemberPtr->_size == 16);
+ _state._curMemberPtr->_stateResource = new StateResource(_state,
+ _state._curMemberPtr->_data);
+}
+
/*------------------------------------------------------------------------*/
BoltGroup::BoltGroup(Common::SeekableReadStream *f): _file(f) {
@@ -650,7 +664,9 @@ BoltEntry::BoltEntry(Common::SeekableReadStream *f, uint16 id): _file(f), _id(id
_fontInfoResource = nullptr;
_cMapResource = nullptr;
_vInitCycleResource = nullptr;
+
_ptrResource = nullptr;
+ _stateResource = nullptr;
_controlResource = nullptr;
_vInitCycleResource = nullptr;
_threadResource = nullptr;
@@ -674,9 +690,12 @@ BoltEntry::~BoltEntry() {
delete _fontResource;
delete _fontInfoResource;
delete _cMapResource;
- delete _vInitCycleResource;
+
delete _ptrResource;
delete _controlResource;
+ delete _stateResource;
+ delete _vInitCycleResource;
+ delete _threadResource;
}
void BoltEntry::load() {
@@ -690,7 +709,7 @@ bool BoltEntry::hasResource() const {
return _rectResource || _picResource || _viewPortResource || _viewPortListResource
|| _fontResource || _fontInfoResource || _cMapResource
|| _vInitCycleResource
- || _ptrResource || _controlResource || _threadResource;
+ || _ptrResource || _controlResource || _stateResource || _threadResource;
}
/*------------------------------------------------------------------------*/
@@ -1604,9 +1623,10 @@ PtrResource::PtrResource(BoltFilesState &state, const byte *src) {
/*------------------------------------------------------------------------*/
ControlResource::ControlResource(BoltFilesState &state, const byte *src) {
- // Get pointer
- uint32 ptrId = READ_LE_UINT32(&src[0x32]);
- state._curLibPtr->resolveIt(ptrId, &_ptr);
+ // Get Id for the state data. Since it refers to a following entry in the same
+ // group, for simplicity we set the _state back in the main playStamp method
+ _stateId = READ_LE_UINT32(&src[0x32]);
+ _state = nullptr;
for (int i = 0; i < 8; ++i)
_memberIds[i] = READ_LE_UINT16(src + i * 2);
@@ -1624,4 +1644,15 @@ ControlResource::ControlResource(BoltFilesState &state, const byte *src) {
/*------------------------------------------------------------------------*/
+StateResource::StateResource(BoltFilesState &state, const byte *src):
+ _v0(_vals[0]), _v1(_vals[1]), _v2(_vals[2]), _v3(_vals[3]) {
+ for (int i = 0; i < 4; ++i)
+ _vals[i] = READ_LE_UINT32(src + i * 4);
+}
+
+void StateResource::synchronize(Common::Serializer &s) {
+ for (int i = 0; i < 4; ++i)
+ s.syncAsSint32LE(_vals[i]);
+}
+
} // End of namespace Voyeur
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 7cdb61f4e8..a0d66550b9 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -44,6 +44,7 @@ class CMapResource;
class VInitCycleResource;
class PtrResource;
class ControlResource;
+class StateResource;
class ThreadResource;
#define DECOMPRESS_SIZE 0x7000
@@ -158,6 +159,7 @@ public:
class StampBoltFile: public BoltFile {
private:
void initThread();
+ void initState();
void initPtr();
void initControl();
protected:
@@ -212,6 +214,7 @@ public:
// stampblt.blt resource types
PtrResource *_ptrResource;
ControlResource *_controlResource;
+ StateResource *_stateResource;
ThreadResource *_threadResource;
public:
BoltEntry(Common::SeekableReadStream *f, uint16 id);
@@ -484,12 +487,30 @@ class ControlResource {
public:
int _memberIds[8];
byte *_entries[8];
- byte *_ptr;
+ int _stateId;
+ StateResource *_state;
ControlResource(BoltFilesState &state, const byte *src);
virtual ~ControlResource() {}
};
+class StateResource {
+public:
+ int _vals[4];
+ int &_v0;
+ int &_v1;
+ int &_v2;
+ int &_v3;
+
+ StateResource(BoltFilesState &state, const byte *src);
+ virtual ~StateResource() {}
+
+ /**
+ * Synchronizes the game data
+ */
+ void synchronize(Common::Serializer &s);
+};
+
class ThreadResource {
public:
static int _useCount[8];
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index b766733699..57d878f9cd 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -370,7 +370,7 @@ void ThreadResource::parsePlayCommands() {
// Play an audio event
v2 = READ_LE_UINT16(dataP);
- if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
+ if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
_vm->_audioVideoId = READ_LE_UINT16(dataP + 2) - 1;
_vm->_voy._field468 = READ_LE_UINT16(dataP + 4);
_vm->_voy._field46A = READ_LE_UINT16(dataP + 6);
@@ -401,7 +401,7 @@ void ThreadResource::parsePlayCommands() {
// Play a video event
v2 = READ_LE_UINT16(dataP);
- if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
+ if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
_vm->_audioVideoId = READ_LE_UINT16(dataP + 2) - 1;
_vm->_voy._field468 = READ_LE_UINT16(dataP + 4);
_vm->_voy._field46A = READ_LE_UINT16(dataP + 6);
@@ -512,7 +512,7 @@ void ThreadResource::parsePlayCommands() {
// Check whether transition to a given time period is allowed, and
// if so, load the time information for the new time period
v2 = READ_LE_UINT16(dataP);
- if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
+ if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
_vm->_voy._field470 = 5;
int count = READ_LE_UINT16(dataP + 2);
_vm->_voy._RTVLimit = READ_LE_UINT16(dataP + 4);
@@ -547,7 +547,7 @@ void ThreadResource::parsePlayCommands() {
v2 = READ_LE_UINT16(dataP);
v3 = READ_LE_UINT16(dataP + 2) - 1;
- if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
+ if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
int idx = 0;
while (_vm->_voy._videoHotspotTimes._min[idx][v3] != 9999)
++idx;
@@ -565,7 +565,7 @@ void ThreadResource::parsePlayCommands() {
v2 = READ_LE_UINT16(dataP);
v3 = READ_LE_UINT16(dataP + 2) - 1;
- if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
+ if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
int idx = 0;
while (_vm->_voy._audioHotspotTimes._min[idx][v3] != 9999)
++idx;
@@ -583,7 +583,7 @@ void ThreadResource::parsePlayCommands() {
v2 = READ_LE_UINT16(dataP);
v3 = READ_LE_UINT16(dataP + 2) - 1;
- if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
+ if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
int idx = 0;
while (_vm->_voy._evidenceHotspotTimes._min[idx][v3] != 9999)
++idx;
@@ -608,11 +608,11 @@ void ThreadResource::parsePlayCommands() {
} while (randomVal == _vm->_voy._victimNumber);
_vm->_voy._victimNumber = randomVal;
- WRITE_LE_UINT16(_vm->_controlPtr->_ptr + 4, randomVal);
+ _vm->_controlPtr->_state->_v1 = randomVal;
} else {
// Player has seen something that locks in the character to die
_vm->_voy._victimNumber = _vm->_iForceDeath;
- WRITE_LE_UINT16(_vm->_controlPtr->_ptr + 4, _vm->_iForceDeath);
+ _vm->_controlPtr->_state->_v1 = _vm->_iForceDeath;
}
_vm->saveLastInplay();
@@ -625,7 +625,7 @@ void ThreadResource::parsePlayCommands() {
case 12:
v2 = READ_LE_UINT16(dataP);
- if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
+ if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
_vm->_voy._boltGroupId2 = _vm->_resolvePtr[READ_LE_UINT16(dataP + 2)];
_vm->_voy._roomHotspotsEnabled[READ_LE_UINT16(dataP + 4) - 1] = true;
}
@@ -636,7 +636,7 @@ void ThreadResource::parsePlayCommands() {
case 13:
v2 = READ_LE_UINT16(dataP);
- if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
+ if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2) {
_vm->_voy._computerTextId = READ_LE_UINT16(dataP + 2);
_vm->_voy._computerTimeMin = READ_LE_UINT16(dataP + 4);
_vm->_voy._computerTimeMax = READ_LE_UINT16(dataP + 6);
@@ -673,7 +673,7 @@ void ThreadResource::parsePlayCommands() {
v2 = READ_LE_UINT16(dataP);
v3 = READ_LE_UINT16(dataP + 2);
- if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2)
+ if (v2 == 0 || _vm->_controlPtr->_state->_v1 == v2)
_vm->_voy._murderThreshold = v3;
dataP += 4;
@@ -715,9 +715,6 @@ void ThreadResource::parsePlayCommands() {
}
const byte *ThreadResource::cardPerform(const byte *card) {
- const byte *p2;
- byte *pDest;
-
uint16 id = *card++;
int varD = 5;
uint32 v2;
@@ -730,82 +727,87 @@ const byte *ThreadResource::cardPerform(const byte *card) {
case 1:
v2 = READ_LE_UINT32(card);
card += 4;
- WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card << 2), v2);
- ++card;
+ _vm->_controlPtr->_state->_vals[*card++] = v2;
break;
case 2:
- v2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2)),
- WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2), v2);
+ v2 = _vm->_controlPtr->_state->_vals[*card++];
+ _vm->_controlPtr->_state->_vals[*card++] = v2;
break;
case 3:
v2 = READ_LE_UINT32(card);
card += 4;
- WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2), v2);
+ _vm->_controlPtr->_state->_vals[*card++] = v2;
break;
case 4:
- v2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2));
- WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2), v2);
+ v2 = _vm->_controlPtr->_state->_vals[*card++];
+ _vm->_controlPtr->_state->_vals[*card++] = v2;
break;
- case 5:
+ case 5: {
v2 = READ_LE_UINT32(card);
card += 4;
- pDest = _vm->_controlPtr->_ptr + (*card++ << 2);
- WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) - v2);
+ int &v = _vm->_controlPtr->_state->_vals[*card++];
+ v -= v2;
break;
+ }
- case 6:
+ case 6: {
idx1 = *card++;
idx2 = *card++;
- v2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + idx2);
- pDest = _vm->_controlPtr->_ptr + idx1;
- WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) - v2);
+ v2 = _vm->_controlPtr->_state->_vals[idx1];
+ int &v = _vm->_controlPtr->_state->_vals[idx2];
+ v -= v2;
break;
+ }
- case 7:
+ case 7: {
v3 = *card++;
v2 = READ_LE_UINT32(card);
card += 4;
- pDest = _vm->_controlPtr->_ptr + (v3 << 2);
- WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) * v2);
+ int &v = _vm->_controlPtr->_state->_vals[v3];
+ v *= v2;
break;
+ }
- case 8:
+ case 8: {
idx1 = *card++;
idx2 = *card++;
- pDest = _vm->_controlPtr->_ptr + (idx1 << 2);
- p2 = _vm->_controlPtr->_ptr + (idx2 << 2);
- WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) * READ_LE_UINT32(p2));
+ int &v1 = _vm->_controlPtr->_state->_vals[idx1];
+ int &v2 = _vm->_controlPtr->_state->_vals[idx2];
+ v1 *= v2;
break;
+ }
- case 9:
+ case 9: {
idx1 = *card++;
v2 = READ_LE_UINT32(card);
card += 4;
- pDest = _vm->_controlPtr->_ptr + (idx1 << 2);
- WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) / v2);
+ int &v = _vm->_controlPtr->_state->_vals[idx1];
+ v /= v2;
break;
+ }
- case 10:
+ case 10: {
idx1 = *card++;
idx2 = *card++;
- pDest = _vm->_controlPtr->_ptr + (idx1 << 2);
- p2 = _vm->_controlPtr->_ptr + (idx2 << 2);
- WRITE_LE_UINT32(pDest, READ_LE_UINT32(pDest) / READ_LE_UINT32(p2));
+ int &v1 = _vm->_controlPtr->_state->_vals[idx1];
+ int &v2 = _vm->_controlPtr->_state->_vals[idx2];
+ v1 /= v2;
break;
-
+ }
+
case 11:
v2 = READ_LE_UINT32(card);
card += 4;
v2 = _vm->getRandomNumber(v2 - 1) + 1;
- WRITE_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2), v2);
+ _vm->_controlPtr->_state->_vals[*card++] = v2;
break;
case 17:
@@ -815,7 +817,7 @@ const byte *ThreadResource::cardPerform(const byte *card) {
break;
case 18:
- v2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*card++ << 2));
+ v2 = _vm->_controlPtr->_state->_vals[*card++];
_vm->_glGoState = getStateFromID(v2);
break;
@@ -921,45 +923,45 @@ const byte *ThreadResource::cardPerform(const byte *card) {
}
bool ThreadResource::cardPerform2(const byte *pSrc, int cardCmdId) {
- uint32 vLong, vLong2;
+ int vLong, vLong2;
switch (cardCmdId) {
case 21:
- vLong = READ_LE_UINT32(pSrc + 1);
- return READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)) == vLong;
+ vLong = (int32)READ_LE_UINT32(pSrc + 1);
+ return _vm->_controlPtr->_state->_vals[*pSrc] == vLong;
case 22:
- vLong = READ_LE_UINT32(pSrc + 1);
- return READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2)) != vLong;
+ vLong = (int32)READ_LE_UINT32(pSrc + 1);
+ return _vm->_controlPtr->_state->_vals[*pSrc] != vLong;
case 23:
- vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2));
- vLong2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*(pSrc + 1) << 2));
+ vLong = _vm->_controlPtr->_state->_vals[*pSrc];
+ vLong2 = _vm->_controlPtr->_state->_vals[*(pSrc + 1)];
return vLong == vLong2;
case 24:
- vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2));
- vLong2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*(pSrc + 1) << 2));
+ vLong = _vm->_controlPtr->_state->_vals[*pSrc];
+ vLong2 = _vm->_controlPtr->_state->_vals[*(pSrc + 1)];
return vLong != vLong2;
case 25:
- vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2));
- vLong2 = READ_LE_UINT32(pSrc + 1);
+ vLong = _vm->_controlPtr->_state->_vals[*pSrc];
+ vLong2 = (int32)READ_LE_UINT32(pSrc + 1);
return vLong < vLong2;
case 26:
- vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2));
- vLong2 = READ_LE_UINT32(pSrc + 1);
+ vLong = _vm->_controlPtr->_state->_vals[*pSrc];
+ vLong2 = (int32)READ_LE_UINT32(pSrc + 1);
return vLong > vLong2;
case 27:
- vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2));
- vLong2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*(pSrc + 1) << 2));
+ vLong = _vm->_controlPtr->_state->_vals[*pSrc];
+ vLong2 = _vm->_controlPtr->_state->_vals[*(pSrc + 1)];
return vLong < vLong2;
case 28:
- vLong = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*pSrc << 2));
- vLong2 = READ_LE_UINT32(_vm->_controlPtr->_ptr + (*(pSrc + 1) << 2));
+ vLong = _vm->_controlPtr->_state->_vals[*pSrc];
+ vLong2 = _vm->_controlPtr->_state->_vals[*(pSrc + 1)];
return vLong > vLong2;
default:
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 1142599f12..890229762b 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -696,8 +696,7 @@ void VoyeurEngine::flipPageAndWaitForFade() {
void VoyeurEngine::showEndingNews() {
_playStampGroupId = (_voy._field4382 - 1) * 256 + 0x7700;
- _voy._boltGroupId2 = (READ_LE_UINT16(_controlPtr->_ptr + 4)
- - 1) * 256 + 0x7B00;
+ _voy._boltGroupId2 = (_controlPtr->_state->_v1 - 1) * 256 + 0x7B00;
_bVoy->getBoltGroup(_playStampGroupId);
_bVoy->getBoltGroup(_voy._boltGroupId2);
@@ -857,6 +856,7 @@ void VoyeurEngine::synchronize(Common::Serializer &s) {
_voy.synchronize(s);
_graphicsManager.synchronize(s);
_mainThread->synchronize(s);
+ _controlPtr->_state->synchronize(s);
}
/*------------------------------------------------------------------------*/
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index cfd0b6083a..747e0edac3 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -31,6 +31,9 @@ void VoyeurEngine::playStamp() {
_filesManager.openBoltLib("stampblt.blt", _stampLibPtr);
_stampLibPtr->getBoltGroup(0);
+ _controlPtr->_state = _stampLibPtr->boltEntry(_controlPtr->_stateId >> 16)._stateResource;
+ assert(_controlPtr->_state);
+
_resolvePtr = &RESOLVE_TABLE[0];
initStamp();
@@ -640,7 +643,7 @@ void VoyeurEngine::reviewTape() {
pt = _eventsManager.getMousePos();
if (_eventsManager._mouseClicked && _voy._viewBounds->left == pt.x &&
(_voy._eventFlags & EVTFLAG_40) && _eventsManager._rightClick) {
- WRITE_LE_UINT32(_controlPtr->_ptr + 4, (pt.y / 60) + 1);
+ _controlPtr->_state->_v1 = (pt.y / 60) + 1;
foundIndex = -1;
_eventsManager._rightClick = 0;
}
@@ -806,38 +809,38 @@ void VoyeurEngine::doTapePlaying() {
}
bool VoyeurEngine::checkForMurder() {
- int v = READ_LE_UINT32(_controlPtr->_ptr + 12);
+ int v = _controlPtr->_state->_v3;
for (int idx = 0; idx < _voy._eventCount; ++idx) {
VoyeurEvent &evt = _voy._events[idx];
if (evt._type == EVTYPE_VIDEO) {
- switch (READ_LE_UINT32(_controlPtr->_ptr + 4)) {
+ switch (_controlPtr->_state->_v1) {
case 1:
if (evt._audioVideoId == 41 && evt._computerOn <= 15 &&
(evt._computerOff + evt._computerOn) >= 16) {
- WRITE_LE_UINT32(_controlPtr->_ptr + 12, 1);
+ _controlPtr->_state->_v3 = 1;
}
break;
case 2:
if (evt._audioVideoId == 53 && evt._computerOn <= 19 &&
(evt._computerOff + evt._computerOn) >= 21) {
- WRITE_LE_UINT32(_controlPtr->_ptr + 12, 2);
+ _controlPtr->_state->_v3 = 2;
}
break;
case 3:
if (evt._audioVideoId == 50 && evt._computerOn <= 28 &&
(evt._computerOff + evt._computerOn) >= 29) {
- WRITE_LE_UINT32(_controlPtr->_ptr + 12, 3);
+ _controlPtr->_state->_v3 = 3;
}
break;
case 4:
if (evt._audioVideoId == 43 && evt._computerOn <= 10 &&
(evt._computerOff + evt._computerOn) >= 14) {
- WRITE_LE_UINT32(_controlPtr->_ptr + 12, 4);
+ _controlPtr->_state->_v3 = 4;
}
break;
@@ -846,13 +849,13 @@ bool VoyeurEngine::checkForMurder() {
}
}
- if (READ_LE_UINT32(_controlPtr->_ptr + 12) == READ_LE_UINT32(_controlPtr->_ptr + 4)) {
+ if (_controlPtr->_state->_v3 == _controlPtr->_state->_v1) {
_voy._videoEventId = idx;
return true;
}
}
- WRITE_LE_UINT32(_controlPtr->_ptr + 12, v);
+ _controlPtr->_state->_v3 = v;
_voy._videoEventId = -1;
return false;
}
@@ -891,7 +894,7 @@ bool VoyeurEngine::checkForIncriminate() {
}
if (_voy._field4382) {
- WRITE_LE_UINT32(_controlPtr->_ptr + 12, 88);
+ _controlPtr->_state->_v3 = 88;
_voy._videoEventId = idx;
return true;
}
@@ -951,7 +954,7 @@ int VoyeurEngine::getChooseButton() {
for (uint idx = 0; idx < hotspots.size(); ++idx) {
if (hotspots[idx].contains(pt)) {
- if (!_voy._victimMurdered || (idx + 1) != READ_LE_UINT32(_controlPtr->_ptr + 4)) {
+ if (!_voy._victimMurdered || ((int)idx + 1) != _controlPtr->_state->_v1) {
selectedIndex = idx;
if (selectedIndex != prevIndex) {
PictureResource *btnPic = _bVoy->boltEntry(_playStampGroupId + 8 + idx)._picResource;