diff options
author | Strangerke | 2016-04-26 00:23:23 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-05-10 09:54:21 +0200 |
commit | aa8df847f7ab087dc4097f683c583197d2e8b035 (patch) | |
tree | 637712d203ddf161e6840ee4b527a20685c5822e /engines/gnap | |
parent | 700d82c1c22fe9b4c586b272f827b2ee9aa659ba (diff) | |
download | scummvm-rg350-aa8df847f7ab087dc4097f683c583197d2e8b035.tar.gz scummvm-rg350-aa8df847f7ab087dc4097f683c583197d2e8b035.tar.bz2 scummvm-rg350-aa8df847f7ab087dc4097f683c583197d2e8b035.zip |
GNAP: Reduce dereferencing in scene group 4, some renaming
Diffstat (limited to 'engines/gnap')
-rw-r--r-- | engines/gnap/scenes/scene16.cpp | 100 | ||||
-rw-r--r-- | engines/gnap/scenes/scene40.cpp | 12 | ||||
-rw-r--r-- | engines/gnap/scenes/scene41.cpp | 194 | ||||
-rw-r--r-- | engines/gnap/scenes/scene41.h | 8 | ||||
-rw-r--r-- | engines/gnap/scenes/scene42.cpp | 112 | ||||
-rw-r--r-- | engines/gnap/scenes/scene42.h | 4 | ||||
-rw-r--r-- | engines/gnap/scenes/scene43.cpp | 108 | ||||
-rw-r--r-- | engines/gnap/scenes/scene43.h | 4 | ||||
-rw-r--r-- | engines/gnap/scenes/scene44.cpp | 154 | ||||
-rw-r--r-- | engines/gnap/scenes/scene44.h | 8 | ||||
-rw-r--r-- | engines/gnap/scenes/scene45.cpp | 122 | ||||
-rw-r--r-- | engines/gnap/scenes/scene45.h | 2 | ||||
-rw-r--r-- | engines/gnap/scenes/scene46.cpp | 91 | ||||
-rw-r--r-- | engines/gnap/scenes/scene46.h | 8 | ||||
-rw-r--r-- | engines/gnap/scenes/scene47.cpp | 216 | ||||
-rw-r--r-- | engines/gnap/scenes/scene48.cpp | 106 | ||||
-rw-r--r-- | engines/gnap/scenes/scene49.cpp | 412 | ||||
-rw-r--r-- | engines/gnap/scenes/scene49.h | 16 | ||||
-rw-r--r-- | engines/gnap/scenes/scene54.cpp | 180 | ||||
-rw-r--r-- | engines/gnap/scenes/scenecore.cpp | 26 | ||||
-rw-r--r-- | engines/gnap/scenes/scenecore.h | 10 |
21 files changed, 970 insertions, 923 deletions
diff --git a/engines/gnap/scenes/scene16.cpp b/engines/gnap/scenes/scene16.cpp index bfe9afaf87..370faf40bb 100644 --- a/engines/gnap/scenes/scene16.cpp +++ b/engines/gnap/scenes/scene16.cpp @@ -30,56 +30,56 @@ namespace Gnap { Scene16::Scene16(GnapEngine *vm) : CutScene(vm) {} int Scene16::init() { - _s99_sequenceIdArr[0] = 0x1F2; - _s99_sequenceIdArr[1] = 0x201; - _s99_sequenceIdArr[2] = 0x1FC; - _s99_sequenceIdArr[3] = 0x1F4; - _s99_sequenceIdArr[4] = 0x1FB; - _s99_sequenceIdArr[5] = 0x1F0; - _s99_sequenceIdArr[6] = 0x1FD; - _s99_sequenceIdArr[7] = 0x1FE; - _s99_sequenceIdArr[8] = 0x1F7; - _s99_sequenceIdArr[9] = 0x1F9; - _s99_sequenceIdArr[10] = 0x1F8; - _s99_sequenceIdArr[11] = 0x1F1; - _s99_sequenceIdArr[12] = 0x202; - _s99_sequenceIdArr[13] = 0x1F6; - _s99_sequenceIdArr[14] = 0x1F3; - _s99_sequenceIdArr[15] = 0x1FA; - _s99_sequenceIdArr[16] = 0x1FF; - _s99_sequenceIdArr[17] = 0x200; - _s99_sequenceIdArr[18] = 0x203; - _s99_sequenceIdArr[19] = 0x206; - _s99_sequenceIdArr[20] = 0x207; - _s99_sequenceIdArr[21] = 0x204; - _s99_sequenceIdArr[22] = 0x205; - _s99_resourceIdArr[0] = 0x1C; - _s99_resourceIdArr[1] = 2; - _s99_resourceIdArr[2] = 0x1B; - _s99_resourceIdArr[3] = 0; - _s99_resourceIdArr[4] = 0x167; - _s99_resourceIdArr[5] = 1; - _s99_resourceIdArr[6] = 0x15B; - _s99_resourceIdArr[7] = 0x15A; - _s99_resourceIdArr[8] = 0x170; - _s99_resourceIdArr[9] = 0x1EB; - _s99_resourceIdArr[10] = 0x1EC; - _s99_resourceIdArr[11] = 0x1BE; - _s99_resourceIdArr[12] = 0x1BF; - _s99_sequenceCountArr[0] = 4; - _s99_sequenceCountArr[1] = 1; - _s99_sequenceCountArr[2] = 1; - _s99_sequenceCountArr[3] = 6; - _s99_sequenceCountArr[4] = 1; - _s99_sequenceCountArr[5] = 3; - _s99_sequenceCountArr[6] = 1; - _s99_sequenceCountArr[7] = 1; - _s99_sequenceCountArr[8] = 1; - _s99_sequenceCountArr[9] = 1; - _s99_sequenceCountArr[10] = 1; - _s99_sequenceCountArr[11] = 1; - _s99_sequenceCountArr[12] = 1; - _s99_itemsCount = 13; + _sequenceIdArr[0] = 0x1F2; + _sequenceIdArr[1] = 0x201; + _sequenceIdArr[2] = 0x1FC; + _sequenceIdArr[3] = 0x1F4; + _sequenceIdArr[4] = 0x1FB; + _sequenceIdArr[5] = 0x1F0; + _sequenceIdArr[6] = 0x1FD; + _sequenceIdArr[7] = 0x1FE; + _sequenceIdArr[8] = 0x1F7; + _sequenceIdArr[9] = 0x1F9; + _sequenceIdArr[10] = 0x1F8; + _sequenceIdArr[11] = 0x1F1; + _sequenceIdArr[12] = 0x202; + _sequenceIdArr[13] = 0x1F6; + _sequenceIdArr[14] = 0x1F3; + _sequenceIdArr[15] = 0x1FA; + _sequenceIdArr[16] = 0x1FF; + _sequenceIdArr[17] = 0x200; + _sequenceIdArr[18] = 0x203; + _sequenceIdArr[19] = 0x206; + _sequenceIdArr[20] = 0x207; + _sequenceIdArr[21] = 0x204; + _sequenceIdArr[22] = 0x205; + _resourceIdArr[0] = 0x1C; + _resourceIdArr[1] = 2; + _resourceIdArr[2] = 0x1B; + _resourceIdArr[3] = 0; + _resourceIdArr[4] = 0x167; + _resourceIdArr[5] = 1; + _resourceIdArr[6] = 0x15B; + _resourceIdArr[7] = 0x15A; + _resourceIdArr[8] = 0x170; + _resourceIdArr[9] = 0x1EB; + _resourceIdArr[10] = 0x1EC; + _resourceIdArr[11] = 0x1BE; + _resourceIdArr[12] = 0x1BF; + _sequenceCountArr[0] = 4; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = 1; + _sequenceCountArr[3] = 6; + _sequenceCountArr[4] = 1; + _sequenceCountArr[5] = 3; + _sequenceCountArr[6] = 1; + _sequenceCountArr[7] = 1; + _sequenceCountArr[8] = 1; + _sequenceCountArr[9] = 1; + _sequenceCountArr[10] = 1; + _sequenceCountArr[11] = 1; + _sequenceCountArr[12] = 1; + _itemsCount = 13; return -1; } diff --git a/engines/gnap/scenes/scene40.cpp b/engines/gnap/scenes/scene40.cpp index c3adbf2f50..ade66363dc 100644 --- a/engines/gnap/scenes/scene40.cpp +++ b/engines/gnap/scenes/scene40.cpp @@ -43,8 +43,10 @@ Scene40::Scene40(GnapEngine *vm) : Scene(vm) { } int Scene40::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); return _vm->isFlag(kGFUnk23) ? 0x01 : 0x00; } @@ -177,8 +179,10 @@ void Scene40::run() { } void Scene40::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); if (_vm->_gnapActionStatus) _vm->_gnapActionStatus = -1; else diff --git a/engines/gnap/scenes/scene41.cpp b/engines/gnap/scenes/scene41.cpp index 0cc83ff819..605dff0abe 100644 --- a/engines/gnap/scenes/scene41.cpp +++ b/engines/gnap/scenes/scene41.cpp @@ -60,16 +60,18 @@ enum { }; Scene41::Scene41(GnapEngine *vm) : Scene(vm) { - _s41_currKidSequenceId = -1; - _s41_nextKidSequenceId = -1; - _s41_currToyVendorSequenceId = -1; - _s41_nextToyVendorSequenceId = -1; + _currKidSequenceId = -1; + _nextKidSequenceId = -1; + _currToyVendorSequenceId = -1; + _nextToyVendorSequenceId = -1; } int Scene41::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 2); + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); return 0x129; } @@ -96,6 +98,8 @@ void Scene41::updateHotspots() { } void Scene41::run() { + GameSys gameSys = *_vm->_gameSys; + _vm->queueInsertDeviceIcon(); if (_vm->isFlag(kGFGnapControlsToyUFO)) { @@ -116,26 +120,26 @@ void Scene41::run() { _vm->_toyUfoSequenceId = _vm->toyUfoGetSequenceId(); _vm->_toyUfoNextSequenceId = _vm->_toyUfoSequenceId; - _vm->_gameSys->setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 2); - _vm->_gameSys->insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); - _vm->_gameSys->insertSequence(0x128, 0, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 2); + gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + gameSys.insertSequence(0x128, 0, 0, 0, kSeqLoop, 0, 0, 0); if (_vm->isFlag(kGFGnapControlsToyUFO)) - _s41_currKidSequenceId = 0x11B; + _currKidSequenceId = 0x11B; else - _s41_currKidSequenceId = 0x11D; + _currKidSequenceId = 0x11D; - _s41_nextKidSequenceId = -1; + _nextKidSequenceId = -1; - _vm->_gameSys->setAnimation(_s41_currKidSequenceId, 1, 4); - _vm->_gameSys->insertSequence(_s41_currKidSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(_currKidSequenceId, 1, 4); + gameSys.insertSequence(_currKidSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - _s41_currToyVendorSequenceId = 0x118; - _s41_nextToyVendorSequenceId = -1; + _currToyVendorSequenceId = 0x118; + _nextToyVendorSequenceId = -1; - _vm->_gameSys->setAnimation(0x118, 1, 3); - _vm->_gameSys->insertSequence(_s41_currToyVendorSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->insertSequence(0x127, 2, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x118, 1, 3); + gameSys.insertSequence(_currToyVendorSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x127, 2, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_gnapSequenceId = 0x120; @@ -144,8 +148,8 @@ void Scene41::run() { _vm->_gnapX = 7; _vm->_gnapY = 7; _vm->_gnapId = 140; - _vm->_gameSys->insertSequence(0x120, 140, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + gameSys.insertSequence(0x120, 140, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); _vm->initPlatypusPos(8, 10, kDirBottomLeft); _vm->endSceneInit(); } else if (_vm->_prevSceneNum == 45) { @@ -329,7 +333,7 @@ void Scene41::run() { case kHSToyUfo: if (_vm->_grabCursorSpriteIndex == kItemGum) { _vm->playGnapPullOutDevice(9, 0); - _vm->_gameSys->setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); + gameSys.setAnimation(makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, 0); _vm->_gnapActionStatus = kASUseGumWithToyUfo; } break; @@ -345,10 +349,10 @@ void Scene41::run() { if (!_vm->_timers[9] && _vm->_gnapActionStatus < 0) { _vm->_gnapActionStatus = kASGiveBackToyUfo; if (_vm->_gnapSequenceId == 0x121 || _vm->_gnapSequenceId == 0x122) { - _vm->_gameSys->insertSequence(0x123, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x123, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x123; _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x123, _vm->_gnapId, 0); + gameSys.setAnimation(0x123, _vm->_gnapId, 0); } } } @@ -372,10 +376,10 @@ void Scene41::run() { else sequenceId = 0x121; } - _vm->_gameSys->insertSequence(sequenceId, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(sequenceId, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = sequenceId; _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(sequenceId, _vm->_gnapId, 0); + gameSys.setAnimation(sequenceId, _vm->_gnapId, 0); _vm->_toyUfoActionStatus = kASToyUfoRefresh; _vm->toyUfoFlyTo(-1, -1, 0, 799, 0, 300, 2); } else { @@ -392,31 +396,31 @@ void Scene41::run() { _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(100) + 100; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _s41_nextToyVendorSequenceId == -1) { + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextToyVendorSequenceId == -1) { switch (_vm->getRandom(3)) { case 0: - _s41_nextToyVendorSequenceId = 0x113; + _nextToyVendorSequenceId = 0x113; break; case 1: - _s41_nextToyVendorSequenceId = 0x117; + _nextToyVendorSequenceId = 0x117; break; case 2: - _s41_nextToyVendorSequenceId = 0x119; + _nextToyVendorSequenceId = 0x119; break; } - if (_s41_nextToyVendorSequenceId == _s41_currToyVendorSequenceId) - _s41_nextToyVendorSequenceId = -1; + if (_nextToyVendorSequenceId == _currToyVendorSequenceId) + _nextToyVendorSequenceId = -1; } } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(30) + 20; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _s41_nextKidSequenceId == -1) { + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _vm->_toyUfoActionStatus == -1 && _nextKidSequenceId == -1) { if (_vm->isFlag(kGFGnapControlsToyUFO)) - _s41_nextKidSequenceId = 0x11B; + _nextKidSequenceId = 0x11B; else if (_vm->getRandom(3) != 0) - _s41_nextKidSequenceId = 0x11D; + _nextKidSequenceId = 0x11D; else - _s41_nextKidSequenceId = 0x11E; + _nextKidSequenceId = 0x11E; } } } @@ -435,25 +439,27 @@ void Scene41::run() { } void Scene41::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { + GameSys gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _vm->_gameSys->setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 0); _vm->_sceneDone = true; _vm->_gnapActionStatus = -1; break; case kASUseQuarterWithToyVendor: - _vm->_gameSys->setAnimation(0, 0, 0); - _s41_nextToyVendorSequenceId = 0x114; + gameSys.setAnimation(0, 0, 0); + _nextToyVendorSequenceId = 0x114; _vm->_gnapActionStatus = -1; break; case kASTalkToyVendor: - _vm->_gameSys->setAnimation(0, 0, 0); - _s41_nextToyVendorSequenceId = 0x116; + gameSys.setAnimation(0, 0, 0); + _nextToyVendorSequenceId = 0x116; _vm->_gnapActionStatus = -1; break; case kASUseGumWithToyUfo: - _vm->_gameSys->setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 0); _vm->playGnapUseDevice(9, 0); _vm->_gnapActionStatus = -1; _vm->setGrabCursorSprite(-1); @@ -461,19 +467,19 @@ void Scene41::updateAnimations() { _vm->_toyUfoActionStatus = kASUfoGumAttached; break; case kASUseChickenBucketWithKid: - if (_vm->_gameSys->getAnimationStatus(4) == 2) { + if (gameSys.getAnimationStatus(4) == 2) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; _vm->setGrabCursorSprite(-1); - _vm->_gameSys->insertSequence(0x11F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x11F, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x11F; _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x11F, _vm->_gnapId, 0); - _s41_nextKidSequenceId = 0x11A; - _vm->_gameSys->insertSequence(0x11A, 1, _s41_currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s41_nextKidSequenceId, 1, 4); - _s41_currKidSequenceId = _s41_nextKidSequenceId; - _s41_nextKidSequenceId = 0x11B; + gameSys.setAnimation(0x11F, _vm->_gnapId, 0); + _nextKidSequenceId = 0x11A; + gameSys.insertSequence(0x11A, 1, _currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextKidSequenceId, 1, 4); + _currKidSequenceId = _nextKidSequenceId; + _nextKidSequenceId = 0x11B; _vm->_timers[5] = _vm->getRandom(30) + 20; _vm->_gnapActionStatus = -1; _vm->setFlag(kGFGnapControlsToyUFO); @@ -482,49 +488,49 @@ void Scene41::updateAnimations() { } break; case kASGrabKid: - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _vm->_gameSys->getAnimationStatus(4) == 2) { + if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - _vm->_gameSys->insertSequence(0x110, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x110, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x110; _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x110, _vm->_gnapId, 0); - _s41_nextToyVendorSequenceId = 0x111; - _vm->_gameSys->insertSequence(0x111, 1, _s41_currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s41_nextToyVendorSequenceId, 1, 3); - _s41_currToyVendorSequenceId = _s41_nextToyVendorSequenceId; - _s41_nextToyVendorSequenceId = -1; + gameSys.setAnimation(0x110, _vm->_gnapId, 0); + _nextToyVendorSequenceId = 0x111; + gameSys.insertSequence(0x111, 1, _currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextToyVendorSequenceId, 1, 3); + _currToyVendorSequenceId = _nextToyVendorSequenceId; + _nextToyVendorSequenceId = -1; _vm->_timers[4] = _vm->getRandom(100) + 100; - _s41_nextKidSequenceId = 0x10F; - _vm->_gameSys->insertSequence(0x10F, 1, _s41_currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s41_nextKidSequenceId, 1, 4); - _s41_currKidSequenceId = _s41_nextKidSequenceId; - _s41_nextKidSequenceId = -1; + _nextKidSequenceId = 0x10F; + gameSys.insertSequence(0x10F, 1, _currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextKidSequenceId, 1, 4); + _currKidSequenceId = _nextKidSequenceId; + _nextKidSequenceId = -1; _vm->_timers[5] = _vm->getRandom(30) + 20; _vm->_gnapActionStatus = -1; } break; case kASGiveBackToyUfo: - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _vm->_gameSys->getAnimationStatus(4) == 2) { + if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - _vm->_gameSys->insertSequence(0x124, _vm->_gnapId, + gameSys.insertSequence(0x124, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x124; _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x124, _vm->_gnapId, 0); - _s41_nextToyVendorSequenceId = 0x112; - _vm->_gameSys->insertSequence(0x112, 1, _s41_currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s41_nextToyVendorSequenceId, 1, 3); - _s41_currToyVendorSequenceId = _s41_nextToyVendorSequenceId; - _s41_nextToyVendorSequenceId = -1; + gameSys.setAnimation(0x124, _vm->_gnapId, 0); + _nextToyVendorSequenceId = 0x112; + gameSys.insertSequence(0x112, 1, _currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextToyVendorSequenceId, 1, 3); + _currToyVendorSequenceId = _nextToyVendorSequenceId; + _nextToyVendorSequenceId = -1; _vm->_timers[4] = _vm->getRandom(100) + 100; - _s41_nextKidSequenceId = 0x11C; - _vm->_gameSys->insertSequence(0x11C, 1, _s41_currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s41_nextKidSequenceId, 1, 4); - _s41_currKidSequenceId = _s41_nextKidSequenceId; - _s41_nextKidSequenceId = -1; + _nextKidSequenceId = 0x11C; + gameSys.insertSequence(0x11C, 1, _currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextKidSequenceId, 1, 4); + _currKidSequenceId = _nextKidSequenceId; + _nextKidSequenceId = -1; _vm->_timers[5] = _vm->getRandom(30) + 20; _vm->_gnapActionStatus = -1; _vm->clearFlag(kGFGnapControlsToyUFO); @@ -534,46 +540,46 @@ void Scene41::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { + if (gameSys.getAnimationStatus(2) == 2) { switch (_vm->_toyUfoActionStatus) { case kASToyUfoLeaveScene: _vm->_sceneDone = true; break; case kASUfoGumAttached: _vm->_toyUfoNextSequenceId = 0x873; - _vm->_gameSys->insertSequence(0x10873, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, + gameSys.insertSequence(0x10873, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, _vm->_toyUfoX - 365, _vm->_toyUfoY - 128); _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; - _vm->_gameSys->setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 2); + gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 2); _vm->toyUfoSetStatus(kGFJointTaken); break; default: _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); - _vm->_gameSys->insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, + gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; ++_vm->_toyUfoId; - _vm->_gameSys->setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 2); + gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 2); break; } _vm->_toyUfoActionStatus = -1; } - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s41_nextToyVendorSequenceId != -1) { - _vm->_gameSys->insertSequence(_s41_nextToyVendorSequenceId, 1, _s41_currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s41_nextToyVendorSequenceId, 1, 3); - _s41_currToyVendorSequenceId = _s41_nextToyVendorSequenceId; - _s41_nextToyVendorSequenceId = -1; + if (gameSys.getAnimationStatus(3) == 2 && _nextToyVendorSequenceId != -1) { + gameSys.insertSequence(_nextToyVendorSequenceId, 1, _currToyVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextToyVendorSequenceId, 1, 3); + _currToyVendorSequenceId = _nextToyVendorSequenceId; + _nextToyVendorSequenceId = -1; _vm->_timers[4] = _vm->getRandom(100) + 100; } - if (_vm->_gameSys->getAnimationStatus(4) == 2 && _s41_nextKidSequenceId != -1) { - _vm->_gameSys->insertSequence(_s41_nextKidSequenceId, 1, _s41_currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s41_nextKidSequenceId, 1, 4); - _s41_currKidSequenceId = _s41_nextKidSequenceId; - _s41_nextKidSequenceId = -1; + if (gameSys.getAnimationStatus(4) == 2 && _nextKidSequenceId != -1) { + gameSys.insertSequence(_nextKidSequenceId, 1, _currKidSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextKidSequenceId, 1, 4); + _currKidSequenceId = _nextKidSequenceId; + _nextKidSequenceId = -1; _vm->_timers[5] = _vm->getRandom(30) + 20; - if (_s41_currKidSequenceId == 0x11E) { + if (_currKidSequenceId == 0x11E) { _vm->_toyUfoActionStatus = kASToyUfoRefresh; _vm->toyUfoFlyTo(_vm->getRandom(300) + 500, _vm->getRandom(225) + 75, 0, 799, 0, 300, 2); } diff --git a/engines/gnap/scenes/scene41.h b/engines/gnap/scenes/scene41.h index 91e8a1a1a4..0b0cd4ec40 100644 --- a/engines/gnap/scenes/scene41.h +++ b/engines/gnap/scenes/scene41.h @@ -42,10 +42,10 @@ public: virtual void updateAnimationsCb() {}; private: - int _s41_currKidSequenceId; - int _s41_nextKidSequenceId; - int _s41_currToyVendorSequenceId; - int _s41_nextToyVendorSequenceId; + int _currKidSequenceId; + int _nextKidSequenceId; + int _currToyVendorSequenceId; + int _nextToyVendorSequenceId; }; } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene42.cpp b/engines/gnap/scenes/scene42.cpp index 33f961d653..8bab50260b 100644 --- a/engines/gnap/scenes/scene42.cpp +++ b/engines/gnap/scenes/scene42.cpp @@ -58,14 +58,16 @@ enum { }; Scene42::Scene42(GnapEngine *vm) : Scene(vm) { - _s42_currBBQVendorSequenceId = -1; - _s42_nextBBQVendorSequenceId = -1; + _currBBQVendorSequenceId = -1; + _nextBBQVendorSequenceId = -1; } int Scene42::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 2); + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); if (_vm->isFlag(kGFPictureTaken) || (_vm->isFlag(kGFUnk18) && _vm->isFlag(kGFUnk23))) return 0x153; return 0x152; @@ -96,13 +98,15 @@ void Scene42::updateHotspots() { } void Scene42::run() { + GameSys gameSys = *_vm->_gameSys; + _vm->queueInsertDeviceIcon(); - _s42_currBBQVendorSequenceId = 0x14A; - _s42_nextBBQVendorSequenceId = -1; + _currBBQVendorSequenceId = 0x14A; + _nextBBQVendorSequenceId = -1; - _vm->_gameSys->setAnimation(0x14A, 1, 2); - _vm->_gameSys->insertSequence(_s42_currBBQVendorSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x14A, 1, 2); + gameSys.insertSequence(_currBBQVendorSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoId = 0; @@ -110,7 +114,7 @@ void Scene42::run() { if (_vm->_prevSceneNum == 43 && _vm->isFlag(kGFUnk18)) { _vm->_toyUfoSequenceId = 0x872; _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); - _vm->_gameSys->insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, 0, 0); _vm->_toyUfoX = 317; _vm->_toyUfoY = 61; _vm->toyUfoSetStatus(kGFJointTaken); @@ -123,9 +127,9 @@ void Scene42::run() { _vm->_toyUfoX = 30; else _vm->_toyUfoX = 770; - _vm->_gameSys->insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); } - _vm->_gameSys->setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 3); + gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 3); _vm->endSceneInit(); if (_vm->_toyUfoSequenceId == 0x872) _vm->setGrabCursorSprite(-1); @@ -329,27 +333,27 @@ void Scene42::run() { _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 30; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s42_nextBBQVendorSequenceId == -1) { + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextBBQVendorSequenceId == -1) { switch (_vm->getRandom(8)) { case 0: - _s42_nextBBQVendorSequenceId = 0x14C; + _nextBBQVendorSequenceId = 0x14C; break; case 1: case 2: - _s42_nextBBQVendorSequenceId = 0x149; + _nextBBQVendorSequenceId = 0x149; break; case 3: case 4: case 5: case 6: - _s42_nextBBQVendorSequenceId = 0x14D; + _nextBBQVendorSequenceId = 0x14D; break; case 7: - _s42_nextBBQVendorSequenceId = 0x14A; + _nextBBQVendorSequenceId = 0x14A; break; } - if (_s42_nextBBQVendorSequenceId == _s42_currBBQVendorSequenceId && _s42_nextBBQVendorSequenceId != 0x14D) - _s42_nextBBQVendorSequenceId = -1; + if (_nextBBQVendorSequenceId == _currBBQVendorSequenceId && _nextBBQVendorSequenceId != 0x14D) + _nextBBQVendorSequenceId = -1; } } } @@ -368,104 +372,106 @@ void Scene42::run() { } void Scene42::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { + GameSys gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { switch (_vm->_gnapActionStatus) { case kASLeaveScene: - _vm->_gameSys->setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 0); _vm->_gnapActionStatus = -1; _vm->_sceneDone = true; break; case kASTalkBBQVendor: - _vm->_gameSys->setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 0); _vm->_gnapActionStatus = -1; - _s42_nextBBQVendorSequenceId = 0x14B; + _nextBBQVendorSequenceId = 0x14B; break; case kASUseQuarterWithBBQVendor: case kASGrabChickenLeg: - if (_vm->_gameSys->getAnimationStatus(2) == 2) { + if (gameSys.getAnimationStatus(2) == 2) { int sequenceId; if (_vm->_gnapActionStatus == kASUseQuarterWithBBQVendor) { _vm->invRemove(kItemDiceQuarterHole); _vm->invAdd(kItemChickenBucket); _vm->setGrabCursorSprite(-1); sequenceId = 0x150; - _s42_nextBBQVendorSequenceId = 0x148; + _nextBBQVendorSequenceId = 0x148; } else if (_vm->isFlag(kGFUnk27)) { if (_vm->isFlag(kGFUnk28)) { sequenceId = 0x7B7; - _s42_nextBBQVendorSequenceId = 0x145; + _nextBBQVendorSequenceId = 0x145; } else { _vm->setFlag(kGFUnk28); sequenceId = 0x14F; - _s42_nextBBQVendorSequenceId = 0x147; + _nextBBQVendorSequenceId = 0x147; } } else { _vm->setFlag(kGFUnk27); sequenceId = 0x14E; - _s42_nextBBQVendorSequenceId = 0x146; + _nextBBQVendorSequenceId = 0x146; } if (sequenceId == 0x7B7) { - _vm->_gameSys->insertSequence(0x107B7, _vm->_gnapId, + gameSys.insertSequence(0x107B7, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, - kSeqSyncWait, _vm->getSequenceTotalDuration(_s42_nextBBQVendorSequenceId), + kSeqSyncWait, _vm->getSequenceTotalDuration(_nextBBQVendorSequenceId), 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->_gnapSequenceDatNum = 1; } else { - _vm->_gameSys->insertSequence(sequenceId, _vm->_gnapId, + gameSys.insertSequence(sequenceId, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceDatNum = 0; } _vm->_gnapSequenceId = sequenceId; - _vm->_gameSys->setAnimation(sequenceId | (_vm->_gnapSequenceDatNum << 16), _vm->_gnapId, 0); + gameSys.setAnimation(sequenceId | (_vm->_gnapSequenceDatNum << 16), _vm->_gnapId, 0); if (_vm->_gnapActionStatus == kASUseQuarterWithBBQVendor) _vm->_gnapActionStatus = kASUseQuarterWithBBQVendorDone; else _vm->_gnapActionStatus = -1; - _vm->_gameSys->insertSequence(_s42_nextBBQVendorSequenceId, 1, _s42_currBBQVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s42_nextBBQVendorSequenceId, 1, 2); - _s42_currBBQVendorSequenceId = _s42_nextBBQVendorSequenceId; - if (_s42_nextBBQVendorSequenceId == 0x145) - _s42_nextBBQVendorSequenceId = 0x14A; + gameSys.insertSequence(_nextBBQVendorSequenceId, 1, _currBBQVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextBBQVendorSequenceId, 1, 2); + _currBBQVendorSequenceId = _nextBBQVendorSequenceId; + if (_nextBBQVendorSequenceId == 0x145) + _nextBBQVendorSequenceId = 0x14A; else - _s42_nextBBQVendorSequenceId = -1; + _nextBBQVendorSequenceId = -1; _vm->_timers[4] = _vm->getRandom(20) + 30; _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; } break; case kASUseQuarterWithBBQVendorDone: - _vm->_gameSys->setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 0); _vm->setGrabCursorSprite(kItemChickenBucket); _vm->_gnapActionStatus = -1; break; default: - _vm->_gameSys->setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 0); _vm->_gnapActionStatus = -1; break; } } - if (_vm->_gameSys->getAnimationStatus(2) == 2 && _s42_nextBBQVendorSequenceId != -1) { - _vm->_gameSys->insertSequence(_s42_nextBBQVendorSequenceId, 1, _s42_currBBQVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s42_nextBBQVendorSequenceId, 1, 2); - _s42_currBBQVendorSequenceId = _s42_nextBBQVendorSequenceId; - _s42_nextBBQVendorSequenceId = -1; + if (gameSys.getAnimationStatus(2) == 2 && _nextBBQVendorSequenceId != -1) { + gameSys.insertSequence(_nextBBQVendorSequenceId, 1, _currBBQVendorSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextBBQVendorSequenceId, 1, 2); + _currBBQVendorSequenceId = _nextBBQVendorSequenceId; + _nextBBQVendorSequenceId = -1; _vm->_timers[4] = _vm->getRandom(20) + 30; } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { switch (_vm->_toyUfoActionStatus) { case kASToyUfoLeaveScene: _vm->_sceneDone = true; break; case kASToyUfoPickUpHotSauce: - _vm->_gameSys->insertSequence(0x10870, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x10870, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, 0, 0); _vm->setFlag(kGFUnk24); updateHotspots(); _vm->toyUfoSetStatus(kGFGroceryStoreHatTaken); _vm->_toyUfoSequenceId = 0x870; - _vm->_gameSys->setAnimation(0x10870, _vm->_toyUfoId, 3); + gameSys.setAnimation(0x10870, _vm->_toyUfoId, 3); _vm->_toyUfoActionStatus = -1; _vm->_toyUfoX = 0x181; _vm->_toyUfoY = 53; @@ -474,16 +480,16 @@ void Scene42::updateAnimations() { if (_vm->_toyUfoSequenceId == 0x872) { _vm->hideCursor(); _vm->addFullScreenSprite(0x13E, 255); - _vm->_gameSys->setAnimation(0x151, 256, 0); - _vm->_gameSys->insertSequence(0x151, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) + gameSys.setAnimation(0x151, 256, 0); + gameSys.insertSequence(0x151, 256, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); _vm->removeFullScreenSprite(); _vm->showCursor(); } _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); - _vm->_gameSys->setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, (_vm->_toyUfoId + 1) % 10, 3); - _vm->_gameSys->insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, (_vm->_toyUfoId + 1) % 10, + gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, (_vm->_toyUfoId + 1) % 10, 3); + gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, (_vm->_toyUfoId + 1) % 10, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; diff --git a/engines/gnap/scenes/scene42.h b/engines/gnap/scenes/scene42.h index a3008a2829..8175e98110 100644 --- a/engines/gnap/scenes/scene42.h +++ b/engines/gnap/scenes/scene42.h @@ -42,8 +42,8 @@ public: virtual void updateAnimationsCb() {}; private: - int _s42_currBBQVendorSequenceId; - int _s42_nextBBQVendorSequenceId; + int _currBBQVendorSequenceId; + int _nextBBQVendorSequenceId; }; } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene43.cpp b/engines/gnap/scenes/scene43.cpp index 9c7b56aabf..a3119bfb1e 100644 --- a/engines/gnap/scenes/scene43.cpp +++ b/engines/gnap/scenes/scene43.cpp @@ -49,14 +49,16 @@ enum { }; Scene43::Scene43(GnapEngine *vm) : Scene(vm) { - _s43_currTwoHeadedGuySequenceId = -1; - _s43_nextTwoHeadedGuySequenceId = -1; + _currTwoHeadedGuySequenceId = -1; + _nextTwoHeadedGuySequenceId = -1; } int Scene43::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 2); + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); return 0x13F; } @@ -92,16 +94,18 @@ void Scene43::updateHotspots() { } void Scene43::run() { + GameSys gameSys = *_vm->_gameSys; + _vm->queueInsertDeviceIcon(); if (!_vm->isFlag(kGFUnk14)) - _vm->_gameSys->insertSequence(0x1086F, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x1086F, 1, 0, 0, kSeqNone, 0, 0, 0); - _s43_currTwoHeadedGuySequenceId = 0x13C; - _s43_nextTwoHeadedGuySequenceId = -1; + _currTwoHeadedGuySequenceId = 0x13C; + _nextTwoHeadedGuySequenceId = -1; - _vm->_gameSys->setAnimation(0x13C, 1, 2); - _vm->_gameSys->insertSequence(_s43_currTwoHeadedGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x13C, 1, 2); + gameSys.insertSequence(_currTwoHeadedGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoId = 0; @@ -112,8 +116,8 @@ void Scene43::run() { _vm->_toyUfoX = 30; else _vm->_toyUfoX = 770; - _vm->_gameSys->setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 3); - _vm->_gameSys->insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 3); + gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->endSceneInit(); } else { switch (_vm->_prevSceneNum) { @@ -329,26 +333,26 @@ void Scene43::run() { _vm->updateGnapIdleSequence(); if (!_vm->_timers[4] && (!_vm->isFlag(kGFGnapControlsToyUFO) || !_vm->isFlag(kGFGroceryStoreHatTaken))) { _vm->_timers[4] = _vm->getRandom(100) + 100; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s43_nextTwoHeadedGuySequenceId == -1) { + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextTwoHeadedGuySequenceId == -1) { switch (_vm->getRandom(5)) { case 0: - _s43_nextTwoHeadedGuySequenceId = 0x13C; + _nextTwoHeadedGuySequenceId = 0x13C; break; case 1: - _s43_nextTwoHeadedGuySequenceId = 0x134; + _nextTwoHeadedGuySequenceId = 0x134; break; case 2: - _s43_nextTwoHeadedGuySequenceId = 0x135; + _nextTwoHeadedGuySequenceId = 0x135; break; case 3: - _s43_nextTwoHeadedGuySequenceId = 0x136; + _nextTwoHeadedGuySequenceId = 0x136; break; case 4: - _s43_nextTwoHeadedGuySequenceId = 0x13A; + _nextTwoHeadedGuySequenceId = 0x13A; break; } - if (_s43_nextTwoHeadedGuySequenceId == _s43_currTwoHeadedGuySequenceId) - _s43_nextTwoHeadedGuySequenceId = -1; + if (_nextTwoHeadedGuySequenceId == _currTwoHeadedGuySequenceId) + _nextTwoHeadedGuySequenceId = -1; } } } @@ -370,89 +374,91 @@ void Scene43::run() { } void Scene43::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { + GameSys gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { switch (_vm->_gnapActionStatus) { case 0: - _vm->_gameSys->setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 0); _vm->_sceneDone = true; break; case 1: - if (_vm->_gameSys->getAnimationStatus(2) == 2) { + if (gameSys.getAnimationStatus(2) == 2) { _vm->_timers[2] = _vm->getRandom(30) + 20; _vm->_timers[3] = _vm->getRandom(50) + 200; - _vm->_gameSys->insertSequence(0x13D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x13D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x13D; _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x13D, _vm->_gnapId, 0); - _s43_nextTwoHeadedGuySequenceId = 0x13B; - _vm->_gameSys->insertSequence(0x13B, 1, _s43_currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s43_nextTwoHeadedGuySequenceId, 1, 2); - _s43_currTwoHeadedGuySequenceId = _s43_nextTwoHeadedGuySequenceId; - _s43_nextTwoHeadedGuySequenceId = -1; + gameSys.setAnimation(0x13D, _vm->_gnapId, 0); + _nextTwoHeadedGuySequenceId = 0x13B; + gameSys.insertSequence(0x13B, 1, _currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextTwoHeadedGuySequenceId, 1, 2); + _currTwoHeadedGuySequenceId = _nextTwoHeadedGuySequenceId; + _nextTwoHeadedGuySequenceId = -1; _vm->_timers[4] = _vm->getRandom(100) + 100; _vm->_gnapActionStatus = -1; } break; default: - _vm->_gameSys->setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 0); _vm->_gnapActionStatus = -1; break; } } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - if (_s43_currTwoHeadedGuySequenceId == 0x13A) { + if (gameSys.getAnimationStatus(2) == 2) { + if (_currTwoHeadedGuySequenceId == 0x13A) { if (_vm->isFlag(kGFGroceryStoreHatTaken)) { - _s43_nextTwoHeadedGuySequenceId = 0x13E; + _nextTwoHeadedGuySequenceId = 0x13E; _vm->stopSound(0x108F6); } else if (_vm->getRandom(2) != 0) { - _s43_nextTwoHeadedGuySequenceId = 0x137; + _nextTwoHeadedGuySequenceId = 0x137; } else { - _s43_nextTwoHeadedGuySequenceId = 0x138; + _nextTwoHeadedGuySequenceId = 0x138; } - } else if (_s43_currTwoHeadedGuySequenceId == 0x13E) { + } else if (_currTwoHeadedGuySequenceId == 0x13E) { _vm->_sceneDone = true; _vm->_newSceneNum = 54; } - if (_s43_nextTwoHeadedGuySequenceId != -1) { - _vm->_gameSys->insertSequence(_s43_nextTwoHeadedGuySequenceId, 1, _s43_currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s43_nextTwoHeadedGuySequenceId, 1, 2); - _s43_currTwoHeadedGuySequenceId = _s43_nextTwoHeadedGuySequenceId; - _s43_nextTwoHeadedGuySequenceId = -1; + if (_nextTwoHeadedGuySequenceId != -1) { + gameSys.insertSequence(_nextTwoHeadedGuySequenceId, 1, _currTwoHeadedGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextTwoHeadedGuySequenceId, 1, 2); + _currTwoHeadedGuySequenceId = _nextTwoHeadedGuySequenceId; + _nextTwoHeadedGuySequenceId = -1; _vm->_timers[4] = _vm->getRandom(100) + 100; } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { switch (_vm->_toyUfoActionStatus) { case 4: _vm->_sceneDone = true; _vm->_toyUfoActionStatus = -1; break; case 6: - _vm->_gameSys->insertSequence(0x10871, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->removeSequence(0x1086F, 1, true); + gameSys.insertSequence(0x10871, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, 0, 0); + gameSys.removeSequence(0x1086F, 1, true); _vm->setFlag(kGFUnk14); updateHotspots(); _vm->toyUfoSetStatus(kGFUnk18); _vm->_toyUfoSequenceId = 0x871; - _vm->_gameSys->setAnimation(0x10871, _vm->_toyUfoId, 3); + gameSys.setAnimation(0x10871, _vm->_toyUfoId, 3); _vm->_toyUfoActionStatus = -1; _vm->_toyUfoX = 96; _vm->_toyUfoY = 131; break; case 7: - _vm->_gameSys->insertSequence(0x10874, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x10874, _vm->_toyUfoId, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, 0, 0); _vm->_toyUfoSequenceId = 0x874; - _vm->_gameSys->setAnimation(0x10874, _vm->_toyUfoId, 3); + gameSys.setAnimation(0x10874, _vm->_toyUfoId, 3); _vm->_toyUfoActionStatus = 8; _vm->setFlag(kGFJointTaken); _vm->_gnapActionStatus = 3; break; case 8: - _s43_nextTwoHeadedGuySequenceId = 0x13A; + _nextTwoHeadedGuySequenceId = 0x13A; _vm->_toyUfoX = 514; _vm->_toyUfoY = 125; _vm->toyUfoFlyTo(835, 125, 0, 835, 0, 300, 3); @@ -463,12 +469,12 @@ void Scene43::updateAnimations() { break; default: _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); - _vm->_gameSys->insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, + gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; ++_vm->_toyUfoId; - _vm->_gameSys->setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 3); + gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 3); _vm->_toyUfoActionStatus = -1; break; } diff --git a/engines/gnap/scenes/scene43.h b/engines/gnap/scenes/scene43.h index 427d18bdae..fdf6d6e4c2 100644 --- a/engines/gnap/scenes/scene43.h +++ b/engines/gnap/scenes/scene43.h @@ -42,8 +42,8 @@ public: virtual void updateAnimationsCb() {}; private: - int _s43_currTwoHeadedGuySequenceId; - int _s43_nextTwoHeadedGuySequenceId; + int _currTwoHeadedGuySequenceId; + int _nextTwoHeadedGuySequenceId; }; } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene44.cpp b/engines/gnap/scenes/scene44.cpp index 6c3bd9098b..2e66df7991 100644 --- a/engines/gnap/scenes/scene44.cpp +++ b/engines/gnap/scenes/scene44.cpp @@ -47,17 +47,19 @@ enum { }; Scene44::Scene44(GnapEngine *vm) : Scene(vm) { - _s44_nextSpringGuySequenceId = -1; - _s44_nextKissingLadySequenceId = -1; - _s44_currSpringGuySequenceId = -1; - _s44_currKissingLadySequenceId = -1; + _nextSpringGuySequenceId = -1; + _nextKissingLadySequenceId = -1; + _currSpringGuySequenceId = -1; + _currKissingLadySequenceId = -1; } int Scene44::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 2); - _vm->_gameSys->setAnimation(0, 0, 3); + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); + gameSys.setAnimation(0, 0, 3); return 0xFF; } @@ -88,37 +90,39 @@ void Scene44::updateHotspots() { } void Scene44::run() { + GameSys gameSys = *_vm->_gameSys; + _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0xF7, 0, 0, 0, kSeqLoop, 0, 0, 0); - _vm->_gameSys->insertSequence(0xFC, 256, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xF7, 0, 0, 0, kSeqLoop, 0, 0, 0); + gameSys.insertSequence(0xFC, 256, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFSpringTaken)) - _s44_currSpringGuySequenceId = 0xF8; + _currSpringGuySequenceId = 0xF8; else - _s44_currSpringGuySequenceId = 0xF9; + _currSpringGuySequenceId = 0xF9; - _s44_nextSpringGuySequenceId = -1; - _vm->_gameSys->setAnimation(_s44_currSpringGuySequenceId, 1, 4); - _vm->_gameSys->insertSequence(_s44_currSpringGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _nextSpringGuySequenceId = -1; + gameSys.setAnimation(_currSpringGuySequenceId, 1, 4); + gameSys.insertSequence(_currSpringGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFUnk13)) { if (_vm->_prevSceneNum != 50 || _vm->_sceneSavegameLoaded) { - _s44_currKissingLadySequenceId = 0xF6; - _s44_nextKissingLadySequenceId = -1; + _currKissingLadySequenceId = 0xF6; + _nextKissingLadySequenceId = -1; } else { _vm->setGrabCursorSprite(kItemGum); - _s44_currKissingLadySequenceId = 0xF5; - _s44_nextKissingLadySequenceId = 0xF6; - _vm->_gameSys->setAnimation(0xF5, 1, 2); + _currKissingLadySequenceId = 0xF5; + _nextKissingLadySequenceId = 0xF6; + gameSys.setAnimation(0xF5, 1, 2); } } else { - _s44_currKissingLadySequenceId = 0xEC; - _s44_nextKissingLadySequenceId = -1; - _vm->_gameSys->setAnimation(0xEC, 1, 2); + _currKissingLadySequenceId = 0xEC; + _nextKissingLadySequenceId = -1; + gameSys.setAnimation(0xEC, 1, 2); } - _vm->_gameSys->insertSequence(_s44_currKissingLadySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_currKissingLadySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoId = 0; @@ -129,8 +133,8 @@ void Scene44::run() { _vm->_toyUfoX = 30; else _vm->_toyUfoX = 770; - _vm->_gameSys->setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 3); - _vm->_gameSys->insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 3); + gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->endSceneInit(); } else { switch (_vm->_prevSceneNum) { @@ -161,7 +165,7 @@ void Scene44::run() { _vm->_platypusFacing = kDirNone; _vm->_platypusId = 160; _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->insertSequence(0xFD, 160, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0xFD, 160, 0, 0, kSeqNone, 0, 0, 0); } _vm->endSceneInit(); break; @@ -308,7 +312,7 @@ void Scene44::run() { case GRAB_CURSOR: _vm->playGnapPullOutDevice(8, 0); _vm->playGnapUseDevice(8, 0); - _s44_nextSpringGuySequenceId = 0xFB; + _nextSpringGuySequenceId = 0xFB; _vm->invAdd(kItemSpring); _vm->setFlag(kGFSpringTaken); updateHotspots(); @@ -369,48 +373,48 @@ void Scene44::run() { _vm->toyUfoCheckTimer(); if (!_vm->_isLeavingScene) { - if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO) && _s44_currKissingLadySequenceId != 0xF5) + if (_vm->_platypusActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO) && _currKissingLadySequenceId != 0xF5) _vm->updatePlatypusIdleSequence(); if (_vm->_gnapActionStatus < 0 && !_vm->isFlag(kGFGnapControlsToyUFO)) _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(20) + 20; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s44_nextKissingLadySequenceId == -1) { + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextKissingLadySequenceId == -1) { switch (_vm->getRandom(20)) { case 0: - _s44_nextKissingLadySequenceId = 0xED; + _nextKissingLadySequenceId = 0xED; break; case 1: - _s44_nextKissingLadySequenceId = 0xEE; + _nextKissingLadySequenceId = 0xEE; break; case 2: - _s44_nextKissingLadySequenceId = 0xF0; + _nextKissingLadySequenceId = 0xF0; break; case 3: - _s44_nextKissingLadySequenceId = 0xF3; + _nextKissingLadySequenceId = 0xF3; break; case 4: - _s44_nextKissingLadySequenceId = 0xF4; + _nextKissingLadySequenceId = 0xF4; break; default: - _s44_nextKissingLadySequenceId = 0xEC; + _nextKissingLadySequenceId = 0xEC; break; } - if (_s44_nextKissingLadySequenceId != 0xEC && _s44_nextKissingLadySequenceId == _s44_currKissingLadySequenceId) - _s44_nextKissingLadySequenceId = -1; + if (_nextKissingLadySequenceId != 0xEC && _nextKissingLadySequenceId == _currKissingLadySequenceId) + _nextKissingLadySequenceId = -1; } } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(20) + 20; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s44_nextSpringGuySequenceId == -1) { + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextSpringGuySequenceId == -1) { if (_vm->getRandom(5) != 0) { if (!_vm->isFlag(kGFSpringTaken)) - _s44_nextSpringGuySequenceId = 0xF9; + _nextSpringGuySequenceId = 0xF9; } else { if (_vm->isFlag(kGFSpringTaken)) - _s44_nextSpringGuySequenceId = 0xF8; + _nextSpringGuySequenceId = 0xF8; else - _s44_nextSpringGuySequenceId = 0xFA; + _nextSpringGuySequenceId = 0xFA; } } } @@ -430,32 +434,34 @@ void Scene44::run() { } void Scene44::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case 0: _vm->_sceneDone = true; break; case 1: - _s44_nextKissingLadySequenceId = 0xEF; + _nextKissingLadySequenceId = 0xEF; break; case 2: - _s44_nextKissingLadySequenceId = 0xF2; + _nextKissingLadySequenceId = 0xF2; break; } _vm->_gnapActionStatus = -1; } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); switch (_vm->_platypusActionStatus) { case 4: - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - _vm->_gameSys->insertSequence(0xFE, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); + if (gameSys.getAnimationStatus(2) == 2) { + gameSys.insertSequence(0xFE, _vm->_platypusId, _vm->_platypusSequenceId | (_vm->_platypusSequenceDatNum << 16), _vm->_platypusId, kSeqSyncWait, 0, 0, 0); _vm->_platypusSequenceId = 0xFE; _vm->_platypusSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0xFE, _vm->_platypusId, 1); - _vm->_gameSys->removeSequence(_s44_currKissingLadySequenceId, 1, true); + gameSys.setAnimation(0xFE, _vm->_platypusId, 1); + gameSys.removeSequence(_currKissingLadySequenceId, 1, true); _vm->_platypusActionStatus = 5; } break; @@ -469,49 +475,49 @@ void Scene44::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - if (_s44_nextKissingLadySequenceId == 0xF6) { - _vm->_gameSys->insertSequence(_s44_nextKissingLadySequenceId, 1, _s44_currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); + if (gameSys.getAnimationStatus(2) == 2) { + if (_nextKissingLadySequenceId == 0xF6) { + gameSys.insertSequence(_nextKissingLadySequenceId, 1, _currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); _vm->initPlatypusPos(5, 8, kDirNone); - _s44_currKissingLadySequenceId = _s44_nextKissingLadySequenceId; - _s44_nextKissingLadySequenceId = -1; - _vm->_gameSys->setAnimation(0, 0, 2); - } else if (_s44_nextKissingLadySequenceId != -1) { - _vm->_gameSys->insertSequence(_s44_nextKissingLadySequenceId, 1, _s44_currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s44_nextKissingLadySequenceId, 1, 2); - _s44_currKissingLadySequenceId = _s44_nextKissingLadySequenceId; - _s44_nextKissingLadySequenceId = -1; + _currKissingLadySequenceId = _nextKissingLadySequenceId; + _nextKissingLadySequenceId = -1; + gameSys.setAnimation(0, 0, 2); + } else if (_nextKissingLadySequenceId != -1) { + gameSys.insertSequence(_nextKissingLadySequenceId, 1, _currKissingLadySequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextKissingLadySequenceId, 1, 2); + _currKissingLadySequenceId = _nextKissingLadySequenceId; + _nextKissingLadySequenceId = -1; _vm->_timers[4] = _vm->getRandom(20) + 20; } } - if (_vm->_gameSys->getAnimationStatus(4) == 2) { - if (_s44_currSpringGuySequenceId == 0xFB) { + if (gameSys.getAnimationStatus(4) == 2) { + if (_currSpringGuySequenceId == 0xFB) { _vm->setGrabCursorSprite(kItemSpring); - _s44_nextSpringGuySequenceId = 0xF8; + _nextSpringGuySequenceId = 0xF8; } - if (_s44_nextSpringGuySequenceId != -1) { - _vm->_gameSys->insertSequence(_s44_nextSpringGuySequenceId, 1, _s44_currSpringGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s44_nextSpringGuySequenceId, 1, 4); - _s44_currSpringGuySequenceId = _s44_nextSpringGuySequenceId; - _s44_nextSpringGuySequenceId = -1; + if (_nextSpringGuySequenceId != -1) { + gameSys.insertSequence(_nextSpringGuySequenceId, 1, _currSpringGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextSpringGuySequenceId, 1, 4); + _currSpringGuySequenceId = _nextSpringGuySequenceId; + _nextSpringGuySequenceId = -1; _vm->_timers[5] = _vm->getRandom(20) + 20; } } - if (_vm->_gameSys->getAnimationStatus(3) == 2) { + if (gameSys.getAnimationStatus(3) == 2) { switch (_vm->_toyUfoActionStatus) { case 6: _vm->_sceneDone = true; break; default: _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); - _vm->_gameSys->insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, + gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; ++_vm->_toyUfoId; - _vm->_gameSys->setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 3); + gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 3); break; } _vm->_toyUfoActionStatus = -1; diff --git a/engines/gnap/scenes/scene44.h b/engines/gnap/scenes/scene44.h index f26cba0039..3ba5438487 100644 --- a/engines/gnap/scenes/scene44.h +++ b/engines/gnap/scenes/scene44.h @@ -42,10 +42,10 @@ public: virtual void updateAnimationsCb() {}; private: - int _s44_nextSpringGuySequenceId; - int _s44_nextKissingLadySequenceId; - int _s44_currSpringGuySequenceId; - int _s44_currKissingLadySequenceId; + int _nextSpringGuySequenceId; + int _nextKissingLadySequenceId; + int _currSpringGuySequenceId; + int _currKissingLadySequenceId; }; } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene45.cpp b/engines/gnap/scenes/scene45.cpp index 15722ab7e5..95aac39065 100644 --- a/engines/gnap/scenes/scene45.cpp +++ b/engines/gnap/scenes/scene45.cpp @@ -45,16 +45,18 @@ enum { }; Scene45::Scene45(GnapEngine *vm) : Scene(vm) { - _s45_currDancerSequenceId = -1; + _currDancerSequenceId = -1; } int Scene45::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 2); - _vm->_gameSys->setAnimation(0, 0, 3); - _vm->_gameSys->setAnimation(0, 0, 4); - _vm->_gameSys->setAnimation(0, 0, 5); + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); + gameSys.setAnimation(0, 0, 3); + gameSys.setAnimation(0, 0, 4); + gameSys.setAnimation(0, 0, 5); return _vm->isFlag(kGFUnk23) ? 0xA2 : 0xA1; } @@ -88,18 +90,20 @@ void Scene45::updateHotspots() { } void Scene45::run() { + GameSys gameSys = *_vm->_gameSys; + if (!_vm->isSoundPlaying(0x1094A)) _vm->playSound(0x1094A, true); _vm->queueInsertDeviceIcon(); - _vm->_gameSys->insertSequence(0x96, 1, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(0x96, 1, 3); - _vm->_gameSys->insertSequence(0x99, 1, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(0x99, 1, 4); - _s45_currDancerSequenceId = 0x8F; - _vm->_gameSys->setAnimation(_s45_currDancerSequenceId, 1, 2); - _vm->_gameSys->insertSequence(_s45_currDancerSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(0x96, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x96, 1, 3); + gameSys.insertSequence(0x99, 1, 0, 0, kSeqNone, 0, 0, 0); + gameSys.setAnimation(0x99, 1, 4); + _currDancerSequenceId = 0x8F; + gameSys.setAnimation(_currDancerSequenceId, 1, 2); + gameSys.insertSequence(_currDancerSequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoId = 0; @@ -110,16 +114,16 @@ void Scene45::run() { _vm->_toyUfoX = 30; else _vm->_toyUfoX = 770; - _vm->_gameSys->setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 5); - _vm->_gameSys->insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 5); + gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->endSceneInit(); } else if (_vm->isFlag(kGFUnk22)) { _vm->_gnapSequenceId = 0x9E; _vm->_gnapSequenceDatNum = 0; _vm->_gnapId = 1; - _vm->_gameSys->setAnimation(0x9E, 1, 0); + gameSys.setAnimation(0x9E, 1, 0); _vm->_gnapActionStatus = 1; - _vm->_gameSys->insertSequence(_vm->_gnapSequenceId, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); + gameSys.insertSequence(_vm->_gnapSequenceId, _vm->_gnapId, 0, 0, kSeqNone, 0, 0, 0); _vm->initPlatypusPos(4, 8, kDirNone); _vm->endSceneInit(); } else if (_vm->_prevSceneNum == 46) { @@ -145,34 +149,34 @@ void Scene45::run() { if (!_vm->isFlag(kGFUnk21) && !_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->setFlag(kGFUnk21); _vm->setGrabCursorSprite(-1); - _vm->_gameSys->setAnimation(0x9D, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x9D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) { + gameSys.setAnimation(0x9D, _vm->_gnapId, 0); + gameSys.insertSequence(0x9D, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + while (gameSys.getAnimationStatus(0) != 2) { _vm->gameUpdateTick(); - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - _vm->_gameSys->setAnimation(0, 0, 2); + if (gameSys.getAnimationStatus(2) == 2) { + gameSys.setAnimation(0, 0, 2); int newSeqId = _vm->getRandom(7) + 0x8F; - _vm->_gameSys->insertSequence(newSeqId, 1, _s45_currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(newSeqId, 1, 2); - _s45_currDancerSequenceId = newSeqId; + gameSys.insertSequence(newSeqId, 1, _currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(newSeqId, 1, 2); + _currDancerSequenceId = newSeqId; } - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _vm->_gameSys->getAnimationStatus(4) == 2) { - _vm->_gameSys->insertSequence(0x96, 1, 0x96, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x96, 1, 3); - _vm->_gameSys->insertSequence(0x99, 1, 0x99, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x99, 1, 4); + if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { + gameSys.insertSequence(0x96, 1, 0x96, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x96, 1, 3); + gameSys.insertSequence(0x99, 1, 0x99, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x99, 1, 4); } } _vm->_gnapSequenceId = 0x9D; _vm->_gnapSequenceDatNum = 0; _vm->hideCursor(); _vm->addFullScreenSprite(0x8A, 255); - _vm->_gameSys->setAnimation(0xA0, 256, 0); - _vm->_gameSys->insertSequence(0xA0, 256, 0, 0, kSeqNone, 0, 0, 0); - while (_vm->_gameSys->getAnimationStatus(0) != 2) + gameSys.setAnimation(0xA0, 256, 0); + gameSys.insertSequence(0xA0, 256, 0, 0, kSeqNone, 0, 0, 0); + while (gameSys.getAnimationStatus(0) != 2) _vm->gameUpdateTick(); - _vm->_gameSys->setAnimation(0x107BD, _vm->_gnapId, 0); - _vm->_gameSys->insertSequence(0x107BD, _vm->_gnapId, + gameSys.setAnimation(0x107BD, _vm->_gnapId, 0); + gameSys.insertSequence(0x107BD, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 75 * _vm->_gnapX - _vm->_gnapGridX, 48 * _vm->_gnapY - _vm->_gnapGridY); _vm->removeFullScreenSprite(); @@ -182,7 +186,7 @@ void Scene45::run() { } _vm->playPlatypusSequence(0x9A); - _vm->_gameSys->setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); + gameSys.setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); while (!_vm->_sceneDone) { if (!_vm->isSoundPlaying(0x1094A)) @@ -240,7 +244,7 @@ void Scene45::run() { case GRAB_CURSOR: _vm->gnapKissPlatypus(0); _vm->playPlatypusSequence(0x9A); - _vm->_gameSys->setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); + gameSys.setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); break; case TALK_CURSOR: _vm->playGnapBrainPulsating(_vm->_platX, _vm->_platY); @@ -352,8 +356,10 @@ void Scene45::run() { } void Scene45::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case 0: _vm->_sceneDone = true; @@ -362,10 +368,10 @@ void Scene45::updateAnimations() { _vm->_sceneWaiting = true; _vm->setFlag(kGFUnk22); updateHotspots(); - _vm->_gameSys->insertSequence(0x9E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); + gameSys.insertSequence(0x9E, _vm->_gnapId, makeRid(_vm->_gnapSequenceDatNum, _vm->_gnapSequenceId), _vm->_gnapId, kSeqSyncWait, 0, 0, 0); _vm->_gnapSequenceId = 0x9E; _vm->_gnapSequenceDatNum = 0; - _vm->_gameSys->setAnimation(0x9E, _vm->_gnapId, 0); + gameSys.setAnimation(0x9E, _vm->_gnapId, 0); break; default: _vm->_gnapActionStatus = -1; @@ -373,43 +379,43 @@ void Scene45::updateAnimations() { } } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { - _vm->_gameSys->setAnimation(0, 0, 1); + if (gameSys.getAnimationStatus(1) == 2) { + gameSys.setAnimation(0, 0, 1); if (_vm->getRandom(2) != 0) _vm->playPlatypusSequence(0x9B); else _vm->playPlatypusSequence(0x9C); - _vm->_gameSys->setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); + gameSys.setAnimation(_vm->_platypusSequenceId, _vm->_platypusId, 1); } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { - _vm->_gameSys->setAnimation(0, 0, 2); + if (gameSys.getAnimationStatus(2) == 2) { + gameSys.setAnimation(0, 0, 2); int newSeqId = _vm->getRandom(7) + 0x8F; - _vm->_gameSys->insertSequence(newSeqId, 1, _s45_currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(newSeqId, 1, 2); - _s45_currDancerSequenceId = newSeqId; + gameSys.insertSequence(newSeqId, 1, _currDancerSequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(newSeqId, 1, 2); + _currDancerSequenceId = newSeqId; } - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _vm->_gameSys->getAnimationStatus(4) == 2) { - _vm->_gameSys->insertSequence(0x96, 1, 0x96, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x96, 1, 3); - _vm->_gameSys->insertSequence(0x99, 1, 0x99, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(0x99, 1, 4); + if (gameSys.getAnimationStatus(3) == 2 && gameSys.getAnimationStatus(4) == 2) { + gameSys.insertSequence(0x96, 1, 0x96, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x96, 1, 3); + gameSys.insertSequence(0x99, 1, 0x99, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(0x99, 1, 4); } - if (_vm->_gameSys->getAnimationStatus(5) == 2) { + if (gameSys.getAnimationStatus(5) == 2) { switch (_vm->_toyUfoActionStatus) { case 2: _vm->_sceneDone = true; break; default: _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); - _vm->_gameSys->insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, + gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; ++_vm->_toyUfoId; - _vm->_gameSys->setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 5); + gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 5); break; } _vm->_toyUfoActionStatus = -1; diff --git a/engines/gnap/scenes/scene45.h b/engines/gnap/scenes/scene45.h index 549e0779cf..3aa7f9cb29 100644 --- a/engines/gnap/scenes/scene45.h +++ b/engines/gnap/scenes/scene45.h @@ -42,7 +42,7 @@ public: virtual void updateAnimationsCb() {}; private: - int _s45_currDancerSequenceId; + int _currDancerSequenceId; }; } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene46.cpp b/engines/gnap/scenes/scene46.cpp index 74b60def33..5de3d4911d 100644 --- a/engines/gnap/scenes/scene46.cpp +++ b/engines/gnap/scenes/scene46.cpp @@ -45,18 +45,20 @@ enum { }; Scene46::Scene46(GnapEngine *vm) : Scene(vm) { - _s46_currSackGuySequenceId = -1; - _s46_nextItchyGuySequenceId = -1; - _s46_nextSackGuySequenceId = -1; - _s46_currItchyGuySequenceId = -1; + _currSackGuySequenceId = -1; + _nextItchyGuySequenceId = -1; + _nextSackGuySequenceId = -1; + _currItchyGuySequenceId = -1; } int Scene46::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); - _vm->_gameSys->setAnimation(0, 0, 2); - _vm->_gameSys->setAnimation(0, 0, 3); - _vm->_gameSys->setAnimation(0, 0, 4); + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); + gameSys.setAnimation(0, 0, 2); + gameSys.setAnimation(0, 0, 3); + gameSys.setAnimation(0, 0, 4); return 0x4E; } @@ -81,19 +83,20 @@ void Scene46::updateHotspots() { } void Scene46::run() { - _vm->queueInsertDeviceIcon(); + GameSys gameSys = *_vm->_gameSys; - _vm->_gameSys->insertSequence(0x4D, 0, 0, 0, kSeqLoop, 0, 0, 0); + _vm->queueInsertDeviceIcon(); + gameSys.insertSequence(0x4D, 0, 0, 0, kSeqLoop, 0, 0, 0); - _s46_currSackGuySequenceId = 0x4B; - _s46_nextSackGuySequenceId = -1; - _vm->_gameSys->setAnimation(0x4B, 1, 3); - _vm->_gameSys->insertSequence(_s46_currSackGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _currSackGuySequenceId = 0x4B; + _nextSackGuySequenceId = -1; + gameSys.setAnimation(0x4B, 1, 3); + gameSys.insertSequence(_currSackGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); - _s46_currItchyGuySequenceId = 0x47; - _s46_nextItchyGuySequenceId = -1; - _vm->_gameSys->setAnimation(0x47, 1, 4); - _vm->_gameSys->insertSequence(_s46_currItchyGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); + _currItchyGuySequenceId = 0x47; + _nextItchyGuySequenceId = -1; + gameSys.setAnimation(0x47, 1, 4); + gameSys.insertSequence(_currItchyGuySequenceId, 1, 0, 0, kSeqNone, 0, 0, 0); if (_vm->isFlag(kGFGnapControlsToyUFO)) { _vm->_toyUfoId = 0; @@ -104,8 +107,8 @@ void Scene46::run() { _vm->_toyUfoX = 30; else _vm->_toyUfoX = 770; - _vm->_gameSys->setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 2); - _vm->_gameSys->insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); + gameSys.setAnimation(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 2); + gameSys.insertSequence(_vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, 0, 0, kSeqNone, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->endSceneInit(); } else if (_vm->_prevSceneNum == 44) { _vm->initGnapPos(-1, 8, kDirUpRight); @@ -290,17 +293,17 @@ void Scene46::run() { _vm->updateGnapIdleSequence(); if (!_vm->_timers[4]) { _vm->_timers[4] = _vm->getRandom(50) + 80; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s46_nextItchyGuySequenceId == -1) { + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextItchyGuySequenceId == -1) { if (_vm->getRandom(2) != 0) - _s46_nextItchyGuySequenceId = 0x49; + _nextItchyGuySequenceId = 0x49; else - _s46_nextItchyGuySequenceId = 0x48; + _nextItchyGuySequenceId = 0x48; } } if (!_vm->_timers[5]) { _vm->_timers[5] = _vm->getRandom(50) + 80; - if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _s46_nextSackGuySequenceId == -1) - _s46_nextSackGuySequenceId = 0x4C; + if (_vm->_gnapActionStatus < 0 && _vm->_platypusActionStatus < 0 && _nextSackGuySequenceId == -1) + _nextSackGuySequenceId = 0x4C; } } @@ -317,51 +320,53 @@ void Scene46::run() { } void Scene46::updateAnimations() { - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - _vm->_gameSys->setAnimation(0, 0, 0); + GameSys gameSys = *_vm->_gameSys; + + if (gameSys.getAnimationStatus(0) == 2) { + gameSys.setAnimation(0, 0, 0); switch (_vm->_gnapActionStatus) { case 0: _vm->_sceneDone = true; break; case 1: - _s46_nextItchyGuySequenceId = 0x46; + _nextItchyGuySequenceId = 0x46; break; case 2: - _s46_nextSackGuySequenceId = 0x4A; + _nextSackGuySequenceId = 0x4A; break; } _vm->_gnapActionStatus = -1; } - if (_vm->_gameSys->getAnimationStatus(3) == 2 && _s46_nextSackGuySequenceId != -1) { - _vm->_gameSys->insertSequence(_s46_nextSackGuySequenceId, 1, _s46_currSackGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s46_nextSackGuySequenceId, 1, 3); - _s46_currSackGuySequenceId = _s46_nextSackGuySequenceId; - _s46_nextSackGuySequenceId = -1; + if (gameSys.getAnimationStatus(3) == 2 && _nextSackGuySequenceId != -1) { + gameSys.insertSequence(_nextSackGuySequenceId, 1, _currSackGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextSackGuySequenceId, 1, 3); + _currSackGuySequenceId = _nextSackGuySequenceId; + _nextSackGuySequenceId = -1; _vm->_timers[5] = _vm->getRandom(50) + 80; } - if (_vm->_gameSys->getAnimationStatus(4) == 2 && _s46_nextItchyGuySequenceId != -1) { - _vm->_gameSys->insertSequence(_s46_nextItchyGuySequenceId, 1, _s46_currItchyGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); - _vm->_gameSys->setAnimation(_s46_nextItchyGuySequenceId, 1, 4); - _s46_currItchyGuySequenceId = _s46_nextItchyGuySequenceId; - _s46_nextItchyGuySequenceId = -1; + if (gameSys.getAnimationStatus(4) == 2 && _nextItchyGuySequenceId != -1) { + gameSys.insertSequence(_nextItchyGuySequenceId, 1, _currItchyGuySequenceId, 1, kSeqSyncWait, 0, 0, 0); + gameSys.setAnimation(_nextItchyGuySequenceId, 1, 4); + _currItchyGuySequenceId = _nextItchyGuySequenceId; + _nextItchyGuySequenceId = -1; _vm->_timers[4] = _vm->getRandom(50) + 80; } - if (_vm->_gameSys->getAnimationStatus(2) == 2) { + if (gameSys.getAnimationStatus(2) == 2) { switch (_vm->_toyUfoActionStatus) { case 3: _vm->_sceneDone = true; break; default: _vm->_toyUfoNextSequenceId = _vm->toyUfoGetSequenceId(); - _vm->_gameSys->insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, + gameSys.insertSequence(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId + 1, _vm->_toyUfoSequenceId | 0x10000, _vm->_toyUfoId, kSeqSyncWait, 0, _vm->_toyUfoX - 274, _vm->_toyUfoY - 128); _vm->_toyUfoSequenceId = _vm->_toyUfoNextSequenceId; ++_vm->_toyUfoId; - _vm->_gameSys->setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 2); + gameSys.setAnimation(_vm->_toyUfoNextSequenceId | 0x10000, _vm->_toyUfoId, 2); break; } _vm->_toyUfoActionStatus = -1; diff --git a/engines/gnap/scenes/scene46.h b/engines/gnap/scenes/scene46.h index c7beca277d..9a578288ad 100644 --- a/engines/gnap/scenes/scene46.h +++ b/engines/gnap/scenes/scene46.h @@ -42,10 +42,10 @@ public: virtual void updateAnimationsCb() {}; private: - int _s46_currSackGuySequenceId; - int _s46_nextItchyGuySequenceId; - int _s46_nextSackGuySequenceId; - int _s46_currItchyGuySequenceId; + int _currSackGuySequenceId; + int _nextItchyGuySequenceId; + int _nextSackGuySequenceId; + int _currItchyGuySequenceId; }; } // End of namespace Gnap diff --git a/engines/gnap/scenes/scene47.cpp b/engines/gnap/scenes/scene47.cpp index ec0be02aeb..1c96139fdd 100644 --- a/engines/gnap/scenes/scene47.cpp +++ b/engines/gnap/scenes/scene47.cpp @@ -30,27 +30,27 @@ namespace Gnap { Scene471::Scene471(GnapEngine *vm) : CutScene(vm) {} int Scene471::init() { - _s99_sequenceIdArr[0] = 0x301; - _s99_sequenceIdArr[1] = 0x305; - _s99_sequenceIdArr[2] = 0x302; - _s99_sequenceIdArr[3] = 0x304; - _s99_sequenceIdArr[4] = 0x300; - _s99_resourceIdArr[0] = 3; - _s99_resourceIdArr[1] = 0; - _s99_resourceIdArr[2] = 1; - _s99_resourceIdArr[3] = 0; - _s99_resourceIdArr[4] = 2; - _s99_sequenceCountArr[0] = 1; - _s99_sequenceCountArr[1] = 1; - _s99_sequenceCountArr[2] = 1; - _s99_sequenceCountArr[3] = 1; - _s99_sequenceCountArr[4] = 1; - _s99_canSkip[0] = false; - _s99_canSkip[1] = false; - _s99_canSkip[2] = false; - _s99_canSkip[3] = false; - _s99_canSkip[4] = false; - _s99_itemsCount = 5; + _sequenceIdArr[0] = 0x301; + _sequenceIdArr[1] = 0x305; + _sequenceIdArr[2] = 0x302; + _sequenceIdArr[3] = 0x304; + _sequenceIdArr[4] = 0x300; + _resourceIdArr[0] = 3; + _resourceIdArr[1] = 0; + _resourceIdArr[2] = 1; + _resourceIdArr[3] = 0; + _resourceIdArr[4] = 2; + _sequenceCountArr[0] = 1; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = 1; + _sequenceCountArr[3] = 1; + _sequenceCountArr[4] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _canSkip[2] = false; + _canSkip[3] = false; + _canSkip[4] = false; + _itemsCount = 5; return -1; } @@ -58,24 +58,24 @@ int Scene471::init() { Scene472::Scene472(GnapEngine *vm) : CutScene(vm) {} int Scene472::init() { - _s99_sequenceIdArr[0] = 0x306; - _s99_sequenceIdArr[1] = 0x309; - _s99_sequenceIdArr[2] = 0x307; - _s99_sequenceIdArr[3] = 0x308; - _s99_sequenceIdArr[4] = 0x30A; - _s99_resourceIdArr[0] = 0x8E; - _s99_resourceIdArr[1] = 0x90; - _s99_resourceIdArr[2] = 0x8F; - _s99_resourceIdArr[3] = 0x91; - _s99_sequenceCountArr[0] = 2; - _s99_sequenceCountArr[1] = 1; - _s99_sequenceCountArr[2] = 1; - _s99_sequenceCountArr[3] = 1; - _s99_canSkip[0] = false; - _s99_canSkip[1] = false; - _s99_canSkip[2] = false; - _s99_canSkip[3] = false; - _s99_itemsCount = 4; + _sequenceIdArr[0] = 0x306; + _sequenceIdArr[1] = 0x309; + _sequenceIdArr[2] = 0x307; + _sequenceIdArr[3] = 0x308; + _sequenceIdArr[4] = 0x30A; + _resourceIdArr[0] = 0x8E; + _resourceIdArr[1] = 0x90; + _resourceIdArr[2] = 0x8F; + _resourceIdArr[3] = 0x91; + _sequenceCountArr[0] = 2; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = 1; + _sequenceCountArr[3] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _canSkip[2] = false; + _canSkip[3] = false; + _itemsCount = 4; return -1; } @@ -83,15 +83,15 @@ int Scene472::init() { Scene473::Scene473(GnapEngine *vm) : CutScene(vm) {} int Scene473::init() { - _s99_sequenceIdArr[0] = 0x320; - _s99_sequenceIdArr[1] = 0x321; - _s99_resourceIdArr[0] = 0x142; - _s99_resourceIdArr[1] = 0x143; - _s99_sequenceCountArr[0] = 1; - _s99_sequenceCountArr[1] = 1; - _s99_canSkip[0] = false; - _s99_canSkip[1] = false; - _s99_itemsCount = 2; + _sequenceIdArr[0] = 0x320; + _sequenceIdArr[1] = 0x321; + _resourceIdArr[0] = 0x142; + _resourceIdArr[1] = 0x143; + _sequenceCountArr[0] = 1; + _sequenceCountArr[1] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _itemsCount = 2; return -1; } @@ -99,19 +99,19 @@ int Scene473::init() { Scene474::Scene474(GnapEngine *vm) : CutScene(vm) {} int Scene474::init() { - _s99_sequenceIdArr[0] = 0x30C; - _s99_sequenceIdArr[1] = 0x30D; - _s99_sequenceIdArr[2] = 0x30B; - _s99_resourceIdArr[0] = 0x142; - _s99_resourceIdArr[1] = 0x141; - _s99_resourceIdArr[2] = 0x177; - _s99_sequenceCountArr[0] = 1; - _s99_sequenceCountArr[1] = 1; - _s99_sequenceCountArr[2] = 1; - _s99_canSkip[0] = false; - _s99_canSkip[1] = false; - _s99_canSkip[2] = false; - _s99_itemsCount = 3; + _sequenceIdArr[0] = 0x30C; + _sequenceIdArr[1] = 0x30D; + _sequenceIdArr[2] = 0x30B; + _resourceIdArr[0] = 0x142; + _resourceIdArr[1] = 0x141; + _resourceIdArr[2] = 0x177; + _sequenceCountArr[0] = 1; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _canSkip[2] = false; + _itemsCount = 3; return -1; } @@ -119,17 +119,17 @@ int Scene474::init() { Scene475::Scene475(GnapEngine *vm) : CutScene(vm) {} int Scene475::init() { - _s99_sequenceIdArr[0] = 0x30E; - _s99_sequenceIdArr[1] = 0x30F; - _s99_sequenceIdArr[2] = 0x310; - _s99_sequenceIdArr[3] = 0x311; - _s99_resourceIdArr[0] = 0x206; - _s99_resourceIdArr[1] = 0x207; - _s99_sequenceCountArr[0] = 3; - _s99_sequenceCountArr[1] = 1; - _s99_canSkip[0] = false; - _s99_canSkip[1] = false; - _s99_itemsCount = 2; + _sequenceIdArr[0] = 0x30E; + _sequenceIdArr[1] = 0x30F; + _sequenceIdArr[2] = 0x310; + _sequenceIdArr[3] = 0x311; + _resourceIdArr[0] = 0x206; + _resourceIdArr[1] = 0x207; + _sequenceCountArr[0] = 3; + _sequenceCountArr[1] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _itemsCount = 2; return -1; } @@ -137,12 +137,12 @@ int Scene475::init() { Scene476::Scene476(GnapEngine *vm) : CutScene(vm) {} int Scene476::init() { - _s99_sequenceIdArr[0] = 0x31E; - _s99_sequenceIdArr[1] = 0x31F; - _s99_resourceIdArr[0] = 0x2FA; - _s99_sequenceCountArr[0] = 2; - _s99_canSkip[0] = false; - _s99_itemsCount = 1; + _sequenceIdArr[0] = 0x31E; + _sequenceIdArr[1] = 0x31F; + _resourceIdArr[0] = 0x2FA; + _sequenceCountArr[0] = 2; + _canSkip[0] = false; + _itemsCount = 1; return -1; } @@ -152,47 +152,47 @@ Scene477::Scene477(GnapEngine *vm) : CutScene(vm) {} int Scene477::init() { int v0, v4, v2, v3; - _s99_sequenceIdArr[0] = 0x316; - _s99_sequenceIdArr[1] = 0x31A; - _s99_sequenceIdArr[2] = 0x314; - _s99_sequenceIdArr[3] = 0x31B; + _sequenceIdArr[0] = 0x316; + _sequenceIdArr[1] = 0x31A; + _sequenceIdArr[2] = 0x314; + _sequenceIdArr[3] = 0x31B; int v1 = 4; if (!_vm->isFlag(kGFTwigTaken)) { - _s99_sequenceIdArr[4] = 0x31C; + _sequenceIdArr[4] = 0x31C; v1 = 5; } if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) - _s99_sequenceIdArr[v1++] = 0x31D; + _sequenceIdArr[v1++] = 0x31D; v4 = v1; - _s99_sequenceIdArr[v1] = 0x319; + _sequenceIdArr[v1] = 0x319; v0 = v1 + 1; v3 = v0; - _s99_sequenceIdArr[v0++] = 0x317; - _s99_sequenceIdArr[v0++] = 0x312; - _s99_sequenceIdArr[v0] = 0x31A; + _sequenceIdArr[v0++] = 0x317; + _sequenceIdArr[v0++] = 0x312; + _sequenceIdArr[v0] = 0x31A; v2 = v0 + 1; if (!_vm->isFlag(kGFTwigTaken)) - _s99_sequenceIdArr[v2++] = 0x31C; + _sequenceIdArr[v2++] = 0x31C; if (!_vm->isFlag(kGFPlatypusTalkingToAssistant)) - _s99_sequenceIdArr[v2++] = 0x31D; - _s99_sequenceIdArr[v2] = 0x313; - _s99_sequenceIdArr[v2 + 1] = 0x315; - _s99_resourceIdArr[0] = 0x2B8; - _s99_resourceIdArr[1] = 0x20C; - _s99_resourceIdArr[2] = 0x2B8; - _s99_resourceIdArr[3] = 0x20B; - _s99_resourceIdArr[4] = 0x20B; - _s99_sequenceCountArr[0] = v4; - _s99_sequenceCountArr[1] = 1; - _s99_sequenceCountArr[2] = v2 - v3; - _s99_sequenceCountArr[3] = 1; - _s99_sequenceCountArr[4] = 1; - _s99_canSkip[0] = false; - _s99_canSkip[1] = false; - _s99_canSkip[2] = false; - _s99_canSkip[3] = false; - _s99_canSkip[4] = false; - _s99_itemsCount = 5; + _sequenceIdArr[v2++] = 0x31D; + _sequenceIdArr[v2] = 0x313; + _sequenceIdArr[v2 + 1] = 0x315; + _resourceIdArr[0] = 0x2B8; + _resourceIdArr[1] = 0x20C; + _resourceIdArr[2] = 0x2B8; + _resourceIdArr[3] = 0x20B; + _resourceIdArr[4] = 0x20B; + _sequenceCountArr[0] = v4; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = v2 - v3; + _sequenceCountArr[3] = 1; + _sequenceCountArr[4] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _canSkip[2] = false; + _canSkip[3] = false; + _canSkip[4] = false; + _itemsCount = 5; return -1; } diff --git a/engines/gnap/scenes/scene48.cpp b/engines/gnap/scenes/scene48.cpp index 46d624ea3f..27f8d829d8 100644 --- a/engines/gnap/scenes/scene48.cpp +++ b/engines/gnap/scenes/scene48.cpp @@ -30,59 +30,59 @@ namespace Gnap { Scene48::Scene48(GnapEngine *vm) : CutScene(vm) {} int Scene48::init() { - _s99_sequenceIdArr[0] = 390; - _s99_sequenceIdArr[1] = 391; - _s99_sequenceIdArr[2] = 392; - _s99_sequenceIdArr[3] = 393; - _s99_sequenceIdArr[4] = 394; - _s99_sequenceIdArr[5] = 395; - _s99_sequenceIdArr[6] = 396; - _s99_sequenceIdArr[7] = 397; - _s99_sequenceIdArr[8] = 398; - _s99_sequenceIdArr[9] = 399; - _s99_sequenceIdArr[10] = 400; - _s99_sequenceIdArr[11] = 401; - _s99_sequenceIdArr[12] = 402; - _s99_resourceIdArr[0] = 238; - _s99_resourceIdArr[1] = 42; - _s99_resourceIdArr[2] = 2; - _s99_resourceIdArr[3] = 37; - _s99_resourceIdArr[4] = 35; - _s99_resourceIdArr[5] = 38; - _s99_resourceIdArr[6] = 39; - _s99_resourceIdArr[7] = 40; - _s99_resourceIdArr[8] = 41; - _s99_resourceIdArr[9] = 36; - _s99_resourceIdArr[10] = 41; - _s99_resourceIdArr[11] = 388; - _s99_resourceIdArr[12] = 387; - _s99_sequenceCountArr[0] = 1; - _s99_sequenceCountArr[1] = 1; - _s99_sequenceCountArr[2] = 1; - _s99_sequenceCountArr[3] = 1; - _s99_sequenceCountArr[4] = 1; - _s99_sequenceCountArr[5] = 1; - _s99_sequenceCountArr[6] = 1; - _s99_sequenceCountArr[7] = 1; - _s99_sequenceCountArr[8] = 1; - _s99_sequenceCountArr[9] = 1; - _s99_sequenceCountArr[10] = 1; - _s99_sequenceCountArr[11] = 1; - _s99_sequenceCountArr[12] = 1; - _s99_canSkip[0] = false; - _s99_canSkip[1] = false; - _s99_canSkip[2] = false; - _s99_canSkip[3] = false; - _s99_canSkip[4] = false; - _s99_canSkip[5] = false; - _s99_canSkip[6] = false; - _s99_canSkip[7] = false; - _s99_canSkip[8] = false; - _s99_canSkip[9] = false; - _s99_canSkip[10] = false; - _s99_canSkip[11] = false; - _s99_canSkip[12] = false; - _s99_itemsCount = 13; + _sequenceIdArr[0] = 390; + _sequenceIdArr[1] = 391; + _sequenceIdArr[2] = 392; + _sequenceIdArr[3] = 393; + _sequenceIdArr[4] = 394; + _sequenceIdArr[5] = 395; + _sequenceIdArr[6] = 396; + _sequenceIdArr[7] = 397; + _sequenceIdArr[8] = 398; + _sequenceIdArr[9] = 399; + _sequenceIdArr[10] = 400; + _sequenceIdArr[11] = 401; + _sequenceIdArr[12] = 402; + _resourceIdArr[0] = 238; + _resourceIdArr[1] = 42; + _resourceIdArr[2] = 2; + _resourceIdArr[3] = 37; + _resourceIdArr[4] = 35; + _resourceIdArr[5] = 38; + _resourceIdArr[6] = 39; + _resourceIdArr[7] = 40; + _resourceIdArr[8] = 41; + _resourceIdArr[9] = 36; + _resourceIdArr[10] = 41; + _resourceIdArr[11] = 388; + _resourceIdArr[12] = 387; + _sequenceCountArr[0] = 1; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = 1; + _sequenceCountArr[3] = 1; + _sequenceCountArr[4] = 1; + _sequenceCountArr[5] = 1; + _sequenceCountArr[6] = 1; + _sequenceCountArr[7] = 1; + _sequenceCountArr[8] = 1; + _sequenceCountArr[9] = 1; + _sequenceCountArr[10] = 1; + _sequenceCountArr[11] = 1; + _sequenceCountArr[12] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _canSkip[2] = false; + _canSkip[3] = false; + _canSkip[4] = false; + _canSkip[5] = false; + _canSkip[6] = false; + _canSkip[7] = false; + _canSkip[8] = false; + _canSkip[9] = false; + _canSkip[10] = false; + _canSkip[11] = false; + _canSkip[12] = false; + _itemsCount = 13; return -1; } diff --git a/engines/gnap/scenes/scene49.cpp b/engines/gnap/scenes/scene49.cpp index 9f637b2b78..3753d987eb 100644 --- a/engines/gnap/scenes/scene49.cpp +++ b/engines/gnap/scenes/scene49.cpp @@ -41,31 +41,33 @@ static const ObstacleDef kObstacleDefs[] = { }; Scene49::Scene49(GnapEngine *vm) : Scene(vm) { - _s49_scoreBarFlash = false; - _s49_scoreBarPos = -1; - _s49_scoreLevel = -1; - _s49_obstacleIndex = -1; - _s49_truckSequenceId = -1; - _s49_truckId = -1; - _s49_truckLaneNum = -1; + _scoreBarFlash = false; + _scoreBarPos = -1; + _scoreLevel = -1; + _obstacleIndex = -1; + _truckSequenceId = -1; + _truckId = -1; + _truckLaneNum = -1; for (int i = 0; i < 5; i++) { - _s49_obstacles[i]._currSequenceId = -1; - _s49_obstacles[i]._closerSequenceId = -1; - _s49_obstacles[i]._passedSequenceId = -1; - _s49_obstacles[i]._splashSequenceId = -1; - _s49_obstacles[i]._collisionSequenceId = -1; - _s49_obstacles[i]._prevId = -1; - _s49_obstacles[i]._currId = -1; - _s49_obstacles[i]._laneNum = -1; + _obstacles[i]._currSequenceId = -1; + _obstacles[i]._closerSequenceId = -1; + _obstacles[i]._passedSequenceId = -1; + _obstacles[i]._splashSequenceId = -1; + _obstacles[i]._collisionSequenceId = -1; + _obstacles[i]._prevId = -1; + _obstacles[i]._currId = -1; + _obstacles[i]._laneNum = -1; } } int Scene49::init() { - _vm->_gameSys->setAnimation(0, 0, 0); - _vm->_gameSys->setAnimation(0, 0, 1); + GameSys gameSys = *_vm->_gameSys; + + gameSys.setAnimation(0, 0, 0); + gameSys.setAnimation(0, 0, 1); for (int i = 0; i < 5; ++i) - _vm->_gameSys->setAnimation(0, 0, i + 2); + gameSys.setAnimation(0, 0, i + 2); _vm->_timers[2] = 0; _vm->_timers[0] = 0; _vm->_timers[1] = 0; @@ -87,68 +89,68 @@ void Scene49::checkObstacles() { } for (int j = 0; j < 5; ++j) { - if (_s49_obstacles[j]._currSequenceId == 0) { + if (_obstacles[j]._currSequenceId == 0) { _vm->_timers[3] = 35; - _s49_obstacles[j]._currSequenceId = kObstacleDefs[_s49_obstacleIndex]._sequenceId; - switch (_s49_obstacles[j]._currSequenceId) { + _obstacles[j]._currSequenceId = kObstacleDefs[_obstacleIndex]._sequenceId; + switch (_obstacles[j]._currSequenceId) { case 0xB4: - _s49_obstacles[j]._laneNum = 1; - _s49_obstacles[j]._closerSequenceId = 180; - _s49_obstacles[j]._passedSequenceId = 181; - _s49_obstacles[j]._splashSequenceId = 182; - _s49_obstacles[j]._collisionSequenceId = 192; + _obstacles[j]._laneNum = 1; + _obstacles[j]._closerSequenceId = 180; + _obstacles[j]._passedSequenceId = 181; + _obstacles[j]._splashSequenceId = 182; + _obstacles[j]._collisionSequenceId = 192; break; case 0xB7: - _s49_obstacles[j]._laneNum = 2; - _s49_obstacles[j]._closerSequenceId = 183; - _s49_obstacles[j]._passedSequenceId = 184; - _s49_obstacles[j]._splashSequenceId = 185; - _s49_obstacles[j]._collisionSequenceId = 193; + _obstacles[j]._laneNum = 2; + _obstacles[j]._closerSequenceId = 183; + _obstacles[j]._passedSequenceId = 184; + _obstacles[j]._splashSequenceId = 185; + _obstacles[j]._collisionSequenceId = 193; break; case 0xBD: - _s49_obstacles[j]._laneNum = 3; - _s49_obstacles[j]._closerSequenceId = 189; - _s49_obstacles[j]._passedSequenceId = 190; - _s49_obstacles[j]._splashSequenceId = 191; - _s49_obstacles[j]._collisionSequenceId = 195; + _obstacles[j]._laneNum = 3; + _obstacles[j]._closerSequenceId = 189; + _obstacles[j]._passedSequenceId = 190; + _obstacles[j]._splashSequenceId = 191; + _obstacles[j]._collisionSequenceId = 195; break; case 0xBA: - _s49_obstacles[j]._laneNum = 2; - _s49_obstacles[j]._closerSequenceId = 186; - _s49_obstacles[j]._passedSequenceId = 187; - _s49_obstacles[j]._splashSequenceId = 188; - _s49_obstacles[j]._collisionSequenceId = 194; + _obstacles[j]._laneNum = 2; + _obstacles[j]._closerSequenceId = 186; + _obstacles[j]._passedSequenceId = 187; + _obstacles[j]._splashSequenceId = 188; + _obstacles[j]._collisionSequenceId = 194; break; case 0xCB: - _s49_obstacles[j]._laneNum = 1; - _s49_obstacles[j]._closerSequenceId = 203; - _s49_obstacles[j]._passedSequenceId = 204; - _s49_obstacles[j]._splashSequenceId = 0; - _s49_obstacles[j]._collisionSequenceId = 209; + _obstacles[j]._laneNum = 1; + _obstacles[j]._closerSequenceId = 203; + _obstacles[j]._passedSequenceId = 204; + _obstacles[j]._splashSequenceId = 0; + _obstacles[j]._collisionSequenceId = 209; break; case 0xCD: - _s49_obstacles[j]._laneNum = 2; - _s49_obstacles[j]._closerSequenceId = 205; - _s49_obstacles[j]._passedSequenceId = 206; - _s49_obstacles[j]._splashSequenceId = 0; - _s49_obstacles[j]._collisionSequenceId = 210; + _obstacles[j]._laneNum = 2; + _obstacles[j]._closerSequenceId = 205; + _obstacles[j]._passedSequenceId = 206; + _obstacles[j]._splashSequenceId = 0; + _obstacles[j]._collisionSequenceId = 210; break; case 0xCF: - _s49_obstacles[j]._laneNum = 3; - _s49_obstacles[j]._closerSequenceId = 207; - _s49_obstacles[j]._passedSequenceId = 208; - _s49_obstacles[j]._splashSequenceId = 0; - _s49_obstacles[j]._collisionSequenceId = 211; + _obstacles[j]._laneNum = 3; + _obstacles[j]._closerSequenceId = 207; + _obstacles[j]._passedSequenceId = 208; + _obstacles[j]._splashSequenceId = 0; + _obstacles[j]._collisionSequenceId = 211; break; } - _s49_obstacles[j]._prevId = _s49_truckId; - _s49_obstacles[j]._currId = _s49_obstacles[j]._prevId; - _vm->_gameSys->setAnimation(_s49_obstacles[j]._currSequenceId, _s49_obstacles[j]._currId, j + 2); - _vm->_gameSys->insertSequence(_s49_obstacles[j]._currSequenceId, _s49_obstacles[j]._currId, 0, 0, kSeqNone, 0, 0, -50); - _vm->_timers[2] = kObstacleDefs[_s49_obstacleIndex]._ticks; - ++_s49_obstacleIndex; - if (_s49_obstacleIndex == 50) - _s49_obstacleIndex = 0; + _obstacles[j]._prevId = _truckId; + _obstacles[j]._currId = _obstacles[j]._prevId; + _vm->_gameSys->setAnimation(_obstacles[j]._currSequenceId, _obstacles[j]._currId, j + 2); + _vm->_gameSys->insertSequence(_obstacles[j]._currSequenceId, _obstacles[j]._currId, 0, 0, kSeqNone, 0, 0, -50); + _vm->_timers[2] = kObstacleDefs[_obstacleIndex]._ticks; + ++_obstacleIndex; + if (_obstacleIndex == 50) + _obstacleIndex = 0; break; } } @@ -158,72 +160,74 @@ void Scene49::checkObstacles() { } void Scene49::updateObstacle(int id) { - Scene49Obstacle &obstacle = _s49_obstacles[id]; + GameSys gameSys = *_vm->_gameSys; + Scene49Obstacle &obstacle = _obstacles[id]; + obstacle._currId = obstacle._prevId; switch (obstacle._laneNum) { case 1: - obstacle._prevId = _s49_truckId + 1; + obstacle._prevId = _truckId + 1; break; case 2: - if (_s49_truckLaneNum != 2 && _s49_truckLaneNum != 3) - obstacle._prevId = _s49_truckId - 1; + if (_truckLaneNum != 2 && _truckLaneNum != 3) + obstacle._prevId = _truckId - 1; else - obstacle._prevId = _s49_truckId + 1; + obstacle._prevId = _truckId + 1; break; case 3: - if (_s49_truckLaneNum != 1 && _s49_truckLaneNum != 2) - obstacle._prevId = _s49_truckId; + if (_truckLaneNum != 1 && _truckLaneNum != 2) + obstacle._prevId = _truckId; else - obstacle._prevId = _s49_truckId - 1; + obstacle._prevId = _truckId - 1; break; } if (obstacle._currSequenceId == obstacle._closerSequenceId) { - if (_s49_truckLaneNum == obstacle._laneNum) { + if (_truckLaneNum == obstacle._laneNum) { if (obstacle._splashSequenceId) { - _vm->_gameSys->setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2); - _vm->_gameSys->insertSequence(obstacle._collisionSequenceId, obstacle._prevId, + gameSys.setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._collisionSequenceId, obstacle._prevId, obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); obstacle._currSequenceId = obstacle._collisionSequenceId; _vm->playSound(224, false); increaseScore(30); - } else if ((obstacle._laneNum == 1 && _s49_truckSequenceId == 0xB0) || - (obstacle._laneNum == 2 && (_s49_truckSequenceId == 0xB1 || _s49_truckSequenceId == 0xB2)) || - (obstacle._laneNum == 3 && _s49_truckSequenceId == 0xB3)) { - _vm->_gameSys->setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); - _vm->_gameSys->insertSequence(obstacle._passedSequenceId, obstacle._prevId, + } else if ((obstacle._laneNum == 1 && _truckSequenceId == 0xB0) || + (obstacle._laneNum == 2 && (_truckSequenceId == 0xB1 || _truckSequenceId == 0xB2)) || + (obstacle._laneNum == 3 && _truckSequenceId == 0xB3)) { + gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId, obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); obstacle._currSequenceId = obstacle._passedSequenceId; } else { - _vm->_gameSys->setAnimation(obstacle._collisionSequenceId, 256, 0); - _vm->_gameSys->setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); - _vm->_gameSys->insertSequence(obstacle._passedSequenceId, obstacle._prevId, + gameSys.setAnimation(obstacle._collisionSequenceId, 256, 0); + gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId, obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); - _vm->_gameSys->insertSequence(obstacle._collisionSequenceId, 256, - _s49_truckSequenceId, _s49_truckId, + gameSys.insertSequence(obstacle._collisionSequenceId, 256, + _truckSequenceId, _truckId, kSeqSyncExists, 0, 0, -50); - _s49_truckSequenceId = obstacle._collisionSequenceId; - _s49_truckId = 256; + _truckSequenceId = obstacle._collisionSequenceId; + _truckId = 256; obstacle._currSequenceId = obstacle._passedSequenceId; _vm->playSound(225, false); decreaseScore(30); } } else { - _vm->_gameSys->setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); - _vm->_gameSys->insertSequence(obstacle._passedSequenceId, obstacle._prevId, + gameSys.setAnimation(obstacle._passedSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._passedSequenceId, obstacle._prevId, obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); obstacle._currSequenceId = obstacle._passedSequenceId; } } else if (obstacle._currSequenceId == obstacle._passedSequenceId) { - if (_s49_truckLaneNum == obstacle._laneNum) { + if (_truckLaneNum == obstacle._laneNum) { if (obstacle._splashSequenceId) { - _vm->_gameSys->setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2); - _vm->_gameSys->insertSequence(obstacle._collisionSequenceId, obstacle._prevId, + gameSys.setAnimation(obstacle._collisionSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._collisionSequenceId, obstacle._prevId, obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); obstacle._currSequenceId = obstacle._collisionSequenceId; @@ -231,56 +235,58 @@ void Scene49::updateObstacle(int id) { increaseScore(30); } } else if (obstacle._splashSequenceId) { - _vm->_gameSys->setAnimation(obstacle._splashSequenceId, obstacle._prevId, id + 2); - _vm->_gameSys->insertSequence(obstacle._splashSequenceId, obstacle._prevId, + gameSys.setAnimation(obstacle._splashSequenceId, obstacle._prevId, id + 2); + gameSys.insertSequence(obstacle._splashSequenceId, obstacle._prevId, obstacle._currSequenceId, obstacle._currId, kSeqSyncWait, 0, 0, -50); obstacle._currSequenceId = obstacle._splashSequenceId; } } else { - _vm->_gameSys->setAnimation(0, 0, id + 2); + gameSys.setAnimation(0, 0, id + 2); clearObstacle(id); } } void Scene49::increaseScore(int amount) { - if (_s49_scoreBarPos + amount <= 556) { - _s49_scoreBarPos += amount; - _vm->_gameSys->fillSurface(0, _s49_scoreBarPos, 508, amount, 22, 255, 0, 0); + if (_scoreBarPos + amount <= 556) { + _scoreBarPos += amount; + _vm->_gameSys->fillSurface(0, _scoreBarPos, 508, amount, 22, 255, 0, 0); } - _s49_scoreLevel = _s49_scoreBarPos + amount >= 556; + _scoreLevel = _scoreBarPos + amount >= 556; } void Scene49::decreaseScore(int amount) { - if (_s49_scoreBarPos >= 226 && _s49_scoreLevel == 0) { - if (_s49_scoreBarFlash) + if (_scoreBarPos >= 226 && _scoreLevel == 0) { + if (_scoreBarFlash) refreshScoreBar(); - _vm->_gameSys->fillSurface(0, _s49_scoreBarPos, 508, amount, 22, 89, 0, 5); - _s49_scoreBarPos -= amount; - _s49_scoreLevel = 0; + _vm->_gameSys->fillSurface(0, _scoreBarPos, 508, amount, 22, 89, 0, 5); + _scoreBarPos -= amount; + _scoreLevel = 0; } } void Scene49::refreshScoreBar() { - if (_s49_scoreBarFlash) + if (_scoreBarFlash) _vm->_gameSys->fillSurface(0, 226, 508, 330, 22, 255, 0, 0); else _vm->_gameSys->fillSurface(0, 226, 508, 330, 22, 89, 0, 5); - _s49_scoreBarFlash = !_s49_scoreBarFlash; + _scoreBarFlash = !_scoreBarFlash; } void Scene49::clearObstacle(int index) { - _s49_obstacles[index]._currSequenceId = 0; - _s49_obstacles[index]._closerSequenceId = 0; - _s49_obstacles[index]._passedSequenceId = 0; - _s49_obstacles[index]._splashSequenceId = 0; - _s49_obstacles[index]._collisionSequenceId = 0; - _s49_obstacles[index]._prevId = 0; - _s49_obstacles[index]._currId = 0; - _s49_obstacles[index]._laneNum = 0; + _obstacles[index]._currSequenceId = 0; + _obstacles[index]._closerSequenceId = 0; + _obstacles[index]._passedSequenceId = 0; + _obstacles[index]._splashSequenceId = 0; + _obstacles[index]._collisionSequenceId = 0; + _obstacles[index]._prevId = 0; + _obstacles[index]._currId = 0; + _obstacles[index]._laneNum = 0; } void Scene49::run() { + GameSys gameSys = *_vm->_gameSys; + bool animToggle6 = false; bool animToggle5 = false; bool animToggle4 = false; @@ -294,64 +300,64 @@ void Scene49::run() { _vm->hideCursor(); _vm->setGrabCursorSprite(-1); - _s49_scoreBarPos = 196; - _s49_scoreLevel = 0; - _s49_scoreBarFlash = false; + _scoreBarPos = 196; + _scoreLevel = 0; + _scoreBarFlash = false; switch (_vm->getRandom(3)) { case 0: - _s49_truckSequenceId = 0xAD; - _s49_truckLaneNum = 1; + _truckSequenceId = 0xAD; + _truckLaneNum = 1; break; case 1: - _s49_truckSequenceId = 0xAE; - _s49_truckLaneNum = 2; + _truckSequenceId = 0xAE; + _truckLaneNum = 2; break; case 2: - _s49_truckSequenceId = 0xAF; - _s49_truckLaneNum = 3; + _truckSequenceId = 0xAF; + _truckLaneNum = 3; break; } - int bgWidth1 = _vm->_gameSys->getSpriteWidthById(0x5E); + int bgWidth1 = gameSys.getSpriteWidthById(0x5E); int bgX1 = 600; - int bgWidth2 = _vm->_gameSys->getSpriteWidthById(0x5F); + int bgWidth2 = gameSys.getSpriteWidthById(0x5F); int bgX2 = 400; - int bgWidth3 = _vm->_gameSys->getSpriteWidthById(4); + int bgWidth3 = gameSys.getSpriteWidthById(4); int bgX3 = 700; - int bgWidth4 = _vm->_gameSys->getSpriteWidthById(5); + int bgWidth4 = gameSys.getSpriteWidthById(5); int bgX4 = 500; - int bgWidth5 = _vm->_gameSys->getSpriteWidthById(6); + int bgWidth5 = gameSys.getSpriteWidthById(6); int bgX5 = 300; - int bgWidth6 = _vm->_gameSys->getSpriteWidthById(7); + int bgWidth6 = gameSys.getSpriteWidthById(7); int bgX6 = 100; - _vm->_gameSys->setAnimation(0xC8, 251, 1); - _vm->_gameSys->setAnimation(_s49_truckSequenceId, 256, 0); - _vm->_gameSys->insertSequence(0xC9, 256, 0, 0, kSeqNone, 0, 600, 85); - _vm->_gameSys->insertSequence(0xCA, 257, 0, 0, kSeqNone, 0, 400, 100); - _vm->_gameSys->insertSequence(0xC4, 256, 0, 0, kSeqNone, 0, 700, 140); - _vm->_gameSys->insertSequence(0xC5, 257, 0, 0, kSeqNone, 0, 500, 160); - _vm->_gameSys->insertSequence(0xC6, 258, 0, 0, kSeqNone, 0, 300, 140); - _vm->_gameSys->insertSequence(0xC7, 259, 0, 0, kSeqNone, 0, 100, 140); - _vm->_gameSys->insertSequence(0xC8, 251, 0, 0, kSeqNone, 0, 0, -50); - _vm->_gameSys->insertSequence(_s49_truckSequenceId, 256, 0, 0, kSeqNone, 0, 0, -50); + gameSys.setAnimation(0xC8, 251, 1); + gameSys.setAnimation(_truckSequenceId, 256, 0); + gameSys.insertSequence(0xC9, 256, 0, 0, kSeqNone, 0, 600, 85); + gameSys.insertSequence(0xCA, 257, 0, 0, kSeqNone, 0, 400, 100); + gameSys.insertSequence(0xC4, 256, 0, 0, kSeqNone, 0, 700, 140); + gameSys.insertSequence(0xC5, 257, 0, 0, kSeqNone, 0, 500, 160); + gameSys.insertSequence(0xC6, 258, 0, 0, kSeqNone, 0, 300, 140); + gameSys.insertSequence(0xC7, 259, 0, 0, kSeqNone, 0, 100, 140); + gameSys.insertSequence(0xC8, 251, 0, 0, kSeqNone, 0, 0, -50); + gameSys.insertSequence(_truckSequenceId, 256, 0, 0, kSeqNone, 0, 0, -50); _vm->_timers[0] = 2; for (int i = 0; i < 5; ++i) clearObstacle(i); - _s49_obstacleIndex = 0; + _obstacleIndex = 0; _vm->_timers[2] = _vm->getRandom(20) + 10; - _s49_truckId = 256; + _truckId = 256; _vm->_timers[3] = 35; while (!_vm->_sceneDone) { @@ -376,72 +382,72 @@ void Scene49::run() { if (bgX6 <= -bgWidth6) bgX6 = 799; bgAnimToggle = !bgAnimToggle; - _vm->_gameSys->insertSequence(0xC9, (bgAnimToggle ? 1 : 0) + 256, 0xC9, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX1, 85); - _vm->_gameSys->insertSequence(0xCA, (bgAnimToggle ? 1 : 0) + 257, 0xCA, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX2, 100); - _vm->_gameSys->insertSequence(0xC4, (bgAnimToggle ? 1 : 0) + 256, 0xC4, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX3, 140); - _vm->_gameSys->insertSequence(0xC5, (bgAnimToggle ? 1 : 0) + 257, 0xC5, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX4, 160); - _vm->_gameSys->insertSequence(0xC6, (bgAnimToggle ? 1 : 0) + 258, 0xC6, (bgAnimToggle ? 0 : 1) + 258, kSeqSyncWait, 0, bgX5, 140); - _vm->_gameSys->insertSequence(0xC7, (bgAnimToggle ? 1 : 0) + 259, 0xC7, (bgAnimToggle ? 0 : 1) + 259, kSeqSyncWait, 0, bgX6, 140); + gameSys.insertSequence(0xC9, (bgAnimToggle ? 1 : 0) + 256, 0xC9, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX1, 85); + gameSys.insertSequence(0xCA, (bgAnimToggle ? 1 : 0) + 257, 0xCA, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX2, 100); + gameSys.insertSequence(0xC4, (bgAnimToggle ? 1 : 0) + 256, 0xC4, (bgAnimToggle ? 0 : 1) + 256, kSeqSyncWait, 0, bgX3, 140); + gameSys.insertSequence(0xC5, (bgAnimToggle ? 1 : 0) + 257, 0xC5, (bgAnimToggle ? 0 : 1) + 257, kSeqSyncWait, 0, bgX4, 160); + gameSys.insertSequence(0xC6, (bgAnimToggle ? 1 : 0) + 258, 0xC6, (bgAnimToggle ? 0 : 1) + 258, kSeqSyncWait, 0, bgX5, 140); + gameSys.insertSequence(0xC7, (bgAnimToggle ? 1 : 0) + 259, 0xC7, (bgAnimToggle ? 0 : 1) + 259, kSeqSyncWait, 0, bgX6, 140); _vm->_timers[0] = 2; } - if (_vm->_gameSys->getAnimationStatus(1) == 2) { + if (gameSys.getAnimationStatus(1) == 2) { streetAnimToggle = !streetAnimToggle; - _vm->_gameSys->setAnimation(0xC8, (streetAnimToggle ? 1 : 0) + 251, 1); - _vm->_gameSys->insertSequence(0xC8, (streetAnimToggle ? 1 : 0) + 251, 200, (streetAnimToggle ? 0 : 1) + 251, kSeqSyncWait, 0, 0, -50); + gameSys.setAnimation(0xC8, (streetAnimToggle ? 1 : 0) + 251, 1); + gameSys.insertSequence(0xC8, (streetAnimToggle ? 1 : 0) + 251, 200, (streetAnimToggle ? 0 : 1) + 251, kSeqSyncWait, 0, 0, -50); } checkObstacles(); - if (_vm->_gameSys->getAnimationStatus(0) == 2) { - switch (_s49_truckSequenceId) { + if (gameSys.getAnimationStatus(0) == 2) { + switch (_truckSequenceId) { case 0xB1: - _s49_truckLaneNum = 1; + _truckLaneNum = 1; break; case 0xB0: case 0xB3: - _s49_truckLaneNum = 2; + _truckLaneNum = 2; break; case 0xB2: - _s49_truckLaneNum = 3; + _truckLaneNum = 3; break; } animToggle3 = !animToggle3; - if (_s49_truckLaneNum == 1) { - _vm->_gameSys->setAnimation(0xAD, (animToggle3 ? 1 : 0) + 256, 0); - _vm->_gameSys->insertSequence(0xAD, (animToggle3 ? 1 : 0) + 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncWait, 0, 0, -50); - _s49_truckSequenceId = 0xAD; - } else if (_s49_truckLaneNum == 2) { - _vm->_gameSys->setAnimation(0xAE, (animToggle3 ? 1 : 0) + 256, 0); - _vm->_gameSys->insertSequence(0xAE, (animToggle3 ? 1 : 0) + 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncWait, 0, 0, -50); - _s49_truckSequenceId = 0xAE; + if (_truckLaneNum == 1) { + gameSys.setAnimation(0xAD, (animToggle3 ? 1 : 0) + 256, 0); + gameSys.insertSequence(0xAD, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50); + _truckSequenceId = 0xAD; + } else if (_truckLaneNum == 2) { + gameSys.setAnimation(0xAE, (animToggle3 ? 1 : 0) + 256, 0); + gameSys.insertSequence(0xAE, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50); + _truckSequenceId = 0xAE; } else { - _vm->_gameSys->setAnimation(0xAF, (animToggle3 ? 1 : 0) + 256, 0); - _vm->_gameSys->insertSequence(0xAF, (animToggle3 ? 1 : 0) + 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncWait, 0, 0, -50); - _s49_truckSequenceId = 0xAF; + gameSys.setAnimation(0xAF, (animToggle3 ? 1 : 0) + 256, 0); + gameSys.insertSequence(0xAF, (animToggle3 ? 1 : 0) + 256, _truckSequenceId, _truckId, kSeqSyncWait, 0, 0, -50); + _truckSequenceId = 0xAF; } - _s49_truckId = (animToggle3 ? 1 : 0) + 256; - if (_s49_scoreLevel == 1) { - if (!_vm->_gameSys->isSequenceActive(0xD4, 266)) { - _vm->_gameSys->setAnimation(0xD4, 266, 8); - _vm->_gameSys->insertSequence(0xD4, 266, 0, 0, kSeqNone, 0, 0, -50); + _truckId = (animToggle3 ? 1 : 0) + 256; + if (_scoreLevel == 1) { + if (!gameSys.isSequenceActive(0xD4, 266)) { + gameSys.setAnimation(0xD4, 266, 8); + gameSys.insertSequence(0xD4, 266, 0, 0, kSeqNone, 0, 0, -50); } - ++_s49_scoreLevel; + ++_scoreLevel; _vm->_timers[1] = 2; animToggle4 = false; animToggle5 = false; animToggle6 = false; - _s49_scoreBarFlash = false; + _scoreBarFlash = false; } } - if (_s49_scoreLevel != 0 && !_vm->_timers[1]) { + if (_scoreLevel != 0 && !_vm->_timers[1]) { refreshScoreBar(); _vm->_timers[1] = 8; if (animToggle6) { if (animToggle5) { - if (animToggle4 && !_vm->_gameSys->isSequenceActive(212, 266)) - _vm->_gameSys->insertSequence(212, 266, 0, 0, kSeqNone, 0, 0, -50); + if (animToggle4 && !gameSys.isSequenceActive(212, 266)) + gameSys.insertSequence(212, 266, 0, 0, kSeqNone, 0, 0, -50); animToggle4 = !animToggle4; } animToggle5 = !animToggle5; @@ -459,22 +465,22 @@ void Scene49::run() { if (_vm->isKeyStatus1(Common::KEYCODE_RIGHT)) { // Steer right - if (_s49_truckSequenceId == 0xB3) - _s49_truckLaneNum = 2; - if (_s49_truckSequenceId == 0xB1) - _s49_truckLaneNum = 1; - if (_s49_truckLaneNum != 3 && _s49_truckLaneNum != 2) { - if (_s49_scoreLevel) { + if (_truckSequenceId == 0xB3) + _truckLaneNum = 2; + if (_truckSequenceId == 0xB1) + _truckLaneNum = 1; + if (_truckLaneNum != 3 && _truckLaneNum != 2) { + if (_scoreLevel) { _vm->_sceneDone = true; _vm->_newSceneNum = 47; } } else { - int steerSequenceId = (_s49_truckLaneNum == 3) ? 0xB3 : 0xB1; - if (_s49_truckSequenceId == 0xAE || _s49_truckSequenceId == 0xAF) { - _vm->_gameSys->setAnimation(steerSequenceId, 256, 0); - _vm->_gameSys->insertSequence(steerSequenceId, 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncExists, 0, 0, -50); - _s49_truckSequenceId = steerSequenceId; - _s49_truckId = 256; + int steerSequenceId = (_truckLaneNum == 3) ? 0xB3 : 0xB1; + if (_truckSequenceId == 0xAE || _truckSequenceId == 0xAF) { + gameSys.setAnimation(steerSequenceId, 256, 0); + gameSys.insertSequence(steerSequenceId, 256, _truckSequenceId, _truckId, kSeqSyncExists, 0, 0, -50); + _truckSequenceId = steerSequenceId; + _truckId = 256; } } _vm->clearKeyStatus1(Common::KEYCODE_RIGHT); @@ -482,17 +488,17 @@ void Scene49::run() { if (_vm->isKeyStatus1(Common::KEYCODE_LEFT)) { // Steer left - if (_s49_truckSequenceId == 0xB0) - _s49_truckLaneNum = 2; - if (_s49_truckSequenceId == 0xB2) - _s49_truckLaneNum = 3; - if (_s49_truckLaneNum == 1 || _s49_truckLaneNum == 2) { - int steerSequenceId = (_s49_truckLaneNum == 1) ? 0xB0 : 0xB2; - if (_s49_truckSequenceId == 0xAD || _s49_truckSequenceId == 0xAE) { - _vm->_gameSys->setAnimation(steerSequenceId, 256, 0); - _vm->_gameSys->insertSequence(steerSequenceId, 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncExists, 0, 0, -50); - _s49_truckSequenceId = steerSequenceId; - _s49_truckId = 256; + if (_truckSequenceId == 0xB0) + _truckLaneNum = 2; + if (_truckSequenceId == 0xB2) + _truckLaneNum = 3; + if (_truckLaneNum == 1 || _truckLaneNum == 2) { + int steerSequenceId = (_truckLaneNum == 1) ? 0xB0 : 0xB2; + if (_truckSequenceId == 0xAD || _truckSequenceId == 0xAE) { + gameSys.setAnimation(steerSequenceId, 256, 0); + gameSys.insertSequence(steerSequenceId, 256, _truckSequenceId, _truckId, kSeqSyncExists, 0, 0, -50); + _truckSequenceId = steerSequenceId; + _truckId = 256; } } _vm->clearKeyStatus1(Common::KEYCODE_LEFT); @@ -503,14 +509,16 @@ void Scene49::run() { } void Scene49::updateAnimations() { + GameSys gameSys = *_vm->_gameSys; + for (int i = 0; i < 5; ++i) { - if (_vm->_gameSys->getAnimationStatus(i + 2) == 2) { - if (_s49_obstacles[i]._currSequenceId) + if (gameSys.getAnimationStatus(i + 2) == 2) { + if (_obstacles[i]._currSequenceId) updateObstacle(i); } } - if (_vm->_gameSys->getAnimationStatus(8) == 2) { + if (gameSys.getAnimationStatus(8) == 2) { _vm->_sceneDone = true; _vm->_newSceneNum = 47; } diff --git a/engines/gnap/scenes/scene49.h b/engines/gnap/scenes/scene49.h index f44b2ed25b..d69d9771c9 100644 --- a/engines/gnap/scenes/scene49.h +++ b/engines/gnap/scenes/scene49.h @@ -58,14 +58,14 @@ public: virtual void updateAnimationsCb() {}; private: - int _s49_scoreBarPos; - int _s49_scoreLevel; - bool _s49_scoreBarFlash; - int _s49_obstacleIndex; - Scene49Obstacle _s49_obstacles[5]; - int _s49_truckSequenceId; - int _s49_truckId; - int _s49_truckLaneNum; + int _scoreBarPos; + int _scoreLevel; + bool _scoreBarFlash; + int _obstacleIndex; + Scene49Obstacle _obstacles[5]; + int _truckSequenceId; + int _truckId; + int _truckLaneNum; void checkObstacles(); void updateObstacle(int id); diff --git a/engines/gnap/scenes/scene54.cpp b/engines/gnap/scenes/scene54.cpp index 935a1668ee..222c6e81e4 100644 --- a/engines/gnap/scenes/scene54.cpp +++ b/engines/gnap/scenes/scene54.cpp @@ -30,31 +30,31 @@ namespace Gnap { Scene541::Scene541(GnapEngine *vm) : CutScene(vm) {} int Scene541::init() { - _s99_sequenceIdArr[0] = 0x1BE; - _s99_sequenceIdArr[1] = 0x1BF; - _s99_sequenceIdArr[2] = 0x1BA; - _s99_sequenceIdArr[3] = 0x1BB; - _s99_sequenceIdArr[4] = 0x1BD; - _s99_sequenceIdArr[5] = 0x1BC; - _s99_resourceIdArr[0] = 0x3C; - _s99_resourceIdArr[1] = 0x43; - _s99_resourceIdArr[2] = 0x44; + _sequenceIdArr[0] = 0x1BE; + _sequenceIdArr[1] = 0x1BF; + _sequenceIdArr[2] = 0x1BA; + _sequenceIdArr[3] = 0x1BB; + _sequenceIdArr[4] = 0x1BD; + _sequenceIdArr[5] = 0x1BC; + _resourceIdArr[0] = 0x3C; + _resourceIdArr[1] = 0x43; + _resourceIdArr[2] = 0x44; if (_vm->isFlag(kGFPictureTaken)) - _s99_resourceIdArr[3] = 0x47; + _resourceIdArr[3] = 0x47; else - _s99_resourceIdArr[3] = 0x46; - _s99_resourceIdArr[4] = 0x45; - _s99_sequenceCountArr[0] = 1; - _s99_sequenceCountArr[1] = 1; - _s99_sequenceCountArr[2] = 1; - _s99_sequenceCountArr[3] = 2; - _s99_sequenceCountArr[4] = 1; - _s99_canSkip[0] = false; - _s99_canSkip[1] = false; - _s99_canSkip[2] = false; - _s99_canSkip[3] = false; - _s99_canSkip[4] = false; - _s99_itemsCount = 5; + _resourceIdArr[3] = 0x46; + _resourceIdArr[4] = 0x45; + _sequenceCountArr[0] = 1; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = 1; + _sequenceCountArr[3] = 2; + _sequenceCountArr[4] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _canSkip[2] = false; + _canSkip[3] = false; + _canSkip[4] = false; + _itemsCount = 5; return -1; } @@ -62,73 +62,73 @@ int Scene541::init() { Scene542::Scene542(GnapEngine *vm) : CutScene(vm) {} int Scene542::init() { - _s99_sequenceIdArr[0] = 0x1C9; - _s99_sequenceIdArr[1] = 0x1C7; - _s99_sequenceIdArr[2] = 0x1CC; - _s99_sequenceIdArr[3] = 0x1C8; - _s99_sequenceIdArr[4] = 0x1CB; - _s99_sequenceIdArr[5] = 0x1C0; - _s99_sequenceIdArr[6] = 0x1CA; - _s99_sequenceIdArr[7] = 0x1CE; - _s99_sequenceIdArr[8] = 0x1CD; - _s99_sequenceIdArr[9] = 0x1C1; - _s99_sequenceIdArr[10] = 0x1C2; - _s99_sequenceIdArr[11] = 0x1C3; - _s99_sequenceIdArr[12] = 0x1C4; - _s99_sequenceIdArr[13] = 0x1C6; - _s99_sequenceIdArr[14] = 0x1C5; - _s99_sequenceIdArr[15] = 0x1D0; - _s99_sequenceIdArr[16] = 0x1D0; - _s99_sequenceIdArr[17] = 0x1D0; - _s99_resourceIdArr[0] = 0xD5; - _s99_resourceIdArr[1] = 0x14C; - _s99_resourceIdArr[2] = 0xD5; - _s99_resourceIdArr[3] = 0xBF; - _s99_resourceIdArr[4] = 0xD6; - _s99_resourceIdArr[5] = 0x154; - _s99_resourceIdArr[6] = 0x155; - _s99_resourceIdArr[7] = 0xB9; - _s99_resourceIdArr[8] = 0xBA; - _s99_resourceIdArr[9] = 0x17B; - _s99_resourceIdArr[10] = 0x17A; - _s99_resourceIdArr[11] = 0x17C; - _s99_resourceIdArr[12] = 0x17A; - _s99_resourceIdArr[13] = 0x1B7; - _s99_resourceIdArr[14] = 0x1B8; - _s99_resourceIdArr[15] = 0x1B9; - _s99_sequenceCountArr[0] = 2; - _s99_sequenceCountArr[1] = 1; - _s99_sequenceCountArr[2] = 2; - _s99_sequenceCountArr[3] = 1; - _s99_sequenceCountArr[4] = 1; - _s99_sequenceCountArr[5] = 1; - _s99_sequenceCountArr[6] = 1; - _s99_sequenceCountArr[7] = 1; - _s99_sequenceCountArr[8] = 1; - _s99_sequenceCountArr[9] = 1; - _s99_sequenceCountArr[10] = 1; - _s99_sequenceCountArr[11] = 1; - _s99_sequenceCountArr[12] = 1; - _s99_sequenceCountArr[13] = 1; - _s99_sequenceCountArr[14] = 1; - _s99_sequenceCountArr[15] = 1; - _s99_canSkip[0] = false; - _s99_canSkip[1] = false; - _s99_canSkip[2] = false; - _s99_canSkip[3] = false; - _s99_canSkip[4] = false; - _s99_canSkip[5] = false; - _s99_canSkip[6] = false; - _s99_canSkip[7] = false; - _s99_canSkip[8] = false; - _s99_canSkip[9] = false; - _s99_canSkip[10] = false; - _s99_canSkip[11] = false; - _s99_canSkip[12] = false; - _s99_canSkip[13] = true; - _s99_canSkip[14] = true; - _s99_canSkip[15] = false; - _s99_itemsCount = 16; + _sequenceIdArr[0] = 0x1C9; + _sequenceIdArr[1] = 0x1C7; + _sequenceIdArr[2] = 0x1CC; + _sequenceIdArr[3] = 0x1C8; + _sequenceIdArr[4] = 0x1CB; + _sequenceIdArr[5] = 0x1C0; + _sequenceIdArr[6] = 0x1CA; + _sequenceIdArr[7] = 0x1CE; + _sequenceIdArr[8] = 0x1CD; + _sequenceIdArr[9] = 0x1C1; + _sequenceIdArr[10] = 0x1C2; + _sequenceIdArr[11] = 0x1C3; + _sequenceIdArr[12] = 0x1C4; + _sequenceIdArr[13] = 0x1C6; + _sequenceIdArr[14] = 0x1C5; + _sequenceIdArr[15] = 0x1D0; + _sequenceIdArr[16] = 0x1D0; + _sequenceIdArr[17] = 0x1D0; + _resourceIdArr[0] = 0xD5; + _resourceIdArr[1] = 0x14C; + _resourceIdArr[2] = 0xD5; + _resourceIdArr[3] = 0xBF; + _resourceIdArr[4] = 0xD6; + _resourceIdArr[5] = 0x154; + _resourceIdArr[6] = 0x155; + _resourceIdArr[7] = 0xB9; + _resourceIdArr[8] = 0xBA; + _resourceIdArr[9] = 0x17B; + _resourceIdArr[10] = 0x17A; + _resourceIdArr[11] = 0x17C; + _resourceIdArr[12] = 0x17A; + _resourceIdArr[13] = 0x1B7; + _resourceIdArr[14] = 0x1B8; + _resourceIdArr[15] = 0x1B9; + _sequenceCountArr[0] = 2; + _sequenceCountArr[1] = 1; + _sequenceCountArr[2] = 2; + _sequenceCountArr[3] = 1; + _sequenceCountArr[4] = 1; + _sequenceCountArr[5] = 1; + _sequenceCountArr[6] = 1; + _sequenceCountArr[7] = 1; + _sequenceCountArr[8] = 1; + _sequenceCountArr[9] = 1; + _sequenceCountArr[10] = 1; + _sequenceCountArr[11] = 1; + _sequenceCountArr[12] = 1; + _sequenceCountArr[13] = 1; + _sequenceCountArr[14] = 1; + _sequenceCountArr[15] = 1; + _canSkip[0] = false; + _canSkip[1] = false; + _canSkip[2] = false; + _canSkip[3] = false; + _canSkip[4] = false; + _canSkip[5] = false; + _canSkip[6] = false; + _canSkip[7] = false; + _canSkip[8] = false; + _canSkip[9] = false; + _canSkip[10] = false; + _canSkip[11] = false; + _canSkip[12] = false; + _canSkip[13] = true; + _canSkip[14] = true; + _canSkip[15] = false; + _itemsCount = 16; return -1; } diff --git a/engines/gnap/scenes/scenecore.cpp b/engines/gnap/scenes/scenecore.cpp index c549a7aac9..8c16bb593e 100644 --- a/engines/gnap/scenes/scenecore.cpp +++ b/engines/gnap/scenes/scenecore.cpp @@ -699,7 +699,7 @@ void CutScene::run() { if (_vm->_prevSceneNum == 2) { soundId = 0x36B; - duration = MAX(1, 300 / _vm->getSequenceTotalDuration(_s99_sequenceIdArr[_s99_itemsCount - 1]));//CHECKME + duration = MAX(1, 300 / _vm->getSequenceTotalDuration(_sequenceIdArr[_itemsCount - 1]));//CHECKME _vm->_timers[0] = 0; } @@ -708,11 +708,11 @@ void CutScene::run() { _vm->hideCursor(); - _vm->_gameSys->drawSpriteToBackground(0, 0, _s99_resourceIdArr[0]); + _vm->_gameSys->drawSpriteToBackground(0, 0, _resourceIdArr[0]); - for (int j = 0; j < _s99_sequenceCountArr[0]; ++j) - _vm->_gameSys->insertSequence(_s99_sequenceIdArr[j], j + 2, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->setAnimation(_s99_sequenceIdArr[0], 2, 0); + for (int j = 0; j < _sequenceCountArr[0]; ++j) + _vm->_gameSys->insertSequence(_sequenceIdArr[j], j + 2, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->setAnimation(_sequenceIdArr[0], 2, 0); _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); _vm->clearKeyStatus1(Common::KEYCODE_SPACE); @@ -729,14 +729,14 @@ void CutScene::run() { _vm->_gameSys->requestClear2(false); _vm->_gameSys->requestClear1(); _vm->_gameSys->setAnimation(0, 0, 0); - firstSequenceIndex += _s99_sequenceCountArr[itemIndex++]; - if (itemIndex >= _s99_itemsCount) { + firstSequenceIndex += _sequenceCountArr[itemIndex++]; + if (itemIndex >= _itemsCount) { _vm->_sceneDone = true; } else { - for (int m = 0; m < _s99_sequenceCountArr[itemIndex]; ++m) - _vm->_gameSys->insertSequence(_s99_sequenceIdArr[firstSequenceIndex + m], m + 2, 0, 0, kSeqNone, 0, 0, 0); - _vm->_gameSys->drawSpriteToBackground(0, 0, _s99_resourceIdArr[itemIndex]); - _vm->_gameSys->setAnimation(_s99_sequenceIdArr[firstSequenceIndex], 2, 0); + for (int m = 0; m < _sequenceCountArr[itemIndex]; ++m) + _vm->_gameSys->insertSequence(_sequenceIdArr[firstSequenceIndex + m], m + 2, 0, 0, kSeqNone, 0, 0, 0); + _vm->_gameSys->drawSpriteToBackground(0, 0, _resourceIdArr[itemIndex]); + _vm->_gameSys->setAnimation(_sequenceIdArr[firstSequenceIndex], 2, 0); } } @@ -744,13 +744,13 @@ void CutScene::run() { _vm->clearKeyStatus1(Common::KEYCODE_ESCAPE); _vm->clearKeyStatus1(Common::KEYCODE_SPACE); _vm->clearKeyStatus1(29); - if (_s99_canSkip[itemIndex]) + if (_canSkip[itemIndex]) skip = true; else _vm->_sceneDone = true; } - if (!_vm->_timers[0] && itemIndex == _s99_itemsCount - 1) { + if (!_vm->_timers[0] && itemIndex == _itemsCount - 1) { _vm->_timers[0] = 2; volume = MAX(1, volume - duration); _vm->setSoundVolume(soundId, volume); diff --git a/engines/gnap/scenes/scenecore.h b/engines/gnap/scenes/scenecore.h index 73723fd685..209f07a162 100644 --- a/engines/gnap/scenes/scenecore.h +++ b/engines/gnap/scenes/scenecore.h @@ -59,11 +59,11 @@ public: void updateAnimationsCb() {} protected: - int _s99_itemsCount; - int _s99_resourceIdArr[16]; - int _s99_sequenceCountArr[16]; - int _s99_sequenceIdArr[50]; - bool _s99_canSkip[16]; + int _itemsCount; + int _resourceIdArr[16]; + int _sequenceCountArr[16]; + int _sequenceIdArr[50]; + bool _canSkip[16]; }; } // End of namespace Gnap |