Skip to content

Commit

Permalink
VOYEUR: Make checkForKey() less verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Mar 13, 2014
1 parent 5405664 commit e310e98
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions engines/voyeur/data.cpp
Expand Up @@ -279,7 +279,8 @@ void SVoy::reviewComputerEvent(int eventIndex) {
}

bool SVoy::checkForKey() {
_vm->_controlPtr->_state->_victimEvidenceIndex = 0;
StateResource *state = _vm->_controlPtr->_state;
state->_victimEvidenceIndex = 0;
if (_vm->_voy->_victimMurdered)
return false;

Expand All @@ -288,25 +289,25 @@ bool SVoy::checkForKey() {

switch (e._type) {
case EVTYPE_VIDEO:
switch (_vm->_controlPtr->_state->_victimIndex) {
switch (state->_victimIndex) {
case 1:
if (e._audioVideoId == 33 && e._computerOn < 2 && e._computerOff >= 38)
_vm->_controlPtr->_state->_victimEvidenceIndex = 1;
state->_victimEvidenceIndex = 1;
break;

case 2:
if (e._audioVideoId == 47 && e._computerOn < 2 && e._computerOff >= 9)
_vm->_controlPtr->_state->_victimEvidenceIndex = 2;
state->_victimEvidenceIndex = 2;
break;

case 3:
if (e._audioVideoId == 46 && e._computerOn < 2 && e._computerOff > 2)
_vm->_controlPtr->_state->_victimEvidenceIndex = 3;
state->_victimEvidenceIndex = 3;
break;

case 4:
if (e._audioVideoId == 40 && e._computerOn < 2 && e._computerOff > 6)
_vm->_controlPtr->_state->_victimEvidenceIndex = 4;
state->_victimEvidenceIndex = 4;
break;

default:
Expand All @@ -315,17 +316,17 @@ bool SVoy::checkForKey() {
break;

case EVTYPE_AUDIO:
switch (_vm->_controlPtr->_state->_victimIndex) {
switch (state->_victimIndex) {
case 1:
if (e._audioVideoId == 8 && e._computerOn < 2 && e._computerOff > 26)
_vm->_controlPtr->_state->_victimEvidenceIndex = 1;
state->_victimEvidenceIndex = 1;
break;

case 3:
if (e._audioVideoId == 20 && e._computerOn < 2 && e._computerOff > 28)
_vm->_controlPtr->_state->_victimEvidenceIndex = 3;
state->_victimEvidenceIndex = 3;
if (e._audioVideoId == 35 && e._computerOn < 2 && e._computerOff > 18)
_vm->_controlPtr->_state->_victimEvidenceIndex = 3;
state->_victimEvidenceIndex = 3;
break;

default:
Expand All @@ -334,21 +335,21 @@ bool SVoy::checkForKey() {
break;

case EVTYPE_EVID:
switch (_vm->_controlPtr->_state->_victimIndex) {
switch (state->_victimIndex) {
case 4:
if (e._audioVideoId == 0x2400 && e._computerOn == 0x4f00 && e._computerOff == 17)
_vm->_controlPtr->_state->_victimEvidenceIndex = 4;
state->_victimEvidenceIndex = 4;

default:
break;
}
break;

case EVTYPE_COMPUTER:
switch (_vm->_controlPtr->_state->_victimIndex) {
switch (state->_victimIndex) {
case 2:
if (e._computerOn == 13 && e._computerOff > 76)
_vm->_controlPtr->_state->_victimEvidenceIndex = 2;
state->_victimEvidenceIndex = 2;
break;

default:
Expand All @@ -360,7 +361,7 @@ bool SVoy::checkForKey() {
break;
}

if (_vm->_controlPtr->_state->_victimEvidenceIndex == _vm->_controlPtr->_state->_victimIndex)
if (state->_victimEvidenceIndex == state->_victimIndex)
return true;
}

Expand Down

0 comments on commit e310e98

Please sign in to comment.