diff options
Diffstat (limited to 'engines/mads/nebular')
-rw-r--r-- | engines/mads/nebular/nebular_scenes.cpp | 2 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes3.cpp | 789 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes3.h | 52 |
3 files changed, 837 insertions, 6 deletions
diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 67c32fdaa1..6a78903645 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -111,6 +111,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene303(vm); case 304: return new Scene304(vm); + case 307: + return new Scene307(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 6d60395c86..68c2783f7e 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -53,7 +53,7 @@ void Scene3xx::setPlayerSpritesPrefix() { || ((_scene->_nextSceneId >= 387) && (_scene->_nextSceneId <= 391))) { _game._player._spritesPrefix = ""; _game._player._spritesChanged = true; - } + } _game._player._scalingVelocity = true; if (oldName != _game._player._spritesPrefix) @@ -129,6 +129,109 @@ void Scene3xx::sceneEntrySound() { } } +void Scene3xx::initForceField(ForceField *force, bool flag) { + force->_flag = flag; + force->_vertical = 0; + force->_horizontal = 0; + force->_timer = 0; + + for (int count = 0; count < 40; count++) + force->_seqId[count] = -1; + + if (force->_flag) + _vm->_sound->command(24); +} + +int Scene3xx::computeScale(int low, int high, int id) { + int diff = high - (low + 2); + int quotient = diff / 20; + int remainder = diff % 20; + int value = low + 2 + (quotient * id) + (remainder / (id + 1)); + + return (value); +} + +void Scene3xx::handleForceField(ForceField *force, int *sprites) { + if (_game._trigger >= 150) { + int id = _game._trigger - 150; + if (id < 40) { + if (id < 20) + force->_vertical--; + else + force->_horizontal--; + + force->_seqId[id] = -1; + } + return; + } + + if (!force->_flag || (_scene->_frameStartTime < force->_timer) || (force->_vertical + force->_horizontal >= 5)) + return; + + if (_vm->getRandomNumber(1, 1000) <= (200 + ((40 - (force->_vertical + force->_horizontal)) << 5))) { + int id = -1; + for (int i = 0; i < 100; i++) { + int randIdx = _vm->getRandomNumber(0, 39); + if (force->_seqId[randIdx] < 0) { + id = randIdx; + break; + } + } + + if (id < 0) { + for (int i = 0; i < 40; i++) { + if (force->_seqId[i] < 0) { + id = i; + break; + } + } + } + + int speedX, speedY; + int posX, posY; + int randVal = _vm->getRandomNumber(1, 100); + int spriteId; + bool mirror; + + if (id >= 20) { + spriteId = 2; + mirror = (randVal <= 50); + posX = mirror ? 315 : 5; + posY = computeScale(15, 119, id - 20); + speedX = 1000 * (mirror ? -1 : 1); + speedY = 0; + } else if (randVal <= 50) { + spriteId = 1; + mirror = false; + posX = computeScale(21, 258, id); + posY = 0; + speedX = 0; + speedY = 600; + } else { + spriteId = 0; + mirror = false; + posX = computeScale(21, 258, id); + posY = 155; + speedX = 0; + speedY = -600; + } + + if (id >= 0) { + force->_seqId[id] = _scene->_sequences.addSpriteCycle(sprites[spriteId], mirror, 2, 0, 0, 0); + _scene->_sequences.setDepth(force->_seqId[id], 8); + _scene->_sequences.setMsgPosition(force->_seqId[id], Common::Point(posX, posY)); + _scene->_sequences.sub70C52(force->_seqId[id], 2, speedX, speedY); + _scene->_sequences.addSubEntry(force->_seqId[id], SEQUENCE_TRIGGER_EXPIRE, 0, 150 + id); + if (spriteId == 2) + force->_horizontal++; + else + force->_vertical++; + } + } + + force->_timer = _scene->_frameStartTime + 4; +} + /*------------------------------------------------------------------------*/ void Scene301::setup() { @@ -166,7 +269,7 @@ void Scene302::enter() { _game._player._stepEnabled = false; _game._player._visible = false; - _scene->loadAnimation(formAnimName('a',-1), 71); + _scene->loadAnimation(formAnimName('a', -1), 71); sceneEntrySound(); } @@ -231,7 +334,7 @@ void Scene304::enter() { if (_scene->_priorSceneId == 303) { _game._player._visible = false; _game._player._stepEnabled = false; - _scene->loadAnimation(formAnimName('a',-1), 60); + _scene->loadAnimation(formAnimName('a', -1), 60); } else { if (_globals[kSexOfRex] == REX_MALE) _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('a', 0)); @@ -264,7 +367,7 @@ void Scene304::step() { if (_game._trigger == 60) _scene->_nextSceneId = 311; - if (_game._trigger >= 70) { + if (_game._trigger >= 70) { switch (_game._trigger) { case 70: { _game._player._visible = false; @@ -316,7 +419,7 @@ void Scene304::step() { _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 75); break; - case 75: + case 75: _globals._sequenceIndexes[2] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 2, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); @@ -336,7 +439,7 @@ void Scene304::step() { _scene->_sequences.addTimer(120, 78); break; - case 78: + case 78: _scene->_nextSceneId = 316; break; @@ -348,5 +451,679 @@ void Scene304::step() { /*------------------------------------------------------------------------*/ +void Scene307::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x11); + _scene->addActiveVocab(0x2F7); +} + +void Scene307::handleRexDialog(int quote) { + Common::String curQuote = _game.getQuote(_action._activeAction._verbId); + if (_vm->_font->getWidth(curQuote, _scene->_textSpacing) > 200) { + Common::String subQuote1; + _game.splitQuote(curQuote, subQuote1, _subQuote2); + _scene->_kernelMessages.add(Common::Point(0, -14), 0x1110, 34, 0, 240, subQuote1); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 1, 180, _subQuote2); + } else + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 1, 120, curQuote); +} + +void Scene307::handlePrisonerEncounter() { + switch (_action._activeAction._verbId) { + case 275: + setDialogNode(5); + break; + + case 277: + setDialogNode(4); + break; + + case 276: + setDialogNode(6); + break; + } +} + +void Scene307::handlePrisonerSpeech(int firstQuoteId, int number, long time) { + int height = number * 14; + int posY; + + if (height < 60) + posY = 65 - height; + else + posY = 78 - (height / 2); + + _scene->_kernelMessages.reset(); + _activePrisonerFl = true; + + int quoteId = firstQuoteId; + for (int count = 0; count < number; count++) { + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_kernelMessages.add(Common::Point(5, posY), 0xFDFC, 0, 81, time, _game.getQuote(quoteId)); + posY += 14; + quoteId++; + } +} + +void Scene307::setDialogNode(int node) { + switch (node) { + case 0: + handlePrisonerSpeech(0x153, 2, 120); + _scene->_userInterface.setup(kInputBuildingSentences); + break; + + case 1: + _globals[kMetBuddyBeast] = true; + handlePrisonerSpeech(0x10F, 2, 9999999); + warning("TODO: talk_init(&dialog1);"); + break; + + case 2: + _globals[kMetBuddyBeast] = true; + handlePrisonerSpeech(0x111, 2, 9999999); + warning("TODO: talk_init(&dialog1);"); + break; + + case 4: + handlePrisonerSpeech(0x116, 1, 120); + _scene->_userInterface.setup(kInputBuildingSentences); + break; + + case 5: + _globals[kKnowsBuddyBeast] = true; + handlePrisonerSpeech(0x117, 2, 9999999); + warning("TODO: talk_init(&dialog2);"); + break; + + case 6: + handlePrisonerSpeech(0x123, 1, 120); + _scene->_userInterface.setup(kInputBuildingSentences); + break; + + case 7: + _globals[kKnowsBuddyBeast] = true; + handlePrisonerSpeech(0x124, 10, 9999999); + warning("TODO: sub71B9E(&dialog2, 0x11A, false);"); + warning("TODO: sub71B9E(&dialog2, 0x11B, true);"); + warning("TODO: sub71B9E(&dialog2, 0x120, true);"); + warning("TODO: talk_init(&dialog2);"); + break; + + case 8: + handlePrisonerSpeech(0x12E, 6, 9999999); + warning("TODO: sub71B9E(&dialog2, 0x11A, false);"); + warning("TODO: sub71B9E(&dialog2, 0x11B, false);"); + warning("TODO: sub71B9E(&dialog2, 0x11C, true);"); + warning("TODO: sub71B9E(&dialog2, 0x11D, true);"); + warning("TODO: sub71B9E(&dialog2, 0x11F, true);"); + warning("TODO: talk_init(&dialog2);"); + break; + + case 9: + handlePrisonerSpeech(0x134, 4, 9999999); + warning("TODO: sub71B9E(&dialog2, 0x11D, false);"); + warning("TODO: talk_init(&dialog2);"); + break; + + case 10: + handlePrisonerSpeech(0x138, 6, 9999999); + warning("TODO: sub71B9E(&dialog2, 0x11E, false);"); + warning("TODO: talk_init(&dialog2);"); + break; + + case 11: + handlePrisonerSpeech(0x13E, 6, 9999999); + warning("TODO: sub71B9E(&dialog2, 0x11F, false);"); + warning("TODO: sub71B9E(&dialog2, 0x121, true);"); + warning("TODO: talk_init(&dialog2);"); + break; + + case 12: + handlePrisonerSpeech(0x144, 4, 9999999); + warning("TODO: sub71B9E(&dialog2, 0x11C, false);"); + warning("TODO: talk_init(&dialog2);"); + break; + + case 13: + handlePrisonerSpeech(0x148, 7, 9999999); + warning("TODO: sub71B9E(&dialog2, 0x120, false);"); + warning("TODO: talk_init(&dialog2);"); + break; + + case 14: + handlePrisonerSpeech(0x14F, 3, 9999999); + warning("TODO: sub71B9E(&dialog2, 0x121, false);"); + warning("TODO: talk_init(&dialog2);"); + break; + + case 15: + handlePrisonerSpeech(0x152, 1, 120); + _scene->_userInterface.setup(kInputBuildingSentences); + break; + + case 16: + _globals[kKnowsBuddyBeast] = true; + handlePrisonerSpeech(0x10C, 1, 9999999); + warning("TODO: talk_init(&dialog2);"); + break; + + default: + break; + } +} + +void Scene307::handlePrisonerDialog() { + switch (_action._activeAction._verbId) { + case 0x11A: + setDialogNode(7); + break; + + case 0x11B: + setDialogNode(8); + break; + + case 0x11C: + setDialogNode(12); + break; + + case 0x11D: + setDialogNode(9); + break; + + case 0x11E: + setDialogNode(10); + break; + + case 0x11F: + setDialogNode(11); + break; + + case 0x120: + setDialogNode(13); + break; + + case 0x121: + setDialogNode(14); + break; + + case 0x122: + setDialogNode(15); + break; + } +} + +void Scene307::handleDialog() { + if (_game._trigger == 0) { + _scene->_kernelMessages.reset(); + _game._player._stepEnabled = false; + handleRexDialog(_action._activeAction._verbId); + } else { + _game._player._stepEnabled = true; + + if (!_globals[kKnowsBuddyBeast]) { + handlePrisonerEncounter(); + } else { + handlePrisonerDialog(); + } + } +} + +void Scene307::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*SC003x0"); + _globals._spriteIndexes[0] = _scene->_sprites.addSprites("*SC003x1"); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*SC003x2"); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 0)); + + initForceField(&_forceField, true); + + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 15); + + _animationMode = 0; + _fieldCollisionCounter = 0; + + _scene->changeVariant(1); + + _game.loadQuoteSet(0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0x10C, 0x104, 0x106, 0x107, 0x108, 0x105, + 0x109, 0x10A, 0x10B, 0x10D, 0x10E, 0x10F, 0x110, 0x111, 0x112, 0x113, 0x114, 0x115, 0x116, 0x117, + 0x118, 0x119, 0x11A, 0x11B, 0x11C, 0x11D, 0x11E, 0x11F, 0x120, 0x121, 0x122, 0x123, 0x124, 0x125, + 0x126, 0x127, 0x128, 0x129, 0x12A, 0x12B, 0x12C, 0x12D, 0x12E, 0x12F, 0x130, 0x131, 0x132, 0x133, + 0x134, 0x135, 0x136, 0x137, 0x138, 0x139, 0x13A, 0x13B, 0x13C, 0x13D, 0x13E, 0x13F, 0x140, 0x141, + 0x142, 0x143, 0x144, 0x145, 0x146, 0x147, 0x148, 0x149, 0x14A, 0x14B, 0x14C, 0x14D, 0x14E, 0x14F, + 0x150, 0x151, 0x152, 0x153, 0); + + warning("TODO: sub71A50(&dialog1, 0x3F, 0x113, 0x114, 0x115, -1);"); + warning("TODO: sub71A50(&dialog2, 0x40, 0x11A, 0x11B, 0x11C, 0x11D, 0x11E, 0x11F, 0x120, 0x121, 0x122, 0);"); + + if (!_game._visitedScenes._sceneRevisited) + warning("TODO: sub71B18(&dialog2, 0x11A, 0x122, 0);"); + else if (_scene->_priorSceneId == 318) + warning("TODO: sub71B9E(&dialog2, 0x11E, -1);"); + + + if (_scene->_priorSceneId == -2) { + if (_grateOpenedFl) + _vm->_sound->command(10); + else + _vm->_sound->command(3); + } else { + _afterPeeingFl = false; + _duringPeeingFl = false; + _guardTime = 0; + _grateOpenedFl = false; + _activePrisonerFl = false; + _prisonerTimer = 0; + _prisonerMessageId = 0x104; + + if (_scene->_priorSceneId == 308) { + _game._player._visible = false; + _game._player._stepEnabled = false; + _game._player._playerPos = Common::Point(156, 113); + _game._player._facing = FACING_NORTH; + _animationMode = 1; + _vm->_sound->command(11); + _scene->loadAnimation(formAnimName('a', -1), 60); + } else if (_scene->_priorSceneId == 387) { + _game._player._playerPos = Common::Point(129, 108); + _game._player._facing = FACING_NORTH; + _vm->_sound->command(3); + _grateOpenedFl = true; + } else { + _game._player._playerPos = Common::Point(159, 109); + _game._player._facing = FACING_SOUTH; + _vm->_sound->command(3); + } + } + + if (_grateOpenedFl) { + _scene->_hotspots.activate(17, false); + + int idx = _scene->_dynamicHotspots.add(17, 0x2F7, -1, Common::Rect(117, 67, 117 + 19, 67 + 13)); + int hotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(129, 104), FACING_NORTH); + _scene->_dynamicHotspots.setCursor(hotspotId, CURSOR_GO_UP); + + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 15); + } + + _vm->_palette->setEntry(252, 63, 30, 20); + _vm->_palette->setEntry(253, 45, 15, 12); + + sceneEntrySound(); + + if ((_scene->_priorSceneId == 318) || (_scene->_priorSceneId == 387)) + _scene->_kernelMessages.addQuote(0xF3, 120, 0); +} + +void Scene307::step() { + handleForceField(&_forceField, &_globals._spriteIndexes[0]); + + if ((_animationMode == 1) && (_scene->_activeAnimation != nullptr)) { + if (_scene->_activeAnimation->getCurrentFrame() == 126) { + _forceField._flag = false; + _vm->_sound->command(5); + } + + if (_scene->_activeAnimation->getCurrentFrame() == 194) { + _forceField._flag = true; + _vm->_sound->command(24); + } + } + + if ((_animationMode == 2) && (_scene->_activeAnimation != nullptr)) { + if (_scene->_activeAnimation->getCurrentFrame() == 54) + _forceField._flag = false; + + if (_scene->_activeAnimation->getCurrentFrame() == 150) { + _game._player._visible = false; + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + } + } + + if (_game._trigger == 60) { + _game._player._visible = true; + _game._player._stepEnabled = true; + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _animationMode = 0; + _vm->_sound->command(9); + } + + if ((_lastFrameTime != _scene->_frameStartTime) && !_duringPeeingFl) { + int32 elapsedTime = _lastFrameTime - _scene->_frameStartTime; + if ((elapsedTime > 0) && (elapsedTime <= 4)) { + _guardTime += elapsedTime; + _prisonerTimer += elapsedTime; + } else { + _guardTime++; + _prisonerTimer++; + } + _lastFrameTime = _scene->_frameStartTime; + + if ((_guardTime > 3000) && !_duringPeeingFl && (_scene->_activeAnimation == nullptr) + && (_game._screenObjects._inputMode != 1) && _globals[kMetBuddyBeast] && !_activePrisonerFl) { + if (!_game._objects.isInInventory(OBJ_SCALPEL) && !_grateOpenedFl) { + _game._player._stepEnabled = false; + _game._player.walk(Common::Point(151, 119), FACING_SOUTHEAST); + _animationMode = 2; + _vm->_sound->command(11); + _scene->loadAnimation(formAnimName('b', -1), 70); + } + _guardTime = 0; + } else if ((_prisonerTimer > 300) && (_game._screenObjects._inputMode != 1) && (_scene->_activeAnimation == nullptr) && !_activePrisonerFl) { + if (!_globals[kMetBuddyBeast]) { + int idx = _scene->_kernelMessages.add(Common::Point(5, 51), 0xFDFC, 0, 81, 120, _game.getQuote(_prisonerMessageId)); + _scene->_kernelMessages.setQuoted(idx, 4, true); + _prisonerMessageId++; + if (_prisonerMessageId > 0x10A) + _prisonerMessageId = 0x104; + } else if (_globals[kKnowsBuddyBeast] && (_vm->getRandomNumber(1, 3) == 1)) { + warning("TODO: if (_globals[kKnowsBuddyBeast] && (sub71C16(&dialog2, 0) > 1) && (_vm->getRandomNumber(1, 3) == 1)) {"); + int idx = _scene->_kernelMessages.add(Common::Point(5, 51), 0xFDFC, 0, 81, 120, _game.getQuote(267)); + _scene->_kernelMessages.setQuoted(idx, 4, true); + } + _prisonerTimer = 0; + } + } + + if (_game._trigger == 70) + _scene->_nextSceneId = 318; + + if (_game._trigger == 81) { + _prisonerTimer = 0; + if (_activePrisonerFl && (_guardTime > 2600)) + _guardTime = 3000 - _vm->getRandomNumber(1, 800); + + _activePrisonerFl = false; + } +} + +void Scene307::actions() { + if (_action._lookFlag) + _vm->_dialogs->show(0x77FB); + else if (_game._screenObjects._inputMode == 1) + handleDialog(); + else if (_action.isAction(VERB_TALKTO, 0x207) || _action.isAction(VERB_TALKTO, 0x18D) || _action.isAction(VERB_TALKTO, 0x21B)) { + int node, say; + if (_globals[kKnowsBuddyBeast]) { + say = 0x10E; + node = 16; + } else if (_globals[kMetBuddyBeast]) { + say = 0x10E; + node = 2; + } else { + say = 0x10D; + node = 1; + } + + switch (_game._trigger) { + case 0: + handleRexDialog(say); + break; + + case 1: + setDialogNode(node); + break; + } + } else if (_action.isAction(0x11C, 0x12C, 0x11)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(239)); + _scene->_sequences.addTimer(120, 1); + break; + + case 1: + _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RXCL_8"); + _game._player._visible = false; + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], -1, 3); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 2: { + int oldIdx = _globals._sequenceIndexes[5]; + _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], false, 12, 6, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 2, 3); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[5], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + } + break; + + case 3: { + int oldIdx = _globals._sequenceIndexes[5]; + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[5], oldIdx); + _scene->_sequences.addTimer(48, 4); + } + break; + + case 4: + _vm->_sound->command(26); + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 15); + _scene->_sequences.addTimer(90, 5); + break; + + case 5: + _vm->_sound->command(10); + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(241)); + _scene->_sequences.addTimer(120, 6); + break; + + case 6: { + _game._player._visible = true; + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _grateOpenedFl = true; + _scene->_hotspots.activate(17, false); + int idx = _scene->_dynamicHotspots.add(17, 0x2F7, -1, Common::Rect(117, 67, 117 + 19, 67 + 13)); + int hotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(129, 104), FACING_NORTH); + _scene->_dynamicHotspots.setCursor(hotspotId, CURSOR_GO_UP); + _game._objects.removeFromInventory(OBJ_SCALPEL, NOWHERE); + _scene->_kernelMessages.addQuote(0xF2, 120, 7); + } + break; + + case 7: + _scene->_sprites.remove(_globals._spriteIndexes[5]); + _game._player._stepEnabled = true; + break; + + default: + break; + } + }else if (_action.isAction(0x2F7, 0x11)) { + if (_grateOpenedFl) { + switch (_game._trigger) { + case 0: + _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RXCL_8"); + _game._player._stepEnabled = false; + _game._player._visible = false; + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 60, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 3, -2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 15); + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 18, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], -1, 4); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, -2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 15); + break; + + case 2: { + int oldIdx = _globals._sequenceIndexes[5]; + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 4, 10); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[5], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + } + break; + + case 3: + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 3); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 11); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[5], Common::Point(129, 102)); + _scene->_sequences.addTimer(48, 4); + break; + + case 4: + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 12, 14); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[5], Common::Point(129, 102)); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 5); + break; + + case 5: + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 15); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[5], Common::Point(129, 102)); + _scene->_sequences.addTimer(48, 6); + break; + + case 6: + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); + _scene->_sequences.addTimer(48, 7); + break; + + case 7: + _scene->_nextSceneId = 313; + break; + + default: + break; + } + } + } else if (_action.isAction(0x20C, 0x21B) && (_game._storyMode != STORYMODE_NAUGHTY)) + _vm->_dialogs->show(0x7803); + else if (_action.isAction(0x20C, 0x21B)) { + if (!_afterPeeingFl) { + switch (_game._trigger) { + case 0: + _vm->_sound->command(25); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 0)); + _duringPeeingFl = true; + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 9, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -1, 2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + + case 1: + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 9, 5, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 3, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 2: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[3]); + _game._player._visible = true; + _scene->_sequences.addTimer(48, 3); + break; + + case 3: { + _scene->_sprites.remove(_globals._spriteIndexes[3]); + _scene->_kernelMessages.reset(); + int idx = _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 4, 120, _game.getQuote(237)); + _scene->_kernelMessages.setQuoted(idx, 4, true); + } + break; + + case 4: + _game._player._stepEnabled = true; + _duringPeeingFl = false; + _afterPeeingFl = true; + break; + + default: + break; + } + } else { + _scene->_kernelMessages.reset(); + int idx = _scene->_kernelMessages.add(Common::Point(85, 39), 0x1110, 0, 0, 180, _game.getQuote(238)); + _scene->_kernelMessages.setQuoted(idx, 4, true); + } + } else if (_action.isAction(VERB_LOOK, 0x11)) { + if (!_grateOpenedFl) + _vm->_dialogs->show(0x77F6); + else + _vm->_dialogs->show(0x77F7); + } else if (_action.isAction(VERB_LOOK, 0x1CB)) + _vm->_dialogs->show(0x77F8); + else if (_action.isAction(VERB_LOOK, 0x216)) + _vm->_dialogs->show(0x77F9); + else if (_action.isAction(VERB_LOOK, 0x21B)) + _vm->_dialogs->show(0x77FA); + else if (_action.isAction(0x134, 0x12C)) + _vm->_dialogs->show(0x77FC); + else if (_action.isAction(VERB_LOOK, 0x207)) + _vm->_dialogs->show(0x77FD); + else if (_action.isAction(VERB_LOOK, 0xCD)) + _vm->_dialogs->show(0x77FE); + else if (_action.isAction(0x242, 0x204)) { + switch (_fieldCollisionCounter) { + case 0: + _vm->_dialogs->show(0x77FF); + _fieldCollisionCounter = 1; + break; + + case 1: + _vm->_dialogs->show(0x7800); + _fieldCollisionCounter = 2; + break; + + case 2: + _vm->_dialogs->show(0x7801); + _fieldCollisionCounter = 3; + break; + + case 3: + _vm->_dialogs->show(0x7802); + break; + } + } else + return; + + _action._inProgress = false; +} + + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 74611a61f9..5b25e391eb 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -32,6 +32,14 @@ namespace MADS { namespace Nebular { +typedef struct { + bool _flag; + int _vertical; + int _horizontal; + int _seqId[40]; + uint32 _timer; +} ForceField; + class Scene3xx : public NebularScene { protected: /** @@ -45,6 +53,11 @@ protected: void setPlayerSpritesPrefix(); void sceneEntrySound(); + + void initForceField(ForceField *force, bool flag); + void handleForceField(ForceField *force, int *sprites); + int computeScale(int low, int high, int id); + public: Scene3xx(MADSEngine *vm) : NebularScene(vm) {} }; @@ -103,6 +116,45 @@ public: virtual void postActions() {}; }; +class Scene307: public Scene3xx { +private: + ForceField _forceField; + + bool _afterPeeingFl; + bool _duringPeeingFl; + bool _grateOpenedFl; + bool _activePrisonerFl; + + int _animationMode; + int _prisonerMessageId; + int _fieldCollisionCounter; + + uint32 _lastFrameTime; + uint32 _guardTime; + uint32 _prisonerTimer; + + Common::String _subQuote2; + + // dialog1, dialog2; + + void handleDialog(); + void handleRexDialog(int quote); + void handlePrisonerDialog(); + void handlePrisonerEncounter(); + void setDialogNode(int node); + void handlePrisonerSpeech(int firstQuoteId, int number, long time); + +public: + Scene307(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS |