aboutsummaryrefslogtreecommitdiff
path: root/engines/mads
diff options
context:
space:
mode:
authorStrangerke2014-04-22 23:26:09 +0200
committerStrangerke2014-04-22 23:26:39 +0200
commitb2e2a2deeee660ec2b28bc0098dfe0da67869e04 (patch)
tree2bc6723e92ad8280f57aab79c5b6d6394ef74f63 /engines/mads
parent692af23f6f0a698e9089fcef0592fcb20e56efa6 (diff)
downloadscummvm-rg350-b2e2a2deeee660ec2b28bc0098dfe0da67869e04.tar.gz
scummvm-rg350-b2e2a2deeee660ec2b28bc0098dfe0da67869e04.tar.bz2
scummvm-rg350-b2e2a2deeee660ec2b28bc0098dfe0da67869e04.zip
MADS: Implement scene 319
Diffstat (limited to 'engines/mads')
-rw-r--r--engines/mads/nebular/nebular_scenes.cpp2
-rw-r--r--engines/mads/nebular/nebular_scenes3.cpp460
-rw-r--r--engines/mads/nebular/nebular_scenes3.h28
-rw-r--r--engines/mads/palette.cpp3
-rw-r--r--engines/mads/palette.h2
5 files changed, 493 insertions, 2 deletions
diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp
index 77146a0773..2c16fdb52e 100644
--- a/engines/mads/nebular/nebular_scenes.cpp
+++ b/engines/mads/nebular/nebular_scenes.cpp
@@ -127,6 +127,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) {
return new Scene316(vm);
case 318:
return new Scene318(vm);
+ case 319:
+ return new Scene319(vm);
// Scene group #8
case 804:
diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp
index 1928461f84..15cd4822aa 100644
--- a/engines/mads/nebular/nebular_scenes3.cpp
+++ b/engines/mads/nebular/nebular_scenes3.cpp
@@ -2870,5 +2870,465 @@ void Scene318::actions() {
/*------------------------------------------------------------------------*/
+void Scene319::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene319::handleRexDialogues(int quote) {
+ _scene->_kernelMessages.reset();
+
+ Common::String curQuote = _game.getQuote(quote);
+ if (_vm->_font->getWidth(curQuote, _scene->_textSpacing) > 200) {
+ Common::String subQuote1;
+ _game.splitQuote(curQuote, subQuote1, _subQuote2);
+ _scene->_kernelMessages.add(Common::Point(160, 106), 0x1110, 32, 0, 120, subQuote1);
+ _scene->_kernelMessages.add(Common::Point(160, 120), 0x1110, 32, 1, 120, _subQuote2);
+ } else
+ _scene->_kernelMessages.add(Common::Point(160, 120), 0x1110, 32, 1, 120, curQuote);
+}
+
+void Scene319::handleSlacheDialogs(int quoteId, int counter, uint32 timer) {
+ int curQuote = quoteId;
+ int posY = 5 + (_slachePosY * 14);
+
+ for (int count = 0; count < counter; count++, curQuote++) {
+ _scene->_kernelMessages.add(Common::Point(8, posY), 0xFDFC, 0, 0, timer, _game.getQuote(curQuote));
+ posY += 14;
+ }
+}
+
+void Scene319::enter() {
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('e', 0));
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('a', 0));
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('a', 1));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 2));
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 3));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('k', -1));
+
+ if (!_game._objects.isInInventory(OBJ_SCALPEL)) {
+ _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1);
+ }
+
+ _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 18, 0, 0, 300);
+ _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 67, 0, 0, 377);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 173, 0, 0, 233);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14);
+
+ _globals._sequenceIndexes[0] = _scene->_sequences.startCycle (_globals._spriteIndexes[0], false, 1);
+ _globals._sequenceIndexes[1] = _scene->_sequences.startCycle (_globals._spriteIndexes[1], false, 1);
+
+ _dialog1.setup(0x43, 0x165, 0x166, 0x167, 0x168, 0x169, 0x16A, 0);
+ _dialog2.setup(0x44, 0x171, 0x172, 0x173, 0x174, 0x175, 0x176, 0);
+ _dialog3.setup(0x45, 0x17D, 0x17E, 0x17F, 0x180, 0x181, 0x182, 0x183, 0);
+
+ if (_scene->_priorSceneId != -2) {
+ _dialog1.set(0x165, 0x166, 0x167, 0x168, 0);
+ _dialog2.set(0x171, 0x172, 0x173, 0x174, 0);
+ _dialog3.set(0x17D, 0x17E, 0x17F, 0x180, 0);
+ }
+
+ _game.loadQuoteSet(0x15F, 0x160, 0x161, 0x162, 0x163, 0x164, 0x16B, 0x16C, 0x16D,
+ 0x16E, 0x16F, 0x170, 0x177, 0x178, 0x178, 0x17A, 0x17B, 0x17C, 0x165, 0x166,
+ 0x167, 0x168, 0x169, 0x16A, 0x171, 0x172, 0x173, 0x174, 0x175, 0x176, 0x17D,
+ 0x17E, 0x17F, 0x180, 0x181, 0x182, 0x183, 0x184, 0x185, 0x186, 0x187, 0x188,
+ 0x189, 0x18A, 0x18B, 0);
+
+ _vm->_palette->setEntry(252, 63, 30, 2);
+ _vm->_palette->setEntry(253, 45, 15, 1);
+
+ _slachePosY = 0;
+ _slacheInitFl = false;
+ _slacheTalkingFl = false;
+ _slacheReady = false;
+ _animFrame = 0;
+
+ _scene->loadAnimation(formAnimName('b', 0));
+
+ if (_scene->_priorSceneId != -2) {
+ _animMode = 1;
+ _nextAction1 = 2;
+ _nextAction2 = 2;
+ _slacheMode = 1;
+ _slacheTopic = 1;
+ _slacheInitFl = true;
+
+ if (_globals[kRexHasMetSlache]) {
+ handleSlacheDialogs(0x18A, 2, 9999999);
+ _slachePosY = 3;
+ } else {
+ handleSlacheDialogs(0x186, 4, 9999999);
+ _slachePosY = 5;
+ }
+ }
+
+ switch (_slacheTopic) {
+ case 1:
+ handleSlacheDialogs(0x15F, 2, 9999999);
+ _dialog1.start();
+ break;
+
+ case 2:
+ handleSlacheDialogs(0x16B, 2, 9999999);
+ _dialog2.start();
+ break;
+
+ case 3:
+ handleSlacheDialogs(0x177, 2, 9999999);
+ _dialog3.start();
+ break;
+
+ default:
+ break;
+ }
+
+ _slachePosY = 0;
+ sceneEntrySound();
+}
+
+void Scene319::step() {
+ if (_scene->_activeAnimation == nullptr)
+ return;
+
+ if (_animFrame != _scene->_activeAnimation->getCurrentFrame()) {
+ _animFrame = _scene->_activeAnimation->getCurrentFrame();
+ int nextFrame = -1;
+ if (_animMode == 1) {
+ switch (_animFrame) {
+ case 6:
+ _slacheTalkingFl = true;
+ break;
+
+ case 29:
+ _slacheReady = true;
+ break;
+
+ case 39:
+ if (_slacheInitFl) {
+ _slacheInitFl = false;
+ if (_nextAction1 == 2)
+ nextFrame = 0;
+ } else if (_nextAction1 == 2)
+ _nextAction1 = 1;
+ break;
+
+ case 50:
+ case 60:
+ case 70:
+ case 85:
+ if (_nextAction1 == 2)
+ nextFrame = 0;
+ else if (_nextAction1 == 3) {
+ nextFrame = 85;
+ _slacheTalkingFl = true;
+ } else if (_animFrame == 85) {
+ if (!_game._player._stepEnabled)
+ _slacheTalkingFl = true;
+ nextFrame = 40;
+ }
+ break;
+
+ case 115:
+ _slacheReady = true;
+ break;
+
+ case 129:
+ if (_nextAction1 == 3) {
+ nextFrame = 115;
+ if (!_game._player._stepEnabled)
+ _slacheTalkingFl = true;
+ }
+ break;
+
+ case 145:
+ nextFrame = 40;
+ break;
+
+ default:
+ break;
+ }
+
+ if ((_animFrame > 40) && (_animFrame < 85) && (nextFrame < 0)) {
+ switch (_nextAction1) {
+ case 4:
+ _animFrame = 0;
+ _scene->freeAnimation();
+ _animMode = 2;
+ _scene->loadAnimation(formAnimName('b', 3), 70);
+ break;
+
+ case 5:
+ _animFrame = 0;
+ _scene->freeAnimation();
+ _animMode = 3;
+ _scene->loadAnimation(formAnimName('b', 4), 71);
+ break;
+
+ case 6:
+ _animFrame = 0;
+ _scene->freeAnimation();
+ _animMode = 4;
+ _scene->loadAnimation(formAnimName('b', 5), 72);
+ break;
+
+ default:
+ break;
+ }
+
+ if (!_animFrame) {
+ _scene->_sequences.remove(_globals._sequenceIndexes[0]);
+ _scene->_sequences.remove(_globals._sequenceIndexes[1]);
+
+ for (int i = 0; i <= 1; i++) {
+ _globals._sequenceIndexes[i] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[i], false, 8, 1, 0, 0);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[i], 1, 7);
+ }
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 73);
+ }
+ }
+ }
+
+ if (_animMode == 2) {
+ if (_animFrame == 13)
+ warning("TODO: shake_countdown = 40;");
+
+ if (_animFrame == 16)
+ warning("TODO: shake_countdown = 1;");
+ }
+
+ if (_animMode == 3) {
+ if (_animFrame == 11)
+ warning("TODO: shake_countdown = 60;");
+
+ if (_animFrame == 18)
+ warning("TODO: shake_countdown = 1;");
+ }
+
+ if ((_animMode == 4) && (_animFrame == 16))
+ warning("TODO: shake_countdown = 80;");
+
+ if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) {
+ _scene->_activeAnimation->setCurrentFrame(nextFrame);
+ _animFrame = nextFrame;
+ }
+ }
+
+ switch (_game._trigger) {
+ case 70:
+ case 71:
+ _animMode = 1;
+ _nextAction1 = _nextAction2;
+ _animFrame = 0;
+ _scene->freeAnimation();
+ _scene->loadAnimation(formAnimName('b', 0), false);
+ if (_nextAction1 == 3)
+ _scene->_activeAnimation->setCurrentFrame(85);
+ else if (_nextAction1 == 1)
+ _scene->_activeAnimation->setCurrentFrame(40);
+
+ _animFrame = _scene->_activeAnimation->getCurrentFrame();
+ _slacheTalkingFl = true;
+ warning("TODO: shake_countdown = 1;");
+
+ for (int i = 0; i <= 1; i++) {
+ int oldIdx = _globals._sequenceIndexes[i];
+ _scene->_sequences.remove(_globals._sequenceIndexes[i]);
+ _globals._sequenceIndexes[i] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[i], false, 8, 1, 0, 0);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[i], 8, 13);
+ _scene->_sequences.updateTimeout(_globals._sequenceIndexes[i], oldIdx);
+ }
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 74);
+ break;
+
+ case 72:
+ warning("TODO: sub7CBD8(-1, 0, 0);");
+ warning("TODO: sub7CBE4(0, 0, 0);");
+ _vm->_palette->fadeOut(_vm->_palette->_mainPalette, 18, 228, 16, 1, 8, 248, 0, 0);
+ warning("TODO: shake_countdown = 1;");
+ _scene->_reloadSceneFlag = true;
+ break;
+
+ case 73:
+ for (int i = 0; i <= 1; i++) {
+ int oldIdx = _globals._sequenceIndexes[i];
+ _scene->_sequences.remove(_globals._sequenceIndexes[i]);
+ _globals._sequenceIndexes[i] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[i], false, 8, 0, 0, 0);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[i], 6, 7);
+ _scene->_sequences.updateTimeout(_globals._sequenceIndexes[i], oldIdx);
+ }
+ break;
+
+ case 74:
+ for (int i = 0; i <= 1; i++) {
+ int oldIdx = _globals._sequenceIndexes[i];
+ _scene->_sequences.remove(_globals._sequenceIndexes[i]);
+ _globals._sequenceIndexes[i] = _scene->_sequences.startCycle (_globals._spriteIndexes[i], false, 1);
+ _scene->_sequences.updateTimeout(_globals._sequenceIndexes[i], oldIdx);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+void Scene319::actions() {
+ if (_game._trigger == 0) {
+ _game._player._stepEnabled = false;
+ handleRexDialogues(_action._activeAction._verbId);
+ } else {
+ if ((_action._activeAction._verbId == 0x165) || (_action._activeAction._verbId == 0x166)) {
+ if (_game._trigger == 1) {
+ _nextAction1 = 3;
+ _slacheTalkingFl = false;
+ _slacheMode = 1;
+ _slacheTopic = 2;
+ }
+
+ if (!_slacheTalkingFl) {
+ _scene->_sequences.addTimer(4, 2);
+ } else {
+ handleSlacheDialogs(0x16B, 2, 9999999);
+ _dialog2.start();
+ _game._player._stepEnabled = true;
+ }
+ }
+
+ if ((_action._activeAction._verbId == 0x171) || (_action._activeAction._verbId == 0x172)) {
+ if (_game._trigger == 1) {
+ _nextAction1 = 2;
+ _slacheTalkingFl = false;
+ _slacheMode = 1;
+ _slacheTopic = 3;
+ }
+
+ if (!_slacheTalkingFl) {
+ _scene->_sequences.addTimer(4, 2);
+ } else {
+ handleSlacheDialogs(0x177, 2, 9999999);
+ _dialog3.start();
+ _game._player._stepEnabled = true;
+ }
+ }
+
+ if ((_action._activeAction._verbId == 0x17D) || (_action._activeAction._verbId == 0x17E)) {
+ if (_game._trigger == 1) {
+ _nextAction1 = 3;
+ _slacheTalkingFl = false;
+ _slacheReady = false;
+ _slacheMode = 1;
+ _slacheTopic = 1;
+ }
+
+ if (!_slacheTalkingFl) {
+ _scene->_sequences.addTimer(4, 2);
+ } else {
+ if (_game._trigger == 2)
+ handleSlacheDialogs(0x184, 2, 180);
+
+ if (!_slacheReady) {
+ _scene->_sequences.addTimer(120, 3);
+ } else {
+ _globals[kRexHasMetSlache] = true;
+ _scene->_nextSceneId = 318;
+ }
+ }
+ }
+
+ if ((_action._activeAction._verbId == 0x168) || (_action._activeAction._verbId == 0x174) ||
+ (_action._activeAction._verbId == 0x180) || (_action._activeAction._verbId == 0x169) ||
+ (_action._activeAction._verbId == 0x175) || (_action._activeAction._verbId == 0x181) ||
+ (_action._activeAction._verbId == 0x16A) || (_action._activeAction._verbId == 0x176) ||
+ (_action._activeAction._verbId == 0x182) || (_action._activeAction._verbId == 0x183) ||
+ (_action._activeAction._verbId == 0x167) || (_action._activeAction._verbId == 0x173) ||
+ (_action._activeAction._verbId == 0x17F)) {
+
+ bool addDialogLine = !((_action._activeAction._verbId == 0x167) || (_action._activeAction._verbId == 0x173) ||
+ (_action._activeAction._verbId == 0x17F) || (_action._activeAction._verbId == 0x16A) ||
+ (_action._activeAction._verbId == 0x176) || (_action._activeAction._verbId == 0x182) ||
+ (_action._activeAction._verbId == 0x183));
+
+ int addVerbId = _action._activeAction._verbId + 1;
+ if ((addVerbId == 0x182) && (_game._storyMode != STORYMODE_NAUGHTY))
+ addVerbId = 0x183;
+
+ if (_slacheMode == 1) {
+ if (_game._trigger == 1) {
+ _nextAction2 = _nextAction1;
+ _nextAction1 = 4;
+ }
+
+ if (_nextAction1 != _nextAction2) {
+ _scene->_sequences.addTimer(4, 2);
+ } else {
+ Conversation *curDialog;
+ int nextDocQuote;
+ if ((_action._activeAction._verbId == 0x168) || (_action._activeAction._verbId == 0x167)) {
+ curDialog = &_dialog1;
+ nextDocQuote = 0x161;
+ } else if ((_action._activeAction._verbId == 0x174) || (_action._activeAction._verbId == 0x1753)) {
+ nextDocQuote = 0x16D;
+ curDialog = &_dialog2;
+ } else {
+ nextDocQuote = 0x179;
+ curDialog = &_dialog3;
+ }
+
+ handleSlacheDialogs(nextDocQuote, 2, 9999999);
+ if (addDialogLine) {
+ curDialog->write(_action._activeAction._verbId, false);
+ curDialog->write(addVerbId, true);
+ }
+
+ curDialog->start();
+ _game._player._stepEnabled = true;
+ _slacheMode = 2;
+ }
+ } else if (_slacheMode == 2) {
+ if (_game._trigger == 1) {
+ _nextAction2 = _nextAction1;
+ _nextAction1 = 5;
+ }
+
+ if (_nextAction1 != _nextAction2) {
+ _scene->_sequences.addTimer(4, 2);
+ } else {
+ Conversation *curDialog;
+ int nextDocQuote;
+ if ((_action._activeAction._verbId == 0x168) || (_action._activeAction._verbId == 0x169) || (_action._activeAction._verbId == 0x167)) {
+ curDialog = &_dialog1;
+ nextDocQuote = 0x163;
+ } else if ((_action._activeAction._verbId == 0x174) || (_action._activeAction._verbId == 0x175) || (_action._activeAction._verbId == 0x173)) {
+ nextDocQuote = 0x16F;
+ curDialog = &_dialog2;
+ } else {
+ nextDocQuote = 0x17B;
+ curDialog = &_dialog3;
+ }
+
+ handleSlacheDialogs(nextDocQuote, 2, 9999999);
+ if (addDialogLine) {
+ curDialog->write(_action._activeAction._verbId, false);
+ curDialog->write(addVerbId, true);
+ }
+
+ curDialog->start();
+ _game._player._stepEnabled = true;
+ _slacheMode = 3;
+ }
+ } else {
+ _nextAction2 = _nextAction1;
+ _nextAction1 = 6;
+ }
+ }
+ }
+
+ _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 c48017fc30..b284a2ef9b 100644
--- a/engines/mads/nebular/nebular_scenes3.h
+++ b/engines/mads/nebular/nebular_scenes3.h
@@ -282,6 +282,34 @@ public:
virtual void postActions() {};
};
+class Scene319: public Scene3xx {
+private:
+ Conversation _dialog1, _dialog2, _dialog3;
+
+ int _animMode, _animFrame;
+ int _nextAction1, _nextAction2;
+ int _slacheMode;
+ int _slacheTopic;
+ int _slachePosY;
+
+ bool _slacheTalkingFl;
+ bool _slacheReady;
+ bool _slacheInitFl;
+
+ Common::String _subQuote2;
+
+ void handleRexDialogues(int quote);
+ void handleSlacheDialogs(int quoteId, int counter, uint32 timer);
+public:
+ Scene319(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
diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp
index d6cf652760..d9a46a93ef 100644
--- a/engines/mads/palette.cpp
+++ b/engines/mads/palette.cpp
@@ -495,7 +495,8 @@ void Palette::setLowRange() {
_vm->_palette->setPalette(_mainPalette, 0, 4);
}
-void Palette::fadeOut(byte palette[PALETTE_SIZE], int v1, int v2, int v3, int v4, int v5, int v6) {
+void Palette::fadeOut(byte palette[PALETTE_SIZE], int start, int count, int v1, int v2, int v3, int v4, int v5, int v6) {
+ warning("TODO: Palette::fadeOut()");
}
void Palette::lock() {
diff --git a/engines/mads/palette.h b/engines/mads/palette.h
index 75aff7a6ec..0d808ce218 100644
--- a/engines/mads/palette.h
+++ b/engines/mads/palette.h
@@ -250,7 +250,7 @@ public:
warning("TODO: Palette::close");
}
- void fadeOut(byte palette[PALETTE_SIZE], int v1, int v2, int v3, int v4, int v5, int v6);
+ void fadeOut(byte palette[PALETTE_SIZE], int start, int count, int v1, int v2, int v3, int v4, int v5, int v6);
void lock();
void unlock();