[Scummvm-cvs-logs] scummvm master -> 162ddbea0f264a29a5972f23139d287e775050d9

dreammaster dreammaster at scummvm.org
Fri Jan 8 07:02:57 CET 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
162ddbea0f MADS: Cleanup of existing converstations skeleton code


Commit: 162ddbea0f264a29a5972f23139d287e775050d9
    https://github.com/scummvm/scummvm/commit/162ddbea0f264a29a5972f23139d287e775050d9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-01-08T17:02:17+11:00

Commit Message:
MADS: Cleanup of existing converstations skeleton code

Changed paths:
    engines/mads/conversations.cpp
    engines/mads/conversations.h
    engines/mads/dragonsphere/dragonsphere_scenes1.cpp
    engines/mads/mads.cpp
    engines/mads/mads.h
    engines/mads/phantom/game_phantom.cpp
    engines/mads/phantom/phantom_scenes1.cpp
    engines/mads/phantom/phantom_scenes2.cpp
    engines/mads/phantom/phantom_scenes3.cpp
    engines/mads/phantom/phantom_scenes5.cpp



diff --git a/engines/mads/conversations.cpp b/engines/mads/conversations.cpp
index 53b8e79..f51759d 100644
--- a/engines/mads/conversations.cpp
+++ b/engines/mads/conversations.cpp
@@ -28,187 +28,226 @@
 
 namespace MADS {
 
-#define MAX_SPEAKERS 5
-
-enum DialogCommands {
-	cmdNodeEnd = 0,
-	//
-	cmdHide = 2,
-	cmdUnhide = 3,
-	cmdMessage = 4,
-	//
-	//
-	cmdGoto = 7,
-	//
-	cmdAssign = 9,
-	cmdDialogEnd = 255
-};
-
-struct ConvDialog {
-	int16 textLineIndex;	// 0-based
-	int16 speechIndex;		// 1-based
-	uint16 nodeOffset;		// offset in section 6
-	uint16 nodeSize;		// size in section 6
-};
-
-struct ConvNode {
-	uint16 index;
-	uint16 dialogCount;
-	int16 unk1;
-	int16 unk2;
-	int16 unk3;
-
-	Common::Array<ConvDialog> dialogs;
-};
-
-struct ConvData {
-	uint16 nodeCount;		// conversation nodes, each one containing several dialog options and messages
-	uint16 dialogCount;		// messages (non-selectable) + texts (selectable)
-	uint16 messageCount;	// messages (non-selectable)
-	uint16 textLineCount;
-	uint16 unk2;
-	uint16 importCount;
-	uint16 speakerCount;
-	Common::String portraits[MAX_SPEAKERS];
-	bool speakerExists[MAX_SPEAKERS];
-	Common::String speechFile;
-	Common::Array<Common::String> textLines;
-	Common::Array<ConvNode> convNodes;
-};
-
-GameConversation::GameConversation(MADSEngine *vm)
-	: _vm(vm) {
-	_running = _restoreRunning = 0;
+GameConversations::GameConversations(MADSEngine *vm) : _vm(vm) {
+	_runningConv = nullptr;
+	_restoreRunning = 0;
 	_nextStartNode = nullptr;
+	_playerEnabled = false;
+	_startFrameNumber = 0;
+
+	// Mark all conversation slots as empty
+	for (int idx = 0; idx < MAX_CONVERSATIONS; ++idx)
+		_conversations[idx]._convId = -1;
 }
 
-GameConversation::~GameConversation() {
+GameConversations::~GameConversations() {
 }
 
-void GameConversation::get(int id) {
-	Common::File inFile;
-	Common::String fileName = Common::String::format("CONV%03d.CNV", id);
+void GameConversations::get(int id) {
+	// Scan through the conversation list for a free slot
+	int slotIndex = -1;
+	for (int idx = 0; idx < MAX_CONVERSATIONS && slotIndex == -1; ++idx) {
+		if (_conversations[idx]._convId == -1)
+			slotIndex = idx;
+	}
+	if (slotIndex == -1)
+		error("Too many conversations loaded");
+
+	// Set the conversation the slot will contain
+	_conversations[slotIndex]._convId = id;
+
+	// Load the conversation data
+	Common::String cnvFilename = Common::String::format("CONV%03d.CNV", id);
+	_conversations[slotIndex]._data.load(cnvFilename);
+
 	// TODO: Also handle the .CND file
+}
 
-	inFile.open(fileName);
-	MadsPack convFileUnpacked(&inFile);
-	Common::SeekableReadStream *convFile = convFileUnpacked.getItemStream(0);
+ConversationEntry *GameConversations::getConv(int convId) {
+	for (uint idx = 0; idx < MAX_CONVERSATIONS; ++idx) {
+		if (_conversations[idx]._convId == convId)
+			return &_conversations[idx];
+	}
+
+	return nullptr;
+}
+
+
+void GameConversations::run(int id) {
+	// If another conversation is running, then stop it first
+	if (_runningConv)
+		stop();
+
+	// Get the next conversation to run
+	_runningConv = getConv(id);
+	if (!_runningConv)
+		error("Specified conversation %d not loaded", id);
+
+	// Initialize needed fields
+	_startFrameNumber = _vm->_events->getFrameCounter();
+	_playerEnabled = _vm->_game->_player._stepEnabled;
+	//TODO
+
+	// Start the conversation
+	start();
+
+	warning("TODO GameConversations::run");
+}
+
+void GameConversations::start() {
+
+	warning("TODO: GameConversations::start");
+}
+
+void GameConversations::stop() {
+	warning("TODO GameConversations::stop");
+}
+
+void GameConversations::exportPointer(int *val) {
+	warning("TODO GameConversations::exportPointer");
+}
+
+void GameConversations::exportValue(int val) {
+	warning("TODO GameConversations::exportValue");
+}
+
+void GameConversations::setHeroTrigger(int val) {
+	_vm->_game->_trigger = val;	// HACK
+	//_running = -1;	// HACK
+	warning("TODO: GameConversations::setHeroTrigger");
+}
+
+void GameConversations::setInterlocutorTrigger(int val) {
+	warning("TODO: GameConversations::setInterlocutorTrigger");
+}
+
+int* GameConversations::getVariable(int idx) {
+	warning("TODO: GameConversations::getVariable");
+	return nullptr;
+}
+
+void GameConversations::hold() {
+	warning("TODO: GameConversations::hold");
+}
+
+void GameConversations::release() {
+	warning("TODO: GameConversations::release");
+}
+
+void GameConversations::reset(int id) {
+	warning("TODO: GameConversations::reset");
+}
+
+void GameConversations::abortConv() {
+	warning("TODO: GameConversations::abort");
+}
 
+/*------------------------------------------------------------------------*/
+
+void ConversationData::load(const Common::String &filename) {
+	Common::File inFile;
 	char buffer[16];
 
-	ConvData conv;
+	inFile.open(filename);
+	MadsPack convFileUnpacked(&inFile);
+	Common::SeekableReadStream *convFile = convFileUnpacked.getItemStream(0);
 
 	// **** Section 0: Header *************************************************
-	conv.nodeCount = convFile->readUint16LE();
-	conv.dialogCount = convFile->readUint16LE();
-	conv.messageCount = convFile->readUint16LE();
-	conv.textLineCount = convFile->readUint16LE();
-	conv.unk2 = convFile->readUint16LE();
-	conv.importCount = convFile->readUint16LE();
-	conv.speakerCount = convFile->readUint16LE();
-
-	//debug("Conv %d has %d nodes, %d dialogs, %d messages, %d text lines, %d unk2, %d imports and %d speakers",
-	//		id, conv.nodeCount, conv.dialogCount, conv.messageCount, conv.textLineCount, conv.unk2, conv.importCount, conv.speakerCount);
-
-	for (uint16 i = 0; i < MAX_SPEAKERS; i++) {
+	_nodeCount = convFile->readUint16LE();
+	_dialogCount = convFile->readUint16LE();
+	_messageCount = convFile->readUint16LE();
+	_textLineCount = convFile->readUint16LE();
+	_unk2 = convFile->readUint16LE();
+	_importCount = convFile->readUint16LE();
+	_speakerCount = convFile->readUint16LE();
+
+	for (uint idx = 0; idx < MAX_SPEAKERS; ++idx) {
 		convFile->read(buffer, 16);
-		conv.portraits[i] = buffer;
-		//debug("Speaker %d, portrait %s", i, conv.portraits[i].c_str());
+		_portraits[idx] = buffer;
 	}
 
-	for (uint16 i = 0; i < MAX_SPEAKERS; i++) {
-		conv.speakerExists[i] = convFile->readUint16LE();
-		//debug("Speaker %d exists: %d", i, conv.speakerExists[i]);
+	for (uint idx = 0; idx < MAX_SPEAKERS; ++idx) {
+		_speakerExists[idx] = convFile->readUint16LE();
 	}
 
 	convFile->read(buffer, 14);
-	conv.speechFile = Common::String(buffer);
-	//debug("Speech file %s", conv.speechFile.c_str());
-
-	uint16 textLength = convFile->readUint16LE();	// Total text length in section 5
-	convFile->skip(2);	// TODO: unknown
-	uint16 commandLength = convFile->readUint16LE();	// Total length of commands in section 6
-	//debug("Node entry commands length: %d", commandLength);
-
-#if 0
-	debug("Section 0 unknown bytes");
-	byte *tmp0 = new byte[26];
-	convFile->read(tmp0, 26);
-	Common::hexdump(tmp0, 26);
-	delete[] tmp0;
+	_speechFile = Common::String(buffer);
+
+	// Total text length in section 5
+	_textSize = convFile->readUint32LE();
+	_commandsSize = convFile->readUint32LE();
+
+	// The rest of the section 0 is padding to allow room for a set of pointers
+	// to the contents of the remaining sections loaded into memory as a
+	// continuous data block containing both the header and the sections
 	delete convFile;
-#else
-	warning("Section 0 unknown bytes");
-#endif
+
 	// **** Section 1: Nodes **************************************************
 	convFile = convFileUnpacked.getItemStream(1);
 
-	for (uint16 i = 0; i < conv.nodeCount; i++) {
+	_convNodes.clear();
+	for (uint i = 0; i < _nodeCount; i++) {
 		ConvNode node;
-		node.index = convFile->readUint16LE();
-		node.dialogCount = convFile->readUint16LE();
-		node.unk1 = convFile->readSint16LE();	// TODO
-		node.unk2 = convFile->readSint16LE();	// TODO
-		node.unk3 = convFile->readSint16LE();	// TODO
-		conv.convNodes.push_back(node);
+		node._index = convFile->readUint16LE();
+		node._dialogCount = convFile->readUint16LE();
+		node._unk1 = convFile->readSint16LE();	// TODO
+		node._unk2 = convFile->readSint16LE();	// TODO
+		node._unk3 = convFile->readSint16LE();	// TODO
+		_convNodes.push_back(node);
 		//debug("Node %d, index %d, entries %d - %d, %d, %d", i, node.index, node.dialogCount, node.unk1, node.unk2, node.unk3);
 	}
 	delete convFile;
 
 	// **** Section 2: Dialogs ************************************************
 	convFile = convFileUnpacked.getItemStream(2);
-	assert(convFile->size() == conv.dialogCount * 8);
+	assert(convFile->size() == _dialogCount * 8);
 
-	for (uint16 i = 0; i < conv.nodeCount; i++) {
-		uint16 dialogCount = conv.convNodes[i].dialogCount;
+	for (uint idx = 0; idx < _nodeCount; ++idx) {
+		uint dialogCount = _convNodes[idx]._dialogCount;
 
-		for (uint16 j = 0; j < dialogCount; j++) {
+		for (uint j = 0; j < dialogCount; ++j) {
 			ConvDialog dialog;
-			dialog.textLineIndex = convFile->readSint16LE();
-			dialog.speechIndex = convFile->readSint16LE();
-			dialog.nodeOffset = convFile->readUint16LE();
-			dialog.nodeSize = convFile->readUint16LE();
-			conv.convNodes[i].dialogs.push_back(dialog);
-			//debug("Node %d, dialog %d: text line %d, speech index %d, node offset %d, node size %d", j, i, dialog.textLineIndex, dialog.speechIndex, dialog.nodeOffset, dialog.nodeSize);
+			dialog._textLineIndex = convFile->readSint16LE();
+			dialog._speechIndex = convFile->readSint16LE();
+			dialog._nodeOffset = convFile->readUint16LE();
+			dialog._nodeSize = convFile->readUint16LE();
+			_convNodes[idx]._dialogs.push_back(dialog);
 		}
 	}
 	delete convFile;
 
-	// **** Section 3: ???? ***************************************************
-#if 0
-	debug("Section 3");
+	// **** Section 3: Messages ***********************************************
 	convFile = convFileUnpacked.getItemStream(3);
-	byte *tmp1 = new byte[convFile->size()];
-	convFile->read(tmp1, convFile->size());
-	Common::hexdump(tmp1, convFile->size());
-	delete[] tmp1;
+	assert(convFile->size() == _messageCount * 8);
+
+	_messages.resize(_messageCount);
+	for (uint idx = 0; idx < _messageCount; ++idx)
+		_messages[idx] = convFile->readUint32LE();
+
 	delete convFile;
-#else
-	warning("Section 3 - TODO");
-#endif
+
 	// **** Section 4: Text line offsets **************************************
 	convFile = convFileUnpacked.getItemStream(4);
-	assert(convFile->size() == conv.textLineCount * 2);
+	assert(convFile->size() == _textLineCount * 2);
 
-	uint16 *textLineOffsets = new uint16[conv.textLineCount];	// deleted below in section 5
-	for (uint16 i = 0; i < conv.textLineCount; i++)
+	uint16 *textLineOffsets = new uint16[_textLineCount];	// deleted below in section 5
+	for (uint16 i = 0; i < _textLineCount; i++)
 		textLineOffsets[i] = convFile->readUint16LE();
 
 	delete convFile;
 
 	// **** Section 5: Text lines *********************************************
 	convFile = convFileUnpacked.getItemStream(5);
-	assert(convFile->size() == textLength);
+	assert(convFile->size() == _textSize);
 
 	Common::String textLine;
-	conv.textLines.resize(conv.textLineCount);
+	_textLines.resize(_textLineCount);
 	char textLineBuffer[256];
 	uint16 nextOffset;
-	for (uint16 i = 0; i < conv.textLineCount; i++) {
-		nextOffset = (i != conv.textLineCount - 1) ? textLineOffsets[i + 1] : convFile->size();
+	for (uint16 i = 0; i < _textLineCount; i++) {
+		nextOffset = (i != _textLineCount - 1) ? textLineOffsets[i + 1] : convFile->size();
 		convFile->read(textLineBuffer, nextOffset - textLineOffsets[i]);
-		conv.textLines[i] = Common::String(textLineBuffer);	
-		//debug("Text line %d: %s", i, conv.textLines[i].c_str());
+		_textLines[i] = Common::String(textLineBuffer);
 	}
 
 	delete[] textLineOffsets;
@@ -216,13 +255,13 @@ void GameConversation::get(int id) {
 
 	// **** Section 6: Node entry commands ************************************
 	convFile = convFileUnpacked.getItemStream(6);
-	assert(convFile->size() == commandLength);
+	assert(convFile->size() == _commandsSize);
 
-	for (uint16 i = 0; i < conv.nodeCount; i++) {
-		uint16 dialogCount = conv.convNodes[i].dialogCount;
+	for (uint16 i = 0; i < _nodeCount; i++) {
+		uint16 dialogCount = _convNodes[i]._dialogCount;
 
 		for (uint16 j = 0; j < dialogCount; j++) {
-			//ConvDialog dialog = conv.convNodes[i].dialogs[j];
+			//ConvDialog dialog = _convNodes[i].dialogs[j];
 			byte command;
 			uint16 chk;
 
@@ -248,8 +287,8 @@ void GameConversation::get(int id) {
 						//debug("Hide node %d", nodeRef);
 					}
 
-					}
-					break;
+				}
+							  break;
 				case cmdUnhide: {
 					byte count = convFile->readByte();
 					for (byte k = 0; k < count; k++) {
@@ -257,8 +296,8 @@ void GameConversation::get(int id) {
 						//debug("Unhide node %d", nodeRef);
 					}
 
-					}
-					break;
+				}
+								break;
 				case cmdMessage:
 					//debug("Message");
 					convFile->skip(7);	// TODO
@@ -267,15 +306,15 @@ void GameConversation::get(int id) {
 					convFile->skip(3);	// unused?
 					/*byte nodeRef = */convFile->readByte();
 					//debug("Goto %d", nodeRef);
-					}
-					break;
+				}
+							  break;
 				case cmdAssign: {
 					convFile->skip(3);	// unused?
 					/*uint16 value = */convFile->readUint16LE();
 					/*uint16 variable = */convFile->readUint16LE();
 					//debug("Variable %d = %d", variable, value);
-					}
-					break;
+				}
+								break;
 				default:
 					error("Unknown conversation command %d", command);
 					break;
@@ -287,76 +326,8 @@ void GameConversation::get(int id) {
 	delete convFile;
 	inFile.close();
 
-	/*
-	// DEBUG: Show the very first message, and play the very first speech
-	_vm->_audio->setSoundGroup(conv.speechFile);
-	uint16 firstText = 0, firstSpeech = 1;
-
-	for (uint16 i = 0; i < conv.convNodes.size(); i++) {
-		for (uint16 k = 0; k < conv.convNodes[i].dialogs.size(); k++) {
-			if (conv.convNodes[i].dialogs[k].textLineIndex >= 0) {
-				firstText = conv.convNodes[i].dialogs[k].textLineIndex;
-				firstSpeech = conv.convNodes[i].dialogs[k].speechIndex;
-				break;
-			}
-		}
-	}
-
-	_vm->_audio->playSound(firstSpeech - 1);
-
-	TextDialog *dialog = new TextDialog(_vm, FONT_INTERFACE, Common::Point(0, 100), 30);
-	dialog->addLine(conv.textLines[firstText]);
-	dialog->show();
-	delete dialog;
-	*/
-
-	warning("TODO GameConversation::get");
-}
-
-void GameConversation::run(int id) {
-	warning("TODO GameConversation::run");
-}
-
-void GameConversation::stop() {
-	warning("TODO GameConversation::stop");
-}
-
-void GameConversation::exportPointer(int *val) {
-	warning("TODO GameConversation::exportPointer");
-}
-
-void GameConversation::exportValue(int val) {
-	warning("TODO GameConversation::exportValue");
-}
-
-void GameConversation::setHeroTrigger(int val) {
-	_vm->_game->_trigger = val;	// HACK
-	_running = -1;	// HACK
-	warning("TODO: GameConversation::setHeroTrigger");
+	// TODO: Still stuff to do
+	warning("TODO GameConversations::get");
 }
 
-void GameConversation::setInterlocutorTrigger(int val) {
-	warning("TODO: GameConversation::setInterlocutorTrigger");
-}
-
-int* GameConversation::getVariable(int idx) {
-	warning("TODO: GameConversation::getVariable");
-	return nullptr;
-}
-
-void GameConversation::hold() {
-	warning("TODO: GameConversation::hold");
-}
-
-void GameConversation::release() {
-	warning("TODO: GameConversation::release");
-}
-
-void GameConversation::reset(int id) {
-	warning("TODO: GameConversation::reset");
-}
-
-void GameConversation::abortConv() {
-	warning("TODO: GameConversation::abort");
-}
 } // End of namespace MADS
diff --git a/engines/mads/conversations.h b/engines/mads/conversations.h
index c4bf06e..2a2a625 100644
--- a/engines/mads/conversations.h
+++ b/engines/mads/conversations.h
@@ -23,24 +23,110 @@
 #ifndef MADS_CONVERSATIONS_H
 #define MADS_CONVERSATIONS_H
 
+#include "common/scummsys.h"
+#include "common/array.h"
+#include "common/str-array.h"
+
 namespace MADS {
 
+#define MAX_CONVERSATIONS 5
+#define MAX_SPEAKERS 5
+
+enum DialogCommands {
+	cmdNodeEnd = 0,
+	//
+	cmdHide = 2,
+	cmdUnhide = 3,
+	cmdMessage = 4,
+	//
+	//
+	cmdGoto = 7,
+	//
+	cmdAssign = 9,
+	cmdDialogEnd = 255
+};
+
+struct ConvDialog {
+	int16 _textLineIndex;	// 0-based
+	int16 _speechIndex;		// 1-based
+	uint16 _nodeOffset;		// offset in section 6
+	uint16 _nodeSize;		// size in section 6
+};
+
+struct ConvNode {
+	uint16 _index;
+	uint16 _dialogCount;
+	int16 _unk1;
+	int16 _unk2;
+	int16 _unk3;
+
+	Common::Array<ConvDialog> _dialogs;
+};
+
+struct ConversationData {
+	uint16 _nodeCount;		// conversation nodes, each one containing several dialog options and messages
+	uint16 _dialogCount;		// messages (non-selectable) + texts (selectable)
+	uint16 _messageCount;	// messages (non-selectable)
+	uint16 _textLineCount;
+	uint16 _unk2;
+	uint16 _importCount;
+	uint16 _speakerCount;
+	int _textSize;
+	int _commandsSize;
+
+	Common::String _portraits[MAX_SPEAKERS];
+	bool _speakerExists[MAX_SPEAKERS];
+	Common::String _speechFile;
+	Common::Array<uint> _messages;
+	Common::StringArray _textLines;
+	Common::Array<ConvNode> _convNodes;
+
+	/**
+	 * Load the specified conversation resource file
+	 */
+	void load(const Common::String &filename);
+};
+
+struct ConversationData2 {
+};
+
+struct ConversationEntry {
+	int _convId;
+	ConversationData _data;
+	ConversationData2 _data2;
+};
+
 class MADSEngine;
 
-class GameConversation {
+class GameConversations {
 private:
 	MADSEngine *_vm;
+	ConversationEntry _conversations[MAX_CONVERSATIONS];
+
+	/**
+	 * Returns the record for the specified conversation, if it's loaded
+	 */
+	ConversationEntry *getConv(int convId);
 
+	/**
+	 * Start a specified conversation slot
+	 */
+	void start();
+public:
+	ConversationEntry *_runningConv;
+	int _restoreRunning;
+	bool _playerEnabled;
+	uint32 _startFrameNumber;
 public:
 	/**
 	 * Constructor
 	 */
-	GameConversation(MADSEngine *vm);
+	GameConversations(MADSEngine *vm);
 
 	/**
 	 * Destructor
 	 */
-	virtual ~GameConversation();
+	virtual ~GameConversations();
 
 	int* _nextStartNode;
 	int* getVariable(int idx);
@@ -56,9 +142,16 @@ public:
 	void release();
 	void reset(int id);
 	void abortConv();
+	
+	/**
+	 * Returns true if any conversation is currently atcive
+	 */
+	bool active() const { return _runningConv != nullptr; }
 
-	int _running;
-	int _restoreRunning;
+	/**
+	 * Returns the currently active conversation Id
+	 */
+	int activeConvId() const { return !active() ? -1 : _runningConv->_convId; }
 };
 
 } // End of namespace MADS
diff --git a/engines/mads/dragonsphere/dragonsphere_scenes1.cpp b/engines/mads/dragonsphere/dragonsphere_scenes1.cpp
index 8a89d8e..7fdea71 100644
--- a/engines/mads/dragonsphere/dragonsphere_scenes1.cpp
+++ b/engines/mads/dragonsphere/dragonsphere_scenes1.cpp
@@ -1486,7 +1486,7 @@ void Scene104::step() {
 }
 
 void Scene104::actions() {
-	if (_vm->_gameConv->_running == 1) {
+	if (_vm->_gameConv->activeConvId() == 1) {
 		handleFinalConversation();
 		_action._inProgress = false;
 		return;
@@ -3341,7 +3341,7 @@ void Scene105::actions() {
 		return;
 	}
 
-	if (_vm->_gameConv->_running == 2) {
+	if (_vm->_gameConv->activeConvId() == 2) {
 		handleConversation();
 		_action._inProgress = false;
 		return;
diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp
index 0bdf484..963a35c 100644
--- a/engines/mads/mads.cpp
+++ b/engines/mads/mads.cpp
@@ -104,7 +104,7 @@ void MADSEngine::initialize() {
 		_gameConv = nullptr;
 		break;
 	default:
-		_gameConv = new GameConversation(this);
+		_gameConv = new GameConversations(this);
 	}
 
 	loadOptions();
diff --git a/engines/mads/mads.h b/engines/mads/mads.h
index 1b0f96a..eb808de 100644
--- a/engines/mads/mads.h
+++ b/engines/mads/mads.h
@@ -97,7 +97,7 @@ public:
 	EventsManager *_events;
 	Font *_font;
 	Game *_game;
-	GameConversation * _gameConv;
+	GameConversations * _gameConv;
 	Palette *_palette;
 	Resources *_resources;
 	ScreenSurface _screen;
diff --git a/engines/mads/phantom/game_phantom.cpp b/engines/mads/phantom/game_phantom.cpp
index 3ec3052..af9769d 100644
--- a/engines/mads/phantom/game_phantom.cpp
+++ b/engines/mads/phantom/game_phantom.cpp
@@ -744,7 +744,7 @@ void GamePhantom::stopWalker() {
 
 void GamePhantom::step() {
 	if (_player._visible  && !_globals[kStopWalkerDisabled]
-	 && (_player._stepEnabled || (_vm->_gameConv->_running >= 0))
+	 && (_player._stepEnabled || (_vm->_gameConv->activeConvId() >= 0))
 	 && !_player._moving && (_player._facing == _player._turnToFacing)
 	 && (_scene._frameStartTime >= (uint32)_globals[kWalkerTiming])) {
 		if (_player._stopWalkers.empty())
diff --git a/engines/mads/phantom/phantom_scenes1.cpp b/engines/mads/phantom/phantom_scenes1.cpp
index c86d285..bfd60da 100644
--- a/engines/mads/phantom/phantom_scenes1.cpp
+++ b/engines/mads/phantom/phantom_scenes1.cpp
@@ -300,9 +300,9 @@ void Scene101::preActions() {
 }
 
 void Scene101::actions() {
-	if (_vm->_gameConv->_running == 0)
+	if (_vm->_gameConv->activeConvId() == 0)
 		handleConversation0();
-	else if (_vm->_gameConv->_running == 1)
+	else if (_vm->_gameConv->activeConvId() == 1)
 		handleConversation1();
 	else if (_action._lookFlag) {
 		if (_globals[kCurrentYear] == 1993)
@@ -525,7 +525,7 @@ void Scene101::handleAnimation1() {
 		}
 
 		if (_startWalkingFl) {
-			if (_vm->_gameConv->_running == 1) {
+			if (_vm->_gameConv->activeConvId() == 1) {
 				if (_talkCounter > 13)
 					_chandelierStatus = 1;
 			} else
@@ -541,7 +541,7 @@ void Scene101::handleAnimation1() {
 		case 1:
 			_globals[kBrieTalkStatus] = 2;
 			resetFrame = 45;
-			if (_vm->_gameConv->_running == 1)
+			if (_vm->_gameConv->activeConvId() == 1)
 				_vm->_gameConv->stop();
 			_scene->_dynamicHotspots.remove(_brieAnimId);
 			_game._player._stepEnabled = false;
@@ -1376,7 +1376,7 @@ void Scene103::actions() {
 		return;
 	}
 
-	if (_vm->_gameConv->_running == 12) {
+	if (_vm->_gameConv->activeConvId() == 12) {
 		process_conv_jacques();
 		_action._inProgress = false;
 		return;
@@ -2678,7 +2678,7 @@ void Scene104::preActions() {
 }
 
 void Scene104::actions() {
-	if (_vm->_gameConv->_running == 7) {
+	if (_vm->_gameConv->activeConvId() == 7) {
 		processConversations();
 		_action._inProgress = false;
 		return;
@@ -5076,7 +5076,7 @@ void Scene108::enter() {
 		_globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('c', 1), 1);
 		_anim0ActvFl = true;
 
-		if (_vm->_gameConv->_running == 2) {
+		if (_vm->_gameConv->activeConvId() == 2) {
 			_globals[kWalkerConverse] = _vm->getRandomNumber(1, 4);
 			_charAction = 0;
 			_vm->_gameConv->run(2);
@@ -5133,7 +5133,7 @@ void Scene108::step() {
 }
 
 void Scene108::actions() {
-	if (_vm->_gameConv->_running == 2) {
+	if (_vm->_gameConv->activeConvId() == 2) {
 		handleCharlesConversation();
 		_action._inProgress = false;
 		return;
@@ -6641,7 +6641,7 @@ void Scene111::step() {
 }
 
 void Scene111::actions() {
-	if (_vm->_gameConv->_running == 14) {
+	if (_vm->_gameConv->activeConvId() == 14) {
 		handleListenConversation();
 		_action._inProgress = false;
 		return;
@@ -7081,7 +7081,7 @@ void Scene112::step() {
 }
 
 void Scene112::actions() {
-	if (_vm->_gameConv->_running == 3) {
+	if (_vm->_gameConv->activeConvId() == 3) {
 		handleConversation();
 		_action._inProgress = false;
 		return;
@@ -8081,19 +8081,19 @@ void Scene113::step() {
 }
 
 void Scene113::actions() {
-	if (_vm->_gameConv->_running == 13) {
+	if (_vm->_gameConv->activeConvId() == 13) {
 		handleLoveConversation();
 		_action._inProgress = false;
 		return;
 	}
 
-	if (_vm->_gameConv->_running == 4) {
+	if (_vm->_gameConv->activeConvId() == 4) {
 		handleFlorentConversation();
 		_action._inProgress = false;
 		return;
 	}
 
-	if (_vm->_gameConv->_running == 6) {
+	if (_vm->_gameConv->activeConvId() == 6) {
 		handleDeadConversation();
 		_action._inProgress = false;
 		return;
diff --git a/engines/mads/phantom/phantom_scenes2.cpp b/engines/mads/phantom/phantom_scenes2.cpp
index eff0bf8..02e2d7c 100644
--- a/engines/mads/phantom/phantom_scenes2.cpp
+++ b/engines/mads/phantom/phantom_scenes2.cpp
@@ -156,14 +156,14 @@ void Scene201::step() {
 	if (_anim1ActvFl)
 		handleSellerAnimation();
 
-	if ((_needHoldFl) && (_vm->_gameConv->_running != 16)) {
+	if ((_needHoldFl) && (_vm->_gameConv->activeConvId() != 16)) {
 		_game._player._stepEnabled = false;
 		_needHoldFl = false;
 	}
 }
 
 void Scene201::actions() {
-	if (_vm->_gameConv->_running == 16) {
+	if (_vm->_gameConv->activeConvId() == 16) {
 		handleConversation();
 		_action._inProgress = false;
 		return;
@@ -786,13 +786,13 @@ void Scene202::step() {
 }
 
 void Scene202::actions() {
-	if (_vm->_gameConv->_running == 17) {
+	if (_vm->_gameConv->activeConvId() == 17) {
 		handleConversation1();
 		_action._inProgress = false;
 		return;
 	}
 
-	if (_vm->_gameConv->_running == 9) {
+	if (_vm->_gameConv->activeConvId() == 9) {
 		handleConversation2();
 		_action._inProgress = false;
 		return;
@@ -1725,7 +1725,7 @@ void Scene203::step() {
 		_vm->_sound->command(25);
 		_globals._sequenceIndexes[5] = _scene->_sequences.addStampCycle(_globals._spriteIndexes[5], false, -1);
 		_scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14);
-		if (_vm->_gameConv->_running != 15)
+		if (_vm->_gameConv->activeConvId() != 15)
 			_game._player._stepEnabled = true;
 		break;
 
@@ -1735,19 +1735,19 @@ void Scene203::step() {
 }
 
 void Scene203::actions() {
-	if (_vm->_gameConv->_running == 5) {
+	if (_vm->_gameConv->activeConvId() == 5) {
 		handleBrieConversation();
 		_action._inProgress = false;
 		return;
 	}
 
-	if (_vm->_gameConv->_running == 8) {
+	if (_vm->_gameConv->activeConvId() == 8) {
 		handleRichardConversation();
 		_action._inProgress = false;
 		return;
 	}
 
-	if (_vm->_gameConv->_running == 15) {
+	if (_vm->_gameConv->activeConvId() == 15) {
 		handleRichardAndDaaeConversation();
 		_action._inProgress = false;
 		return;
@@ -3481,7 +3481,7 @@ void Scene204::step() {
 	if (_game._trigger == 85)
 		_scene->_nextSceneId = 250;
 
-	if ((_vm->_gameConv->_running != 22) && !_skip1Fl && _endGameFl) {
+	if ((_vm->_gameConv->activeConvId() != 22) && !_skip1Fl && _endGameFl) {
 		_game._player._stepEnabled = false;
 		_skip1Fl = true;
 	}
@@ -3500,7 +3500,7 @@ void Scene204::step() {
 }
 
 void Scene204::actions() {
-	if (_vm->_gameConv->_running == 22) {
+	if (_vm->_gameConv->activeConvId() == 22) {
 		handleConversation();
 
 		_action._inProgress = false;
@@ -4525,19 +4525,19 @@ void Scene205::step() {
 }
 
 void Scene205::actions() {
-	if (_vm->_gameConv->_running == 18) {
+	if (_vm->_gameConv->activeConvId() == 18) {
 		handleConversation18();
 		_action._inProgress = false;
 		return;
 	}
 
-	if (_vm->_gameConv->_running == 10) {
+	if (_vm->_gameConv->activeConvId() == 10) {
 		handleConversation10();
 		_action._inProgress = false;
 		return;
 	}
 
-	if (_vm->_gameConv->_running == 11) {
+	if (_vm->_gameConv->activeConvId() == 11) {
 		handleConversation11();
 		_action._inProgress = false;
 		return;
diff --git a/engines/mads/phantom/phantom_scenes3.cpp b/engines/mads/phantom/phantom_scenes3.cpp
index bb9bcee..3527a79 100644
--- a/engines/mads/phantom/phantom_scenes3.cpp
+++ b/engines/mads/phantom/phantom_scenes3.cpp
@@ -1070,7 +1070,7 @@ void Scene304::step() {
 }
 
 void Scene304::actions() {
-	if (_vm->_gameConv->_running == 23) {
+	if (_vm->_gameConv->activeConvId() == 23) {
 		handleConversation23();
 		_action._inProgress = false;
 		return;
diff --git a/engines/mads/phantom/phantom_scenes5.cpp b/engines/mads/phantom/phantom_scenes5.cpp
index 2daaed9..406637e 100644
--- a/engines/mads/phantom/phantom_scenes5.cpp
+++ b/engines/mads/phantom/phantom_scenes5.cpp
@@ -257,7 +257,7 @@ void Scene501::step() {
 }
 
 void Scene501::actions() {
-	if (_vm->_gameConv->_running == 26) {
+	if (_vm->_gameConv->activeConvId() == 26) {
 		_action._inProgress = false;
 		return;
 	}
@@ -620,7 +620,7 @@ void Scene501::preActions() {
 			break;
 
 		case 1:
-			if (_vm->_gameConv->_running >= 0)
+			if (_vm->_gameConv->activeConvId() >= 0)
 				_scene->_sequences.addTimer(6, 1);
 			else {
 				_game._player._stepEnabled = true;
@@ -2263,7 +2263,7 @@ void Scene504::step() {
 }
 
 void Scene504::actions() {
-	if (_vm->_gameConv->_running == 26) {
+	if (_vm->_gameConv->activeConvId() == 26) {
 		_action._inProgress = false;
 		return;
 	}
@@ -2304,19 +2304,19 @@ void Scene504::actions() {
 		return;
 	}
 
-	if (_vm->_gameConv->_running == 19) {
+	if (_vm->_gameConv->activeConvId() == 19) {
 		handleListenConversation();
 		_action._inProgress = false;
 		return;
 	}
 
-	if (_vm->_gameConv->_running == 27) {
+	if (_vm->_gameConv->activeConvId() == 27) {
 		handlePlayConversation();
 		_action._inProgress = false;
 		return;
 	}
 
-	if (_vm->_gameConv->_running == 21) {
+	if (_vm->_gameConv->activeConvId() == 21) {
 		handleFightConversation();
 		_action._inProgress = false;
 		return;
@@ -2360,7 +2360,7 @@ void Scene504::actions() {
 
 	if (_action.isAction(VERB_WALK_THROUGH, NOUN_RIGHT_DOOR) || _action.isAction(VERB_OPEN, NOUN_RIGHT_DOOR)) {
 		if (_globals[kRightDoorIsOpen504]) {
-			if (_vm->_gameConv->_running == 26)
+			if (_vm->_gameConv->activeConvId() == 26)
 				_vm->_gameConv->abortConv();
 
 			_scene->_nextSceneId = 505;
@@ -2580,7 +2580,7 @@ void Scene504::preActions() {
 					break;
 
 				case 1:
-					if (_vm->_gameConv->_running >= 0)
+					if (_vm->_gameConv->activeConvId() >= 0)
 						_scene->_sequences.addTimer(6, 1);
 					else {
 						_game._player._stepEnabled = true;
@@ -3314,7 +3314,7 @@ void Scene505::actions() {
 		return;
 	}
 
-	if (_vm->_gameConv->_running == 20) {
+	if (_vm->_gameConv->activeConvId() == 20) {
 		handleCoffinDialog();
 		_action._inProgress = false;
 		return;
@@ -4077,7 +4077,7 @@ void Scene506::step() {
 			_scene->_nextSceneId = 501;
 	}
 
-	if (_ascendingFl && (_vm->_gameConv->_running != 26)) {
+	if (_ascendingFl && (_vm->_gameConv->activeConvId() != 26)) {
 		_ascendingFl = false;
 		_game._player._stepEnabled = false;
 	}
@@ -4205,7 +4205,7 @@ void Scene506::actions() {
 		return;
 	}
 
-	if (_vm->_gameConv->_running == 26) {
+	if (_vm->_gameConv->activeConvId() == 26) {
 		_action._inProgress = false;
 		return;
 	}






More information about the Scummvm-git-logs mailing list