From e310e9832db8759ba3aeac2ee0f98204ce65f86d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 13 Mar 2014 07:05:06 +0100 Subject: VOYEUR: Make checkForKey() less verbose --- engines/voyeur/data.cpp | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'engines/voyeur/data.cpp') diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp index d8324ca5b8..cc0b81a313 100644 --- a/engines/voyeur/data.cpp +++ b/engines/voyeur/data.cpp @@ -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; @@ -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: @@ -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: @@ -334,10 +335,10 @@ 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; @@ -345,10 +346,10 @@ bool SVoy::checkForKey() { 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: @@ -360,7 +361,7 @@ bool SVoy::checkForKey() { break; } - if (_vm->_controlPtr->_state->_victimEvidenceIndex == _vm->_controlPtr->_state->_victimIndex) + if (state->_victimEvidenceIndex == state->_victimIndex) return true; } -- cgit v1.2.3