diff options
author | Strangerke | 2015-10-10 17:32:51 +0200 |
---|---|---|
committer | Strangerke | 2015-10-10 17:32:51 +0200 |
commit | 3ffa01ec2a4482441f0147c0947a600def0a178b (patch) | |
tree | 44739e6c24df2611785db8eb3cb88e3f9ef6378c /engines | |
parent | 7fbbf515932a32447fce1c2785936d3f2277bcaa (diff) | |
download | scummvm-rg350-3ffa01ec2a4482441f0147c0947a600def0a178b.tar.gz scummvm-rg350-3ffa01ec2a4482441f0147c0947a600def0a178b.tar.bz2 scummvm-rg350-3ffa01ec2a4482441f0147c0947a600def0a178b.zip |
MADS: Phantom: Implement Scene101::enter(), add some empty (new) engine functions
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mads/conversations.cpp | 47 | ||||
-rw-r--r-- | engines/mads/conversations.h | 54 | ||||
-rw-r--r-- | engines/mads/hotspots.cpp | 5 | ||||
-rw-r--r-- | engines/mads/hotspots.h | 11 | ||||
-rw-r--r-- | engines/mads/mads.cpp | 11 | ||||
-rw-r--r-- | engines/mads/mads.h | 3 | ||||
-rw-r--r-- | engines/mads/module.mk | 1 | ||||
-rw-r--r-- | engines/mads/phantom/phantom_scenes1.cpp | 112 | ||||
-rw-r--r-- | engines/mads/phantom/phantom_scenes1.h | 16 | ||||
-rw-r--r-- | engines/mads/player.cpp | 16 | ||||
-rw-r--r-- | engines/mads/player.h | 6 | ||||
-rw-r--r-- | engines/mads/scene.cpp | 7 | ||||
-rw-r--r-- | engines/mads/scene.h | 3 | ||||
-rw-r--r-- | engines/mads/sequence.cpp | 5 | ||||
-rw-r--r-- | engines/mads/sequence.h | 2 |
15 files changed, 291 insertions, 8 deletions
diff --git a/engines/mads/conversations.cpp b/engines/mads/conversations.cpp new file mode 100644 index 0000000000..451142aeb7 --- /dev/null +++ b/engines/mads/conversations.cpp @@ -0,0 +1,47 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "mads/conversations.h" +#include "mads/mads.h" + +namespace MADS { + +GameConversation::GameConversation(MADSEngine *vm) + : _vm(vm) { + _restoreRunning = 0; +} + +GameConversation::~GameConversation() { +} + +void GameConversation::get(int id) { + warning("TODO GameConversation::get"); +} + +void GameConversation::run(int id) { + warning("TODO GameConversation::run"); +} + +void GameConversation::exportPointer(int *val) { + warning("TODO GameConversation::exportPointer"); +} +} // End of namespace MADS diff --git a/engines/mads/conversations.h b/engines/mads/conversations.h new file mode 100644 index 0000000000..fe128adf43 --- /dev/null +++ b/engines/mads/conversations.h @@ -0,0 +1,54 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_CONVERSATIONS_H +#define MADS_CONVERSATIONS_H + +namespace MADS { + +class MADSEngine; + +class GameConversation { +private: + MADSEngine *_vm; + +public: + /** + * Constructor + */ + GameConversation(MADSEngine *vm); + + /** + * Destructor + */ + virtual ~GameConversation(); + + void get(int id); + void run(int id); + void exportPointer(int *val); + + int _restoreRunning; +}; + +} // End of namespace MADS + +#endif /* MADS_CONVERSATIONS_H */ diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp index 8afef2e524..2235bf5f4b 100644 --- a/engines/mads/hotspots.cpp +++ b/engines/mads/hotspots.cpp @@ -52,6 +52,11 @@ DynamicHotspots::DynamicHotspots(MADSEngine *vm) : _vm(vm) { _count = 0; } +int DynamicHotspots::add(int descId, int verbId, int syntax, int seqIndex, const Common::Rect &bounds) { + warning("TODO: DynamicHotspots::add(5 params))"); + return add(descId, verbId, seqIndex, bounds); +} + int DynamicHotspots::add(int descId, int verbId, int seqIndex, const Common::Rect &bounds) { // Find a free slot uint idx = 0; diff --git a/engines/mads/hotspots.h b/engines/mads/hotspots.h index 902275bb21..12b7e99602 100644 --- a/engines/mads/hotspots.h +++ b/engines/mads/hotspots.h @@ -56,6 +56,16 @@ public: #define DYNAMIC_HOTSPOTS_SIZE 8 +#define SYNTAX_SINGULAR 0 +#define SYNTAX_PLURAL 1 +#define SYNTAX_PARTITIVE 2 +#define SYNTAX_SINGULAR_MASC 3 +#define SYNTAX_SINGULAR_FEM 4 +#define SYNTAX_SINGULAR_LIVING 5 +#define SYNTAX_MASC_NOT_PROPER 6 +#define SYNTAX_FEM_NOT_PROPER 7 +#define MAX_SYNTAX 8 + class DynamicHotspots { private: MADSEngine *_vm; @@ -68,6 +78,7 @@ public: Common::Array<MADS::DynamicHotspot>::size_type size() const { return _entries.size(); } DynamicHotspot &operator[](uint idx) { return _entries[idx]; } + int add(int descId, int verbId, int syntax, int seqIndex, const Common::Rect &bounds); int add(int descId, int verbId, int seqIndex, const Common::Rect &bounds); int setPosition(int index, const Common::Point &pos, Facing facing); int setCursor(int index, CursorType cursor); diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 8c7b6b1ce3..0bdf484c9a 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -46,12 +46,14 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : _musicFlag = true; _soundFlag = true; _dithering = false; + _disableFastwalk = false; _debugger = nullptr; _dialogs = nullptr; _events = nullptr; _font = nullptr; _game = nullptr; + _gameConv = nullptr; _palette = nullptr; _resources = nullptr; _sound = nullptr; @@ -65,6 +67,7 @@ MADSEngine::~MADSEngine() { delete _font; Font::deinit(); delete _game; + delete _gameConv; delete _palette; delete _resources; delete _sound; @@ -96,6 +99,14 @@ void MADSEngine::initialize() { _audio = new AudioPlayer(_mixer, getGameID()); _game = Game::init(this); + switch (getGameID()) { + case GType_RexNebular: + _gameConv = nullptr; + break; + default: + _gameConv = new GameConversation(this); + } + loadOptions(); _screen.empty(); diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 901035320a..1b0f96a656 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -30,6 +30,7 @@ #include "common/util.h" #include "engines/engine.h" #include "graphics/surface.h" +#include "mads/conversations.h" #include "mads/debugger.h" #include "mads/dialogs.h" #include "mads/events.h" @@ -96,6 +97,7 @@ public: EventsManager *_events; Font *_font; Game *_game; + GameConversation * _gameConv; Palette *_palette; Resources *_resources; ScreenSurface _screen; @@ -108,6 +110,7 @@ public: bool _musicFlag; bool _soundFlag; bool _dithering; + bool _disableFastwalk; public: MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc); virtual ~MADSEngine(); diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 7cb7a91e8c..9c79068ed2 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -26,6 +26,7 @@ MODULE_OBJS := \ assets.o \ audio.o \ compression.o \ + conversations.o \ debugger.o \ detection.o \ dialogs.o \ diff --git a/engines/mads/phantom/phantom_scenes1.cpp b/engines/mads/phantom/phantom_scenes1.cpp index 97ff94ee94..e47505d318 100644 --- a/engines/mads/phantom/phantom_scenes1.cpp +++ b/engines/mads/phantom/phantom_scenes1.cpp @@ -22,6 +22,7 @@ #include "common/scummsys.h" #include "mads/mads.h" +#include "mads/conversations.h" #include "mads/scene.h" #include "mads/phantom/phantom_scenes.h" #include "mads/phantom/phantom_scenes1.h" @@ -117,30 +118,129 @@ void Scene1xx::setPlayerSpritesPrefix() { /*------------------------------------------------------------------------*/ Scene101::Scene101(MADSEngine *vm) : Scene1xx(vm) { - + _execute_chan = -1; + _execute_wipe = -1; + _brie_calling_position = -1; + _brie_chandelier_position = -1; + _brie_calling_frame = -1; + _brie_chandelier_frame = -1; + _talk_count = -1; + _dynamic_brie = 0; + _dynamic_brie_2 = 0; + _start_walking = false; + _start_walking_0 = false; + _anim_0_running = false; + _anim_1_running = false; + _start_sitting_down = false; } void Scene101::synchronize(Common::Serializer &s) { Scene1xx::synchronize(s); + s.syncAsSint16LE(_execute_chan); + s.syncAsSint16LE(_execute_wipe); + s.syncAsSint16LE(_brie_calling_position); + s.syncAsSint16LE(_brie_chandelier_position); + s.syncAsSint16LE(_brie_calling_frame); + s.syncAsSint16LE(_brie_chandelier_frame); + s.syncAsSint16LE(_talk_count); + s.syncAsSint16LE(_dynamic_brie); + s.syncAsSint16LE(_dynamic_brie_2); + s.syncAsByte(_start_walking); + s.syncAsByte(_start_walking_0); + s.syncAsByte(_anim_0_running); + s.syncAsByte(_anim_1_running); + s.syncAsByte(_start_sitting_down); } void Scene101::setup() { setPlayerSpritesPrefix(); setAAName(); + _scene->addActiveVocab(NOUN_MONSIEUR_BRIE); } void Scene101::enter() { - // TODO + _vm->_disableFastwalk = true; + + if (_scene->_priorSceneId != RETURNING_FROM_DIALOG) { + _execute_chan = -1; + _execute_wipe = -1; + _start_walking = false; + _start_walking_0 = false; + _anim_0_running = true; + _anim_1_running = false; + _start_sitting_down = false; + } + + // Load Dialogs + _vm->_gameConv->get(0); + _vm->_gameConv->get(1); if (_globals[kCurrentYear] == 1993) { _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('z', -1)); - // TODO - //_scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14); + _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14); } else { - // TODO + _scene->_hotspots.activate(NOUN_CHANDELIER, false); } - // TODO + if (_globals[kBrieTalkStatus] == 0) { + _game._player.firstWalk(Common::Point(-20, 75), FACING_EAST, Common::Point(18, 79), FACING_EAST, true); + _brie_calling_position = 0; + _brie_chandelier_position = 3; + _game._player.setWalkTrigger(50); + + _scene->loadAnimation(formAnimName('b', 9), 1, 1); + _scene->loadAnimation(formAnimName('b', 8), 1, 0); + + _anim_0_running = true; + _anim_1_running = true; + + _dynamic_brie = _scene->_dynamicHotspots.add(NOUN_MONSIEUR_BRIE, VERB_WALKTO, SYNTAX_SINGULAR_MASC, -1, Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots[_dynamic_brie]._articleNumber = PREP_ON; + _scene->_dynamicHotspots.setPosition(_dynamic_brie, Common::Point(490, 119), FACING_NONE); + _scene->setDynamicAnim(_dynamic_brie, 0, 0); + _scene->setDynamicAnim(_dynamic_brie, 0, 1); + _scene->setDynamicAnim(_dynamic_brie, 0, 2); + _scene->setDynamicAnim(_dynamic_brie, 0, 3); + _scene->setDynamicAnim(_dynamic_brie, 0, 4); + + _dynamic_brie_2 = _scene->_dynamicHotspots.add(NOUN_MONSIEUR_BRIE, VERB_WALKTO, SYNTAX_SINGULAR_MASC, -1, Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots[_dynamic_brie_2]._articleNumber = PREP_ON; + _scene->_dynamicHotspots.setPosition(_dynamic_brie_2, Common::Point(25, 80), FACING_NONE); + _scene->setDynamicAnim(_dynamic_brie_2, 1, 1); + _scene->setDynamicAnim(_dynamic_brie_2, 1, 2); + + _talk_count = 0; + } else if (_globals[kBrieTalkStatus] == 1) { + _scene->loadAnimation(formAnimName('b', 9), 1, 1); + _dynamic_brie = _scene->_dynamicHotspots.add(NOUN_MONSIEUR_BRIE, VERB_WALKTO, SYNTAX_SINGULAR_MASC, -1, Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots[_dynamic_brie]._articleNumber = PREP_ON; + _scene->setDynamicAnim(_dynamic_brie, 1, 1); + _scene->setDynamicAnim(_dynamic_brie, 1, 2); + _anim_1_running = true; + _talk_count = 0; + _brie_chandelier_position = 3; + + if (_vm->_gameConv->_restoreRunning == 1) { + _vm->_gameConv->run(1); + _vm->_gameConv->exportPointer(&_globals[kPlayerScore]); + _brie_chandelier_position = 4; + if (_scene->_animation[1]) + _scene->_animation[1]->setCurrentFrame(25); + } + } else { + if (_scene->_priorSceneId == 202) { + if (_globals[kJacquesStatus] == 1) + _globals[kJacquesStatus] = 2; + + _game._player.firstWalk(Common::Point(-20, 75), FACING_EAST, Common::Point(18, 79), FACING_EAST, true); + } else if ((_scene->_priorSceneId == 102) || (_scene->_priorSceneId != RETURNING_FROM_LOADING)) { + _game._player.firstWalk(Common::Point(655, 130), FACING_WEST, Common::Point(625, 127), FACING_WEST, true); + _scene->setCamera(Common::Point(320, 0)); + } + } + + sceneEntrySound(); } void Scene101::step() { diff --git a/engines/mads/phantom/phantom_scenes1.h b/engines/mads/phantom/phantom_scenes1.h index 0f5f56a4cf..60cb63bd0b 100644 --- a/engines/mads/phantom/phantom_scenes1.h +++ b/engines/mads/phantom/phantom_scenes1.h @@ -55,8 +55,20 @@ public: class Scene101 : public Scene1xx { private: - // TODO - + int _execute_chan; + int _execute_wipe; + int _brie_calling_position; + int _brie_chandelier_position; + int _brie_calling_frame; + int _brie_chandelier_frame; + int _talk_count; + int _dynamic_brie; + int _dynamic_brie_2; + bool _start_walking; + bool _start_walking_0; + bool _anim_0_running; + bool _anim_1_running; + bool _start_sitting_down; public: Scene101(MADSEngine *vm); virtual void synchronize(Common::Serializer &s); diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 10c93e55ab..ce8ab37eda 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -81,6 +81,8 @@ Player::Player(MADSEngine *vm) _walkOffScreen = 0; _walkOffScreenSceneId = -1; _forcePrefix = false; + _commandsAllowed = false; + _enableAtTarget = false; Common::fill(&_stopWalkerList[0], &_stopWalkerList[12], 0); Common::fill(&_stopWalkerTrigger[0], &_stopWalkerTrigger[12], 0); @@ -798,4 +800,18 @@ void Player::removePlayerSprites() { _visible = false; } +void Player::firstWalk(Common::Point fromPos, Facing fromFacing, Common::Point destPos, Facing destFacing, bool enableFl) { + _playerPos = fromPos; + _facing = fromFacing; + + walk(destPos, destFacing); + _walkAnywhere = true; + + _commandsAllowed = false; + _enableAtTarget = enableFl; +} + +void Player::setWalkTrigger(int val) { + warning("TODO: Player::setWalkTrigger"); +} } // End of namespace MADS diff --git a/engines/mads/player.h b/engines/mads/player.h index d2cdd47df0..d4b703ff95 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -134,6 +134,8 @@ public: bool _forcePrefix; bool _needToWalk; bool _readyToWalk; + bool _commandsAllowed; + bool _enableAtTarget; int _stopWalkerIndex; int _centerOfGravity; int _currentDepth; @@ -222,6 +224,10 @@ public: } void removePlayerSprites(); + + void firstWalk(Common::Point fromPos, Facing fromFacing, Common::Point destPos, Facing destFacing, bool enableFl); + + void setWalkTrigger(int val); }; } // End of namespace MADS diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 9eb6a1aa86..b02c57e6a2 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -744,4 +744,11 @@ void Scene::synchronize(Common::Serializer &s) { _dynamicHotspots.synchronize(s); } +void Scene::setDynamicAnim(int id, int anim_id, int segment) { + warning("TODO: Scene::setDynamicAnim"); +} + +void Scene::setCamera(Common::Point pos) { + warning("TODO: Scene::setCamera"); +} } // End of namespace MADS diff --git a/engines/mads/scene.h b/engines/mads/scene.h index a29f8a0ded..ba37b97339 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -248,6 +248,9 @@ public: * Synchronize the game */ void synchronize(Common::Serializer &s); + + void setDynamicAnim(int id, int anim_id, int segment); + void setCamera(Common::Point pos); }; } // End of namespace MADS diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index e5bf1631c2..dc670062e1 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -550,4 +550,9 @@ void SequenceList::setMotion(int seqIndex, int flags, int deltaX, int deltaY) { se._posAccum.x = se._posAccum.y = 0; } +int SequenceList::addStampCycle(int srcSpriteIdx, bool flipped, int sprite) { + warning("TODO: SequenceList::addStampCycle"); + return -1; +} + } // End of namespace diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index c3a277c5a5..df491703d4 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -125,6 +125,8 @@ public: void setMsgLayout(int seqIndex); void setDone(int seqIndex); void setMotion(int seqIndex, int flags, int deltaX, int deltaY); + + int addStampCycle(int srcSpriteIdx, bool flipped, int sprite); }; } // End of namespace MADS |