aboutsummaryrefslogtreecommitdiff
path: root/engines/gnap/scenes/group1.cpp
diff options
context:
space:
mode:
authorStrangerke2016-05-08 01:19:40 +0200
committerEugene Sandulenko2016-05-10 12:14:55 +0200
commit1f7eeb24a0622a44a4b4582b51950fae4a80fcb7 (patch)
treed557c3759d98f94c74fd1b2cc9679dd39b4135e5 /engines/gnap/scenes/group1.cpp
parent81c5f8651d7b78986a5487c0b6b67a3ea1bea19c (diff)
downloadscummvm-rg350-1f7eeb24a0622a44a4b4582b51950fae4a80fcb7.tar.gz
scummvm-rg350-1f7eeb24a0622a44a4b4582b51950fae4a80fcb7.tar.bz2
scummvm-rg350-1f7eeb24a0622a44a4b4582b51950fae4a80fcb7.zip
GNAP: Simplify some checks
Diffstat (limited to 'engines/gnap/scenes/group1.cpp')
-rw-r--r--engines/gnap/scenes/group1.cpp53
1 files changed, 31 insertions, 22 deletions
diff --git a/engines/gnap/scenes/group1.cpp b/engines/gnap/scenes/group1.cpp
index 0122a08109..aa55e1dcf5 100644
--- a/engines/gnap/scenes/group1.cpp
+++ b/engines/gnap/scenes/group1.cpp
@@ -410,20 +410,25 @@ void Scene10::updateAnimations() {
}
switch (_currCookSequenceId) {
- case 0x106: {
- // TODO: Refactor into a if + a switch
- int rnd = _vm->getRandom(7);
+ case 0x106:
if (_vm->_gnap->_actionStatus >= 0 || _vm->_plat->_actionStatus >= 0)
_nextCookSequenceId = 0x106;
- else if (rnd == 0)
- _nextCookSequenceId = 0x104;
- else if (rnd == 1)
- _nextCookSequenceId = 0x103;
- else if (rnd == 2) {
- _nextCookSequenceId = 0x106;
- gameSys.insertSequence(0x10D, 1, 0, 0, kSeqNone, 0, 0, 0);
- } else
- _nextCookSequenceId = 0x106;
+ else {
+ int rnd = _vm->getRandom(7);
+ switch (rnd) {
+ case 0:
+ _nextCookSequenceId = 0x104;
+ break;
+ case 1:
+ _nextCookSequenceId = 0x103;
+ break;
+ case 2:
+ _nextCookSequenceId = 0x106;
+ gameSys.insertSequence(0x10D, 1, 0, 0, kSeqNone, 0, 0, 0);
+ break;
+ default:
+ _nextCookSequenceId = 0x106;
+ }
}
break;
case 0x103:
@@ -442,17 +447,22 @@ void Scene10::updateAnimations() {
else
_nextCookSequenceId = 0x106;
break;
- case 0x105: {
- // TODO: Refactor into a if + a switch
- int rnd = _vm->getRandom(7);
+ case 0x105:
if (_vm->_gnap->_actionStatus >= 0 || _vm->_plat->_actionStatus >= 0)
_nextCookSequenceId = 0x106;
- else if (rnd == 0)
- _nextCookSequenceId = 0x104;
- else if (rnd == 1)
- _nextCookSequenceId = 0x103;
- else
- _nextCookSequenceId = 0x106;
+ else {
+ int rnd = _vm->getRandom(7);
+ switch (rnd) {
+ case 0:
+ _nextCookSequenceId = 0x104;
+ break;
+ case 1:
+ _nextCookSequenceId = 0x103;
+ break;
+ default:
+ _nextCookSequenceId = 0x106;
+ }
+ }
_vm->_timers[2] = _vm->getRandom(30) + 20;
_vm->_timers[3] = 300;
gameSys.insertSequence(0x10C, _vm->_gnap->_id, makeRid(_vm->_gnap->_sequenceDatNum, _vm->_gnap->_sequenceId), _vm->_gnap->_id, kSeqSyncWait, 0, 0, 0);
@@ -461,7 +471,6 @@ void Scene10::updateAnimations() {
_vm->_gnap->_sequenceDatNum = 0;
_vm->_gnap->_actionStatus = -1;
_vm->_plat->_actionStatus = -1;
- }
break;
}
if (_currCookSequenceId == 0x843)