aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/voyeur/events.cpp85
-rw-r--r--engines/voyeur/events.h25
-rw-r--r--engines/voyeur/files.h3
-rw-r--r--engines/voyeur/files_threads.cpp44
-rw-r--r--engines/voyeur/graphics.cpp2
-rw-r--r--engines/voyeur/staticres.cpp3
-rw-r--r--engines/voyeur/staticres.h3
-rw-r--r--engines/voyeur/voyeur.h6
-rw-r--r--engines/voyeur/voyeur_game.cpp127
9 files changed, 219 insertions, 79 deletions
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 6d38dc4695..1139b95cbf 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -44,19 +44,6 @@ IntNode::IntNode(uint16 curTime, uint16 timeReset, uint16 flags) {
/*------------------------------------------------------------------------*/
-VoyeurEvent::VoyeurEvent(int hour, int minute, bool isAM, int v4, int v5, int v6, int v7) {
- _hour = hour;
- _minute = minute;
- _isAM = isAM;
- _field6 = v4;
- _field8 = v5;
- _computerOn = v6;
- _dead = v7;
-}
-
-
-/*------------------------------------------------------------------------*/
-
IntData::IntData() {
_field9 = false;
_flipWait = false;
@@ -469,4 +456,76 @@ void EventsManager::incrementTime(int amt) {
mainVoyeurIntFunc();
}
+void EventsManager::addVideoEventStart() {
+ VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
+ e._hour = _vm->_gameHour;
+ e._minute = _vm->_gameMinute;
+ e._isAM = _vm->_voy._isAM;
+ e._type = EVTYPE_VIDEO;
+ e._field8 = _vm->_eventsManager._videoComputerBut4;
+ e._computerOn = _vm->_voy._vocSecondsOffset;
+ e._dead = _vm->_eventsManager._videoDead;
+}
+
+void EventsManager::addVideoEventEnd() {
+ VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
+ e._computerOff = _vm->_voy._RTVNum - _vm->_voy._field468 - _vm->_voy._vocSecondsOffset;
+ if (_vm->_voy._eventCount < (TOTAL_EVENTS - 1))
+ ++_vm->_voy._eventCount;
+}
+
+void EventsManager::addAudioEventStart() {
+ VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
+ e._hour = _vm->_gameHour;
+ e._minute = _vm->_gameMinute;
+ e._isAM = _vm->_voy._isAM;
+ e._type = EVTYPE_AUDIO;
+ e._field8 = _vm->_eventsManager._videoComputerBut4;
+ e._computerOn = _vm->_voy._field47A;
+ e._dead = _vm->_eventsManager._videoDead;
+}
+
+void EventsManager::addAudioEventEnd() {
+ VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
+ e._computerOff = _vm->_voy._RTVNum - _vm->_voy._field468 - _vm->_voy._vocSecondsOffset;
+ if (_vm->_voy._eventCount < (TOTAL_EVENTS - 1))
+ ++_vm->_voy._eventCount;
+}
+
+void EventsManager::addEvidEventStart(int v) {
+ VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
+ e._hour = _vm->_gameHour;
+ e._minute = _vm->_gameMinute;
+ e._isAM = _vm->_voy._isAM;
+ e._type = EVTYPE_EVID;
+ e._field8 = _vm->_eventsManager._videoComputerBut4;
+ e._computerOn = _vm->_voy._vocSecondsOffset;
+ e._dead = _vm->_eventsManager._videoDead;
+
+}
+
+void EventsManager::addEvidEventEnd(int dead) {
+ VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
+ e._dead = dead;
+ if (_vm->_voy._eventCount < (TOTAL_EVENTS - 1))
+ ++_vm->_voy._eventCount;
+}
+
+void EventsManager::addComputerEventStart() {
+ VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
+ e._hour = _vm->_gameHour;
+ e._minute = _vm->_gameMinute;
+ e._isAM = _vm->_voy._isAM;
+ e._type = EVTYPE_COMPUTER;
+ e._field8 = _vm->_playStamp1;
+ e._computerOn = _vm->_voy._computerTextId;
+}
+
+void EventsManager::addComputerEventEnd(int v) {
+ VoyeurEvent &e = _vm->_voy._events[_vm->_voy._eventCount];
+ e._computerOff = v;
+ if (_vm->_voy._eventCount < (TOTAL_EVENTS - 1))
+ ++_vm->_voy._eventCount;
+}
+
} // End of namespace Voyeur
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index c8377487dc..c7d8910f5c 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -36,6 +36,7 @@ class CMapResource;
#define GAME_FRAME_RATE 50
#define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE)
+#define TOTAL_EVENTS 1000
typedef void (EventsManager::*EventMethodPtr)();
@@ -50,18 +51,18 @@ public:
IntNode(uint16 curTime, uint16 timeReset, uint16 flags);
};
-class VoyeurEvent {
-public:
+enum VoyeurEventType { EVTYPE_VIDEO = 1, EVTYPE_AUDIO = 2, EVTYPE_EVID = 3,
+ EVTYPE_COMPUTER = 4 };
+
+struct VoyeurEvent {
int _hour;
int _minute;
bool _isAM;
- int _field6;
+ VoyeurEventType _type;
int _field8;
int _computerOn;
int _computerOff;
int _dead;
-public:
- VoyeurEvent(int hour, int minute, bool isAM, int v4, int v5, int v6, int v7);
};
class SVoy {
@@ -92,15 +93,14 @@ public:
int _field4AE[5];
int _field4B8;
- int _field4E2;
+ int _computerTextId;
Common::Rect _rect4E4;
int _field4EC;
int _field4EE;
int _field4F0;
int _field4F2;
int _eventCount;
- Common::Array<VoyeurEvent> _events;
-
+ VoyeurEvent _events[TOTAL_EVENTS];
int _timeStart;
int _duration;
@@ -231,6 +231,15 @@ public:
void checkForKey();
void startCursorBlink();
void incrementTime(int amt);
+
+ void addVideoEventStart();
+ void addVideoEventEnd();
+ void addAudioEventStart();
+ void addAudioEventEnd();
+ void addEvidEventStart(int v);
+ void addEvidEventEnd(int dead);
+ void addComputerEventStart();
+ void addComputerEventEnd(int v);
};
} // End of namespace Voyeur
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index aa03383366..f15f066736 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -446,9 +446,6 @@ private:
uint32 getSID(int sid);
void cardAction(const byte *p);
void doSTAMPCardAction();
- void addAudioEventStart();
- void addAudioEventEnd();
- void addVideoEventEnd();
bool goToStateID(int stackId, int sceneId);
bool goToState(int stackId, int sceneId);
const byte *cardPerform(const byte *card);
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 4432d7eb84..38a5fab80c 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -344,7 +344,7 @@ void ThreadResource::parsePlayCommands() {
_vm->_voy._field468 = 0;
_vm->_voy._field46A = 0;
_vm->_voy._field47A = -1;
- _vm->_voy._field4E2 = -1;
+ _vm->_voy._computerTextId = -1;
_vm->_voy._field478 &= ~8;
_vm->_eventsManager._videoDead = -1;
@@ -386,7 +386,7 @@ void ThreadResource::parsePlayCommands() {
_vm->_eventsManager._videoComputerBut4 = -1;
} else {
_vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468;
- addAudioEventStart();
+ _vm->_eventsManager.addAudioEventStart();
assert(_vm->_eventsManager._videoComputerBut4 < 38);
_vm->_graphicsManager._backgroundPage = _vm->_bVoy->boltEntry(
@@ -417,7 +417,7 @@ void ThreadResource::parsePlayCommands() {
_vm->_voy._field478 |= 1;
_vm->_soundManager.stopVOCPlay();
- addAudioEventEnd();
+ _vm->_eventsManager.addAudioEventEnd();
_vm->_eventsManager.incrementTime(1);
_vm->_eventsManager.incrementTime(1);
@@ -445,14 +445,14 @@ void ThreadResource::parsePlayCommands() {
_vm->_eventsManager._videoComputerBut4 = -1;
} else {
_vm->_voy._vocSecondsOffset = _vm->_voy._RTVNum - _vm->_voy._field468;
- addAudioEventStart();
+ _vm->_eventsManager.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.addVideoEventEnd();
_vm->_eventsManager.incrementTime(1);
_vm->_eventsManager._videoComputerBut4 = -1;
@@ -669,14 +669,14 @@ void ThreadResource::parsePlayCommands() {
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._computerTextId = 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];
+ _vm->_voy._rect4E4.left = COMP_BUT_TABLE[_vm->_voy._computerTextId * 4];
+ _vm->_voy._rect4E4.top = COMP_BUT_TABLE[_vm->_voy._computerTextId * 4 + 1];
+ _vm->_voy._rect4E4.right = COMP_BUT_TABLE[_vm->_voy._computerTextId * 4 + 2];
+ _vm->_voy._rect4E4.bottom = COMP_BUT_TABLE[_vm->_voy._computerTextId * 4 + 3];
}
dataP += 8;
@@ -1223,7 +1223,7 @@ void ThreadResource::doRoom() {
vm._eventsManager.getMouseInfo();
Common::Point pt = vm._eventsManager.getMousePos();
i4e4 = -1;
- if (voy._field4E2 != -1 && voy._rect4E4.contains(pt))
+ if (voy._computerTextId != -1 && voy._rect4E4.contains(pt))
i4e4 = 999;
for (int idx = 0; idx < count; ++idx) {
@@ -1288,13 +1288,14 @@ void ThreadResource::doRoom() {
(*vm._graphicsManager._vPort)->_flags |= 8;
vm._graphicsManager.flipPage();
vm._eventsManager.sWaitFlip();
- vm.addPlainEvent();
+ vm._eventsManager.addComputerEventStart();
voy._incriminate = false;
vm._eventsManager.startCursorBlink();
- if (vm.doComputerText(9999))
- vm.addComputerEventEnd();
+ int v = vm.doComputerText(9999);
+ if (v)
+ vm._eventsManager.addComputerEventEnd(v);
vm._bVoy->freeBoltGroup(0x4900);
} else {
@@ -1568,21 +1569,6 @@ int ThreadResource::doInterface() {
return !_vm->_voy._fadeFunc ? regionIndex : -2;
}
-void ThreadResource::addAudioEventStart() {
- _vm->_voy._events.push_back(VoyeurEvent(_vm->_gameHour,
- _vm->_gameMinute, _vm->_voy._isAM, 2,
- _vm->_eventsManager._videoComputerBut4, _vm->_voy._vocSecondsOffset,
- _vm->_eventsManager._videoDead));
-}
-
-void ThreadResource::addAudioEventEnd() {
- error("TODO: addAudioEventEnd");
-}
-
-void ThreadResource::addVideoEventEnd() {
- error("TODO: addVideoEventEnd");
-}
-
bool ThreadResource::goToStateID(int stackId, int sceneId) {
debugC(DEBUG_BASIC, kDebugScripts, "goToStateID - %d, %d", stackId, sceneId);
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index a62a912c35..f07616bb36 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -137,7 +137,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
int var52;
int var20, var22;
int var26;
- byte pixel;
+ byte pixel = 0;
byte *srcImgData, *destImgData;
byte *srcP, *destP;
diff --git a/engines/voyeur/staticres.cpp b/engines/voyeur/staticres.cpp
index b6f373078b..6835ff053b 100644
--- a/engines/voyeur/staticres.cpp
+++ b/engines/voyeur/staticres.cpp
@@ -111,4 +111,7 @@ const char *const MONDAY = "Monday Morning";
const char *const AM = "am";
const char *const PM = "pm";
+const char *const START_OF_MESSAGE = "*** Start of Message ***";
+const char *const END_OF_MESSAGE = "*** End of Message ***";
+
} // End of namespace Voyeur
diff --git a/engines/voyeur/staticres.h b/engines/voyeur/staticres.h
index 990e2cf72a..ab35ac202f 100644
--- a/engines/voyeur/staticres.h
+++ b/engines/voyeur/staticres.h
@@ -47,6 +47,9 @@ extern const char *const MONDAY;
extern const char *const AM;
extern const char *const PM;
+extern const char *const START_OF_MESSAGE;
+extern const char *const END_OF_MESSAGE;
+
} // End of namespace Voyeur
#endif
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 0da5058992..7b065e6675 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -153,7 +153,7 @@ public:
void makeViewFinderP();
void initIFace();
void checkTransition();
- bool doComputerText(int v);
+ bool doComputerText(int maxLen);
void getComputerBrush();
/**
@@ -173,10 +173,6 @@ public:
void checkPhoneCall();
void doEvidDisplay(int v1, int v2);
-
- void addVideoEventStart();
- void addComputerEventEnd();
- void addPlainEvent();
};
} // End of namespace Voyeur
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 1a6c2d1673..471fec9284 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -25,24 +25,6 @@
namespace Voyeur {
-void VoyeurEngine::addVideoEventStart() {
- VoyeurEvent &e = _voy._events[_voy._eventCount];
- e._hour = _gameHour;
- e._minute = _gameMinute;
- e._isAM = _voy._isAM;
- e._field6 = 1;
- e._field8 = _eventsManager._videoComputerBut4;
- e._dead = _eventsManager._videoDead;
-}
-
-void VoyeurEngine::addComputerEventEnd() {
- error("TODO: addComputerEventEnd");
-}
-
-void VoyeurEngine::addPlainEvent() {
- error("TODO: addPlainEvent");
-}
-
void VoyeurEngine::playStamp() {
_stampLibPtr = NULL;
_filesManager.openBoltLib("stampblt.blt", _stampLibPtr);
@@ -444,12 +426,107 @@ void VoyeurEngine::checkTransition(){
}
}
-bool VoyeurEngine::doComputerText(int v) {
- error("TODO: doComputerText");
+bool VoyeurEngine::doComputerText(int maxLen) {
+ FontInfoResource &font = *_graphicsManager._fontPtr;
+ int totalChars = 0;
+
+ font._curFont = _bVoy->boltEntry(0x4910)._fontResource;
+ font._foreColor = 129;
+ font._fontSaveBack = false;
+ font._fontFlags = 0;
+ if (_voy._vocSecondsOffset > 60)
+ _voy._vocSecondsOffset = 0;
+
+ if (_voy._RTVNum > _voy._field4EE && maxLen == 9999) {
+ if (_playStamp2 != -1)
+ _soundManager.startVOCPlay(_playStamp2);
+ font._justify = ALIGN_LEFT;
+ font._justifyWidth = 384;
+ font._justifyHeight = 100;
+ font._pos = Common::Point(128, 100);
+ (*_graphicsManager._vPort)->drawText(END_OF_MESSAGE);
+ } else if (_voy._RTVNum < _voy._field4EC && maxLen == 9999) {
+ if (_playStamp2 != -1)
+ _soundManager.startVOCPlay(_playStamp2);
+ font._justify = ALIGN_LEFT;
+ font._justifyWidth = 384;
+ font._justifyHeight = 100;
+ font._pos = Common::Point(120, 100);
+ (*_graphicsManager._vPort)->drawText(START_OF_MESSAGE);
+ } else {
+ char *msg = (char *)_bVoy->memberAddr(0x4900 + _voy._computerTextId);
+ font._pos = Common::Point(96, 60);
+
+ bool showEnd = true;
+ int yp = 60;
+ do {
+ if (_playStamp2 != -1 && !_soundManager.getVOCStatus()) {
+ if (_voy._vocSecondsOffset > 60)
+ _voy._vocSecondsOffset = 0;
+ _soundManager.startVOCPlay(_playStamp2);
+ }
+
+ char c = *msg++;
+ if (c == '\0') {
+ if (showEnd) {
+ _eventsManager.delay(90);
+ _graphicsManager._drawPtr->_pos = Common::Point(54, 96);
+ _graphicsManager._drawPtr->_penColor = 254;
+ (*_graphicsManager._vPort)->sFillBox(196, 124);
+ _graphicsManager._fontPtr->_justify = ALIGN_LEFT;
+ _graphicsManager._fontPtr->_justifyWidth = 384;
+ _graphicsManager._fontPtr->_justifyHeight = 100;
+ _graphicsManager._fontPtr->_pos = Common::Point(128, 100);
+ (*_graphicsManager._vPort)->drawText(END_OF_MESSAGE);
+ }
+ break;
+ }
+
+ if (c == '~' || c == '^') {
+ if (c == '^') {
+ yp += 10;
+ } else {
+ _eventsManager.delay(90);
+ _graphicsManager._drawPtr->_pos = Common::Point(54, 96);
+ _graphicsManager._drawPtr->_penColor = 255;
+ (*_graphicsManager._vPort)->sFillBox(196, 124);
+ yp = 60;
+ }
+
+ _graphicsManager._fontPtr->_pos = Common::Point(96, yp);
+ } else if (c == '_') {
+ showEnd = false;
+ } else {
+ _graphicsManager._fontPtr->_justify = ALIGN_LEFT;
+ _graphicsManager._fontPtr->_justifyWidth = 0;
+ _graphicsManager._fontPtr->_justifyHeight = 0;
+ (*_graphicsManager._vPort)->drawText(Common::String(c));
+ _eventsManager.delay(4);
+ }
+
+ (*_graphicsManager._vPort)->_flags |= 8;
+ _graphicsManager.flipPage();
+ _eventsManager.sWaitFlip();
+ _eventsManager.getMouseInfo();
+ ++totalChars;
+
+ } while (!shouldQuit() && !_voy._incriminate && totalChars < maxLen);
+
+ _voy._field4EE = 0;
+ }
+
+ (*_graphicsManager._vPort)->_flags |= 8;
+ _graphicsManager.flipPage();
+ _eventsManager.sWaitFlip();
+
+ _graphicsManager._fontPtr->_curFont = _bVoy->boltEntry(0x101)._fontResource;
+ return totalChars;
}
void VoyeurEngine::getComputerBrush() {
error("TODO: getComputerBrush");
+// if (_bVoy->getBoltGroup(0x4900)) {
+// }
}
void VoyeurEngine::doTimeBar(bool force) {
@@ -518,6 +595,16 @@ void VoyeurEngine::checkPhoneCall() {
}
void VoyeurEngine::doEvidDisplay(int v1, int v2) {
+ _eventsManager.getMouseInfo();
+ (*_graphicsManager._vPort)->_flags |= 8;
+ _graphicsManager.flipPage();
+ _eventsManager.sWaitFlip();
+
+ if (_playStamp2 != -1) {
+ _voy._vocSecondsOffset = _voy._RTVNum - _voy._field4AC;
+ _soundManager.stopVOCPlay();
+ }
+
error("TODO: doEvidDisplay");
}