diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mads/inventory.cpp | 5 | ||||
-rw-r--r-- | engines/mads/inventory.h | 2 | ||||
-rw-r--r-- | engines/mads/nebular/game_nebular.h | 2 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes2.cpp | 1693 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes2.h | 39 |
5 files changed, 1678 insertions, 63 deletions
diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index 43b7b6ea28..ec5670b090 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -167,4 +167,9 @@ void InventoryObjects::removeFromInventory(int objectId, int newScene) { } } +int InventoryObjects::getIdFromDesc(int objectId) { + warning("TODO: InventoryObjects::getIdFromDesc()"); + return objectId; +} + } // End of namespace MADS diff --git a/engines/mads/inventory.h b/engines/mads/inventory.h index eec272b365..13b81094af 100644 --- a/engines/mads/inventory.h +++ b/engines/mads/inventory.h @@ -109,6 +109,8 @@ public: * @param newScene Specifies the new scene to set the item to */ void removeFromInventory(int objectId, int newScene); + + int getIdFromDesc(int objectId); }; } // End of namespace MADS diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index 5b88f631e3..e4f4efcd8a 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -33,7 +33,7 @@ namespace Nebular { enum StoryMode { STORYMODE_NAUGHTY = 1, STORYMODE_NICE = 2 }; -enum InventoryObject { OBJ_NONE = 0, +enum InventoryObject { OBJ_NONE = -1, OBJ_BINOCULARS = 0, OBJ_BURGER = 1, OBJ_DEAD_FISH = 2, OBJ_STUFFED_FISH = 3, OBJ_REBREATHER = 4, OBJ_TIMER_MODULE = 5, OBJ_BIG_LEAVES = 6, OBJ_POISON_DARTS = 7, OBJ_PLANT_STALK = 8, OBJ_BLOWGUN = 9, OBJ_TWINKIFRUIT = 10, OBJ_BONE = 11, OBJ_CHICKEN = 12, diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index b91384d85b..0bf5c21e59 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -57,7 +57,7 @@ void Scene2xx::setPlayerSpritesPrefix() { if (oldName != _game._player._spritesPrefix) _game._player._spritesChanged = true; - + if ((_scene->_nextSceneId == 203 || _scene->_nextSceneId == 204) && _globals[kRhotundaStatus]) _game._player._loadsFirst = false; @@ -156,7 +156,7 @@ void Scene201::enter() { int sepChar = (_globals[kSexOfRex] == SEX_UNKNOWN) ? 't' : 'u'; // Guess values. What is the default value used by the compiler? int suffixNum = -1; - int abortTimers = -1; + int abortTimers = -1; switch(_globals[kTeleporterCommand]) { case 1: suffixNum = 3; @@ -181,7 +181,7 @@ void Scene201::enter() { if (suffixNum >= 0) _scene->loadAnimation(formAnimName(sepChar, suffixNum), abortTimers); } - + if ((_scene->_priorSceneId == 202) && (_globals[kMeteorologistStatus] == 1) && !_scene->_roomChanged) { _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('a', 0), 0); _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('a', 1), 0); @@ -282,10 +282,10 @@ void Scene201::step() { void Scene201::actions() { MADSAction *action = _game._player._action; if (action->_lookFlag == false) { - if (action->isAction(0x18C, 0x83)) + if (_action.isAction(0x18C, 0x83)) _scene->_nextSceneId = 202; - else if ((action->isAction(0x50, 0x156)) || (action->isAction(0x188, 0x16C)) || (action->isAction(0x188, 0x1B6))) { - if (_game._trigger == 0) { + else if ((_action.isAction(0x50, 0x156)) || (_action.isAction(0x188, 0x16C)) || (_action.isAction(0x188, 0x1B6))) { + if (_game._trigger == 0) { _game._player._stepEnabled = false; _game._player._visible = false; int sepChar = (_globals[kSexOfRex] == SEX_UNKNOWN) ? 't' : 'u'; @@ -293,30 +293,30 @@ void Scene201::actions() { } else if (_game._trigger == 1) { _scene->_nextSceneId = 213; } - } else if (action->isAction(VERB_LOOK, 0x1A6)) { + } else if (_action.isAction(VERB_LOOK, 0x1A6)) { _vm->_dialogs->show(0x4E85); - } else if (action->isAction(VERB_LOOK, 0x129)) { + } else if (_action.isAction(VERB_LOOK, 0x129)) { _vm->_dialogs->show(0x4E86); - } else if (action->isAction(VERB_LOOK, 0x16F)) { + } else if (_action.isAction(VERB_LOOK, 0x16F)) { _vm->_dialogs->show(0x4E87); - } else if (action->isAction(VERB_LOOK, 0x142)) { + } else if (_action.isAction(VERB_LOOK, 0x142)) { _vm->_dialogs->show(0x4E88); - } else if (action->isAction(VERB_LOOK, 0x18F)) { + } else if (_action.isAction(VERB_LOOK, 0x18F)) { _vm->_dialogs->show(0x4E89); - } else if (action->isAction(VERB_LOOK, 0x1B9)) { + } else if (_action.isAction(VERB_LOOK, 0x1B9)) { _vm->_dialogs->show(0x4E8A); - } else if (action->isAction(VERB_LOOK, 0x192)) { + } else if (_action.isAction(VERB_LOOK, 0x192)) { _vm->_dialogs->show(0x4E8B); - } else if (action->isAction(VERB_LOOK, 0x1BA)) { + } else if (_action.isAction(VERB_LOOK, 0x1BA)) { _vm->_dialogs->show(0x4E8C); - } else if (action->isAction(VERB_LOOK, 0x83)) { + } else if (_action.isAction(VERB_LOOK, 0x83)) { _vm->_dialogs->show(0x4E8E); - } else if (action->isAction(VERB_LOOK, 0x1B6)) { + } else if (_action.isAction(VERB_LOOK, 0x1B6)) { if (_globals[kMeteorologistEverSeen]) _vm->_dialogs->show(0x4E90); else _vm->_dialogs->show(0x4E8D); - } else if (action->isAction(VERB_LOOK, 0x16C)) { + } else if (_action.isAction(VERB_LOOK, 0x16C)) { _vm->_dialogs->show(0x4E91); } else return; @@ -415,8 +415,8 @@ void Scene202::enter() { _meteoClock1 = _meteoClock2 = _scene->_frameStartTime; if (_scene->_roomChanged) - _game._objects.addToInventory(OBJ_NONE); - + _game._objects.addToInventory(OBJ_BINOCULARS); + if (_globals[kMeteorologistWatch]) { _game._player._visible = false; _game._player._stepEnabled = false; @@ -489,7 +489,7 @@ void Scene202::step() { } int msgIndex = _scene->_kernelMessages.add(msgPos, 0x1110, msgFlag | 32, 0, 120, _game.getQuote(102)); _scene->_kernelMessages.setQuoted(msgIndex, 4, true); - + if (_globals[kMeteorologistWatch] == 1) { MADSAction *action = _game._player._action; action->_activeAction._verbId = VERB_LOOK; @@ -508,7 +508,7 @@ void Scene202::step() { case 90: _vm->_sound->command(41); _scene->_sequences.remove(_globals._spriteIndexes[25]); - _globals._spriteIndexes[24] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0); + _globals._spriteIndexes[24] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[24], SM_0, 0, 91); @@ -547,7 +547,7 @@ void Scene202::step() { default: break; } - + if (!_scene->_activeAnimation && (_globals[kMeteorologistStatus] != 2) && (_meteoClock2 <= _scene->_frameStartTime) && (_meteoClock1 <= _scene->_frameStartTime)) { int randVal = _vm->getRandomNumber(1, 500); int threshold = 1; @@ -566,7 +566,7 @@ void Scene202::step() { _meteoClock2 = _scene->_frameStartTime + 2; } } - + if (!_scene->_activeAnimation) return; @@ -602,11 +602,11 @@ void Scene202::step() { if (_scene->_activeAnimation->getCurrentFrame() == _meteoFrame) { return; } - + _meteoFrame = _scene->_activeAnimation->getCurrentFrame(); int randVal = _vm->getRandomNumber(1, 1000); int frameStep = -1; - + switch (_scene->_activeAnimation->getCurrentFrame()) { case 42: case 77: @@ -703,7 +703,7 @@ int Scene202::subStep4(int randVal) { if (randVal <= 200) return 19; - return 166; + return 166; } void Scene202::preActions() { @@ -713,7 +713,7 @@ void Scene202::preActions() { if (player._readyToWalk) _scene->_kernelMessages.reset(); - if (!_ladderTopFl && (action->isAction(0x4E, 0xC7) || !player._readyToWalk)) { + if (!_ladderTopFl && (_action.isAction(0x4E, 0xC7) || !player._readyToWalk)) { if (_game._trigger == 0) { _vm->_sound->command(29); player._readyToWalk = false; @@ -729,10 +729,10 @@ void Scene202::preActions() { player._readyToWalk = true; _game._player._stepEnabled = true; _ladderTopFl = false; - } + } } - if (action->isAction(VERB_LOOK, 0x27) && action->_activeAction._indirectObjectId > 0) { + if (_action.isAction(VERB_LOOK, 0x27) && (action->_activeAction._indirectObjectId > 0)) { if (!player._readyToWalk || _ladderTopFl) _game._player._needToWalk = false; else @@ -746,12 +746,12 @@ void Scene202::preActions() { void Scene202::actions() { MADSAction *action = _game._player._action; if (action->_lookFlag == false) { - if (action->isAction(0x4E, 0xC7)) { + if (_action.isAction(0x4E, 0xC7)) { action->_inProgress = false; return; - } else if (action->isAction(0x18C, 0x83)) { + } else if (_action.isAction(0x18C, 0x83)) { _scene->_nextSceneId = 203; - } else if (action->isAction(0x18C, 0x82)) { + } else if (_action.isAction(0x18C, 0x82)) { if (_globals[kMeteorologistStatus] != 2) { if (_scene->_activeAnimation) _globals[kMeteorologistStatus] = 1; @@ -759,7 +759,7 @@ void Scene202::actions() { _globals[kMeteorologistStatus] = 0; } _scene->_nextSceneId = 201; - } else if (action->isAction(VERB_TAKE, 0x2C)) { + } else if (_action.isAction(VERB_TAKE, 0x2C)) { if (action->_mainObjectSource == 4) { if (_game._trigger == 0) { if (_game._objects.isInInventory(OBJ_BONES)) { @@ -797,7 +797,7 @@ void Scene202::actions() { return; } } - } else if ((action->isAction(0x50, 0xC7)) && (_globals[kLadderBroken] == 0)) { + } else if ((_action.isAction(0x50, 0xC7)) && (_globals[kLadderBroken] == 0)) { if (_game._trigger == 0) { _vm->_sound->command(29); _meteoClock1 = _scene->_frameStartTime; @@ -822,7 +822,7 @@ void Scene202::actions() { action->_inProgress = false; return; } - } else if (((action->isAction(VERB_LOOK, 0x27, 0x82)) || (action->isAction(VERB_LOOK, 0x27, 0x1B6))) && (_globals[kSexOfRex] == SEX_MALE)) { + } else if (((_action.isAction(VERB_LOOK, 0x27, 0x82)) || (_action.isAction(VERB_LOOK, 0x27, 0x1B6))) && (_globals[kSexOfRex] == SEX_MALE)) { if (!_ladderTopFl) { if (_game._trigger == 0) { _game._player._stepEnabled = false; @@ -911,15 +911,15 @@ void Scene202::actions() { return; } } - } else if (action->isAction(0x188, 0xAA)) { + } else if (_action.isAction(0x188, 0xAA)) { setRandomKernelMessage(); - } else if (action->isAction(VERB_LOOK, 0x129)) { + } else if (_action.isAction(VERB_LOOK, 0x129)) { _vm->_dialogs->show(0x4EEA); - } else if (action->isAction(VERB_LOOK, 0x86)) { + } else if (_action.isAction(VERB_LOOK, 0x86)) { _vm->_dialogs->show(0x4EEB); - } else if (action->isAction(VERB_LOOK, 0x19C)) { + } else if (_action.isAction(VERB_LOOK, 0x19C)) { _vm->_dialogs->show(0x4EEC); - } else if (action->isAction(VERB_LOOK, 0x82)) { + } else if (_action.isAction(VERB_LOOK, 0x82)) { if ((_globals[kMeteorologistStatus] == 0) || (_globals[kMeteorologistStatus] == 2)) { _vm->_dialogs->show(0x4EED); } else if (_globals[kMeteorologistStatus] == 1) { @@ -927,37 +927,37 @@ void Scene202::actions() { } else { action->_inProgress = false; return; - } - } else if (action->isAction(VERB_LOOK, 0x18E)) { + } + } else if (_action.isAction(VERB_LOOK, 0x18E)) { _vm->_dialogs->show(0x4EEE); - } else if (action->isAction(VERB_LOOK, 0x164)) { + } else if (_action.isAction(VERB_LOOK, 0x164)) { _vm->_dialogs->show(0x4EEF); - } else if (action->isAction(VERB_LOOK, 0x175)) { + } else if (_action.isAction(VERB_LOOK, 0x175)) { _vm->_dialogs->show(0x4EF0); - } else if (action->isAction(VERB_LOOK, 0x174)) { + } else if (_action.isAction(VERB_LOOK, 0x174)) { _vm->_dialogs->show(0x4EF1); - } else if (action->isAction(VERB_LOOK, 0x142)) { + } else if (_action.isAction(VERB_LOOK, 0x142)) { _vm->_dialogs->show(0x4EF2); - } else if (action->isAction(VERB_LOOK, 0xAA)) { + } else if (_action.isAction(VERB_LOOK, 0xAA)) { if ((_game._player._playerPos == Common::Point(77, 105)) && (_game._player._facing == FACING_NORTH)) _vm->_dialogs->show(0x4EF4); else _vm->_dialogs->show(0x4EF3); - } else if (action->isAction(VERB_LOOK, 0x186)) { + } else if (_action.isAction(VERB_LOOK, 0x186)) { _vm->_dialogs->show(0x4EF5); - } else if (action->isAction(VERB_LOOK, 0x1B5)) { + } else if (_action.isAction(VERB_LOOK, 0x1B5)) { _vm->_dialogs->show(0x4EF6); - } else if (action->isAction(VERB_LOOK, 0x140)) { + } else if (_action.isAction(VERB_LOOK, 0x140)) { _vm->_dialogs->show(0x4EF7); - } else if (action->isAction(VERB_TAKE, 0x140)) { + } else if (_action.isAction(VERB_TAKE, 0x140)) { _vm->_dialogs->show(0x4EF8); - } else if (action->isAction(VERB_LOOK, 0x2D)) { + } else if (_action.isAction(VERB_LOOK, 0x2D)) { if (action->_commandSource == 4) _vm->_dialogs->show(0x4EF9); else return; } else { - return; + return; } } else { _vm->_dialogs->show(0x4EFB); @@ -1038,7 +1038,7 @@ void Scene203::step() { } else if (_game._trigger == 81) { _scene->_nextSceneId = 208; _scene->_reloadSceneFlag = true; - } + } } void Scene203::preActions() { @@ -1094,7 +1094,7 @@ void Scene205::enter() { _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('f', -1), 0); _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('c', -1), 0); _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('p', -1), 0); - + if (_globals[kSexOfRex] == SEX_MALE) _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('a', 1), 0); @@ -1144,7 +1144,7 @@ void Scene205::enter() { warning("sub71704(0x3, 0xC3, 0x108, 0x63, 0x86, 0xD, 2, 0xFDFC, 0x3C, 0x6C, 0x6C, 0x6D, 0x6D, 0x6E, 0x6E, 0x6F, 0x6C, 0);"); if (_scene->_priorSceneId != -2) - _game._player._playerPos = Common::Point(99, 152); + _game._player._playerPos = Common::Point(99, 152); if (_globals[kSexOfRex] != SEX_MALE) { _scene->loadAnimation(formAnimName('a', -1), 0); @@ -1246,7 +1246,7 @@ void Scene207::enter() { _vultureFl = true; _spiderFl = (var2 & 1); - + if (_vultureFl) { _globals._spriteIndexes[16] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 30, 0, 0, 400); _vultureTime = _game._player._priorTimer; @@ -1479,7 +1479,7 @@ void Scene208::enter() { } void Scene208::step() { - if (_boundingFl && (_rhotundaTime <= _scene->_activeAnimation->getCurrentFrame())) { + if (_boundingFl && (_rhotundaTime <= _scene->_activeAnimation->getCurrentFrame())) { _rhotundaTime = _scene->_activeAnimation->getCurrentFrame(); if (_rhotundaTime == 125) @@ -1494,9 +1494,9 @@ void Scene208::step() { if ((_game._trigger == 0) && _boundingFl) return; - + _boundingFl = true; - + switch (_game._trigger) { case 0: _scene->loadAnimation(formAnimName('A', -1), 81); @@ -1532,7 +1532,7 @@ void Scene208::subAction(int mode) { switch (_game._trigger) { case 0: { _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._visible = false; _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 1, 0, 0); _scene->_sequences.setMsgLayout(_globals._spriteIndexes[20]); @@ -1686,16 +1686,1587 @@ void Scene209::setup() { _scene->addActiveVocab(0x10F); } +void Scene209::handlePause() { + switch (_game._trigger) { + case 124: + if (++_pauseCounter <= _pauseCounterThreshold) + _scene->_sequences.addTimer(60, 124); + else + _pauseMode = 0; + break; + } +} + +void Scene209::initPauseCounterThreshold() { + switch (_game._trigger) { + case 226: + _scene->_sequences.addTimer(1, 124); + _pauseCounterThreshold = _vm->getRandomNumber(7,12); + _pauseMode = 2; + _pauseCounter = 0; + break; + } +} + +void Scene209::handlePeek() { + switch (_game._trigger) { + case 133: + _vm->_sound->command(18); + _globals._spriteIndexes[18] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 51, 52); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 134); + break; + + case 134: { + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addTimer(60, 135); + } + break; + + case 135: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 7); + _scene->_sequences.addTimer(10, 136); + break; + + case 136: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.addTimer(50, 137); + break; + + case 137: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 51, 52); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 138); + break; + + case 138: + _pauseMode = 1; + _scene->_hotspots.activate(227, false); + _playingAnimFl = false; + break; + } +} + +void Scene209::handleVerticalMove() { + switch (_game._trigger) { + case 140: + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 8, 0, 1); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 1, 5); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 141); + break; + + case 141: { + _vm->_sound->command(18); + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 5); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addTimer(60, 142); + } + break; + + case 142: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 1, 5); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 143); + break; + + case 143: + _pauseMode = 1; + _playingAnimFl = false; + _scene->_hotspots.activate(227, false); + break; + } +} + +void Scene209::handleLookStay() { + switch (_game._trigger) { + case 145: + _vm->_sound->command(18); + _monkeyPosition = 2; + _globals._spriteIndexes[18] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 51, 52); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 146); + break; + + case 146: { + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addTimer(15, 147); + } + break; + + case 147: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 7); + _scene->_sequences.addTimer(8, 148); + break; + + case 148: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + + if (!_dodgeFl) + _scene->_sequences.addTimer(90, 149); + else { + _scene->_sequences.addTimer(1, 149); + _shouldDodgeFl = true; + } + break; + + case 149: + _playingAnimFl = false; + break; + } +} + +void Scene209::handleLookRight() { + switch (_game._trigger) { + case 151: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 8, 14); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 152); + break; + + case 152: { + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addTimer(60, 153); + } + break; + + case 153: + _playingAnimFl = false; + if (_dodgeFl) + _shouldDodgeFl = true; + break; + } +} + +void Scene209::handleBlink() { + switch (_game._trigger) { + case 155: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.addTimer(50, 156); + break; + + case 156: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 7); + _scene->_sequences.addTimer(10, 157); + break; + + case 157: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.addTimer(50, 158); + break; + + case 158: + _playingAnimFl = false; + if (_dodgeFl) + _shouldDodgeFl = true; + break; + } +} + +void Scene209::handleGetBinoculars() { + switch (_game._trigger) { + case 161: + _vm->_sound->command(18); + _monkeyPosition = 3; + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 8, 24); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_FRAME_INDEX, 20, 165); + if (!_fallFl && !_dodgeFl) { + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 162); + } else { + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 163); + } + break; + + case 162: { + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 6, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 23, 25); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 163); + } + break; + + case 163: { + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 23, 24); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addTimer(8, 164); + } + break; + + case 164: + _playingAnimFl = false; + if (_fallFl) + _shouldFallFl = true; + break; + + case 165: + _vm->_sound->command(18); + break; + } +} + +void Scene209::handleBinocularBlink() { + switch (_game._trigger) { + case 167: { + int oldIdx = _globals._spriteIndexes[18]; + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 23, 25); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 168); + } + break; + + case 168: { + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 23, 24); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addTimer(30, 169); + } + break; + + case 169: + _playingAnimFl = false; + if (_fallFl) + _shouldFallFl = true; + break; + } +} + +void Scene209::handleBinocularScan() { + switch (_game._trigger) { + case 171: { + int oldIdx = _globals._spriteIndexes[18]; + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 43, 45); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 172); + } + break; + + case 172: { + int oldIdx = _globals._spriteIndexes[18]; + int randAction = _vm->getRandomNumber(1,2); + switch (randAction) { + case 1: + _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 2, 0, 0); + break; + case 2: + _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 4, 0, 0); + break; + } + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 23, 25); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 173); + } + break; + + case 173: { + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 26, 30); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 174); + } + break; + + case 174: { + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 23, 24); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addTimer(60, 175); + } + break; + + case 175: + _playingAnimFl = false; + if (_fallFl) + _shouldFallFl = true; + break; + } +} + +void Scene209::handleJumpInTree() { + switch (_game._trigger) { + case 178: { + int oldIdx = 0; + _monkeyPosition = 1; + if (_removeMonkeyFl) + _scene->_sequences.remove(_globals._spriteIndexes[18]); + else + oldIdx = _globals._spriteIndexes[18]; + + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 46, 49); + if (!_removeMonkeyFl) + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 179); + } + break; + + case 179: { + _vm->_sound->command(18); + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 53, 61); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 180); + } + break; + + case 180: + _removeMonkeyFl = true; + _pauseMode = 1; + _playingAnimFl = false; + _scene->_hotspots.activate(227, false); + break; + } +} + +void Scene209::handleTongue() { + switch (_game._trigger) { + case 182: { + int oldIdx = _globals._spriteIndexes[18]; + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 26, 30); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 183); + } + break; + + case 183: { + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 31, 33); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 184); + } + break; + + case 184: { + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 36, 37); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 185); + } + break; + + case 185: { + _vm->_sound->command(18); + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 6, 20, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 38, 39); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 186); + } + break; + + case 186: { + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 40, 41); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 178); + _removeMonkeyFl = false; + } + break; + } +} + +void Scene209::handleStandFromPeek() { + switch (_game._trigger) { + case 189: + _monkeyPosition = 4; + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 50); + _scene->_sequences.addTimer(8, 190); + break; + + case 190: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.addTimer(8, 191); + break; + + case 191: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], 1, 5); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 192); + break; + + case 192: { + _vm->_sound->command(18); + int oldIdx = _globals._spriteIndexes[21]; + _globals._spriteIndexes[20] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[20], oldIdx); + _scene->_sequences.addTimer(8, 193); + } + break; + + case 193: + _scene->_sequences.remove(_globals._spriteIndexes[20]); + _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 22); + _scene->_sequences.addTimer(5, 194); + break; + + case 194: + _playingAnimFl = false; + _counter = 0; + break; + } +} + +void Scene209::handleStandBlink() { + switch (_game._trigger) { + case 246: + _scene->_sequences.remove(_globals._spriteIndexes[19]); + _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 22); + _scene->_sequences.addTimer(10, 247); + break; + + case 247: + _scene->_sequences.remove(_globals._spriteIndexes[19]); + _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 23); + _scene->_sequences.addTimer(8, 248); + break; + + case 248: + _scene->_sequences.remove(_globals._spriteIndexes[19]); + _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 22); + _scene->_sequences.addTimer(10, 249); + break; + + case 249: + _playingAnimFl = false; + break; + } +} + +void Scene209::handleJumpAndHide() { + switch (_game._trigger) { + case 196: + _vm->_sound->command(18); + _monkeyPosition = 1; + _scene->_sequences.remove(_globals._spriteIndexes[19]); + _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[20], 1, 16); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[20], SM_0, 0, 197); + break; + + case 197: + _pauseMode = 1; + _scene->_hotspots.activate(227, false); + _playingAnimFl = false; + break; + } +} + +void Scene209::handleMonkeyEating() { + switch (_game._trigger) { + case 199: + _vm->_sound->command(18); + _scene->_sequences.remove(_globals._spriteIndexes[19]); + _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 1, 14); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 200); + break; + + case 200: { + int oldIdx = _globals._spriteIndexes[19]; + _globals._spriteIndexes[19] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 10, 10, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 15, 16); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 201); + } + break; + + case 201: { + int oldIdx = _globals._spriteIndexes[19]; + _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 12); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); + _scene->_sequences.addTimer(20, 202); + } + break; + + case 202: + _scene->_sequences.remove(_globals._spriteIndexes[19]); + _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 19); + _scene->_sequences.addTimer(20, 203); + break; + + case 203: + _scene->_sequences.remove(_globals._spriteIndexes[19]); + _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 17); + _scene->_sequences.addTimer(20, 204); + break; + + case 204: + _scene->_sequences.remove(_globals._spriteIndexes[19]); + _globals._spriteIndexes[19] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 10, 8, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 18, 19); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 205); + break; + + case 205: { + int oldIdx = _globals._spriteIndexes[19]; + _globals._spriteIndexes[19] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 10, 8, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 20, 21); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 206); + } + break; + + case 206: { + int oldIdx = _globals._spriteIndexes[19]; + _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 22, 25); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); + if (!_dodgeFl && !_fallFl) + _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 207); + else + _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 209); + } + break; + + case 207: { + _vm->_sound->command(18); + int msgIndex = _scene->_kernelMessages.add(Common::Point(180, 25), 0xFDFC, 0, 0, 90, _game.getQuote(130)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + + int oldIdx = _globals._spriteIndexes[19]; + _globals._spriteIndexes[19] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 15, 4, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 26, 27); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 208); + } + break; + + case 208: { + _scene->_kernelMessages.add(Common::Point(180, 39), 0xFDFC, 0, 0, 90, _game.getQuote(131)); + int oldIdx = _globals._spriteIndexes[19]; + _globals._spriteIndexes[19] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 10, 4, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 28, 29); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 209); + } + break; + + case 209: { + int oldIdx = _globals._spriteIndexes[19]; + _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 22); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); + _scene->_sequences.addTimer(1, 210); + } + break; + + case 210: + _playingAnimFl = false; + break; + } +} + +void Scene209::handleMonkeyFall() { + switch (_game._trigger) { + case 219: { + _vm->_sound->command(25); + _scene->_sprites.remove(_globals._spriteIndexes[7]); + _scene->_sprites.remove(_globals._spriteIndexes[6]); + _scene->_sprites.remove(_globals._spriteIndexes[5]); + _scene->_sprites.remove(_globals._spriteIndexes[4]); + + _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('m', 4), 0); + _scene->_kernelMessages.add(Common::Point(180, 26), 0xFDFC, 0, 0, 90, _game.getQuote(151)); + _scene->_sequences.addTimer(40, 100); + _scene->_hotspots.activate(227, false); + int oldIdx = _globals._spriteIndexes[18]; + _monkeyPosition = 1; + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[23], 1, 35); + _scene->_sequences.setDepth (_globals._spriteIndexes[23], 6); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 220); + } + break; + + case 220: { + _vm->_sound->command(18); + _scene->_kernelMessages.add(Common::Point(182, 109), 0xFDFC, 0, 0, 90, _game.getQuote(159)); + _scene->_hotspots.activate(227, false); + int oldIdx = _globals._spriteIndexes[18]; + _monkeyPosition = 1; + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[23], 36, 42); + _scene->_sequences.setDepth (_globals._spriteIndexes[23], 6); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 221); + } + break; + + case 221: { + _game._objects.setRoom(OBJ_BINOCULARS, 209); + _binocularsDroppedFl = true; + int oldIdx = _globals._spriteIndexes[23]; + _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); + _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[24], oldIdx); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(201, 131)); + _scene->_sequences.setDepth(_globals._spriteIndexes[24], 8); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[23], oldIdx); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[23], 43, 72); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 222); + _scene->_dynamicHotspots.setPosition(_scene->_dynamicHotspots.add(39, 13, _globals._spriteIndexes[24], Common::Rect(0, 0, 0, 0)), 200, 133, FACING_NORTH); + } + break; + + case 222: { + _scene->_kernelMessages.add(Common::Point(182, 109), 0xFDFC, 0, 0, 70, _game.getQuote(160)); + int oldIdx = _globals._spriteIndexes[23]; + _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[23], 73, 78); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[23], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 223); + } + break; + + case 223: + _scene->loadAnimation(Resources::formatName(209, 'e', -1, EXT_AA, ""), 224); + _vm->_sound->command(38); + break; + + case 224: + _playingAnimFl = false; + _fallFl = false; + _counter = 0; + _pauseMode = 0; + _vm->_dialogs->show(0x51AE); + _game._player._stepEnabled = true; + break; + } +} + +void Scene209::handleMonkey1() { + switch (_game._trigger) { + case 212: + _scene->_sequences.remove(_globals._spriteIndexes[19]); + _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 9, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 1, 13); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 213); + break; + + case 213: { + int oldIdx = _globals._spriteIndexes[19]; + _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[22], 1, 22); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[22], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 214); + } + break; + + case 214: { + int oldIdx = _globals._spriteIndexes[22]; + _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[22], 23, 26); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[22], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 215); + int msgIndex = _scene->_kernelMessages.add(Common::Point(170, 21), 0xFDFC, 0, 0, 90, _game.getQuote(156)); + _scene->_kernelMessages.setQuoted(msgIndex, 3, true); + } + break; + + case 215: { + _vm->_sound->command(18); + _scene->loadAnimation(Resources::formatName(209, 'a', -1, EXT_AA, ""), 251); + int oldIdx = _globals._spriteIndexes[22]; + _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[22], 27, 35); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[22], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 216); + } + break; + + case 216: { + int oldIdx = _globals._spriteIndexes[22]; + _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 22); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); + _scene->_sequences.addTimer(25, 217); + } + break; + + case 217: + _pitchFl = false; + _counter = 0; + _pauseMode = 0; + _scene->_sequences.addTimer(1, 196); + break; + } +} + +void Scene209::handleMonkey2() { + switch (_game._trigger) { + case 251: + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 60, _game.getQuote(137)); + _vm->_sound->command(22); + _globals._spriteIndexes[27] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[12], false, 11, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[27], Common::Point(111, 133)); + _scene->_sequences.setScale(_globals._spriteIndexes[27], 79); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[27], 1, 6); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[27], SM_0, 0, 252); + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _game._player._visible = false; + break; + + case 252: { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(132)); + int oldIdx = _globals._spriteIndexes[27]; + _globals._spriteIndexes[27] = _scene->_sequences.startCycle(_globals._spriteIndexes[12], false, 7); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[27], Common::Point(111, 133)); + _scene->_sequences.setScale(_globals._spriteIndexes[27], 79); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[27], oldIdx); + _scene->_sequences.addTimer(120, 253); + } + break; + + case 253: + _scene->_sequences.remove(_globals._spriteIndexes[27]); + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + } +} + +void Scene209::handleDodge() { + switch (_game._trigger) { + case 241: + _scene->_hotspots.activate(227, true); + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 7); + _scene->_sequences.addTimer(6, 242); + break; + + case 242: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 5); + _scene->_sequences.addTimer(25, 243); + _vm->_sound->command(24); + break; + + case 243: + _vm->_sound->command(18); + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _playingAnimFl = false; + _pauseMode = 0; + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(180, 21), 0xFDFC, 0, 0, 90, _game.getQuote(155)); + if (!_shootMissedLastFl) { + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(135)); + _shootMissedLastFl = true; + } else { + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(136)); + } + break; + } +} + void Scene209::enter() { + _globals._spriteIndexes[12] = _scene->_sprites.addSprites(formAnimName('a', 1), 0); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('e', -1), 0); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 0), 0); + _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('b', 1), 0); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('m', 0), 0); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('m', 1), 0); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('m', 3), 0); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('m', 6), 0); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('m', 8), 0); + + _game.loadQuoteSet(0x82, 0x83, 0x84, 0x9C, 0x97, 0x95, 0x99, 0x9E, 0x98, 0x9B, 0xA0, 0x96, 0x9F, + 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x91, 0x92, 0x93, 0x94, 0x89, 0x85, 0x8A, 0x86, 0x87, 0x88, 0); + + _vm->_palette->setEntry(252, 63, 44, 30); + _vm->_palette->setEntry(253, 63, 20, 22); + + if (_game._objects.isInRoom(OBJ_PLANT_STALK)) { + _globals._spriteIndexes[16] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + int idx = _scene->_dynamicHotspots.add(271, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, 263, 129, FACING_SOUTH); + _scene->_sequences.setDepth(_globals._spriteIndexes[16], 13); + } + + if (_scene->_priorSceneId == 208) { + _game._player._playerPos = Common::Point(11, 121); + _game._player._facing = FACING_EAST; + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(28, 121); + _game._player._facing = FACING_SOUTH; + } + + if (_game._objects.isInRoom(OBJ_BINOCULARS)) { + _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(201, 131)); + _scene->_sequences.setDepth(_globals._spriteIndexes[24], 8); + int idx = _scene->_dynamicHotspots.add(39, 13, _globals._spriteIndexes[24], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, 200, 133, FACING_NORTH); + } + + if (_scene->_roomChanged) { + _game._objects.addToInventory(OBJ_POISON_DARTS); + _game._objects.addToInventory(OBJ_BLOWGUN); + _globals[36] = 1; + } + + _pitchFl = false; + _fallFl = false; + _dodgeFl = false; + _playingAnimFl = false; + _monkeyPosition = 1; + _counter = 0; + _pauseMode = 0; + _forceFallFl = false; + _shouldFallFl = false; + _forceDodgeFl = false; + _binocularsDroppedFl = false; + _shouldDodgeFl = false; + _startShootingInTimerFl = false; + _dialogAbortVal = 5; + _playingDialogFl = false; + _shootMissedLastFl = false; + _removeMonkeyFl = true; + _shootReadyFl = false; + + _scene->_hotspots.activate(227, false); + + sceneEntrySound(); } void Scene209::step() { + if (!_playingAnimFl && !_pitchFl && !_fallFl && !_dodgeFl && (_pauseMode == 0) && (_globals[36] == 1)) { + int randAction = _vm->getRandomNumber(1,50); + switch (randAction) { + case 1: + if ((_monkeyPosition == 1) && (_counter < 2)) { + _scene->_sequences.addTimer(1, 133); + _playingAnimFl = true; + _scene->_hotspots.activate(227, true); + ++_counter; + } + break; + + case 2: + if ((_monkeyPosition == 1) && (_counter < 2)) { + _scene->_sequences.addTimer(1, 140); + _scene->_hotspots.activate(227, true); + _playingAnimFl = true; + ++_counter; + } + break; + + case 3: + if (_monkeyPosition == 1) { + _scene->_sequences.addTimer(1, 145); + _scene->_hotspots.activate(227, true); + _playingAnimFl = true; + _counter = 0; + } + break; + + case 4: + if ((_monkeyPosition == 2) && (_counter < 2)) { + _scene->_sequences.addTimer(1, 151); + _scene->_hotspots.activate(227, true); + ++_counter; + _playingAnimFl = true; + } + break; + + case 5: + if (_monkeyPosition == 2) { + _scene->_sequences.addTimer(1, 161); + _scene->_hotspots.activate(227, true); + _counter = 0; + _playingAnimFl = true; + } + break; + + case 6: + if (_monkeyPosition == 2) { + _scene->_sequences.addTimer(1, 189); + _scene->_hotspots.activate(227, true); + _counter = 0; + _playingAnimFl = true; + } + break; + case 7: + if (_monkeyPosition == 3) { + _scene->_hotspots.activate(227, true); + _scene->_sequences.addTimer(1, 167); + _playingAnimFl = true; + } + break; + + case 8: + if (_monkeyPosition == 3) { + _scene->_sequences.addTimer(1, 178); + _playingAnimFl = true; + _scene->_hotspots.activate(227, true); + _counter = 0; + } + break; + + case 9: + if ((_monkeyPosition == 3) && (_game._player._playerPos.x<120)) { + _scene->_sequences.addTimer(1, 182); + _scene->_hotspots.activate(227, true); + _counter = 0; + _playingAnimFl = true; + } + break; + + case 10: + if (_monkeyPosition == 4) { + _scene->_sequences.addTimer(1, 196); + _scene->_hotspots.activate(227, true); + _playingAnimFl = true; + _counter = 0; + } + break; + + case 11: + if ((_monkeyPosition == 4) && (_counter < 3)) { + _scene->_sequences.addTimer(1, 199); + _scene->_hotspots.activate(227, true); + ++_counter; + _playingAnimFl = true; + } + break; + + case 30: + if (_monkeyPosition == 4) { + _scene->_sequences.addTimer(1, 246); + _scene->_hotspots.activate(227, true); + _counter = 0; + _playingAnimFl = true; + } + break; + + default: + if ((randAction >= 12) && (randAction <= 20) && (_monkeyPosition == 2) && (_counter < 5)) { + _scene->_sequences.addTimer(1, 155); + ++_counter; + _playingAnimFl = true; + } + + if ((randAction >= 21) && (randAction <= 29) && (_monkeyPosition == 3) && (_counter < 3)) { + _scene->_sequences.addTimer(1, 171); + _playingAnimFl = true; + ++_counter; + } + break; + } + } + + if (!_dodgeFl && !_pitchFl && !_fallFl && (_pauseMode == 1)) + _scene->_sequences.addTimer(1, 226); + + if (!_dodgeFl && !_pitchFl && !_fallFl && (_pauseMode == 2)) + handlePause(); + + if (!_dodgeFl && !_pitchFl && !_fallFl && (_pauseMode == 1)) + initPauseCounterThreshold(); + + handlePeek(); + handleVerticalMove(); + handleLookStay(); + handleLookRight(); + handleBlink(); + handleGetBinoculars(); + handleStandFromPeek(); + handleDodge(); + handleBinocularBlink(); + handleBinocularScan(); + handleJumpInTree(); + handleTongue(); + handleMonkeyFall(); + handleJumpAndHide(); + handleMonkeyEating(); + handleMonkey1(); + handleStandBlink(); + handleMonkey2(); + + if ((_monkeyPosition == 1) && !_playingAnimFl && _fallFl) { + _scene->_sequences.addTimer(1, 145); + _playingAnimFl = true; + } + + if ((_monkeyPosition == 2) && !_playingAnimFl && _fallFl) { + _scene->_sequences.addTimer(1, 161); + _playingAnimFl = true; + } + + if ((_monkeyPosition == 4) && !_playingAnimFl && _fallFl) { + _scene->_sequences.addTimer(1, 196); + _playingAnimFl = true; + } + + if ((_monkeyPosition == 3) && !_playingAnimFl && _fallFl && _forceFallFl) { + _scene->_sequences.addTimer(1, 219); + _playingAnimFl = true; + } + + if ((_monkeyPosition == 1) && !_playingAnimFl && _pitchFl) { + _scene->_sequences.addTimer(1, 145); + _playingAnimFl = true; + } + + if ((_monkeyPosition == 2) && !_playingAnimFl && _pitchFl) { + _scene->_sequences.addTimer(1, 189); + _playingAnimFl = true; + } + + if ((_monkeyPosition == 4) && !_playingAnimFl && _pitchFl) { + _scene->_sequences.addTimer(1, 212); + _playingAnimFl = true; + } + + if ((_monkeyPosition == 3) && !_playingAnimFl && _pitchFl) { + _scene->_sequences.addTimer(1, 178); + _playingAnimFl = true; + } + + if ((_monkeyPosition == 1) && !_playingAnimFl && _dodgeFl) { + _scene->_sequences.addTimer(1, 145); + _playingAnimFl = true; + } + + if ((_monkeyPosition == 4) && !_playingAnimFl && _dodgeFl) { + _scene->_sequences.addTimer(1, 196); + _playingAnimFl = true; + } + + if ((_monkeyPosition == 3) && !_playingAnimFl && _dodgeFl) { + _scene->_sequences.addTimer(1, 178); + _playingAnimFl = true; + } + + if ((_monkeyPosition == 2) && !_playingAnimFl && _dodgeFl && _forceDodgeFl) { + _scene->_sequences.addTimer(1, 241); + _playingAnimFl = true; + } + + if (_dodgeFl || _fallFl) { /* if want to dodge or fall */ + if (!_playingAnimFl && (_monkeyPosition == 2)) + _shouldDodgeFl = true; + + if (!_playingAnimFl && (_monkeyPosition == 3)) + _shouldFallFl = true; + + switch (_game._trigger) { + case 228: + _game._player._visible = false; + _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[17], 1, 7); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_0, 0, 228); + break; + + case 229: { + int oldIdx = _globals._spriteIndexes[17]; + _globals._spriteIndexes[17] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 7); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[17], oldIdx); + _scene->_sequences.addTimer(35, 230); + } + break; + + case 230: + _scene->_sequences.remove(_globals._spriteIndexes[17]); + _globals._spriteIndexes[17] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[17], 1, 7); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_0, 0, 231); + break; + + case 231: { + int oldIdx = _globals._spriteIndexes[17]; + _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[17], 8, 10); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[17], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_0, 0, 232); + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _scene->_sequences.updateTimeout(_globals._spriteIndexes[17], -1); + _game._player._visible = false; + } + break; + + case 232: { + int oldIdx = _globals._spriteIndexes[17]; + _globals._spriteIndexes[17] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 10); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[17], oldIdx); + _scene->_sequences.addTimer(2, 233); + _scene->_kernelMessages.reset(); + if (_dodgeFl && (_monkeyPosition != 1) && (_monkeyPosition != 2)) + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 34463, _game.getQuote(138)); + if (_fallFl && (_monkeyPosition != 3)) + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 34463, _game.getQuote(138)); + } + break; + + case 233: + _shootReadyFl = true; + break; + + case 234: + _scene->_sequences.remove(_globals._spriteIndexes[17]); + _scene->_kernelMessages.reset(); + if (_action.isAction(NOUN_HOSE_DOWN, NOUN_BLOWGUN, NOUN_MONKEY)) { + _globals._spriteIndexes[17] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[2], false, 7, 16, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[17], 11, 12); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_FRAME_INDEX, 12, 239); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_0, 0, 235); + } else if (_action.isAction(NOUN_SHOOT, NOUN_BLOWGUN, NOUN_MONKEY)) { + _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[17], 11, 12); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_0, 0, 235); + _vm->_sound->command(23); + } + break; + + case 235: { + int oldIdx = _globals._spriteIndexes[17]; + _globals._spriteIndexes[17] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 13); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[17], oldIdx); + _scene->_sequences.addTimer(12, 236); + _forceFallFl = true; + _forceDodgeFl = true; + } + break; + + case 236: + _scene->_sequences.remove(_globals._spriteIndexes[17]); + _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[17], 14, 16); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_0, 0, 237); + break; + + case 237: + _game._player._visible = true; + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _scene->_sequences.addTimer(1, 238); + break; + + case 238: + _scene->_sequences.remove(_globals._spriteIndexes[17]); + if (_dodgeFl) + _game._player._stepEnabled = true; + + _startShootingInTimerFl = false; + + if (_fallFl) { + _globals[36] = MONKEY_IS_GONE; + _game._objects.setRoom(OBJ_POISON_DARTS, NOWHERE); + } + _dodgeFl = false; + _fallFl = false; + _forceFallFl = false; + _forceDodgeFl = false; + _shouldFallFl = false; + _shouldDodgeFl = false; + break; + + case 239: + _vm->_sound->command(23); + break; + } + } + + if (_game._trigger == 100) + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(134)); + + if (_shootReadyFl && (_shouldFallFl || _shouldDodgeFl)) { + _scene->_sequences.addTimer(4, 234); + _shootReadyFl = false; + } } void Scene209::preActions() { + if (_action.isAction(0x18C, 0x84)) + _game._player._walkOffScreenSceneId = 208; + + if (_globals[36] == 1) { + if ((_action.isAction(NOUN_SHOOT) || _action.isAction(NOUN_HOSE_DOWN)) && _action.isAction(NOUN_MONKEY) + && _action.isAction(NOUN_BLOWGUN) && _game._objects.isInInventory(OBJ_BLOWGUN) && _game._objects.isInInventory(OBJ_POISON_DARTS)) { + _game._player._prepareWalkPos = Common::Point(111, 129); + _game._player._prepareWalkFacing = FACING_NORTHEAST; + _game._player._needToWalk = true; + _game._player._readyToWalk = true; + } + + if (_action.isAction(VERB_LOOK, NOUN_MONKEY) || _action.isAction(VERB_TALKTO, NOUN_MONKEY)) { + _game._player._prepareWalkPos = Common::Point(111, 129); + _game._player._prepareWalkFacing = FACING_NORTHEAST; + _game._player._needToWalk = true; + _game._player._readyToWalk = true; + } + } } void Scene209::actions() { + if (_action._lookFlag) { + _vm->_dialogs->show(0x51B0); + _action._inProgress = false; + return; + } + + if (_action.isAction(0x18C, 0x1A2)) { + _scene->_nextSceneId = 203; + _action._inProgress = false; + return; + } + + if ((_action.isAction(VERB_TALKTO, NOUN_MONKEY)) && !_pitchFl && !_playingDialogFl) { + _scene->_sequences.addTimer(1, _dialogAbortVal); + _playingDialogFl = true; + _game._player._stepEnabled = false; + _action._inProgress = false; + return; + } + + switch (_game._trigger) { + case 130: + _game._player._stepEnabled = true; + _playingDialogFl = false; + _action._inProgress = false; + return; + + case 5: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 6, 180, _game.getQuote(139)); + _action._inProgress = false; + return; + + case 6: + _scene->_kernelMessages.add(Common::Point(180, 21), 0xFDFC, 0, 0, 60, _game.getQuote(151)); + _scene->_sequences.addTimer(60, 130); + _dialogAbortVal = 7; + _action._inProgress = false; + return; + + case 7: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 8, 180, _game.getQuote(140)); + _action._inProgress = false; + return; + + case 8: + _scene->_kernelMessages.add(Common::Point(180, 21), 0xFDFC, 0, 0, 60, _game.getQuote(149)); + _scene->_sequences.addTimer(60, 130); + _dialogAbortVal = 9; + _action._inProgress = false; + return; + + case 9: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 180, _game.getQuote(141)); + _scene->_sequences.addTimer(200, 10); + _action._inProgress = false; + return; + + case 10: + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 11, 180, _game.getQuote(142)); + _action._inProgress = false; + return; + + case 11: + _scene->_kernelMessages.add(Common::Point(180, 21), 0xFDFC, 0, 0, 60, _game.getQuote(152)); + _scene->_sequences.addTimer(60, 130); + _dialogAbortVal = 12; + _action._inProgress = false; + return; + + case 12: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 130, _game.getQuote(143)); + _scene->_sequences.addTimer(150, 13); + _action._inProgress = false; + return; + + case 13: + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 14, 180, _game.getQuote(145)); + _action._inProgress = false; + return; + + case 14: + _scene->_kernelMessages.add(Common::Point(180, 21), 0xFDFC, 0, 0, 60, _game.getQuote(151)); + _scene->_sequences.addTimer(60, 130); + _dialogAbortVal = 15; + _action._inProgress = false; + return; + + case 15: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 16, 180, _game.getQuote(146)); + _action._inProgress = false; + return; + + case 16: + _scene->_kernelMessages.add(Common::Point(180, 21), 0xFDFC, 0, 17, 60, _game.getQuote(154)); + _action._inProgress = false; + return; + + case 17: + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 130, 60, _game.getQuote(147)); + _dialogAbortVal = 18; + _action._inProgress = false; + return; + + case 18: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 180, _game.getQuote(148)); + _pitchFl = true; + _playingDialogFl = false; + _dialogAbortVal = 5; + _action._inProgress = false; + return; + } + + if (_globals[36] == 1) { + if ((_action.isAction(NOUN_SHOOT) || _action.isAction(NOUN_HOSE_DOWN)) && _action.isAction(NOUN_MONKEY) + && _action.isAction(NOUN_BLOWGUN) && _game._objects.isInInventory(OBJ_BLOWGUN) && _game._objects.isInInventory(OBJ_POISON_DARTS)) { + if (_action.isAction(NOUN_SHOOT, NOUN_BLOWGUN, NOUN_MONKEY) && !_startShootingInTimerFl) { + _game._triggerSetupMode = KERNEL_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 231); + _startShootingInTimerFl = true; + _game._player._stepEnabled = false; + _dodgeFl = true; + _action._inProgress = false; + return; + } + + if (_action.isAction(NOUN_HOSE_DOWN, NOUN_BLOWGUN, NOUN_MONKEY) && !_startShootingInTimerFl) { + _game._triggerSetupMode = KERNEL_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 228); + _game._player._stepEnabled = false; + _fallFl = true; + _startShootingInTimerFl = true; + _action._inProgress = false; + return; + } + } + + if (_action.isAction(VERB_LOOK, NOUN_MONKEY)) { + _pitchFl = true; + _game._player._stepEnabled = false; + _vm->_dialogs->show(0x51B2); + _action._inProgress = false; + return; + } + } + + if (_action.isAction(VERB_TAKE, NOUN_PLANT_STALK) && (_game._trigger || _game._objects.isInRoom(OBJ_PLANT_STALK))) { + switch (_game._trigger) { + case 0: + _globals._spriteIndexes[11] = _scene->_sprites.addSprites("*RXMBD_2", 0); + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._spriteIndexes[26] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[11], false, 3, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._spriteIndexes[26]); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_FRAME_INDEX, 4, 1); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_0, 0, 2); + break; + + case 1: + _scene->_sequences.remove(_globals._spriteIndexes[16]); + _game._objects.addToInventory(OBJ_PLANT_STALK); + break; + + case 2: + _game._player._visible = true; + _game._player._stepEnabled = true; + _scene->_sequences.addTimer(4, 3); + _vm->_dialogs->showPicture(OBJ_PLANT_STALK, 0x328); + break; + + case 3: + _scene->_sprites.remove(_globals._spriteIndexes[11]); + break; + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TAKE, 0x27) && (_game._trigger || _game._objects.isInRoom(OBJ_BINOCULARS))) { + switch (_game._trigger) { + case 0: + _globals._spriteIndexes[10] = _scene->_sprites.addSprites("*RXMBD_8", false); + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._spriteIndexes[25] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[10], false, 3, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._spriteIndexes[25]); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[25], SM_FRAME_INDEX, 4, 1); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[25], SM_0, 0, 2); + break; + + case 1: + _scene->_sequences.remove(_globals._spriteIndexes[24]); + _game._objects.addToInventory(OBJ_BINOCULARS); + break; + + case 2: + _game._player._visible = true; + _game._player._stepEnabled = true; + _binocularsDroppedFl = false; + _scene->_sequences.addTimer(4, 3); + break; + + case 3: + _vm->_dialogs->showPicture (OBJ_BINOCULARS, 0x51AF); + _scene->_sprites.remove(_globals._spriteIndexes[10]); + break; + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x142)) { + _vm->_dialogs->show(0x51A5); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x1A3)) { + _vm->_dialogs->show(0x51A6); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x1A4)) { + _vm->_dialogs->show(0x51A7); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x1A6)) { + _vm->_dialogs->show(0x51A8); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x84)) { + _vm->_dialogs->show(0x51A9); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x1A2)) { + _vm->_dialogs->show(0x51AA); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x10F) && (_action._savedFields._mainObjectSource == 4)) { + _vm->_dialogs->show(0x51AB); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_GIVE, 0x17A, 0xE3) || _action.isAction(VERB_THROW, 0x17A, 0xE3)) { + _vm->_dialogs->show(0x51AD); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x175)) { + _vm->_dialogs->show(0x51B1); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_THROW, 0xE3) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { + if (!_action.isAction(0x114)) { + _vm->_dialogs->show(0x51B3); + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_THROW, 0x114, 0xE3)) { + _vm->_dialogs->show(0x51B4); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x100)) { + if (_globals[36] == 1) { + if (_monkeyPosition == 1) + _vm->_dialogs->show(0x51B5); + else + _vm->_dialogs->show(0x51B6); + } else { + if (_globals[36] == 0) + _vm->_dialogs->show(0x51B5); + else + _vm->_dialogs->show(0x51B7); + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x3A4)) { + _vm->_dialogs->show(0x51B8); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TAKE, 0x3A4)) { + _vm->_dialogs->show(0x51B9); + _action._inProgress = false; + return; + } } } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index a749e8afcb..d29b94e522 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -155,8 +155,45 @@ public: }; class Scene209: public Scene2xx { +private: + bool _dodgeFl, _forceDodgeFl, _shouldDodgeFl; + bool _pitchFl; + bool _fallFl, _forceFallFl, _shouldFallFl; + bool _playingAnimFl, _playingDialogFl; + int _pauseMode, _pauseCounterThreshold, _pauseCounter; + bool _removeMonkeyFl; + int _monkeyPosition; + bool _shootReadyFl, _startShootingInTimerFl, _shootMissedLastFl; + bool _binocularsDroppedFl; + int _dialogAbortVal; + int _counter; + + void handlePause(); + void initPauseCounterThreshold(); + void handlePeek(); + void handleVerticalMove(); + void handleLookStay(); + void handleLookRight(); + void handleBlink(); + void handleGetBinoculars(); + void handleStandFromPeek(); + void handleDodge(); + void handleBinocularBlink(); + void handleBinocularScan(); + void handleJumpInTree(); + void handleTongue(); + void handleMonkeyFall(); + void handleJumpAndHide(); + void handleMonkeyEating(); + void handleMonkey1(); + void handleStandBlink(); + void handleMonkey2(); + public: - Scene209(MADSEngine *vm) : Scene2xx(vm) {} + Scene209(MADSEngine *vm) : Scene2xx(vm), _dodgeFl(false), _forceDodgeFl(false), _pitchFl(false), _fallFl(false), _forceFallFl(false), + _playingAnimFl(false), _shouldFallFl(false), _shouldDodgeFl(false), _monkeyPosition(0), _counter(0), _pauseMode(0), + _binocularsDroppedFl(false), _startShootingInTimerFl(false), _dialogAbortVal(0), _playingDialogFl(false),_shootMissedLastFl(false), + _removeMonkeyFl(false), _shootReadyFl(false), _pauseCounterThreshold(0), _pauseCounter(0) {} virtual void setup(); virtual void enter(); virtual void step(); |