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

dreammaster dreammaster at scummvm.org
Thu Aug 25 03:20:15 CEST 2016


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

Summary:
456ed17671 DEVTOOLS: Add MissiveOMat message data to create_titanic
e81e3aefde TITANIC: Implemented CMissiveOMat class


Commit: 456ed176716432b8c54fae5ed252db07d1c71dd7
    https://github.com/scummvm/scummvm/commit/456ed176716432b8c54fae5ed252db07d1c71dd7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-24T21:19:37-04:00

Commit Message:
DEVTOOLS: Add MissiveOMat message data to create_titanic

Changed paths:
    devtools/create_titanic/create_titanic_dat.cpp



diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp
index 9186c1c..a7dbe53 100644
--- a/devtools/create_titanic/create_titanic_dat.cpp
+++ b/devtools/create_titanic/create_titanic_dat.cpp
@@ -285,6 +285,84 @@ static const FrameRange BARBOT_FRAME_RANGES[60] = {
 	{ 202, 281 }, { 182, 202 }, { 165, 182 }, { 96, 165 }, { 0, 95 }
 };
 
+const char *const MISSIVEOMAT_MESSAGES[3] = {
+	"Welcome, Leovinus.\n"
+	"\n"
+	"This is your Missive-O-Mat.\n"
+	"\n"
+	"You have received 1827 Electric Missives.\n"
+	"\n"
+	"For your convenience I have deleted:\n"
+	" 453 things that people you don't know thought it would be "
+	"terribly witty to forward to you,\n"
+	" 63 Missives containing double or triple exclamation marks,\n"
+	" 846 Missives from mailing-lists you once thought might be quite "
+	"interesting and now can't figure out how to cancel,\n"
+	" 962 Chain Missives,\n"
+	" 1034 instructions on how to become a millionaire using butter,\n"
+	" 3 Yassaccan Death Threats (slightly down on last week which is"
+	" pleasing news),\n"
+	" and a Missive from your Mother which I have answered reassuringly.\n"
+	"\n"
+	"I have selected the following Missives for your particular attention. "
+	"You will not need to run Fib-Finder to see why.  Something Is Up and I "
+	"suspect those two slippery urchins Brobostigon and Scraliontis are behind it.",
+
+	"Hello Droot.  I have evaluated your recent missives.\n"
+	"Contents break down as follows:\n"
+	"\n"
+	"Good news 49%\n"
+	"Bad news 48%\n"
+	"Indifferent news 4%\n"
+	"Petty mailings and Family Missives 5%\n"
+	"Special Offers from the Blerontin Sand Society 1% (note - there's"
+	" a rather pretty dune for hire on p4)\n"
+	"\n"
+	"In general terms you Thrive.  You continue to Prosper.   Your shares are"
+	" Secure.  Your hair, as always, looks Good.  Carpet 14 needs cleaning.  \n"
+	"\n"
+	"I am pleased to report there have been no further comments about "
+	"foot odor.\n"
+	"\n"
+	"Recommend urgently you sell all fish paste shares as Market jittery.\n"
+	"\n"
+	"As your Great Scheme nears completion I have taken the liberty of"
+	" replying to all non-urgent Missives and list below only communic"
+	"ations with Manager Brobostigon and His Pain in the Ass Loftiness"
+	" Leovinus.  \n"
+	"\n"
+	"Beware - Leovinus grows suspicious.  Don't take your eye off B"
+	"robostigon.  \n"
+	"\n"
+	"Weather for the Launch tomorrow is bright and sunny.  Hazy clouds"
+	" will be turned on at eleven.  I suggest the red suit with the st"
+	"reamers.\n"
+	"\n"
+	"All money transfers will be completed through alias accounts by m"
+	"oonsup.\n"
+	"\n"
+	"Eat well.  Your fish levels are down and you may suffer indecisio"
+	"n flutters mid-morning.\n"
+	"\n"
+	"Here are your Missives...",
+
+	"Hello Antar, this is your Missive-o-Mat.\n"
+	"Not that you need reminding but today is the Glorious Dawning of "
+	"a New Age in Luxury Space Travel.\n"
+	"\n"
+	"Generally my assessment of your position this morning is that you"
+	" are well, albeit not as rich as you would like to be.  I hope yo"
+	"ur interesting collaboration with Mr Scraliontis will soon bear f"
+	"ruit. \n"
+	"\n"
+	"I trust your flatulence has eased during the night.  Such a distr"
+	"essing condition for a man in your position.\n"
+	"\n"
+	"Most of your Missives are routine construction matters which I ha"
+	"ve dealt with and deleted.  All Missives from Mr Scraliontis and "
+	"His Loftiness Leovinus are here."
+};
+
 void NORETURN_PRE error(const char *s, ...) {
 	printf("%s\n", s);
 	exit(1);
@@ -619,6 +697,24 @@ void writeBarbotFrameRanges() {
 	dataOffset += size;
 }
 
+void writeMissiveOMatMessages() {
+	outputFile.seek(dataOffset);
+
+	for (int idx = 0; idx < 3; ++idx)
+		outputFile.writeString(MISSIVEOMAT_MESSAGES[idx]);
+
+	uint size = outputFile.size() - dataOffset;
+	writeEntryHeader("TEXT/MISSIVEOMAT/WELCOME", dataOffset, size);
+	dataOffset += size;
+
+	static const int MESSAGES[3] = { 0x5A63C0, 0x5A5BA8, 0x5A4A18 };
+	writeStringArray("TEXT/MISSIVEOMAT/MESSAGES", MESSAGES[_version], 58);
+	static const int FROM[3] = { 0x5A61F0, 0x5A59D8, 0x5A4BE8 };
+	writeStringArray("TEXT/MISSIVEOMAT/FROM", FROM[_version], 58);
+	static const int TO[3] = { 0x5A62D8, 0x5A5AC0, 0x5A4B00 };
+	writeStringArray("TEXT/MISSIVEOMAT/TO", TO[_version], 58);
+}
+
 void writeHeader() {
 	// Write out magic string
 	const char *MAGIC_STR = "SVTN";
@@ -789,6 +885,7 @@ void writeData() {
 	writeAllUpdateStates();
 	writeAllScriptPreResponses();
 	writeBarbotFrameRanges();
+	writeMissiveOMatMessages();
 }
 
 void createScriptMap() {


Commit: e81e3aefde040a9a8e133c3c1059ea66e9d91db5
    https://github.com/scummvm/scummvm/commit/e81e3aefde040a9a8e133c3c1059ea66e9d91db5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-24T21:20:03-04:00

Commit Message:
TITANIC: Implemented CMissiveOMat class

Changed paths:
    engines/titanic/core/game_object.cpp
    engines/titanic/core/game_object.h
    engines/titanic/game/missiveomat.cpp
    engines/titanic/game/missiveomat.h
    engines/titanic/gfx/edit_control.cpp
    engines/titanic/messages/messages.h



diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 3126aac..0289e78 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -1066,7 +1066,7 @@ void CGameObject::setMovieFrameRate(double rate) {
 		_surface->setMovieFrameRate(rate);
 }
 
-void CGameObject::setTextBorder(const CString &str, int border, int borderRight) {
+void CGameObject::setText(const CString &str, int border, int borderRight) {
 	if (!_text)
 		_text = new CPetText();
 	_textBorder = border;
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index d089ce5..53e26b5 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -491,9 +491,9 @@ protected:
 	void setMovieFrameRate(double rate);
 
 	/**
-	 * Set up the text borders for the object
+	 * Set up the text and borders for the object
 	 */
-	void setTextBorder(const CString &str, int border = 0, int borderRight = 0);
+	void setText(const CString &str, int border = 0, int borderRight = 0);
 
 	/**
 	 * Sets whether the text will use borders
diff --git a/engines/titanic/game/missiveomat.cpp b/engines/titanic/game/missiveomat.cpp
index 32ae24e..b7eb3ed 100644
--- a/engines/titanic/game/missiveomat.cpp
+++ b/engines/titanic/game/missiveomat.cpp
@@ -21,6 +21,8 @@
  */
 
 #include "titanic/game/missiveomat.h"
+#include "titanic/core/room_item.h"
+#include "titanic/titanic.h"
 
 namespace Titanic {
 
@@ -32,30 +34,42 @@ BEGIN_MESSAGE_MAP(CMissiveOMat, CGameObject)
 	ON_MESSAGE(LeaveViewMsg)
 END_MESSAGE_MAP()
 
-CMissiveOMat::CMissiveOMat() : CGameObject(), _fieldBC(1),
-	_fieldC0(0), _fieldC4(0), _fieldE0(-1) {
+CMissiveOMat::CMissiveOMat() : CGameObject(), _mode(1),
+		_totalMessages(0), _messageNum(0), _personIndex(-1) {
+	// Load data for the messages, their from and to names
+	loadArray(_welcomeMessages, "TEXT/MISSIVEOMAT/WELCOME", 3);
+	loadArray(_messages, "TEXT/MISSIVEOMAT/MESSAGES", 58);
+	loadArray(_from, "TEXT/MISSIVEOMAT/FROM", 58);
+	loadArray(_to, "TEXT/MISSIVEOMAT/TO", 58);
+}
+
+void CMissiveOMat::loadArray(CString *arr, const CString &resName, int count) {
+	Common::SeekableReadStream *s = g_vm->_filesManager->getResource(resName);
+	for (int idx = 0; idx < count; ++idx)
+		arr[idx] = readStringFromStream(s);
+	delete s;
 }
 
 void CMissiveOMat::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeNumberLine(_fieldBC, indent);
-	file->writeNumberLine(_fieldC0, indent);
-	file->writeNumberLine(_fieldC4, indent);
+	file->writeNumberLine(_mode, indent);
+	file->writeNumberLine(_totalMessages, indent);
+	file->writeNumberLine(_messageNum, indent);
 	file->writeQuotedLine(_string1, indent);
 	file->writeQuotedLine(_string2, indent);
-	file->writeNumberLine(_fieldE0, indent);
+	file->writeNumberLine(_personIndex, indent);
 
 	CGameObject::save(file, indent);
 }
 
 void CMissiveOMat::load(SimpleFile *file) {
 	file->readNumber();
-	_fieldBC = file->readNumber();
-	_fieldC0 = file->readNumber();
-	_fieldC4 = file->readNumber();
+	_mode = file->readNumber();
+	_totalMessages = file->readNumber();
+	_messageNum = file->readNumber();
 	_string1 = file->readString();
 	_string2 = file->readString();
-	_fieldE0 = file->readNumber();
+	_personIndex = file->readNumber();
 
 	CGameObject::load(file);
 }
@@ -67,25 +81,249 @@ bool CMissiveOMat::EnterViewMsg(CEnterViewMsg *msg) {
 }
 
 bool CMissiveOMat::KeyCharMsg(CKeyCharMsg *msg) {
-	// TODO
+	CTreeItem *loginControl = findRoom()->findByName("MissiveOMat Login Control");
+	CTreeItem *welcome = findRoom()->findByName("MissiveOMat Welcome");
+	CTreeItem *scrollUp = findRoom()->findByName("MissiveOMat ScrollUp Button");
+	CEditControlMsg editMsg;
+
+	switch (_mode) {
+	case 1: {
+		playSound("z#228.wav");
+		editMsg._mode = 6;
+		editMsg._param = msg->_key;
+		editMsg.execute(loginControl);
+
+		if (editMsg._param == 1000) {
+			editMsg._mode = 3;
+			editMsg.execute(loginControl);
+		
+			_string1 = editMsg._text;
+			if (!_string1.empty()) {
+				loadFrame(2);
+				_mode = 2;
+
+				editMsg._mode = 1;
+				editMsg.execute(loginControl);
+				editMsg._mode = 10;
+				editMsg._param = 24;
+				editMsg.execute(loginControl);
+			}
+		}
+		break;
+	}
+
+	case 2: {
+		playSound("z#228.wav");
+		editMsg._mode = 6;
+		editMsg._param = msg->_key;
+		editMsg.execute(loginControl);
+
+		_string2 = editMsg._text;
+		if (_string1 == "Droot Scraliontis") {
+			_string1 = "Scraliontis";
+		} else if (_string1 == "Antar Brobostigon") {
+			_string1 = "Brobostigon";
+		} else if (_string1 == "colin") {
+			_string1 = "Leovinus";
+		}
+
+		bool flag = false;
+		if (_string1 == "Leovinus") {
+			if (_string2 == "Other") {
+				flag = true;
+				_personIndex = 0;
+			}
+		} else if (_string1 == "Scraliontis") {
+			if (_string2 == "This") {
+				flag = true;
+				_personIndex = 1;
+			}
+		} else if (_string1 == "Brobostigon") {
+			if (_string2 == "That") {
+				flag = true;
+				_personIndex = 2;
+			}
+		}
+
+		if (flag) {
+			_mode = 4;
+			loadFrame(4);
+			editMsg._mode = 1;
+			editMsg.execute(loginControl);
+
+			getTextCursor()->hide();
+			editMsg._mode = 13;
+			editMsg.execute(loginControl);
+
+			editMsg._mode = 12;
+			editMsg.execute(welcome);
+
+			editMsg._mode = 2;
+			editMsg._text = _welcomeMessages[_personIndex];
+			editMsg.execute(welcome);
+
+			editMsg._mode = 12;
+			editMsg._text = "MissiveOMat OK Button";
+			editMsg.execute(welcome);
+			editMsg.execute(scrollUp);
+		} else {
+			_mode = 3;
+			loadFrame(3);
+			addTimer(1500);
+
+			editMsg._mode = 1;
+			editMsg.execute(loginControl);
+
+			getTextCursor()->hide();
+		}
+		break;
+	}
+
+	default:
+		break;
+	}
+
 	return true;
 }
 
 bool CMissiveOMat::TimerMsg(CTimerMsg *msg) {
-	if (_fieldBC == 3) {
-		// TODO
+	if (_mode == 3) {
+		CTreeItem *loginControl = findRoom()->findByName("MissiveOMat Login Control");
+		CEditControlMsg editMsg;
+		editMsg._mode = 10;
+		editMsg._param = 8;
+		editMsg.execute(loginControl);
 	}
 
 	return true;
 }
 
 bool CMissiveOMat::MissiveOMatActionMsg(CMissiveOMatActionMsg *msg) {
-	// TODO
+	CTreeItem *welcome = findByName("MissiveOMat Welcome");
+
+	switch (msg->_action) {
+	case MESSAGE_SHOW: {
+		CTreeItem *btnOk = findRoom()->findByName("MissiveOMat OK Button");
+		CTreeItem *btnNext = findRoom()->findByName("MissiveOMat Next Button");
+		CTreeItem *btnPrev = findRoom()->findByName("MissiveOMat Prev Button");
+		CTreeItem *btnLogout = findRoom()->findByName("MissiveOMat Logout Button");
+
+		_mode = MESSAGE_5;
+		CVisibleMsg visibleMsg;
+		visibleMsg._visible = false;
+		visibleMsg.execute(btnOk);
+		visibleMsg._visible = true;
+		visibleMsg.execute(btnNext);
+		visibleMsg.execute(btnPrev);
+		visibleMsg.execute(btnLogout);
+
+		_messageNum = 0;
+		_totalMessages = 0;
+		CString *strP = &_messages[_personIndex * 19];
+		for (_totalMessages = 0; !strP->empty(); ++strP, ++_totalMessages)
+			;
+		
+		CMissiveOMatActionMsg actionMsg;
+		actionMsg._action = REDRAW_MESSAGE;
+		actionMsg.execute(this);
+		break;
+	}
+
+	case NEXT_MESSAGE:
+		if (_messageNum < (_totalMessages - 1)) {
+			++_messageNum;
+			CMissiveOMatActionMsg actionMsg;
+			actionMsg._action = REDRAW_MESSAGE;
+			actionMsg.execute(this);
+		}
+		break;
+	
+	case PRIOR_MESSAGE:
+		if (_messageNum > 0) {
+			--_messageNum;
+			CMissiveOMatActionMsg actionMsg;
+			actionMsg._action = REDRAW_MESSAGE;
+			actionMsg.execute(this);
+		}
+		break;
+
+	case MESSAGE_5: {
+		CMissiveOMatActionMsg actionMsg;
+		actionMsg._action = MESSAGE_9;
+		actionMsg.execute(this);
+		break;
+	}
+
+	case MESSAGE_DOWN:
+		if (welcome)
+			scrollTextDown();
+		break;
+
+	case MESSAGE_UP:
+		if (welcome)
+			scrollTextUp();
+		break;
+
+	case REDRAW_MESSAGE:
+		if (welcome) {
+			CString str = CString::format(
+				"Missive %d of %d.\nFrom: %s\nTo: %s\n\n%s\n",
+				_messageNum + 1, _totalMessages, _from[_messageNum],
+				_to[_messageNum], _messages[_messageNum]);
+
+			setText(str);
+		}
+		break;
+
+	case MESSAGE_9: {
+		loadFrame(1);
+		_mode = MESSAGE_NONE;
+		_personIndex = -1;
+
+		static const char *const WIDGETS[7] = {
+			"MissiveOMat Login Control", "MissiveOMat OK Button",
+			"MissiveOMat Next Button", "MissiveOMat Prev Button",
+			"MissiveOMat Logout Button", "MissiveOMat ScrollDown Button",
+			"MissiveOMat ScrollUp Button"
+		};
+		CEditControlMsg editMsg;
+
+		for (int idx = 0; idx < 7; ++idx) {
+			editMsg._mode = 0;
+			editMsg._param = 12;
+			editMsg.execute(WIDGETS[idx]);
+			editMsg._mode = 1;
+			editMsg.execute(WIDGETS[idx]);
+			editMsg._mode = 13;
+			editMsg.execute(WIDGETS[idx]);
+		}
+
+		editMsg._mode = 12;
+		editMsg.execute("MissiveOMat Login Control");
+		editMsg._mode = 10;
+		editMsg._param = 8;
+		editMsg.execute("MissiveOMat Login Control");
+		editMsg._mode = 8;
+		editMsg.execute("MissiveOMat Login Control");
+
+		_string1.clear();
+		_string2.clear();
+		break;
+	}
+
+	default:
+		break;
+	}
+
 	return true;
 }
 
 bool CMissiveOMat::LeaveViewMsg(CLeaveViewMsg *msg) {
-	// TODO
+	CEditControlMsg editMsg;
+	editMsg._mode = 9;
+	editMsg.execute("MissiveOMat Login Control");
+	petShowCursor();
+
 	return true;
 }
 
diff --git a/engines/titanic/game/missiveomat.h b/engines/titanic/game/missiveomat.h
index c4913de..9810fcc 100644
--- a/engines/titanic/game/missiveomat.h
+++ b/engines/titanic/game/missiveomat.h
@@ -27,6 +27,12 @@
 
 namespace Titanic {
 
+enum MissiveOMatAction {
+	MESSAGE_NONE = 1, MESSAGE_SHOW = 2, NEXT_MESSAGE = 3, PRIOR_MESSAGE = 4,
+	MESSAGE_5 = 5, MESSAGE_DOWN = 6, MESSAGE_UP = 7, REDRAW_MESSAGE = 8,
+	MESSAGE_9 = 9
+};
+
 class CMissiveOMat : public CGameObject {
 	DECLARE_MESSAGE_MAP;
 	bool EnterViewMsg(CEnterViewMsg *msg);
@@ -34,13 +40,20 @@ class CMissiveOMat : public CGameObject {
 	bool TimerMsg(CTimerMsg *msg);
 	bool MissiveOMatActionMsg(CMissiveOMatActionMsg *msg);
 	bool LeaveViewMsg(CLeaveViewMsg *msg);
+private:
+	CString _welcomeMessages[3];
+	CString _messages[58];
+	CString _from[58];
+	CString _to[58];
+private:
+	void loadArray(CString *arr, const CString &resName, int count);
 public:
-	int _fieldBC;
-	int _fieldC0;
-	int _fieldC4;
+	int _mode;
+	int _totalMessages;
+	int _messageNum;
 	CString _string1;
 	CString _string2;
-	int _fieldE0;
+	int _personIndex;
 public:
 	CLASSDEF;
 	CMissiveOMat();
diff --git a/engines/titanic/gfx/edit_control.cpp b/engines/titanic/gfx/edit_control.cpp
index 4098220..3f3c4d4 100644
--- a/engines/titanic/gfx/edit_control.cpp
+++ b/engines/titanic/gfx/edit_control.cpp
@@ -190,8 +190,8 @@ bool CEditControl::EditControlMsg(CEditControlMsg *msg) {
 
 	case 14: {
 		makeDirty();
-		CString borderName = _fieldF4 ? CString('*', _text.size()) : _text;
-		setTextBorder(borderName);
+		CString str = _fieldF4 ? CString('*', _text.size()) : _text;
+		setText(str);
 
 		int textWidth = getTextWidth();
 		if (_fieldF0 == 2) {
diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h
index fa05416..82e9a55 100644
--- a/engines/titanic/messages/messages.h
+++ b/engines/titanic/messages/messages.h
@@ -245,7 +245,7 @@ MESSAGE1(CLoadSuccessMsg, int, ticks, 0);
 MESSAGE1(CLockPhonographMsg, int, value, 0);
 MESSAGE0(CMaitreDDefeatedMsg);
 MESSAGE0(CMaitreDHappyMsg);
-MESSAGE1(CMissiveOMatActionMsg, int, value, 0);
+MESSAGE1(CMissiveOMatActionMsg, int, action, 0);
 MESSAGE0(CMoveToStartPosMsg);
 MESSAGE2(CMovieEndMsg, int, startFrame, 0, int, endFrame, 0);
 MESSAGE2(CMovieFrameMsg, int, frameNumber, 0, int, value2, 0);






More information about the Scummvm-git-logs mailing list