From b6ba5cfd89bed28dfab39f5af7b445b0041c2c7e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 18 Mar 2016 01:32:32 +0100 Subject: GNAP: Reduce the scope of a couple of variables, make use of enum values in calls to InsertSequence --- engines/gnap/scenes/scene02.cpp | 2 +- engines/gnap/scenes/scene03.cpp | 4 ++-- engines/gnap/scenes/scene13.cpp | 1 + engines/gnap/scenes/scene17.cpp | 3 ++- engines/gnap/scenes/scene18.cpp | 6 +++++- engines/gnap/scenes/scene20.cpp | 20 ++++++++++---------- engines/gnap/scenes/scene25.cpp | 2 +- engines/gnap/scenes/scene27.cpp | 2 +- engines/gnap/scenes/scene47.cpp | 4 ++-- engines/gnap/scenes/scene49.cpp | 6 +++--- engines/gnap/scenes/scene50.cpp | 6 +++--- engines/gnap/scenes/scene51.cpp | 7 +++---- engines/gnap/scenes/scene53.cpp | 4 ++-- 13 files changed, 36 insertions(+), 31 deletions(-) (limited to 'engines/gnap/scenes') diff --git a/engines/gnap/scenes/scene02.cpp b/engines/gnap/scenes/scene02.cpp index a4d62c80dc..cd72020d94 100644 --- a/engines/gnap/scenes/scene02.cpp +++ b/engines/gnap/scenes/scene02.cpp @@ -498,7 +498,7 @@ void GnapEngine::scene02_updateAnimations() { break; case kASUseTwigWithChicken: playGnapShowItem(5, 0, 0); - _gameSys->insertSequence(0x155, 179, _s02_currChickenSequenceId, 179, 32, 0, 0, 0); + _gameSys->insertSequence(0x155, 179, _s02_currChickenSequenceId, 179, kSeqSyncExists, 0, 0, 0); _s02_currChickenSequenceId = 0x155; _s02_nextChickenSequenceId = -1; _gnapActionStatus = -1; diff --git a/engines/gnap/scenes/scene03.cpp b/engines/gnap/scenes/scene03.cpp index 7ca1c4a2da..95449f5e6c 100644 --- a/engines/gnap/scenes/scene03.cpp +++ b/engines/gnap/scenes/scene03.cpp @@ -406,7 +406,7 @@ void GnapEngine::scene03_updateAnimations() { gameUpdateTick(); removeFullScreenSprite(); _gameSys->setAnimation(0x1BA, 99, 1); - _gameSys->insertSequence(0x1BA, 99, _beaverSequenceId | (_beaverSequenceDatNum << 16), 99, 32, 0, 0, 0); + _gameSys->insertSequence(0x1BA, 99, _beaverSequenceId | (_beaverSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); _beaverSequenceDatNum = 0; _beaverSequenceId = 0x1BA; _gnapActionStatus = -1; @@ -415,7 +415,7 @@ void GnapEngine::scene03_updateAnimations() { break; case kASHypnotizeScaredPlat: playGnapBrainPulsating(0, 0); - _gameSys->insertSequence(0x1BF, 99, _beaverSequenceId | (_beaverSequenceDatNum << 16), 99, 32, 0, 0, 0); + _gameSys->insertSequence(0x1BF, 99, _beaverSequenceId | (_beaverSequenceDatNum << 16), 99, kSeqSyncExists, 0, 0, 0); _gameSys->setAnimation(0x1BF, 99, 1); while (_gameSys->getAnimationStatus(1) != 2) gameUpdateTick(); diff --git a/engines/gnap/scenes/scene13.cpp b/engines/gnap/scenes/scene13.cpp index 233b7544b2..2897f687db 100644 --- a/engines/gnap/scenes/scene13.cpp +++ b/engines/gnap/scenes/scene13.cpp @@ -184,6 +184,7 @@ void GnapEngine::scene13_run() { if (_gnapX == 5 && _gnapY == 5) { _s13_backToiletCtr = MIN(5, _s13_backToiletCtr + 1); _gameSys->setAnimation(_s13_backToiletCtr + 0xA3, _gnapId, 0); + // CHECKME: Check the value of the flag _gameSys->insertSequence(_s13_backToiletCtr + 0xA3, _gnapId, makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, 9, 0, 0, 0); diff --git a/engines/gnap/scenes/scene17.cpp b/engines/gnap/scenes/scene17.cpp index c86df4c8a3..322cdd62dd 100644 --- a/engines/gnap/scenes/scene17.cpp +++ b/engines/gnap/scenes/scene17.cpp @@ -100,7 +100,7 @@ void GnapEngine::scene17_platHangUpPhone() { _s17_platPhoneCtr = 0; _beaverActionStatus = -1; _gameSys->setAnimation(0x257, 254, 4); - _gameSys->insertSequence(0x257, 254, _s17_currPhoneSequenceId, 254, 32, 0, 0, 0); + _gameSys->insertSequence(0x257, 254, _s17_currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); while (_gameSys->getAnimationStatus(4) != 2) gameUpdateTick(); _gameSys->setAnimation(0x25B, _beaverId, 1); @@ -265,6 +265,7 @@ void GnapEngine::scene17_run() { _platY = 8; _beaverId = 160; _gameSys->insertSequence(0x241, 160, 0, 0, kSeqNone, 0, 0, 0); + // CHECKME: Check the value of the flag _gameSys->insertSequence(0x107C1, _beaverId, 0x241, _beaverId, 9, 0, 75 * _platX - _platGridX, 48 * _platY - _platGridY); _gameSys->insertSequence(0x22C, 2, 0, 0, kSeqNone, 0, 0, 0); diff --git a/engines/gnap/scenes/scene18.cpp b/engines/gnap/scenes/scene18.cpp index 4d16486818..5466360c11 100644 --- a/engines/gnap/scenes/scene18.cpp +++ b/engines/gnap/scenes/scene18.cpp @@ -219,6 +219,7 @@ void GnapEngine::scene18_gnapCarryGarbageCanTo(int x, int y, int animationIndex, if (animationIndex >= 0) _gameSys->setAnimation(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, animationIndex); + // CHECKME: Check the value of the flag _gameSys->insertSequence(makeRid(_gnapSequenceDatNum, _gnapSequenceId), _gnapId, gnapSeqId | (gnapDatNum << 16), gnapId, 9, 0, 75 * gnapGridX - _gnapGridX, 48 * _gnapY - _gnapGridY); @@ -264,7 +265,7 @@ void GnapEngine::scene18_platEndPhoning(bool platFl) { _beaverActionStatus = -1; if (_s18_currPhoneSequenceId != -1) { _gameSys->setAnimation(0x21E, 254, 3); - _gameSys->insertSequence(0x21E, 254, _s18_currPhoneSequenceId, 254, 32, 0, 0, 0); + _gameSys->insertSequence(0x21E, 254, _s18_currPhoneSequenceId, 254, kSeqSyncExists, 0, 0, 0); while (_gameSys->getAnimationStatus(3) != 2) gameUpdateTick(); } @@ -843,6 +844,7 @@ void GnapEngine::scene18_updateAnimations() { _gameSys->insertSequence(0x216, 39, 0, 0, kSeqNone, 21, 0, 0); _gameSys->removeSequence(0x20C, 19, true); _gameSys->setAnimation(0x217, 39, 5); + // CHECKME: check the value of the flag _gameSys->insertSequence(0x217, 39, 0x216, 39, 10, 0, 0, 0); while (_gameSys->getAnimationStatus(5) != 2) gameUpdateTick(); @@ -945,6 +947,7 @@ void GnapEngine::scene18_updateAnimations() { _gameSys->requestRemoveSequence(0x1F9, 19); _gameSys->removeSequence(0x20B, 19, true); _gameSys->setAnimation(0x213, 39, 5); + // CHECKME: check the value of the flag _gameSys->insertSequence(0x214, 39, 0x213, 39, 10, 0, 0, 0); while (_gameSys->getAnimationStatus(5) != 2) gameUpdateTick(); @@ -961,6 +964,7 @@ void GnapEngine::scene18_updateAnimations() { _gameSys->insertSequence(0x211, 39, 0, 0, kSeqNone, 21, 0, 0); _gameSys->removeSequence(0x20B, 19, true); _gameSys->setAnimation(0x211, 39, 5); + // CHECKME: check the value of the flag _gameSys->insertSequence(0x212, 39, 0x211, 39, 10, 0, 0, 0); while (_gameSys->getAnimationStatus(5) != 2) gameUpdateTick(); diff --git a/engines/gnap/scenes/scene20.cpp b/engines/gnap/scenes/scene20.cpp index 41a0cc4f79..788a7fac0b 100644 --- a/engines/gnap/scenes/scene20.cpp +++ b/engines/gnap/scenes/scene20.cpp @@ -551,8 +551,8 @@ void GnapEngine::scene20_updateAnimations() { case kASTalkStonerGuyNoJoint: _gameSys->setAnimation(0x170, 21, 2); _gameSys->setAnimation(0x17B, 20, 3); - _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, 32, 0, 0, 0); - _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, 32, 0, 0, 0); + _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); stopSound(0x1A1); scene20_stopSounds(); _s20_currGroceryStoreGuySequenceId = 0x17B; @@ -565,8 +565,8 @@ void GnapEngine::scene20_updateAnimations() { case kASTalkStonerGuyHasJoint: _gameSys->setAnimation(0x168, 21, 2); _gameSys->setAnimation(379, 20, 3); - _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, 32, 0, 0, 0); - _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, 32, 0, 0, 0); + _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); _gameSys->insertSequence(0x168, 21, 0x170, 21, kSeqSyncWait, 0, 0, 0); stopSound(0x1A1); scene20_stopSounds(); @@ -589,8 +589,8 @@ void GnapEngine::scene20_updateAnimations() { case kASTalkGroceryStoreGuy: _gameSys->setAnimation(0x170, 21, 2); _gameSys->setAnimation(0x17B, 20, 3); - _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, 32, 0, 0, 0); - _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, 32, 0, 0, 0); + _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); stopSound(0x1A1); scene20_stopSounds(); _s20_currGroceryStoreGuySequenceId = 0x17B; @@ -606,8 +606,8 @@ void GnapEngine::scene20_updateAnimations() { case kASGrabGroceryStoreGuy: _gameSys->setAnimation(0x170, 21, 2); _gameSys->setAnimation(0x17B, 20, 3); - _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, 32, 0, 0, 0); - _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, 32, 0, 0, 0); + _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); + _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); stopSound(0x1A1); scene20_stopSounds(); _s20_currGroceryStoreGuySequenceId = 0x17B; @@ -619,8 +619,8 @@ void GnapEngine::scene20_updateAnimations() { case kASGrabGroceryStoreHat: _gameSys->setAnimation(0x170, 21, 2); _gameSys->setAnimation(0x17B, 20, 3); - _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, 32, 0, 0, 0); - _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, 32, 0, 0, 0); + _gameSys->insertSequence(0x17B, 20, _s20_currGroceryStoreGuySequenceId, 20, kSeqSyncExists, 0, 0, 0); + _gameSys->insertSequence(0x170, 21, _s20_currStonerGuySequenceId, 21, kSeqSyncExists, 0, 0, 0); stopSound(0x1A1); scene20_stopSounds(); _s20_currGroceryStoreGuySequenceId = 0x17B; diff --git a/engines/gnap/scenes/scene25.cpp b/engines/gnap/scenes/scene25.cpp index 1539b319cf..b1bbfb40e8 100644 --- a/engines/gnap/scenes/scene25.cpp +++ b/engines/gnap/scenes/scene25.cpp @@ -352,7 +352,7 @@ void GnapEngine::scene25_updateAnimations() { _s25_nextTicketVendorSequenceId = 0x5E; _gameSys->setAnimation(0x5E, 39, 0); _gameSys->setAnimation(_s25_nextTicketVendorSequenceId, 39, 3); - _gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, 32, 0, 0, 0); + _gameSys->insertSequence(_s25_nextTicketVendorSequenceId, 39, _s25_currTicketVendorSequenceId, 39, kSeqSyncExists, 0, 0, 0); _gameSys->insertSequence(0x60, 2, 0, 0, kSeqNone, 0, 0, 0); _s25_currTicketVendorSequenceId = _s25_nextTicketVendorSequenceId; _s25_nextTicketVendorSequenceId = -1; diff --git a/engines/gnap/scenes/scene27.cpp b/engines/gnap/scenes/scene27.cpp index 720080d1ec..d241daf04d 100644 --- a/engines/gnap/scenes/scene27.cpp +++ b/engines/gnap/scenes/scene27.cpp @@ -353,7 +353,7 @@ void GnapEngine::scene27_updateAnimations() { break; case kASTryEnterClownTent: _s27_nextJanitorSequenceId = 0xD1; - _gameSys->insertSequence(0xD1, 39, _s27_currJanitorSequenceId, 39, 32, 0, 0, 0); + _gameSys->insertSequence(0xD1, 39, _s27_currJanitorSequenceId, 39, kSeqSyncExists, 0, 0, 0); _gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 3); _gameSys->setAnimation(_s27_nextJanitorSequenceId, 39, 0); _s27_currJanitorSequenceId = _s27_nextJanitorSequenceId; diff --git a/engines/gnap/scenes/scene47.cpp b/engines/gnap/scenes/scene47.cpp index 2e735e3650..f4aa91feda 100644 --- a/engines/gnap/scenes/scene47.cpp +++ b/engines/gnap/scenes/scene47.cpp @@ -123,13 +123,13 @@ void GnapEngine::scene47_initCutscene6() { } void GnapEngine::scene47_initCutscene7() { - int v1 = 4, v0, v4, v2, v3; + int v0, v4, v2, v3; _s99_dword_47F370[0] = 0x316; _s99_dword_47F370[1] = 0x31A; _s99_dword_47F370[2] = 0x314; _s99_dword_47F370[3] = 0x31B; - v1 = 4; + int v1 = 4; if (!isFlag(3)) { _s99_dword_47F370[4] = 0x31C; v1 = 5; diff --git a/engines/gnap/scenes/scene49.cpp b/engines/gnap/scenes/scene49.cpp index e8415bbc9f..e3683bebb9 100644 --- a/engines/gnap/scenes/scene49.cpp +++ b/engines/gnap/scenes/scene49.cpp @@ -190,7 +190,7 @@ void GnapEngine::scene49_updateObstacle(int i) { kSeqSyncWait, 0, 0, -50); _gameSys->insertSequence(obstacle.collisionSequenceId, 256, _s49_truckSequenceId, _s49_truckId, - 32, 0, 0, -50); + kSeqSyncExists, 0, 0, -50); _s49_truckSequenceId = obstacle.collisionSequenceId; _s49_truckId = 256; obstacle.currSequenceId = obstacle.passedSequenceId; @@ -460,7 +460,7 @@ void GnapEngine::scene49_run() { int steerSequenceId = (_s49_truckLaneNum == 3) ? 0xB3 : 0xB1; if (_s49_truckSequenceId == 0xAE || _s49_truckSequenceId == 0xAF) { _gameSys->setAnimation(steerSequenceId, 256, 0); - _gameSys->insertSequence(steerSequenceId, 256, _s49_truckSequenceId, _s49_truckId, 32, 0, 0, -50); + _gameSys->insertSequence(steerSequenceId, 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncExists, 0, 0, -50); _s49_truckSequenceId = steerSequenceId; _s49_truckId = 256; } @@ -478,7 +478,7 @@ void GnapEngine::scene49_run() { int steerSequenceId = (_s49_truckLaneNum == 1) ? 0xB0 : 0xB2; if (_s49_truckSequenceId == 0xAD || _s49_truckSequenceId == 0xAE) { _gameSys->setAnimation(steerSequenceId, 256, 0); - _gameSys->insertSequence(steerSequenceId, 256, _s49_truckSequenceId, _s49_truckId, 32, 0, 0, -50); + _gameSys->insertSequence(steerSequenceId, 256, _s49_truckSequenceId, _s49_truckId, kSeqSyncExists, 0, 0, -50); _s49_truckSequenceId = steerSequenceId; _s49_truckId = 256; } diff --git a/engines/gnap/scenes/scene50.cpp b/engines/gnap/scenes/scene50.cpp index ce24354be0..cd5b700b9f 100644 --- a/engines/gnap/scenes/scene50.cpp +++ b/engines/gnap/scenes/scene50.cpp @@ -281,7 +281,7 @@ void GnapEngine::scene50_updateAnimations() { _gameSys->setAnimation(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, 5); _gameSys->setAnimation(0xB9, _s50_leftTongueNextId, 6); _gameSys->insertSequence(_s50_rightTongueNextSequenceId, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xB9, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, 32, 0, 0, 0); + _gameSys->insertSequence(0xB9, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncExists, 0, 0, 0); _s50_rightTongueSequenceId = _s50_rightTongueNextSequenceId; _s50_rightTongueNextSequenceId = -1; _s50_leftTongueSequenceId = 0xB9; @@ -323,7 +323,7 @@ void GnapEngine::scene50_updateAnimations() { _gameSys->setAnimation(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, 6); _gameSys->setAnimation(0xC1, _s50_rightTongueNextId, 5); _gameSys->insertSequence(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xC1, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, 32, 0, 0, 0); + _gameSys->insertSequence(0xC1, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncExists, 0, 0, 0); _s50_leftTongueSequenceId = _s50_leftTongueNextSequenceId; _s50_leftTongueNextSequenceId = -1; _s50_rightTongueSequenceId = 0xC1; @@ -344,7 +344,7 @@ void GnapEngine::scene50_updateAnimations() { _gameSys->setAnimation(0xBB, _s50_rightTongueNextId, 5); _gameSys->setAnimation(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, 6); _gameSys->insertSequence(_s50_leftTongueNextSequenceId, _s50_leftTongueNextId, _s50_leftTongueSequenceId, _s50_leftTongueId, kSeqSyncWait, 0, 0, 0); - _gameSys->insertSequence(0xBB, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, 32, 0, 0, 0); + _gameSys->insertSequence(0xBB, _s50_rightTongueNextId, _s50_rightTongueSequenceId, _s50_rightTongueId, kSeqSyncExists, 0, 0, 0); _s50_rightTongueSequenceId = 0xBB; _s50_rightTongueId = _s50_rightTongueNextId; _s50_rightTongueNextSequenceId = -1; diff --git a/engines/gnap/scenes/scene51.cpp b/engines/gnap/scenes/scene51.cpp index f56f9c96c4..1610e36192 100644 --- a/engines/gnap/scenes/scene51.cpp +++ b/engines/gnap/scenes/scene51.cpp @@ -236,7 +236,6 @@ int GnapEngine::scene51_checkCollision(int sequenceId) { bool jumpingLeft = false, jumpingRight = false; int v6 = 0; int v2 = 0; - int v5 = 0; int v8, v4; int result = 0; @@ -260,18 +259,19 @@ int GnapEngine::scene51_checkCollision(int sequenceId) { } if (jumpingRight || jumpingLeft) { + int v5 = 0; int i; for (i = 0; i < 6; ++i) { if (_s51_items[i].isCollision) { if (jumpingRight && _s51_items[i].x2 > v8 && _s51_items[i].x2 < v4) { v5 = v8 - 359; - if (v8 == 359) + if (v5 == 0) v5 = 1; _s51_platypusNextSequenceId = 0xB6; break; } else if (jumpingLeft && _s51_items[i].x2 < v4 && _s51_items[i].x2 > v8) { v5 = v8 - 344; - if (v8 == 344) + if (v5 == 0) v5 = 1; _s51_platypusNextSequenceId = 0xB7; break; @@ -294,7 +294,6 @@ int GnapEngine::scene51_checkCollision(int sequenceId) { void GnapEngine::scene51_updateItemAnimation(Scene51Item *item, int index) { switch (item->currSequenceId) { - case 0xBD: case 0xC0: case 0xC1: diff --git a/engines/gnap/scenes/scene53.cpp b/engines/gnap/scenes/scene53.cpp index cc7b7915b2..76dc6d716a 100644 --- a/engines/gnap/scenes/scene53.cpp +++ b/engines/gnap/scenes/scene53.cpp @@ -110,11 +110,11 @@ void GnapEngine::scene53_runRandomCall() { 0x6A, 0x6B, 0x6C, 0x6D, 0x71 }; - int index; - ++_s53_callsMadeCtr; if (_s53_callsMadeCtr <= 10) { + int index; + do { index = scene53_getRandomCallIndex(); } while (!_s53_isGnapPhoning && (index == 0 || index == 3 || index == 4 || index == 11)); -- cgit v1.2.3