aboutsummaryrefslogtreecommitdiff
path: root/engines/mortevielle
diff options
context:
space:
mode:
authorStrangerke2014-01-17 21:52:50 +0100
committerStrangerke2014-01-17 21:52:50 +0100
commitc87074f8a843fcbc52d8824666ec9d26603a017a (patch)
tree71d750677c58e6ad4259c678908ed556fda3c3cd /engines/mortevielle
parent0d4d7a66a97b626a68db15a080c685682e212d05 (diff)
downloadscummvm-rg350-c87074f8a843fcbc52d8824666ec9d26603a017a.tar.gz
scummvm-rg350-c87074f8a843fcbc52d8824666ec9d26603a017a.tar.bz2
scummvm-rg350-c87074f8a843fcbc52d8824666ec9d26603a017a.zip
MORTEVIELLE: Some refactoring in Action
Diffstat (limited to 'engines/mortevielle')
-rw-r--r--engines/mortevielle/actions.cpp99
1 files changed, 62 insertions, 37 deletions
diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp
index 5ea9314d5e..c5d55066ba 100644
--- a/engines/mortevielle/actions.cpp
+++ b/engines/mortevielle/actions.cpp
@@ -208,22 +208,31 @@ void MortevielleEngine::fctTake() {
if (_currBitIndex > 0)
_coreVar._faithScore += 3;
if (_obpart) {
- if (_coreVar._currPlace == PURPLE_ROOM)
+ switch (_coreVar._currPlace) {
+ case PURPLE_ROOM:
_coreVar._purpleRoomObjectId = 0;
- if (_coreVar._currPlace == ATTIC) {
+ break;
+ case ATTIC:
if (_coreVar._atticBallHoleObjectId == _caff)
_coreVar._atticBallHoleObjectId = 0;
if (_coreVar._atticRodHoleObjectId == _caff)
_coreVar._atticRodHoleObjectId = 0;
- }
- if (_coreVar._currPlace == CELLAR)
+ break;
+ case CELLAR:
_coreVar._cellarObjectId = 0;
- if (_coreVar._currPlace == CRYPT)
+ break;
+ case CRYPT:
_coreVar._cryptObjectId = 0;
- if (_coreVar._currPlace == SECRET_PASSAGE)
+ break;
+ case SECRET_PASSAGE:
_coreVar._secretPassageObjectId = 0;
- if (_coreVar._currPlace == WELL)
+ break;
+ case WELL:
_coreVar._wellObjectId = 0;
+ break;
+ default:
+ break;
+ }
_menu->unsetSearchMenu();
_obpart = false;
prepareDisplayText();
@@ -258,38 +267,54 @@ void MortevielleEngine::fctTake() {
if (_currBitIndex > 0)
_coreVar._faithScore += 3;
_crep = 997;
- if ((_coreVar._currPlace == PURPLE_ROOM) && (_coreVar._purpleRoomObjectId != 0))
- putInHand(_coreVar._purpleRoomObjectId);
- if ((_coreVar._currPlace == ATTIC) && (_num == 1) && (_coreVar._atticBallHoleObjectId != 0)) {
- putInHand(_coreVar._atticBallHoleObjectId);
- if ((_crep != 997) && (_crep != 139))
- displayAnimFrame(2, 7);
- }
- if ((_coreVar._currPlace == ATTIC) && (_num == 2) && (_coreVar._atticRodHoleObjectId != 0)) {
- putInHand(_coreVar._atticRodHoleObjectId);
- if ((_crep != 997) && (_crep != 139))
- displayAnimFrame(2, 6);
- }
- if ((_coreVar._currPlace == CELLAR) && (_coreVar._cellarObjectId != 0)) {
- putInHand(_coreVar._cellarObjectId);
- if ((_crep != 997) && (_crep != 139))
- displayAnimFrame(2, 2);
- }
- if ((_coreVar._currPlace == CRYPT) && (_coreVar._cryptObjectId != 0))
- putInHand(_coreVar._cryptObjectId);
-
- if ((_coreVar._currPlace == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId != 0)) {
- putInHand(_coreVar._secretPassageObjectId);
- if ((_crep != 997) && (_crep != 139)) {
- _crep = 182;
- displayAnimFrame(2, 1);
+
+ switch (_coreVar._currPlace) {
+ case PURPLE_ROOM:
+ if (_coreVar._purpleRoomObjectId != 0)
+ putInHand(_coreVar._purpleRoomObjectId);
+ break;
+ case ATTIC:
+ if ((_num == 1) && (_coreVar._atticBallHoleObjectId != 0)) {
+ putInHand(_coreVar._atticBallHoleObjectId);
+ if ((_crep != 997) && (_crep != 139))
+ displayAnimFrame(2, 7);
+ } else if ((_num == 2) && (_coreVar._atticRodHoleObjectId != 0)) {
+ putInHand(_coreVar._atticRodHoleObjectId);
+ if ((_crep != 997) && (_crep != 139))
+ displayAnimFrame(2, 6);
}
+ break;
+ case CELLAR:
+ if (_coreVar._cellarObjectId != 0) {
+ putInHand(_coreVar._cellarObjectId);
+ if ((_crep != 997) && (_crep != 139))
+ displayAnimFrame(2, 2);
+ }
+ break;
+ case CRYPT:
+ if (_coreVar._cryptObjectId != 0)
+ putInHand(_coreVar._cryptObjectId);
+ break;
+ case SECRET_PASSAGE:
+ if (_coreVar._secretPassageObjectId != 0) {
+ putInHand(_coreVar._secretPassageObjectId);
+ if ((_crep != 997) && (_crep != 139)) {
+ _crep = 182;
+ displayAnimFrame(2, 1);
+ }
+ }
+ break;
+ case WELL:
+ if (_coreVar._wellObjectId != 0) {
+ putInHand(_coreVar._wellObjectId);
+ if ((_crep != 997) && (_crep != 139))
+ displayAnimFrame(2, 1);
+ }
+ break;
+ default:
+ break;
}
- if ((_coreVar._currPlace == WELL) && (_coreVar._wellObjectId != 0)) {
- putInHand(_coreVar._wellObjectId);
- if ((_crep != 997) && (_crep != 139))
- displayAnimFrame(2, 1);
- }
+
if ((_crep != 997) && (_crep != 182) && (_crep != 139))
_crep = 999;
}