aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2013-12-09 22:22:32 -0500
committerPaul Gilbert2013-12-09 22:22:32 -0500
commit03f7fb64dbbdd3d595f15b7fa0f12f42eaee02eb (patch)
treee7a0599087d5e7c77c1572c57806a8257f0032e0
parentafc4e0ed333ca4acd5fcb092362f9910225ffd93 (diff)
downloadscummvm-rg350-03f7fb64dbbdd3d595f15b7fa0f12f42eaee02eb.tar.gz
scummvm-rg350-03f7fb64dbbdd3d595f15b7fa0f12f42eaee02eb.tar.bz2
scummvm-rg350-03f7fb64dbbdd3d595f15b7fa0f12f42eaee02eb.zip
VOYEUR: Implemented the playStamp method
-rw-r--r--engines/voyeur/events.cpp29
-rw-r--r--engines/voyeur/events.h13
-rw-r--r--engines/voyeur/files.cpp75
-rw-r--r--engines/voyeur/files.h21
-rw-r--r--engines/voyeur/sound.cpp4
-rw-r--r--engines/voyeur/sound.h1
-rw-r--r--engines/voyeur/voyeur.cpp2
-rw-r--r--engines/voyeur/voyeur.h14
-rw-r--r--engines/voyeur/voyeur_game.cpp196
9 files changed, 336 insertions, 19 deletions
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 5d347d0964..5edcf22d05 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -71,6 +71,7 @@ EventsManager::EventsManager(): _intPtr(_gameData),
_mouseButton = 0;
_fadeStatus = 0;
_priorFrameTime = g_system->getMillis();
+ _joe = 0;
Common::fill(&_keyState[0], &_keyState[256], false);
_v2A0A2 = 0;
@@ -404,4 +405,32 @@ void EventsManager::mouseOff() {
CursorMan.showMouse(false);
}
+void EventsManager::getMouseInfo() {
+ if (_vm->_voy._eCursorOff[58] & 0x10) {
+ if ((_gameCounter - _joe) > 8) {
+ _joe = _gameCounter;
+
+ // TODO: Figure out difference between setOneColor and setColor calls
+ if (_vm->_bob) {
+ _vm->_bob = false;
+ //_vm->_graphicsManager.setColor(128, 55, 5, 5);
+ _vm->_graphicsManager.setColor(128, 220, 20, 20);
+ } else {
+ _vm->_bob = true;
+ //_vm->_graphicsManager.setColor(128, 55, 55, 55);
+ _vm->_graphicsManager.setColor(128, 220, 20, 20);
+ }
+ }
+ }
+
+ _vm->_voy._incriminate = _vm->_voy._newIncriminate;
+ _vm->_voy._lastInplay = _vm->_voy._newLastInplay;
+ _vm->_voy._fadeFunc = _vm->_voy._newFadeFunc;
+ _vm->_voy._fadeICF1 = _vm->_voy._newFadeICF1;
+}
+
+void EventsManager::checkForKey() {
+ warning("TODO: checkForKey");
+}
+
} // End of namespace Voyeur
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 3cfdca4faa..c7bd52d59a 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -104,16 +104,22 @@ public:
int _field437E;
int _field4380;
int _field4382;
- int _field4384;
+ int _videoEventId;
byte *_field4386;
int _curICF0;
int _curICF1;
int _fadeICF0;
int _fadeICF1;
- int _fadeFunc;
+ void (*_fadeFunc)();
int _lastInplay;
int _incriminate;
int _policeEvent;
+
+ // Fields not originally in _voy, but I'm putting in for convenience
+ int _newIncriminate;
+ int _newLastInplay;
+ int _newFadeICF1;
+ void (*_newFadeFunc)();
};
class IntData {
@@ -145,6 +151,7 @@ private:
VoyeurEngine *_vm;
uint32 _priorFrameTime;
uint32 _gameCounter;
+ uint32 _joe;
bool _keyState[256];
int _mouseButton;
Common::List<IntNode *> _intNodes;
@@ -198,6 +205,8 @@ public:
void mouseOn();
void mouseOff();
Common::Point getMousePos() { return _mousePos; }
+ void getMouseInfo();
+ void checkForKey();
};
} // End of namespace Voyeur
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index c5838637c8..056be5d4c4 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -1316,6 +1316,18 @@ ThreadResource::ThreadResource(BoltFilesState &state, const byte *src):
_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);
@@ -1348,8 +1360,18 @@ bool ThreadResource::doState() {
if (!getStateInfo())
return false;
- warning("TODO: stm_doState");
- return true;
+ getButtonsFlags();
+ getField1CE();
+
+ _vm->_glGoScene = -1;
+ _vm->_glGoStack = -1;
+
+ performOpenCard();
+ if (_field40 & 1) {
+ return chooseSTAMPButton(_vm->getRandomNumber(_field42 - 1));
+ } else {
+ return true;
+ }
}
bool ThreadResource::getStateInfo() {
@@ -1393,7 +1415,7 @@ void ThreadResource::getButtonsText() {
if (*p == 0xC0) {
++p;
if (*p++ & 0x80) {
- assert(idx < 7);
+ assert(idx < 63);
_field8E[idx] = getRecordOffset(p);
p += 4;
}
@@ -1404,6 +1426,35 @@ void ThreadResource::getButtonsText() {
}
}
+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) {
@@ -1413,6 +1464,15 @@ void ThreadResource::unloadAllStacks(VoyeurEngine *vm) {
}
}
+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);
}
@@ -1467,6 +1527,15 @@ const byte *ThreadResource::getNextRecord(const byte *p) {
}
}
+void ThreadResource::cardAction(const byte *p) {
+ warning("TODO: cardAction");
+}
+
+bool ThreadResource::chooseSTAMPButton(int idx) {
+ warning("TODO: chooseSTAMPButton");
+ return false;
+}
+
/*------------------------------------------------------------------------*/
PtrResource::PtrResource(BoltFilesState &state, const byte *src) {
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 13023f80fb..f79c723733 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -424,8 +424,12 @@ private:
bool getStateInfo();
byte *getDataOffset();
void getButtonsText();
+ void getButtonsFlags();
+ void getField1CE();
+ void performOpenCard();
const byte *getRecordOffset(const byte *p);
const byte *getNextRecord(const byte *p);
+ void cardAction(const byte *p);
public:
VoyeurEngine *_vm;
@@ -441,17 +445,30 @@ public:
int _field44;
uint32 _field46;
byte *_field4A;
- const byte *_field8E[8];
-
+ byte _field4E[64];
+ const byte *_field8E[64];
+ byte _field18E[64];
+ const byte *_field1CE[48];
byte *_ctlPtr;
byte *_field28E;
public:
ThreadResource(BoltFilesState &state, const byte *src);
virtual ~ThreadResource() {}
+ void initThreadStruct(int idx, int id);
bool loadAStack(int idx);
void unloadAStack(int idx);
bool doState();
+
+ bool chooseSTAMPButton(int idx);
+ void parsePlayCommands();
+ int doInterface();
+ void doRoom();
+ int doApt();
+ void doTapePlaying();
+ void checkForMurder();
+ void checkForIncriminate();
+
};
} // End of namespace Voyeur
diff --git a/engines/voyeur/sound.cpp b/engines/voyeur/sound.cpp
index baba45fb45..f30fc649b8 100644
--- a/engines/voyeur/sound.cpp
+++ b/engines/voyeur/sound.cpp
@@ -51,4 +51,8 @@ void SoundManager::abortVOCMap() {
_mixer->stopHandle(_soundHandle);
}
+void SoundManager::stopVOCPlay() {
+ warning("TODO: stopVOCPlay()");
+}
+
} // End of namespace Voyeur
diff --git a/engines/voyeur/sound.h b/engines/voyeur/sound.h
index 0784b9274e..6f233e66d2 100644
--- a/engines/voyeur/sound.h
+++ b/engines/voyeur/sound.h
@@ -43,6 +43,7 @@ public:
void playVOCMap(byte *voc, int vocSize);
bool vocMapStatus();
void continueVocMap();
+ void stopVOCPlay();
void abortVOCMap();
};
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 7312728c24..58e94866b1 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -41,6 +41,8 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
_bVoy = NULL;
_iForceDeath = -1;
_controlPtr = NULL;
+ _bob = false;
+ _playStamp1 = _playStamp2 = 0;
initialiseManagers();
}
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index bf84893495..a2bde98e72 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -84,7 +84,14 @@ private:
void playStamp();
void initStamp();
void closeStamp();
- void initThreadStruct(ThreadResource *thread, int idx, int id);
+ void reviewTape();
+ bool doGossip();
+ int doApt();
+ void doTapePlaying();
+ bool checkForMurder();
+ void checkForIncriminate();
+ void playAVideoEvent(int eventId);
+ int getChooseButton();
protected:
// Engine APIs
virtual Common::Error run();
@@ -103,6 +110,11 @@ public:
ControlResource *_controlPtr;
byte *_stampData;
BoltGroup *_stackGroupPtr;
+ int _glGoScene;
+ int _glGoStack;
+ bool _bob;
+ int _playStamp1;
+ int _playStamp2;
public:
VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc);
virtual ~VoyeurEngine();
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 0401704d3c..4545a73416 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -45,7 +45,7 @@ void VoyeurEngine::playStamp() {
PtrResource *threadsList = _stampLibPtr->boltEntry(3)._ptrResource;
ThreadResource *threadP = threadsList->_entries[0]->_threadResource;
- initThreadStruct(threadP, 0, 0);
+ threadP->initThreadStruct(0, 0);
_voy._delaySecs = 0;
_eventsManager._videoComputerNum = 9;
@@ -53,9 +53,159 @@ void VoyeurEngine::playStamp() {
_eventsManager._v2A0A2 = 0;
_voy._eCursorOff[53] = 1;
+ int buttonId;
bool breakFlag = false;
while (!breakFlag && !shouldQuit()) {
- breakFlag = true;
+ _eventsManager.getMouseInfo();
+ _playStamp1 = _playStamp2 = -1;
+ _eventsManager._videoComputerBut4 = -1;
+
+ threadP->parsePlayCommands();
+
+ bool flag = breakFlag = (_voy._eCursorOff[58] & 2) != 0;
+
+ switch (_voy._eCursorOff[54]) {
+ case 5:
+ buttonId = threadP->doInterface();
+
+ if (buttonId == -2) {
+ switch (doApt()) {
+ case 0:
+ _voy._eCursorOff[55] = 140;
+ break;
+ case 1:
+ _voy._eCursorOff[58] = -2;
+ _voy._eCursorOff[53] = 1;
+ threadP->chooseSTAMPButton(22);
+ _voy._eCursorOff[55] = 143;
+ break;
+ case 2:
+ _voy._eCursorOff[58] = -2;
+ reviewTape();
+ _voy._eCursorOff[53] = 1;
+ _voy._eCursorOff[55] = 142;
+ break;
+ case 3:
+ _voy._eCursorOff[58] = -2;
+ threadP->chooseSTAMPButton(21);
+ break;
+ case 4:
+ breakFlag = true;
+ break;
+ case 5:
+ doGossip();
+ _voy._eCursorOff[53] = 1;
+ _voy._eCursorOff[55] = 141;
+ _voy._eCursorOff[58] = -1;
+ break;
+ default:
+ break;
+ }
+ } else {
+ threadP->chooseSTAMPButton(buttonId);
+ }
+ break;
+
+ case 6:
+ threadP->doRoom();
+ break;
+
+ case 16:
+ _voy._eCursorOff[56] = 17;
+ buttonId = threadP->doApt();
+
+ switch (buttonId) {
+ case 1:
+ threadP->chooseSTAMPButton(22);
+ flag = true;
+ break;
+ case 2:
+ reviewTape();
+ _voy._eCursorOff[53] = 1;
+ break;
+ case 4:
+ flag = true;
+ breakFlag = true;
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case 17:
+ doTapePlaying();
+ if (!checkForMurder() && _voy._eCursorOff[56] <= 15)
+ checkForIncriminate();
+
+ if (_voy._videoEventId != -1)
+ playAVideoEvent(_voy._videoEventId);
+ _voy._eCursorOff[58] &= 0x10;
+ threadP->chooseSTAMPButton(0);
+ break;
+
+ case 130: {
+ //_tmflag = 1;
+ if (_bVoy->getBoltGroup(_playStamp1)) {
+ _graphicsManager._backgroundPage = _bVoy->boltEntry(_playStamp1)._picResource;
+ _graphicsManager._backColors = _bVoy->boltEntry(_playStamp1 + 1)._cMapResource;
+
+ int buttonId = getChooseButton();
+ if (_voy._fadeFunc)
+ buttonId = 4;
+
+ _bVoy->freeBoltGroup(_playStamp1);
+ _graphicsManager.screenReset();
+ _playStamp1 = -1;
+ flag = true;
+
+ if (buttonId == 4) {
+ _voy._eCursorOff[54] = 131;
+ _eventsManager.checkForKey();
+ threadP->chooseSTAMPButton(buttonId);
+ flag = true;
+ } else {
+ threadP->chooseSTAMPButton(buttonId);
+ _voy._eCursorOff[53] = 1;
+ }
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ do {
+ if (flag) {
+ if (_playStamp2 != -1) {
+ _soundManager.stopVOCPlay();
+ _playStamp2 = -1;
+ }
+
+ _eventsManager._videoComputerBut4 = -1;
+
+ if (_voy._eCursorOff[59] != -1) {
+ _bVoy->freeBoltGroup(_voy._eCursorOff[59]);
+ _voy._eCursorOff[59] = -1;
+ }
+
+ if (_playStamp1 != -1) {
+ _bVoy->freeBoltGroup(_playStamp1);
+ _playStamp1 = -1;
+ }
+
+ // Break out of loop
+ flag = false;
+
+ } else if (threadP->_field40 == 2) {
+ _eventsManager.getMouseInfo();
+ threadP->chooseSTAMPButton(0);
+ flag = true;
+ } else {
+ threadP->chooseSTAMPButton(0);
+ flag = true;
+ }
+ } while (flag);
}
_voy._field4386 = 0;
@@ -78,16 +228,40 @@ void VoyeurEngine::closeStamp() {
ThreadResource::unloadAllStacks(this);
}
-void VoyeurEngine::initThreadStruct(ThreadResource *thread, int idx, int id) {
- thread->_controlIndex = -1;
- if (thread->loadAStack(idx)) {
- thread->_field4 = thread->_field6 = -1;
- thread->_threadId = id;
- thread->_field3A = -1;
- thread->_field3E = -1;
+void VoyeurEngine::reviewTape() {
+ warning("TODO: reviewTape");
+}
- thread->doState();
- }
+bool VoyeurEngine::doGossip() {
+ warning("TODO: doGossip");
+ return false;
+}
+
+int VoyeurEngine::doApt() {
+ warning("TODO");
+ return 0;
+}
+
+void VoyeurEngine::doTapePlaying() {
+ warning("TODO");
+}
+
+bool VoyeurEngine::checkForMurder() {
+ warning("TODO");
+ return false;
+}
+
+void VoyeurEngine::checkForIncriminate() {
+ warning("TODO");
+}
+
+void VoyeurEngine::playAVideoEvent(int eventId) {
+ warning("TODO");
+}
+
+int VoyeurEngine::getChooseButton() {
+ warning("TODO");
+ return 0;
}
} // End of namespace Voyeur