aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2014-04-18 21:54:21 +0200
committerStrangerke2014-04-18 21:55:00 +0200
commit058e1ae575cdb6acdc9625076c6449d2600c559c (patch)
tree4a31429b1fdee84abe0bfce35002f0beecbd54eb
parentcce0a4a3cf2f3380c25109f055e8b0d87b4c8b32 (diff)
downloadscummvm-rg350-058e1ae575cdb6acdc9625076c6449d2600c559c.tar.gz
scummvm-rg350-058e1ae575cdb6acdc9625076c6449d2600c559c.tar.bz2
scummvm-rg350-058e1ae575cdb6acdc9625076c6449d2600c559c.zip
MADS: Implement scene 309
-rw-r--r--engines/mads/animation.h7
-rw-r--r--engines/mads/nebular/nebular_scenes.cpp2
-rw-r--r--engines/mads/nebular/nebular_scenes3.cpp195
-rw-r--r--engines/mads/nebular/nebular_scenes3.h18
4 files changed, 214 insertions, 8 deletions
diff --git a/engines/mads/animation.h b/engines/mads/animation.h
index 3b0341780c..1fff2c48d1 100644
--- a/engines/mads/animation.h
+++ b/engines/mads/animation.h
@@ -136,15 +136,13 @@ class Animation {
private:
MADSEngine *_vm;
Scene *_scene;
- AAHeader _header;
- Common::Array<int> _spriteListIndexes;
Common::Array<AnimMessage> _messages;
Common::Array<AnimMiscEntry> _miscEntries;
Common::Array<SpriteAsset *> _spriteSets;
Font *_font;
- int _currentFrame, _oldFrameEntry;
+ int _currentFrame;
bool _freeFlag;
bool _skipLoad;
int _unkIndex;
@@ -177,9 +175,12 @@ private:
protected:
Animation(MADSEngine *vm, Scene *scene);
public:
+ AAHeader _header;
+ Common::Array<int> _spriteListIndexes;
Common::Array<AnimFrameEntry> _frameEntries;
Common::Array<AnimUIEntry> _uiEntries;
bool _resetFlag;
+ int _oldFrameEntry;
static Animation *init(MADSEngine *vm, Scene *scene);
/*
diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp
index edefd5bf5f..9978f574e8 100644
--- a/engines/mads/nebular/nebular_scenes.cpp
+++ b/engines/mads/nebular/nebular_scenes.cpp
@@ -115,6 +115,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) {
return new Scene307(vm);
case 308:
return new Scene308(vm);
+ case 309:
+ return new Scene309(vm);
// Scene group #8
case 804:
diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp
index e107c67121..aefc0189cc 100644
--- a/engines/mads/nebular/nebular_scenes3.cpp
+++ b/engines/mads/nebular/nebular_scenes3.cpp
@@ -1149,7 +1149,7 @@ void Scene308::enter() {
_scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9);
_scene->_sequences.addTimer(48, 70);
- _game._player._visible = false;
+ _game._player._visible = false;
_game._player._stepEnabled = false;
_scene->loadAnimation(formAnimName('a', -1), 60);
@@ -1198,8 +1198,8 @@ void Scene308::step() {
break;
case 73: {
- int seqIdx = _globals._sequenceIndexes[3];
- _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 5);
+ int seqIdx = _globals._sequenceIndexes[3];
+ _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 5);
_scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9);
_scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], seqIdx);
_scene->_sequences.addTimer(48, 74);
@@ -1219,7 +1219,7 @@ void Scene308::step() {
break;
case 75: {
- int seqIdx = _globals._sequenceIndexes[3];
+ int seqIdx = _globals._sequenceIndexes[3];
_globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 23, 5, 0, 0);
_scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 8, 10);
_scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9);
@@ -1229,7 +1229,7 @@ void Scene308::step() {
break;
case 76: {
- int seqIdx = _globals._sequenceIndexes[3];
+ int seqIdx = _globals._sequenceIndexes[3];
_globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 26, 0, 0, 0);
_scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 2, 3);
_scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9);
@@ -1247,5 +1247,190 @@ void Scene308::step() {
/*------------------------------------------------------------------------*/
+void Scene309::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene309::enter() {
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*SC003x0");
+ _globals._spriteIndexes[0] = _scene->_sprites.addSprites("*SC003x1");
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*SC003x2");
+
+ initForceField(&_forceField, true);
+
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 0));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(Resources::formatName(307, 'X', 0, EXT_SS, ""));
+
+ _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);
+
+ _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 7, 1, 0, 0);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -1, 3);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 11);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 3, 70);
+
+ _vm->_palette->setEntry(252, 63, 37, 26);
+ _vm->_palette->setEntry(253, 45, 24, 17);
+ _vm->_palette->setEntry(16, 63, 63, 63);
+ _vm->_palette->setEntry(17, 45, 45, 45);
+ _vm->_palette->setEntry(250, 63, 20, 20);
+ _vm->_palette->setEntry(251, 45, 10, 10);
+
+ _game._player._visible = false;
+ _game._player._stepEnabled = false;
+ _scene->loadAnimation(formAnimName('a', -1), 60);
+
+ _characterSpriteIndexes[0] = _scene->_activeAnimation->_spriteListIndexes[2];
+ _characterSpriteIndexes[1] = _scene->_activeAnimation->_spriteListIndexes[2];
+ _characterSpriteIndexes[2] = _scene->_activeAnimation->_spriteListIndexes[1];
+
+ _messagesIndexes[0] = -1;
+ _messagesIndexes[1] = -1;
+ _messagesIndexes[2] = -1;
+
+ sceneEntrySound();
+
+ _game.loadQuoteSet(0xF7, 0xF8, 0xF9, 0x15C, 0x15D, 0x15E, 0);
+}
+
+void Scene309::step() {
+ handleForceField(&_forceField, &_globals._spriteIndexes[0]);
+
+ if (_game._trigger == 61) {
+ _messagesIndexes[0] = -1;
+ _messagesIndexes[1] = -1;
+ }
+
+ if (_game._trigger == 62)
+ _messagesIndexes[2] = -1;
+
+ if (_scene->_activeAnimation != nullptr) {
+ if (_lastFrame != _scene->_activeAnimation->getCurrentFrame()) {
+ _lastFrame = _scene->_activeAnimation->getCurrentFrame();
+ if (_lastFrame == 39) {
+ _messagesIndexes[0] = _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 32, 61, 210, _game.getQuote(348));
+ _messagesIndexes[1] = _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 32, 0, 210, _game.getQuote(349));
+ }
+
+ if (_lastFrame == 97)
+ _messagesIndexes[2] = _scene->_kernelMessages.add(Common::Point(0, 0), 0xFBFA, 32, 62, 180, _game.getQuote(350));
+
+ for (int charIdx = 0; charIdx < 3; charIdx++) {
+ if (_messagesIndexes[charIdx] >= 0) {
+ bool match = false;
+ int j = -1;
+ for (j = _scene->_activeAnimation->_oldFrameEntry; j < _scene->_activeAnimation->_header._frameEntriesCount; j++) {
+ if (_scene->_activeAnimation->_frameEntries[j]._spriteSlot._spritesIndex == _characterSpriteIndexes[charIdx]) {
+ match = true;
+ break;
+ }
+ }
+
+ if (match) {
+ SpriteSlotSubset *curSpriteSlot = &_scene->_activeAnimation->_frameEntries[j]._spriteSlot;
+ _scene->_kernelMessages._entries[_messagesIndexes[charIdx]]._position.x = curSpriteSlot->_position.x;
+ _scene->_kernelMessages._entries[_messagesIndexes[charIdx]]._position.y = curSpriteSlot->_position.y - (50 + (14 * ((charIdx == 0) ? 2 : 1)));
+ }
+ }
+ }
+ }
+ }
+
+ if (_game._trigger >= 70) {
+ switch (_game._trigger) {
+ case 70: {
+ int idx = _scene->_dynamicHotspots.add(689, 690, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(142, 146), FACING_NORTHEAST);
+ _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 7, 4, 0, 0);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 2, 3);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 11);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 71);
+ }
+ break;
+
+ case 71: {
+ int _oldIdx = _globals._sequenceIndexes[3];
+ _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 7, 1, 0, 0);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 4, 7);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 11);
+ _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], _oldIdx);
+ int idx = _scene->_kernelMessages.add(Common::Point(85, 37), 0xFDFC, 0, 0, 120, _game.getQuote(248));
+ _scene->_kernelMessages.setQuoted(idx, 2, true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 72);
+ }
+ break;
+
+ case 72: {
+ int _oldIdx = _globals._sequenceIndexes[3];
+ _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 7, 8, 0, 0);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 8, 11);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 11);
+ _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], _oldIdx);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 73);
+ }
+ break;
+
+ case 73: {
+ int _oldIdx = _globals._sequenceIndexes[3];
+ _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 7, 1, 0, 0);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 12, 20);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 11);
+ _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], _oldIdx);
+ int idx = _scene->_kernelMessages.add(Common::Point(170, 49), 0xFDFC, 0, 0, 120, _game.getQuote(249));
+ _scene->_kernelMessages.setQuoted(idx, 2, true);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 74);
+ }
+ break;
+
+ case 74: {
+ int _oldIdx = _globals._sequenceIndexes[3];
+ _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 7, 6, 0, 0);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 21, 23);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 11);
+ _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], _oldIdx);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 75);
+ }
+ break;
+
+ case 75: {
+ int _oldIdx = _globals._sequenceIndexes[3];
+ _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 6, 0, 0);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 24, 25);
+ _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], _oldIdx);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 11);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 76);
+ }
+ break;
+
+ case 76: {
+ int _oldIdx = _globals._sequenceIndexes[3];
+ _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 26, 28);
+ _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], _oldIdx);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 11);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 77);
+ }
+ break;
+
+ case 77: {
+ _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 90, 0, 0, 0);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 29, 30);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 11);
+ int idx = _scene->_kernelMessages.add(Common::Point(15, 46), 0xFDFC, 0, 0, 120, _game.getQuote(247));
+ _scene->_kernelMessages.setQuoted(idx, 2, true);
+ _scene->_sequences.addTimer(120, 78);
+ }
+ break;
+ }
+ }
+
+ if (_game._trigger == 60)
+ _scene->_nextSceneId = 308;
+}
+
+/*------------------------------------------------------------------------*/
+
} // 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 d841ce6e3c..4ca2c5a9ad 100644
--- a/engines/mads/nebular/nebular_scenes3.h
+++ b/engines/mads/nebular/nebular_scenes3.h
@@ -170,6 +170,24 @@ public:
virtual void postActions() {};
};
+class Scene309: public Scene3xx {
+private:
+ ForceField _forceField;
+ int _characterSpriteIndexes[3];
+ int _messagesIndexes[3];
+ int _lastFrame;
+
+public:
+ Scene309(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