mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 06:08:35 +00:00
VOYEUR: Clean up, commenting, and bugfixes for checking for murder
This commit is contained in:
parent
683ef9d50f
commit
d3f4156e6a
@ -41,6 +41,12 @@ void VoyeurEvent::synchronize(Common::Serializer &s) {
|
||||
SVoy::SVoy() {
|
||||
// Initialise all the data fields of SVoy to empty values
|
||||
Common::fill((byte *)this, (byte *)this + sizeof(SVoy), 0);
|
||||
|
||||
_eventFlags = EVTFLAG_TIME_DISABLED;
|
||||
_field4376 = _field4378 = 127;
|
||||
_murderThreshold = 9999;
|
||||
_aptLoadMode = -1;
|
||||
_eventFlags |= EVTFLAG_100;
|
||||
}
|
||||
|
||||
void SVoy::setVm(VoyeurEngine *vm) {
|
||||
@ -90,8 +96,8 @@ void SVoy::synchronize(Common::Serializer &s) {
|
||||
s.syncAsSint16LE(_computerTextId);
|
||||
s.syncAsSint16LE(_computerTimeMin);
|
||||
s.syncAsSint16LE(_computerTimeMax);
|
||||
s.syncAsSint16LE(_field4F0);
|
||||
s.syncAsSint16LE(_field4F2);
|
||||
s.syncAsSint16LE(_victimMurdered);
|
||||
s.syncAsSint16LE(_murderThreshold);
|
||||
|
||||
// Events
|
||||
s.syncAsUint16LE(_eventCount);
|
||||
@ -103,7 +109,7 @@ void SVoy::synchronize(Common::Serializer &s) {
|
||||
s.syncAsSint16LE(_field437A);
|
||||
s.syncAsSint16LE(_field437C);
|
||||
s.syncAsSint16LE(_field437E);
|
||||
s.syncAsSint16LE(_field4380);
|
||||
s.syncAsSint16LE(_victimNumber);
|
||||
s.syncAsSint16LE(_field4382);
|
||||
s.syncAsSint16LE(_videoEventId);
|
||||
|
||||
@ -232,7 +238,7 @@ void SVoy::reviewComputerEvent(int eventIndex) {
|
||||
|
||||
bool SVoy::checkForKey() {
|
||||
WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 0);
|
||||
if (_vm->_voy._field4F0)
|
||||
if (_vm->_voy._victimMurdered)
|
||||
return false;
|
||||
|
||||
for (int eventIdx = 0; eventIdx < _eventCount; ++eventIdx) {
|
||||
@ -243,12 +249,12 @@ bool SVoy::checkForKey() {
|
||||
case EVTYPE_VIDEO:
|
||||
switch (READ_LE_UINT32(_vm->_controlPtr->_ptr + 4)) {
|
||||
case 1:
|
||||
if (e._audioVideoId == 33 && e._computerOn < 1 && e._computerOff > 40)
|
||||
if (e._audioVideoId == 33 && e._computerOn < 2 && e._computerOff >= 38)
|
||||
WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 1);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (e._audioVideoId == 47 && e._computerOn < 1 && e._computerOff > 11)
|
||||
if (e._audioVideoId == 47 && e._computerOn < 2 && e._computerOff >= 9)
|
||||
WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 2);
|
||||
break;
|
||||
|
||||
@ -258,7 +264,7 @@ bool SVoy::checkForKey() {
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (e._audioVideoId == 40 && e._computerOn < 2 && e._computerOff > 7)
|
||||
if (e._audioVideoId == 40 && e._computerOn < 2 && e._computerOff > 6)
|
||||
WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 4);
|
||||
break;
|
||||
|
||||
@ -270,14 +276,14 @@ bool SVoy::checkForKey() {
|
||||
case EVTYPE_AUDIO:
|
||||
switch (READ_LE_UINT32(_vm->_controlPtr->_ptr + 4)) {
|
||||
case 1:
|
||||
if (e._audioVideoId == 8 && e._computerOn < 2 && e._computerOff > 28)
|
||||
if (e._audioVideoId == 8 && e._computerOn < 2 && e._computerOff > 26)
|
||||
WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 1);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (e._audioVideoId == 20 && e._computerOn < 2 && e._computerOff > 30)
|
||||
if (e._audioVideoId == 20 && e._computerOn < 2 && e._computerOff > 28)
|
||||
WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 3);
|
||||
if (e._audioVideoId == 35 && e._computerOn < 2 && e._computerOff > 20)
|
||||
if (e._audioVideoId == 35 && e._computerOn < 2 && e._computerOff > 18)
|
||||
WRITE_LE_UINT32(_vm->_controlPtr->_ptr + 8, 3);
|
||||
break;
|
||||
|
||||
|
@ -35,7 +35,7 @@ enum VoyeurEventType { EVTYPE_VIDEO = 1, EVTYPE_AUDIO = 2, EVTYPE_EVID = 3,
|
||||
EVTYPE_COMPUTER = 4 };
|
||||
|
||||
enum EventFlag { EVTFLAG_TIME_DISABLED = 1, EVTFLAG_2 = 2, EVTFLAG_8 = 8, EVTFLAG_RECORDING = 0x10,
|
||||
EVTFLAG_40 = 0x40, EVTFLAG_100 = 0x100 };
|
||||
EVTFLAG_40 = 0x40, EVTFLAG_VICTIM_PRESET = 0x80, EVTFLAG_100 = 0x100 };
|
||||
|
||||
struct VoyeurEvent {
|
||||
int _hour;
|
||||
@ -133,15 +133,15 @@ public:
|
||||
Common::Rect _rect4E4;
|
||||
int _computerTimeMin;
|
||||
int _computerTimeMax;
|
||||
int _field4F0;
|
||||
int _field4F2;
|
||||
bool _victimMurdered;
|
||||
int _murderThreshold;
|
||||
|
||||
int _field4376;
|
||||
int _field4378;
|
||||
int _field437A;
|
||||
int _field437C;
|
||||
int _field437E;
|
||||
int _field4380;
|
||||
int _victimNumber;
|
||||
int _field4382;
|
||||
int _videoEventId;
|
||||
RectResource *_viewBounds;
|
||||
|
@ -111,8 +111,10 @@ void EventsManager::mainVoyeurIntFunc() {
|
||||
// Increase camera discharge
|
||||
++_vm->_voy._RTVNum;
|
||||
|
||||
if (_vm->_voy._RTVNum >= _vm->_voy._field4F2)
|
||||
_vm->_voy._field4F0 = 1;
|
||||
// If the murder threshold has been set, and is passed, then flag the victim
|
||||
// as murdered, which prevents sending the tape from succeeding
|
||||
if (_vm->_voy._RTVNum >= _vm->_voy._murderThreshold)
|
||||
_vm->_voy._victimMurdered = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -367,6 +367,7 @@ void ThreadResource::parsePlayCommands() {
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// Play an audio event
|
||||
v2 = READ_LE_UINT16(dataP);
|
||||
|
||||
if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
|
||||
@ -397,6 +398,7 @@ void ThreadResource::parsePlayCommands() {
|
||||
break;
|
||||
|
||||
case 3:
|
||||
// Play a video event
|
||||
v2 = READ_LE_UINT16(dataP);
|
||||
|
||||
if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2) {
|
||||
@ -443,6 +445,7 @@ void ThreadResource::parsePlayCommands() {
|
||||
|
||||
case 4:
|
||||
case 22:
|
||||
// Case 22: Endgame news reports
|
||||
_vm->_audioVideoId = READ_LE_UINT16(dataP) - 1;
|
||||
dataP += 2;
|
||||
|
||||
@ -462,7 +465,7 @@ void ThreadResource::parsePlayCommands() {
|
||||
_vm->_audioVideoId = -1;
|
||||
parseIndex = 999;
|
||||
} else {
|
||||
int count = _vm->_bVoy->getBoltGroup(_vm->_playStampGroupId)->_entries.size();
|
||||
int count = _vm->_bVoy->getBoltGroup(_vm->_playStampGroupId)->_entries.size() / 2;
|
||||
_vm->_soundManager.stopVOCPlay();
|
||||
_vm->_eventsManager.getMouseInfo();
|
||||
|
||||
@ -492,7 +495,7 @@ void ThreadResource::parsePlayCommands() {
|
||||
_vm->_soundManager.stopVOCPlay();
|
||||
|
||||
if (i == (count - 1))
|
||||
_vm->_eventsManager.delay(480);
|
||||
_vm->_eventsManager.delayClick(480);
|
||||
|
||||
if (_vm->shouldQuit() || _vm->_eventsManager._mouseClicked)
|
||||
break;
|
||||
@ -594,16 +597,21 @@ void ThreadResource::parsePlayCommands() {
|
||||
break;
|
||||
|
||||
case 10:
|
||||
// Pick the person who is to die, during startup
|
||||
if (_vm->_iForceDeath == -1) {
|
||||
// No specific person has been preset to be killed, so pick one randomly.
|
||||
// The loop below was used because the victim was persisted from the previous
|
||||
// play-through, so it ensured that a different victim is picked.
|
||||
int randomVal;
|
||||
do {
|
||||
randomVal = _vm->getRandomNumber(3) + 1;
|
||||
} while (randomVal == _vm->_voy._field4380);
|
||||
} while (randomVal == _vm->_voy._victimNumber);
|
||||
|
||||
_vm->_voy._field4380 = randomVal;
|
||||
_vm->_voy._victimNumber = randomVal;
|
||||
WRITE_LE_UINT16(_vm->_controlPtr->_ptr + 4, randomVal);
|
||||
} else {
|
||||
_vm->_voy._field4380 = _vm->_iForceDeath;
|
||||
// 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);
|
||||
}
|
||||
|
||||
@ -660,11 +668,13 @@ void ThreadResource::parsePlayCommands() {
|
||||
break;
|
||||
|
||||
case 18:
|
||||
// Called during the murder (Sunday 10:30PM) time period, to specify the
|
||||
// time expired point at which the murder takes place
|
||||
v2 = READ_LE_UINT16(dataP);
|
||||
v3 = READ_LE_UINT16(dataP + 2);
|
||||
|
||||
if (v2 == 0 || READ_LE_UINT16(_vm->_controlPtr->_ptr + 4) == v2)
|
||||
_vm->_voy._field4F2 = v3;
|
||||
_vm->_voy._murderThreshold = v3;
|
||||
|
||||
dataP += 4;
|
||||
break;
|
||||
|
@ -70,8 +70,11 @@ Common::Error VoyeurEngine::run() {
|
||||
|
||||
_eventsManager.resetMouse();
|
||||
if (doHeadTitle()) {
|
||||
// The original allows the victim to be explicitly specified via the command line.
|
||||
// We don't currently support this in ScummVM, but I'm leaving the code below
|
||||
// in case we ever want to make use of it.
|
||||
if (_iForceDeath >= 1 && _iForceDeath <= 4)
|
||||
_voy._eventFlags |= 0x80;
|
||||
_voy._eventFlags |= EVTFLAG_VICTIM_PRESET;
|
||||
|
||||
playStamp();
|
||||
if (!shouldQuit())
|
||||
@ -116,12 +119,6 @@ void VoyeurEngine::globalInitBolt() {
|
||||
assert(_graphicsManager._fontPtr->_curFont);
|
||||
|
||||
// Setup default flags
|
||||
_voy._eventFlags = EVTFLAG_TIME_DISABLED;
|
||||
_voy._field4376 = _voy._field4378 = 127;
|
||||
_voy._field4F2 = 9999;
|
||||
_voy._aptLoadMode = -1;
|
||||
_voy._eventFlags |= EVTFLAG_100;
|
||||
|
||||
_voy._curICF0 = _graphicsManager._palFlag ? 0xFFFFA5E0 : 0x5F90;
|
||||
_eventsManager.addFadeInt();
|
||||
}
|
||||
@ -240,7 +237,6 @@ bool VoyeurEngine::doLock() {
|
||||
byte *wrongVoc = _filesManager.fload("wrong.voc", &wrongVocSize);
|
||||
|
||||
if (_bVoy->getBoltGroup(0x700)) {
|
||||
_voy._field4380 = 0;
|
||||
_voy._viewBounds = _bVoy->boltEntry(0x704)._rectResource;
|
||||
|
||||
Common::String password = "3333";
|
||||
|
@ -177,7 +177,7 @@ public:
|
||||
|
||||
int _audioVideoId;
|
||||
const int *_resolvePtr;
|
||||
int _iForceDeath; // CHECKME: The original initializes it in ESP_init()
|
||||
int _iForceDeath;
|
||||
int _checkTransitionId;
|
||||
int _gameHour;
|
||||
int _gameMinute;
|
||||
|
@ -951,7 +951,7 @@ int VoyeurEngine::getChooseButton() {
|
||||
|
||||
for (uint idx = 0; idx < hotspots.size(); ++idx) {
|
||||
if (hotspots[idx].contains(pt)) {
|
||||
if (!_voy._field4F0 || (idx + 1) != READ_LE_UINT32(_controlPtr->_ptr + 4)) {
|
||||
if (!_voy._victimMurdered || (idx + 1) != READ_LE_UINT32(_controlPtr->_ptr + 4)) {
|
||||
selectedIndex = idx;
|
||||
if (selectedIndex != prevIndex) {
|
||||
PictureResource *btnPic = _bVoy->boltEntry(_playStampGroupId + 8 + idx)._picResource;
|
||||
|
Loading…
Reference in New Issue
Block a user