From 0c82fc1bafce8dc6e6a0852c4bd65e92005eaf39 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 25 Dec 2013 19:26:49 +1100 Subject: VOYEUR: Implemented checkForMurder --- engines/voyeur/voyeur_game.cpp | 49 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp index 811f386835..617b48c8d5 100644 --- a/engines/voyeur/voyeur_game.cpp +++ b/engines/voyeur/voyeur_game.cpp @@ -597,7 +597,54 @@ void VoyeurEngine::doTapePlaying() { } bool VoyeurEngine::checkForMurder() { - warning("TODO"); + int v = READ_LE_UINT32(_controlPtr->_ptr + 12); + + for (int idx = 0; idx < _voy._eventCount; ++idx) { + VoyeurEvent &evt = _voy._events[idx]; + + if (evt._type == EVTYPE_VIDEO) { + switch (READ_LE_UINT32(_controlPtr->_ptr + 4)) { + case 1: + if (evt._field8 == 41 && evt._computerOn <= 15 && + (evt._computerOff + evt._computerOn) >= 16) { + WRITE_LE_UINT32(_controlPtr->_ptr + 12, 1); + } + break; + + case 2: + if (evt._field8 == 53 && evt._computerOn <= 19 && + (evt._computerOff + evt._computerOn) >= 21) { + WRITE_LE_UINT32(_controlPtr->_ptr + 12, 2); + } + break; + + case 3: + if (evt._field8 == 50 && evt._computerOn <= 28 && + (evt._computerOff + evt._computerOn) >= 29) { + WRITE_LE_UINT32(_controlPtr->_ptr + 12, 3); + } + break; + + case 4: + if (evt._field8 == 43 && evt._computerOn <= 10 && + (evt._computerOff + evt._computerOn) >= 14) { + WRITE_LE_UINT32(_controlPtr->_ptr + 12, 4); + } + break; + + default: + break; + } + } + + if (READ_LE_UINT32(_controlPtr->_ptr + 12) == READ_LE_UINT32(_controlPtr->_ptr + 4)) { + _voy._videoEventId = idx; + return true; + } + } + + WRITE_LE_UINT32(_controlPtr->_ptr + 12, v); + _voy._videoEventId = -1; return false; } -- cgit v1.2.3