aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/voyeur/files.cpp49
-rw-r--r--engines/voyeur/files.h19
-rw-r--r--engines/voyeur/voyeur.h2
-rw-r--r--engines/voyeur/voyeur_game.cpp4
4 files changed, 66 insertions, 8 deletions
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 84f0df81ef..5b7e475640 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -1309,10 +1309,11 @@ 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 = READ_LE_UINT16(&src[8]);
+ _flags = src[8];
}
bool ThreadResource::loadAStack(int idx) {
@@ -1341,8 +1342,52 @@ void ThreadResource::unloadAStack(int idx) {
}
}
-void ThreadResource::doState() {
+bool ThreadResource::doState() {
+ _flags |= 1;
+
+ if (!getStateInfo())
+ return false;
+
warning("TODO: stm_doState");
+ 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);
+ _field44 = 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() {
+ warning("TODO: stm_getButtonsText");
}
void ThreadResource::unloadAllStacks(VoyeurEngine *vm) {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 3ce9d4c2f6..1beb091a19 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -416,26 +416,39 @@ class ThreadResource {
public:
static int _stampFlags;
static int _useCount[8];
+ static byte *_threadDataPtr;
static void initUseCount();
static void unloadAllStacks(VoyeurEngine *vm);
+private:
+ bool getStateInfo();
+ byte *getDataOffset();
+ void getButtonsText();
public:
VoyeurEngine *_vm;
- int _field0;
+ int _threadId;
int _controlIndex;
int _field4, _field6;
- int _flags;
+ byte _flags;
+ int _field9;
int _field3A;
int _field3E;
+ int _field40;
+ int _field42;
+ int _field44;
+ uint32 _field46;
+ byte *_field4A;
+
byte *_ctlPtr;
+ byte *_field28E;
public:
ThreadResource(BoltFilesState &state, const byte *src);
virtual ~ThreadResource() {}
bool loadAStack(int idx);
void unloadAStack(int idx);
- void doState();
+ bool doState();
};
} // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 772343b00a..bf84893495 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -84,7 +84,7 @@ private:
void playStamp();
void initStamp();
void closeStamp();
- void initThreadStruct(ThreadResource *thread, int idx, int v3);
+ void initThreadStruct(ThreadResource *thread, int idx, int id);
protected:
// Engine APIs
virtual Common::Error run();
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index adaff87672..0401704d3c 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -78,11 +78,11 @@ void VoyeurEngine::closeStamp() {
ThreadResource::unloadAllStacks(this);
}
-void VoyeurEngine::initThreadStruct(ThreadResource *thread, int idx, int v3) {
+void VoyeurEngine::initThreadStruct(ThreadResource *thread, int idx, int id) {
thread->_controlIndex = -1;
if (thread->loadAStack(idx)) {
thread->_field4 = thread->_field6 = -1;
- thread->_field0 = v3;
+ thread->_threadId = id;
thread->_field3A = -1;
thread->_field3E = -1;