[Scummvm-cvs-logs] scummvm master -> f1a80f91a684cd0e1fc2898d92a1c7531c3b2d75

dreammaster dreammaster at scummvm.org
Fri Jan 8 08:19:52 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:
f1a80f91a6 MADS: Implement GameConversations::run method


Commit: f1a80f91a684cd0e1fc2898d92a1c7531c3b2d75
    https://github.com/scummvm/scummvm/commit/f1a80f91a684cd0e1fc2898d92a1c7531c3b2d75
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-01-08T18:19:17+11:00

Commit Message:
MADS: Implement GameConversations::run method

Changed paths:
    engines/mads/conversations.cpp
    engines/mads/conversations.h



diff --git a/engines/mads/conversations.cpp b/engines/mads/conversations.cpp
index f51759d..5f30486 100644
--- a/engines/mads/conversations.cpp
+++ b/engines/mads/conversations.cpp
@@ -33,7 +33,9 @@ GameConversations::GameConversations(MADSEngine *vm) : _vm(vm) {
 	_restoreRunning = 0;
 	_nextStartNode = nullptr;
 	_playerEnabled = false;
+	_inputMode = kInputBuildingSentences;
 	_startFrameNumber = 0;
+	_val1 = _val2 = _val3 = _val4 = _val5 = 0;
 
 	// Mark all conversation slots as empty
 	for (int idx = 0; idx < MAX_CONVERSATIONS; ++idx)
@@ -86,12 +88,59 @@ void GameConversations::run(int id) {
 	// Initialize needed fields
 	_startFrameNumber = _vm->_events->getFrameCounter();
 	_playerEnabled = _vm->_game->_player._stepEnabled;
-	//TODO
+	_inputMode = _vm->_game->_screenObjects._inputMode;
+	_val1 = _val2 = _val3 = 0;
+	_val4 = 0;
+	_val5 = -1;
+
+	// Initialize speaker arrays
+	Common::fill(&_speakerActive[0], &_speakerActive[MAX_SPEAKERS], false);
+	Common::fill(&_speakerPortraits[0], &_speakerPortraits[MAX_SPEAKERS], -1);
+	Common::fill(&_speakerExists[0], &_speakerExists[MAX_SPEAKERS], 1);
+	Common::fill(&_arr4[0], &_arr4[MAX_SPEAKERS], 0x8000);
+	Common::fill(&_arr5[0], &_arr5[MAX_SPEAKERS], 0x8000);
+	Common::fill(&_arr6[0], &_arr6[MAX_SPEAKERS], 30);
 
 	// Start the conversation
 	start();
 
-	warning("TODO GameConversations::run");
+	// Set variables
+	setVariable(2, 0x4F78);
+	setVariable(3, 0x4F50);
+	setVariable(4, 0x4F52);
+	setVariable(5, 0x4F54);
+	setVariable(6, 0x4F56);
+	setVariable(7, 0x4F58);
+	setVariable(8, 0x4F5A);
+	setVariable(9, 0x4F5C);
+	setVariable(10, 0x4F5E);
+	setVariable(11, 0x4F60);
+	setVariable(12, 0x4F62);
+	setVariable(13, 0x4F64);
+	setVariable(14, 0x4F66);
+	setVariable(15, 0x4F68);
+	setVariable(16, 0x4F6A);
+	setVariable(17, 0x4F6C);
+	setVariable(18, 0x4F6E);
+	setVariable(19, 0x4F70);
+	setVariable(20, 0x4F72);
+	setVariable(21, 0x4F74);
+	setVariable(22, 0x4F76);
+
+	// Load sprite data for speaker portraits
+	for (uint idx = 0; idx < _runningConv->_data._speakerCount; ++idx) {
+		const Common::String &portraitName = _runningConv->_data._portraits[idx];
+		_speakerPortraits[idx] = _vm->_game->_scene._sprites.addSprites(portraitName, PALFLAG_RESERVED);
+
+		if (_speakerPortraits[idx] > 0) {
+			_speakerActive[idx] = true;
+			_speakerExists[idx] = _runningConv->_data._speakerExists[idx];
+		}
+	}
+
+	// Refresh colors if needed
+	if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE)
+		_vm->_palette->refreshSceneColors();
 }
 
 void GameConversations::start() {
@@ -99,6 +148,13 @@ void GameConversations::start() {
 	warning("TODO: 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;
+	}
+}
+
 void GameConversations::stop() {
 	warning("TODO GameConversations::stop");
 }
diff --git a/engines/mads/conversations.h b/engines/mads/conversations.h
index 2a2a625..ceb5ad6 100644
--- a/engines/mads/conversations.h
+++ b/engines/mads/conversations.h
@@ -26,6 +26,7 @@
 #include "common/scummsys.h"
 #include "common/array.h"
 #include "common/str-array.h"
+#include "mads/screen.h"
 
 namespace MADS {
 
@@ -88,6 +89,13 @@ struct ConversationData {
 };
 
 struct ConversationData2 {
+	struct ConversationVar {
+		int v1;
+		int v2;
+		int v3;
+	};
+
+	Common::Array<ConversationVar> _vars;
 };
 
 struct ConversationEntry {
@@ -102,6 +110,14 @@ class GameConversations {
 private:
 	MADSEngine *_vm;
 	ConversationEntry _conversations[MAX_CONVERSATIONS];
+	bool _speakerActive[MAX_SPEAKERS];
+	int _speakerPortraits[MAX_SPEAKERS];
+	int _speakerExists[MAX_SPEAKERS];
+	int _arr4[MAX_SPEAKERS];
+	int _arr5[MAX_SPEAKERS];
+	int _arr6[MAX_SPEAKERS];
+	InputMode _inputMode;
+	int _val1, _val2, _val3, _val4, _val5;
 
 	/**
 	 * Returns the record for the specified conversation, if it's loaded
@@ -128,6 +144,11 @@ public:
 	 */
 	virtual ~GameConversations();
 
+	/**
+	 * Sets a variable
+	 */
+	void setVariable(uint idx, int v1, int v2 = -1);
+
 	int* _nextStartNode;
 	int* getVariable(int idx);
 






More information about the Scummvm-git-logs mailing list