aboutsummaryrefslogtreecommitdiff
path: root/engines/voyeur
diff options
context:
space:
mode:
authorPaul Gilbert2013-12-28 18:37:37 +1100
committerPaul Gilbert2013-12-28 18:37:37 +1100
commitb08e80cd6643b366774551360c7ba9ed611d48e6 (patch)
tree93a07c8142c220906a3bf033c2d63b3218972422 /engines/voyeur
parent84752aa27227bc3dde6005f818d4b2a9b21b8b5b (diff)
downloadscummvm-rg350-b08e80cd6643b366774551360c7ba9ed611d48e6.tar.gz
scummvm-rg350-b08e80cd6643b366774551360c7ba9ed611d48e6.tar.bz2
scummvm-rg350-b08e80cd6643b366774551360c7ba9ed611d48e6.zip
VOYEUR: Implemented evidence display code
Diffstat (limited to 'engines/voyeur')
-rw-r--r--engines/voyeur/events.cpp20
-rw-r--r--engines/voyeur/events.h18
-rw-r--r--engines/voyeur/files_threads.cpp8
-rw-r--r--engines/voyeur/voyeur.cpp12
-rw-r--r--engines/voyeur/voyeur.h2
-rw-r--r--engines/voyeur/voyeur_game.cpp80
6 files changed, 115 insertions, 25 deletions
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index d622a6d00f..b5643e44e6 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -213,6 +213,18 @@ void EventsManager::delay(int cycles) {
}
}
+void EventsManager::delayClick(int cycles) {
+ uint32 totalMilli = cycles * 1000 / GAME_FRAME_RATE;
+ uint32 delayEnd = g_system->getMillis() + totalMilli;
+
+ while (!_vm->shouldQuit() && g_system->getMillis() < delayEnd
+ && !_vm->_voy._incriminate) {
+ g_system->delayMillis(10);
+
+ pollEvents();
+ }
+}
+
void EventsManager::pollEvents() {
checkForNextFrameCounter();
@@ -370,6 +382,10 @@ void EventsManager::fadeIntFunc() {
warning("TODO");
}
+void EventsManager::deleteIntNode(IntNode *node) {
+ _intNodes.remove(node);
+}
+
void EventsManager::vInitColor() {
_fadeIntNode._intFunc = &EventsManager::vDoFadeInt;
_cycleIntNode._intFunc = &EventsManager::vDoCycleInt;
@@ -539,6 +555,10 @@ void EventsManager::addComputerEventEnd(int v) {
++_vm->_voy._eventCount;
}
+void EventsManager::stopEvidDim() {
+ deleteIntNode(&_evIntNode);
+}
+
Common::String EventsManager::getEvidString(int eventIndex) {
assert(eventIndex <= _vm->_voy._eventCount);
VoyeurEvent &e = _vm->_voy._events[eventIndex];
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 5a94434d78..1e4559c65b 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -89,6 +89,8 @@ public:
int _field476;
int _field478;
int _field47A;
+ PictureResource *_evPicPtrs[6];
+ CMapResource *_evCmPtrs[6];
int _field4AC;
int _field4AE[5];
int _field4B8;
@@ -105,15 +107,7 @@ public:
int _timeStart;
int _duration;
int _vidStart;
- int _doApt;
- int _function;
- int _anim;
- int _level;
- int _levelDone;
- int _flags;
- int _evGroup;
- byte *_evPicPtrs[6];
- byte *_evCmPtrs[6];
+
int _audioTime;
int _phones[5];
int _numPhonesUsed;
@@ -187,13 +181,14 @@ private:
void vDoFadeInt();
void vDoCycleInt();
void fadeIntFunc();
+ void deleteIntNode(IntNode *node);
public:
IntData _gameData;
IntData &_intPtr;
IntNode _fadeIntNode;
IntNode _fade2IntNode;
IntNode _cycleIntNode;
- IntNode _evintnode;
+ IntNode _evIntNode;
IntNode _mainIntNode;
int _cycleStatus;
int _fadeFirstCol, _fadeLastCol;
@@ -215,6 +210,7 @@ public:
void vInitColor();
void delay(int cycles);
+ void delayClick(int cycles);
void pollEvents();
void startFade(CMapResource *cMap);
void addIntNode(IntNode *node);
@@ -240,6 +236,8 @@ public:
void addEvidEventEnd(int dead);
void addComputerEventStart();
void addComputerEventEnd(int v);
+ void stopEvidDim();
+
Common::String getEvidString(int eventIndex);
};
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 2d389c014c..944c9db558 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -408,7 +408,7 @@ void ThreadResource::parsePlayCommands() {
while (!_vm->shouldQuit() && !_vm->_voy._incriminate &&
_vm->_soundManager.getVOCStatus())
- _vm->_eventsManager.delay(1);
+ _vm->_eventsManager.delayClick(1);
_vm->_voy._field478 |= 1;
_vm->_soundManager.stopVOCPlay();
@@ -517,7 +517,7 @@ void ThreadResource::parsePlayCommands() {
while (!_vm->shouldQuit() && !_vm->_voy._incriminate &&
_vm->_soundManager.getVOCStatus()) {
- _vm->_eventsManager.delay(1);
+ _vm->_eventsManager.delayClick(1);
_vm->_eventsManager.getMouseInfo();
}
@@ -1272,7 +1272,7 @@ void ThreadResource::doRoom() {
voy._field478 &= ~0x10;
if (!voy._incriminate)
- vm._eventsManager.delay(18000);
+ vm._eventsManager.delayClick(18000);
vm._bVoy->freeBoltGroup(vm._playStamp1);
vm._bVoy->getBoltGroup(vm._playStamp1);
@@ -1722,7 +1722,7 @@ void ThreadResource::doAptAnim(int mode) {
pal->startFade();
_vm->flipPageAndWait();
- _vm->_eventsManager.delay(5);
+ _vm->_eventsManager.delayClick(5);
}
_vm->_bVoy->freeBoltGroup(id);
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 1e09a8f965..76aa8fe1ef 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -187,7 +187,7 @@ bool VoyeurEngine::doHeadTitle() {
if (!_voy._incriminate) {
// doOpening();
// doTransitionCard("Saturday Afternoon", "Player's Apartment");
- _eventsManager.delay(90);
+ _eventsManager.delayClick(90);
} else {
_voy._incriminate = false;
}
@@ -224,7 +224,7 @@ void VoyeurEngine::showConversionScreen() {
cMap->startFade();
// Wait briefly
- _eventsManager.delay(150);
+ _eventsManager.delayClick(150);
if (shouldQuit())
return;
@@ -240,12 +240,10 @@ void VoyeurEngine::showConversionScreen() {
_eventsManager.sWaitFlip();
while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
- _eventsManager.delay(1);
+ _eventsManager.delayClick(1);
_graphicsManager.screenReset();
_bVoy->freeBoltGroup(0x500);
-
-
}
bool VoyeurEngine::doLock() {
@@ -450,7 +448,7 @@ void VoyeurEngine::showTitleScreen() {
cMap->startFade();
// Wait briefly
- _eventsManager.delay(200);
+ _eventsManager.delayClick(200);
if (shouldQuit())
return;
@@ -469,7 +467,7 @@ void VoyeurEngine::showTitleScreen() {
return;
_graphicsManager.screenReset();
- _eventsManager.delay(200);
+ _eventsManager.delayClick(200);
// Voyeur title
playRL2Video("a1100100.rl2");
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 16909052a7..f18ec4be16 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -173,7 +173,7 @@ public:
void doScroll(const Common::Point &pt);
void checkPhoneCall();
- void doEvidDisplay(int v1, int v2);
+ void doEvidDisplay(int evidId, int eventId);
/**
* Flips the active page and waits until it's drawn
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 8bb1bded9c..f0e81e90f5 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -571,7 +571,7 @@ void VoyeurEngine::doTapePlaying() {
_soundManager.startVOCPlay("vcr.voc");
while (!shouldQuit() && !_voy._incriminate && _soundManager.getVOCStatus()) {
- _eventsManager.delay(2);
+ _eventsManager.delayClick(2);
}
_soundManager.stopVOCPlay();
@@ -1073,7 +1073,7 @@ void VoyeurEngine::checkPhoneCall() {
}
}
-void VoyeurEngine::doEvidDisplay(int v1, int v2) {
+void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
_eventsManager.getMouseInfo();
flipPageAndWait();
@@ -1082,7 +1082,81 @@ void VoyeurEngine::doEvidDisplay(int v1, int v2) {
_soundManager.stopVOCPlay();
}
- error("TODO: doEvidDisplay");
+ _bVoy->getBoltGroup(_voy._field47A);
+ PictureResource *pic = _bVoy->boltEntry(_voy._field47A + evidId * 2)._picResource;
+ _graphicsManager.sDrawPic(pic, *_graphicsManager._vPort, Common::Point(
+ 384 - pic->_bounds.width() / 2, 240 - pic->_bounds.height() / 2));
+ _bVoy->freeBoltMember(_voy._field47A + evidId * 2);
+
+ CMapResource *pal = _bVoy->boltEntry(_voy._field47A + evidId * 2 + 1)._cMapResource;
+ pal->startFade();
+
+ while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
+ _eventsManager.delay(1);
+ _bVoy->freeBoltMember(_voy._field47A + evidId * 2 + 1);
+
+ byte *dataP = _bVoy->memberAddr(_playStamp1 + 4);
+ int count = (int16)READ_LE_UINT16(dataP + evidId * 12 + 4);
+
+ if (count > 0) {
+ for (int idx = 1; idx <= count; ++idx) {
+ _voy._evPicPtrs[idx - 1] = _bVoy->boltEntry(_voy._field47A +
+ (evidId + idx) * 2)._picResource;
+ _voy._evCmPtrs[idx - 1] = _bVoy->boltEntry(_voy._field47A +
+ (evidId + idx) * 2 + 1)._cMapResource;
+ }
+ }
+
+ flipPageAndWait();
+ _eventsManager.stopEvidDim();
+
+ if (eventId == 999)
+ _eventsManager.addEvidEventStart(eventId);
+
+ _eventsManager.getMouseInfo();
+
+ int arrIndex = 0;
+ bool breakFlag = _voy._fadeFunc != NULL;
+ int evidIdx = evidId;
+
+ while (!shouldQuit() && !breakFlag) {
+ if (_playStamp2 != -1 && !_soundManager.getVOCStatus()) {
+ if (_voy._vocSecondsOffset > 60)
+ _voy._vocSecondsOffset = 0;
+
+ _soundManager.startVOCPlay(_playStamp2);
+ }
+
+ _eventsManager.delay(600);
+ if (_voy._fadeFunc)
+ break;
+ if (count == 0 || evidIdx >= eventId)
+ continue;
+
+ PictureResource *pic = _voy._evPicPtrs[arrIndex];
+ _graphicsManager.sDrawPic(pic, *_graphicsManager._vPort,
+ Common::Point((384 - pic->_bounds.width()) / 2,
+ (240 - pic->_bounds.height()) / 2));
+ _voy._evCmPtrs[arrIndex]->startFade();
+ while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
+ _eventsManager.delay(1);
+
+ flipPageAndWait();
+ _eventsManager.delay(6);
+
+ ++evidIdx;
+ ++arrIndex;
+ --count;
+ }
+
+ if (eventId != 999)
+ _eventsManager.addEvidEventEnd(evidIdx);
+
+ count = (int16)READ_LE_UINT16(dataP + evidId * 12 + 4);
+ for (int idx = 1; idx <= count; ++idx) {
+ _bVoy->freeBoltGroup(_voy._field47A + (evidId + idx) * 2);
+ _bVoy->freeBoltGroup(_voy._field47A + (evidId + idx) * 2 + 1);
+ }
}
} // End of namespace Voyeur