aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2015-10-29 03:17:14 +0100
committerStrangerke2015-10-29 03:17:14 +0100
commitaf7a233d97fca1e52df6de66c508f5c34d4484bf (patch)
treeabaef8a866824d11868675f2c4112b0064ba9a21 /engines
parent73614e9415cb005926192530cf5da1318c70c483 (diff)
downloadscummvm-rg350-af7a233d97fca1e52df6de66c508f5c34d4484bf.tar.gz
scummvm-rg350-af7a233d97fca1e52df6de66c508f5c34d4484bf.tar.bz2
scummvm-rg350-af7a233d97fca1e52df6de66c508f5c34d4484bf.zip
MADS: Phantom: Implement scene 310
Diffstat (limited to 'engines')
-rw-r--r--engines/mads/animation.cpp6
-rw-r--r--engines/mads/animation.h3
-rw-r--r--engines/mads/game.cpp4
-rw-r--r--engines/mads/game.h1
-rw-r--r--engines/mads/messages.cpp14
-rw-r--r--engines/mads/messages.h3
-rw-r--r--engines/mads/phantom/phantom_scenes3.cpp210
-rw-r--r--engines/mads/phantom/phantom_scenes3.h35
8 files changed, 268 insertions, 8 deletions
diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp
index a36ac314b8..5020110db1 100644
--- a/engines/mads/animation.cpp
+++ b/engines/mads/animation.cpp
@@ -162,6 +162,7 @@ Animation::Animation(MADSEngine *vm, Scene *scene) : _vm(vm), _scene(scene) {
_flags = 0;
_font = nullptr;
_resetFlag = false;
+ _canChangeView = false;
_messageCtr = 0;
_skipLoad = false;
_freeFlag = false;
@@ -616,4 +617,9 @@ void Animation::eraseSprites() {
}
}
+Common::Point Animation::getFramePosAdjust(int idx) {
+ warning("TODO: Implement getFramePosAdjust");
+
+ return Common::Point(0, 0);
+}
} // End of namespace MADS
diff --git a/engines/mads/animation.h b/engines/mads/animation.h
index a967eaabe4..67adeeb8f8 100644
--- a/engines/mads/animation.h
+++ b/engines/mads/animation.h
@@ -189,6 +189,7 @@ public:
Common::Array<AnimUIEntry> _uiEntries;
Common::Array<AnimMessage> _messages;
bool _resetFlag;
+ bool _canChangeView;
int _currentFrame;
int _oldFrameEntry;
int _dynamicHotspotIndex;
@@ -236,6 +237,8 @@ public:
void resetSpriteSetsCount() { _header._spriteSetsCount = 0; } // CHECKME: See if it doesn't leak the memory when the destructor is called
SpriteAsset *getSpriteSet(int idx) { return _spriteSets[idx]; }
+
+ Common::Point getFramePosAdjust(int idx);
};
} // End of namespace MADS
diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp
index 8ddfd1e3fc..f5a5f3be59 100644
--- a/engines/mads/game.cpp
+++ b/engines/mads/game.cpp
@@ -605,5 +605,9 @@ void Game::syncTimers(int slave_type, int slave_id, int master_type, int master_
void Game::camPanTo(Camera *camera, int target) {
warning("TODO: Game::camPanTo");
+ if (camera) {
+ // Incomplete
+ camera->_panMode = 1;
+ }
}
} // End of namespace MADS
diff --git a/engines/mads/game.h b/engines/mads/game.h
index bdc7fc9d7a..30fcf99907 100644
--- a/engines/mads/game.h
+++ b/engines/mads/game.h
@@ -241,6 +241,7 @@ public:
typedef struct {
//TODO
bool _panFrame;
+ int _panMode;
} Camera;
Camera _camX, _camY;
diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp
index d88806150d..2bee77dae7 100644
--- a/engines/mads/messages.cpp
+++ b/engines/mads/messages.cpp
@@ -193,6 +193,10 @@ void KernelMessages::processText(int msgIndex) {
msg._timeout = 0;
}
+ if (msg._flags & KMSG_ANIM) {
+ warning("TODO: Implement animated text");
+ }
+
if ((msg._timeout <= 0) && (_vm->_game->_trigger == 0)) {
msg._flags |= KMSG_EXPIRE;
if (msg._trigger != 0) {
@@ -465,6 +469,16 @@ void KernelMessages::initRandomMessages(int maxSimultaneousMessages,
va_end(va);
}
+void KernelMessages::setAnim(int msgId, int seqId, int val3 = 0) {
+ if (msgId < 0)
+ return;
+
+ _entries[msgId]._flags |= KMSG_ANIM;
+ _entries[msgId]._sequenceIndex = seqId;
+
+ warning("TODO: KernelMessages::setAnim, unused parameter");
+}
+
/*------------------------------------------------------------------------*/
diff --git a/engines/mads/messages.h b/engines/mads/messages.h
index 764477a7fc..739b203b13 100644
--- a/engines/mads/messages.h
+++ b/engines/mads/messages.h
@@ -39,7 +39,7 @@ namespace MADS {
enum KernelMessageFlags {
KMSG_QUOTED = 1, KMSG_PLAYER_TIMEOUT = 2, KMSG_SEQ_ENTRY = 4, KMSG_SCROLL = 8,
KMSG_RIGHT_ALIGN = 0x10, KMSG_CENTER_ALIGN = 0x20, KMSG_EXPIRE = 0x40,
- KMSG_ACTIVE = 0x80
+ KMSG_ACTIVE = 0x80, KMSG_ANIM = 0x100
};
class MADSEngine;
@@ -104,6 +104,7 @@ public:
int addQuote(int quoteId, int endTrigger, uint32 timeout);
void scrollMessage(int msgIndex, int numTicks, bool quoted);
void setSeqIndex(int msgIndex, int seqIndex);
+ void setAnim(int msgId, int seqId, int val3);
void remove(int msgIndex);
void reset();
void update();
diff --git a/engines/mads/phantom/phantom_scenes3.cpp b/engines/mads/phantom/phantom_scenes3.cpp
index c864605039..434dc5707e 100644
--- a/engines/mads/phantom/phantom_scenes3.cpp
+++ b/engines/mads/phantom/phantom_scenes3.cpp
@@ -2560,5 +2560,215 @@ void Scene309::handleBoatAnimation() {
/*------------------------------------------------------------------------*/
+Scene310::Scene310(MADSEngine *vm) : Scene3xx(vm) {
+ _raoulMessageColor = -1;
+ _chrisMessageColor = -1;
+ _lakeFrame = -1;
+ for (int i = 0; i < 4; i++)
+ _multiplanePosX[i] = -1;
+}
+
+void Scene310::synchronize(Common::Serializer &s) {
+ Scene3xx::synchronize(s);
+
+ s.syncAsSint16LE(_raoulMessageColor);
+ s.syncAsSint16LE(_chrisMessageColor);
+ s.syncAsSint16LE(_lakeFrame);
+ for (int i = 0; i < 4; i++)
+ s.syncAsSint16LE(_multiplanePosX[i]);
+}
+
+void Scene310::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+}
+
+void Scene310::enter() {
+ warning("TODO: Switch to letter box view. See definition of MADS_MENU_Y");
+
+ for (int i = 0; i < 4; i++) {
+ _globals._spriteIndexes[i] = _scene->_sprites.addSprites(formAnimName('f', i), false);
+ _globals._sequenceIndexes[i] = -1;
+ }
+
+ _multiplanePosX[0] = 100;
+ _multiplanePosX[1] = 210;
+ _multiplanePosX[2] = 320;
+ _multiplanePosX[3] = 472;
+
+ _game.loadQuoteSet(0x66, 0x67, 0x69, 0x6A, 0x6C, 0x6D, 0x6E, 0x6F, 0x71, 0x72, 0x74, 0x70, 0x68, 0x73, 0x6B, 0);
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('l', 1), 80);
+ _scene->_animation[_globals._animationIndexes[0]]->_canChangeView = true;
+ _game._camX._panMode = 1;
+
+ _raoulMessageColor = 0x102;
+ _chrisMessageColor = 0x1110;
+
+ _scene->_userInterface.emptyConversationList();
+ _scene->_userInterface.setup(kInputConversation);
+
+ sceneEntrySound();
+}
+
+void Scene310::step() {
+ handleLakeAnimation();
+
+ if (_game._trigger == 80)
+ _scene->_nextSceneId = 309;
+
+ bool positionsSetFl = false;
+
+ if (_globals._animationIndexes[0] >= 0) {
+ MADS::Animation *anim = _scene->_animation[_globals._animationIndexes[0]];
+ int curFrame = anim->getCurrentFrame();
+ uint32 clock = anim->getNextFrameTimer();
+ if ((curFrame > 0) && (_scene->_frameStartTime >= clock)) {
+ Common::Point pos = anim->getFramePosAdjust(curFrame);
+ if (pos.x != _scene->_posAdjust.x) {
+ setMultiplanePos(pos.x);
+ positionsSetFl = true;
+ }
+ }
+ }
+
+ if (!positionsSetFl && (_game._fx != kTransitionNone))
+ setMultiplanePos(320);
+}
+
+void Scene310::actions() {
+}
+
+void Scene310::preActions() {
+}
+
+void Scene310::setMultiplanePos(int x_new) {
+ int center = x_new + 160;
+
+ for (int i = 0; i < 4; i++) {
+ if (_globals._sequenceIndexes[i] >= 0)
+ _scene->deleteSequence(_globals._sequenceIndexes[i]);
+
+ int difference = center - _multiplanePosX[i];
+
+ int direction = 0;
+ if (difference < 0)
+ direction = 1;
+ else if (difference > 0)
+ direction = -1;
+
+ int displace = abs(difference);
+ if (direction < 0)
+ displace = -displace;
+
+ int x = _multiplanePosX[i] + displace - 1;
+ int y = _scene->_sprites[_globals._spriteIndexes[i]]->getFrameWidth(0) + 29;
+ int halfWidth = 1 + (_scene->_sprites[_globals._spriteIndexes[i]]->getFrameHeight(0) / 2);
+
+ if (((x - halfWidth) >= (x_new + 320)) || ((x + halfWidth) < x_new))
+ _globals._sequenceIndexes[i] = -1;
+ else {
+ _globals._sequenceIndexes[i] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[i], false, 1);
+ _scene->_sequences.setPosition(_globals._sequenceIndexes[i], Common::Point(x, y));
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[i], 1);
+ }
+ }
+}
+
+void Scene310::handleLakeAnimation() {
+ if (_scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame() == _lakeFrame)
+ return;
+
+
+ _lakeFrame = _scene->_animation[_globals._animationIndexes[0]]->getCurrentFrame();
+ int resetFrame = -1;
+ int id;
+
+ switch (_lakeFrame) {
+ case 60:
+ id = _scene->_kernelMessages.add(Common::Point(-142, 0), _chrisMessageColor, 0, 61, 600, _game.getQuote(0x66));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ id = _scene->_kernelMessages.add(Common::Point(-142, 15), _chrisMessageColor, 0, 0, 600, _game.getQuote(0x67));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ id = _scene->_kernelMessages.add(Common::Point(-142, 30), _chrisMessageColor, 0, 0, 600, _game.getQuote(0x68));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ break;
+
+ case 120:
+ _scene->_kernelMessages.reset();
+ break;
+
+ case 140:
+ id = _scene->_kernelMessages.add(Common::Point(-120, 0), _chrisMessageColor, 0, 63, 360, _game.getQuote(0x69));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ id = _scene->_kernelMessages.add(Common::Point(-120, 15), _chrisMessageColor, 0, 0, 360, _game.getQuote(0x6A));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ id = _scene->_kernelMessages.add(Common::Point(-120, 30), _chrisMessageColor, 0, 0, 360, _game.getQuote(0x6B));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ break;
+
+ case 200:
+ _scene->_kernelMessages.reset();
+ break;
+
+ case 220:
+ id = _scene->_kernelMessages.add(Common::Point(-32, 30), _chrisMessageColor, 0, 65, 240, _game.getQuote(0x6C));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ id = _scene->_kernelMessages.add(Common::Point(-32, 45), _chrisMessageColor, 0, 0, 240, _game.getQuote(0x6D));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ break;
+
+ case 280:
+ _scene->_kernelMessages.reset();
+ break;
+
+ case 300:
+ id = _scene->_kernelMessages.add(Common::Point(101, 0), _raoulMessageColor, 0, 67, 360, _game.getQuote(0x6E));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ id = _scene->_kernelMessages.add(Common::Point(101, 15), _raoulMessageColor, 0, 0, 360, _game.getQuote(0x6F));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ id = _scene->_kernelMessages.add(Common::Point(101, 30), _raoulMessageColor, 0, 0, 360, _game.getQuote(0x70));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ break;
+
+ case 360:
+ _scene->_kernelMessages.reset();
+ break;
+
+ case 380:
+ id = _scene->_kernelMessages.add(Common::Point(107, 0), _chrisMessageColor, 0, 69, 360, _game.getQuote(0x71));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ id = _scene->_kernelMessages.add(Common::Point(107, 15), _chrisMessageColor, 0, 0, 360, _game.getQuote(0x72));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ id = _scene->_kernelMessages.add(Common::Point(107, 30), _chrisMessageColor, 0, 0, 360, _game.getQuote(0x73));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ break;
+
+ case 440:
+ _scene->_kernelMessages.reset();
+ break;
+
+ case 460:
+ id = _scene->_kernelMessages.add(Common::Point(107, 7), _chrisMessageColor, 0, 0, 180, _game.getQuote(0x74));
+ _scene->_kernelMessages.setAnim(id, _globals._animationIndexes[0], 0);
+ break;
+
+ case 510:
+ _scene->_kernelMessages.reset();
+ break;
+
+ default:
+ break;
+ }
+
+ if (resetFrame >= 0) {
+ _scene->setAnimFrame(_globals._animationIndexes[0], resetFrame);
+ _lakeFrame = resetFrame;
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
} // End of namespace Phantom
} // End of namespace MADS
diff --git a/engines/mads/phantom/phantom_scenes3.h b/engines/mads/phantom/phantom_scenes3.h
index b6ecfe667e..bea020396f 100644
--- a/engines/mads/phantom/phantom_scenes3.h
+++ b/engines/mads/phantom/phantom_scenes3.h
@@ -11,7 +11,7 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
@@ -55,12 +55,12 @@ public:
class Scene301 : public Scene3xx {
private:
- bool _anim0ActvFl;
- bool _skip1Fl;
- bool _skip2Fl;
+ bool _anim0ActvFl;
+ bool _skip1Fl;
+ bool _skip2Fl;
- int _lightingHotspotId;
- int _sandbagHotspotId;
+ int _lightingHotspotId;
+ int _sandbagHotspotId;
public:
Scene301(MADSEngine *vm);
@@ -87,7 +87,7 @@ public:
class Scene303 : public Scene3xx {
private:
- bool _anim0ActvFl;
+ bool _anim0ActvFl;
int _hempHotspotId;
int _skipFrameCheckFl;
public:
@@ -221,6 +221,27 @@ public:
virtual void preActions();
virtual void actions();
};
+
+class Scene310 : public Scene3xx {
+private:
+ int _raoulMessageColor;
+ int _chrisMessageColor;
+ int _multiplanePosX[4];
+ int _lakeFrame;
+
+ void setMultiplanePos(int x_new);
+ void handleLakeAnimation();
+
+public:
+ Scene310(MADSEngine *vm);
+ virtual void synchronize(Common::Serializer &s);
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+};
} // End of namespace Phantom
} // End of namespace MADS