diff options
-rw-r--r-- | engines/mads/conversations.cpp | 19 | ||||
-rw-r--r-- | engines/mads/conversations.h | 23 | ||||
-rw-r--r-- | engines/mads/dragonsphere/dragonsphere_scenes1.cpp | 4 | ||||
-rw-r--r-- | engines/mads/phantom/phantom_scenes1.cpp | 22 | ||||
-rw-r--r-- | engines/mads/phantom/phantom_scenes2.cpp | 22 | ||||
-rw-r--r-- | engines/mads/phantom/phantom_scenes3.cpp | 8 | ||||
-rw-r--r-- | engines/mads/phantom/phantom_scenes5.cpp | 14 |
7 files changed, 67 insertions, 45 deletions
diff --git a/engines/mads/conversations.cpp b/engines/mads/conversations.cpp index 5f304860e7..0f51d96c0c 100644 --- a/engines/mads/conversations.cpp +++ b/engines/mads/conversations.cpp @@ -45,7 +45,7 @@ GameConversations::GameConversations(MADSEngine *vm) : _vm(vm) { GameConversations::~GameConversations() { } -void GameConversations::get(int id) { +void GameConversations::load(int id) { // Scan through the conversation list for a free slot int slotIndex = -1; for (int idx = 0; idx < MAX_CONVERSATIONS && slotIndex == -1; ++idx) { @@ -59,10 +59,12 @@ void GameConversations::get(int id) { _conversations[slotIndex]._convId = id; // Load the conversation data - Common::String cnvFilename = Common::String::format("CONV%03d.CNV", id); + Common::String cnvFilename = Common::String::format("CONV%03d.CNV", id); _conversations[slotIndex]._data.load(cnvFilename); - // TODO: Also handle the .CND file + // Load the conversation's CND data + Common::String cndFilename = Common::String::format("CONV%03d.CND", id); + _conversations[slotIndex]._cnd.load(cndFilename); } ConversationEntry *GameConversations::getConv(int convId) { @@ -74,7 +76,6 @@ ConversationEntry *GameConversations::getConv(int convId) { return nullptr; } - void GameConversations::run(int id) { // If another conversation is running, then stop it first if (_runningConv) @@ -150,8 +151,8 @@ void GameConversations::start() { void GameConversations::setVariable(uint idx, int v1, int v2) { if (active()) { - _runningConv->_data2._vars[idx].v1 = v1; - _runningConv->_data2._vars[idx].v2 = v2; + _runningConv->_cnd._vars[idx].v1 = v1; + _runningConv->_cnd._vars[idx].v2 = v2; } } @@ -386,4 +387,10 @@ void ConversationData::load(const Common::String &filename) { warning("TODO GameConversations::get"); } +/*------------------------------------------------------------------------*/ + +void ConversationCnd::load(const Common::String &filename) { + // TODO +} + } // End of namespace MADS diff --git a/engines/mads/conversations.h b/engines/mads/conversations.h index ceb5ad6eb7..b50b87cb98 100644 --- a/engines/mads/conversations.h +++ b/engines/mads/conversations.h @@ -88,7 +88,7 @@ struct ConversationData { void load(const Common::String &filename); }; -struct ConversationData2 { +struct ConversationCnd { struct ConversationVar { int v1; int v2; @@ -96,12 +96,17 @@ struct ConversationData2 { }; Common::Array<ConversationVar> _vars; + + /** + * Load the specified conversation resource file + */ + void load(const Common::String &filename); }; struct ConversationEntry { int _convId; ConversationData _data; - ConversationData2 _data2; + ConversationCnd _cnd; }; class MADSEngine; @@ -145,6 +150,18 @@ public: virtual ~GameConversations(); /** + * Gets the specified conversation and loads into into a free slot + * in the conversation list + */ + void load(int id); + + /** + * Run a specified conversation number. The conversation must have + * previously been loaded by calling the load method + */ + void run(int id); + + /** * Sets a variable */ void setVariable(uint idx, int v1, int v2 = -1); @@ -152,8 +169,6 @@ public: int* _nextStartNode; int* getVariable(int idx); - void get(int id); - void run(int id); void stop(); void exportPointer(int *val); void exportValue(int val); diff --git a/engines/mads/dragonsphere/dragonsphere_scenes1.cpp b/engines/mads/dragonsphere/dragonsphere_scenes1.cpp index 7fdea7137c..7d09c616ac 100644 --- a/engines/mads/dragonsphere/dragonsphere_scenes1.cpp +++ b/engines/mads/dragonsphere/dragonsphere_scenes1.cpp @@ -1141,7 +1141,7 @@ void Scene104::setup() { } void Scene104::enter() { - _vm->_gameConv->get(1); + _vm->_gameConv->load(1); if (_globals[kPlayerPersona] == 1) { _scene->_sprites.addSprites(formAnimName('e', 8)); @@ -3157,7 +3157,7 @@ void Scene105::enter() { _scene->_dynamicHotspots.setPosition(_boneHotspotId, Common::Point(255, 145), FACING_EAST); } - _vm->_gameConv->get(2); + _vm->_gameConv->load(2); _newStatus = 1; _previousStatus = 0; _maidTalkingFl = false; diff --git a/engines/mads/phantom/phantom_scenes1.cpp b/engines/mads/phantom/phantom_scenes1.cpp index bfd60daec7..af22fd3056 100644 --- a/engines/mads/phantom/phantom_scenes1.cpp +++ b/engines/mads/phantom/phantom_scenes1.cpp @@ -168,9 +168,9 @@ void Scene101::enter() { _startSittingFl = false; } - // Load Dialogs - _vm->_gameConv->get(0); - _vm->_gameConv->get(1); + // Load conversations + _vm->_gameConv->load(0); + _vm->_gameConv->load(1); if (_globals[kCurrentYear] == 1993) { _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('z', -1)); @@ -906,7 +906,7 @@ void Scene103::enter() { _scene->_hotspots.activate(NOUN_JACQUES, false); _scene->_hotspots.activate(NOUN_KEY, false); - _vm->_gameConv->get(12); + _vm->_gameConv->load(12); if (_globals[kTrapDoorStatus] == 0) { _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 5); @@ -2493,7 +2493,7 @@ void Scene104::enter() { if (_globals[kCurrentYear] == 1993) _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('z', 0)); - _vm->_gameConv->get(7); + _vm->_gameConv->load(7); if (_globals[kTrapDoorStatus] == 1) { _globals._sequenceIndexes[0] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[0], false, 1); @@ -5056,7 +5056,7 @@ void Scene108::enter() { _maxTalkCount = 15; } - _vm->_gameConv->get(2); + _vm->_gameConv->load(2); if (_globals[kCurrentYear] == 1993) { _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('z', -1)); @@ -6508,7 +6508,7 @@ void Scene111::enter() { _scene->_hotspots.activate(NOUN_FIRE_AXE, false); } - _vm->_gameConv->get(14); + _vm->_gameConv->load(14); _globals._spriteIndexes[0] = _scene->_sprites.addSprites("*RDR_9"); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 1)); @@ -7039,7 +7039,7 @@ void Scene112::enter() { _didOptionFl = 0; } - _vm->_gameConv->get(3); + _vm->_gameConv->load(3); _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('j', 1), 1); _anim0ActvFl = true; @@ -7763,13 +7763,13 @@ void Scene113::enter() { } if (_globals[kCurrentYear] == 1993) { - _vm->_gameConv->get(4); + _vm->_gameConv->load(4); if ((_globals[kDoneBrieConv203] == 1) || (_globals[kDoneBrieConv203] == 3)) - _vm->_gameConv->get(6); + _vm->_gameConv->load(6); } else { _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*faceral", false); _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*facecrsd", false); - _vm->_gameConv->get(13); + _vm->_gameConv->load(13); } if (_globals[kCurrentYear] == 1993) { diff --git a/engines/mads/phantom/phantom_scenes2.cpp b/engines/mads/phantom/phantom_scenes2.cpp index 02e2d7c117..a1c73f2c5d 100644 --- a/engines/mads/phantom/phantom_scenes2.cpp +++ b/engines/mads/phantom/phantom_scenes2.cpp @@ -113,7 +113,7 @@ void Scene201::enter() { _sellerCount = 0; _needHoldFl = false; - _vm->_gameConv->get(16); + _vm->_gameConv->load(16); _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 0)); _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('f', 0)); @@ -651,8 +651,8 @@ void Scene202::enter() { } _conversationCount = 0; - _vm->_gameConv->get(17); - _vm->_gameConv->get(9); + _vm->_gameConv->load(17); + _vm->_gameConv->load(9); _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*RDR_9"); _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 0)); @@ -1563,10 +1563,10 @@ void Scene203::enter() { if (_globals[kCurrentYear] == 1993) { _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('z', -1)); - _vm->_gameConv->get(5); + _vm->_gameConv->load(5); } else { - _vm->_gameConv->get(8); - _vm->_gameConv->get(15); + _vm->_gameConv->load(8); + _vm->_gameConv->load(15); } if (_globals[kCurrentYear] == 1993) { @@ -3323,7 +3323,7 @@ void Scene204::enter() { warning("TODO: If end of game, remove the walking areas"); _scene->_hotspots.activate(NOUN_BOOK, false); - _vm->_gameConv->get(22); + _vm->_gameConv->load(22); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('p', 0)); _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 6)); @@ -4277,9 +4277,9 @@ void Scene205::enter() { _scene->_hotspots.activate(NOUN_MADAME_GIRY, false); _scene->_hotspots.activate(NOUN_WOMAN, false); - _vm->_gameConv->get(18); - _vm->_gameConv->get(10); - _vm->_gameConv->get(11); + _vm->_gameConv->load(18); + _vm->_gameConv->load(10); + _vm->_gameConv->load(11); if (_globals[kCurrentYear] == 1881) { if ((_globals[kMadameGiryShowsUp]) && (_globals[kJacquesStatus] == 0)) { @@ -5864,7 +5864,7 @@ void Scene206::enter() { _skip2Fl = false; _scene->loadSpeech(1); - _vm->_gameConv->get(26); + _vm->_gameConv->load(26); _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 0)); _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 1)); diff --git a/engines/mads/phantom/phantom_scenes3.cpp b/engines/mads/phantom/phantom_scenes3.cpp index 3527a794b4..9fd15d3552 100644 --- a/engines/mads/phantom/phantom_scenes3.cpp +++ b/engines/mads/phantom/phantom_scenes3.cpp @@ -681,7 +681,7 @@ void Scene303::enter() { _skipFrameCheckFl = false; if (_globals[kRightDoorIsOpen504]) - _vm->_gameConv->get(26); + _vm->_gameConv->load(26); if (_globals[kCurrentYear] == 1993) { _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('z', -1)); @@ -1001,7 +1001,7 @@ void Scene304::enter() { } if (_globals[kRightDoorIsOpen504]) - _vm->_gameConv->get(23); + _vm->_gameConv->load(23); if (!_globals[kRightDoorIsOpen504]) { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('f', 1)); @@ -1904,7 +1904,7 @@ void Scene308::enter() { _skip1Fl = false; _skip2Fl = false; - _vm->_gameConv->get(26); + _vm->_gameConv->load(26); _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('a', 0)); _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('b', 0)); _scene->_userInterface.setup(kInputLimitedSentences); @@ -2241,7 +2241,7 @@ void Scene309::enter() { _anim0ActvFl = false; _boatStatus = 1; - _vm->_gameConv->get(26); + _vm->_gameConv->load(26); _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 0)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 1)); diff --git a/engines/mads/phantom/phantom_scenes5.cpp b/engines/mads/phantom/phantom_scenes5.cpp index 406637eac4..d738504b82 100644 --- a/engines/mads/phantom/phantom_scenes5.cpp +++ b/engines/mads/phantom/phantom_scenes5.cpp @@ -92,7 +92,7 @@ void Scene501::enter() { _skipFl = false; } - _vm->_gameConv->get(26); + _vm->_gameConv->load(26); _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 0)); _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 1)); @@ -1853,12 +1853,12 @@ void Scene504::enter() { _scene->_hotspots.activate(NOUN_CHRISTINE, false); if (!_globals[kRightDoorIsOpen504]) { - _vm->_gameConv->get(19); - _vm->_gameConv->get(27); + _vm->_gameConv->load(19); + _vm->_gameConv->load(27); } else - _vm->_gameConv->get(21); + _vm->_gameConv->load(21); - _vm->_gameConv->get(26); + _vm->_gameConv->load(26); _globals._spriteIndexes[14] = _scene->_sprites.addSprites("*RDR_9"); _globals._spriteIndexes[15] = _scene->_sprites.addSprites(formAnimName('x', 8)); @@ -3186,7 +3186,7 @@ void Scene505::enter() { _checkFrame106 = false; } - _vm->_gameConv->get(20); + _vm->_gameConv->load(20); _scene->_hotspots.activateAtPos(NOUN_LID, false, Common::Point(216, 44)); _scene->_hotspots.activate(NOUN_CHRISTINE, false); @@ -3939,7 +3939,7 @@ void Scene506::enter() { _ascendingFl = false; } - _vm->_gameConv->get(26); + _vm->_gameConv->load(26); _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 0)); _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 1)); |