[Scummvm-git-logs] scummvm master -> 977a4a5df150487c01abc7ea06ac76ecbf16279c

dreammaster dreammaster at scummvm.org
Sat Dec 31 11:21:31 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:
977a4a5df1 TITANIC: Further fixes and cleanup for MissiveOMat login


Commit: 977a4a5df150487c01abc7ea06ac76ecbf16279c
    https://github.com/scummvm/scummvm/commit/977a4a5df150487c01abc7ea06ac76ecbf16279c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-12-31T05:21:19-05:00

Commit Message:
TITANIC: Further fixes and cleanup for MissiveOMat login

Changed paths:
    engines/titanic/game/missiveomat.cpp
    engines/titanic/game/missiveomat.h
    engines/titanic/game/missiveomat_button.cpp
    engines/titanic/game/missiveomat_button.h
    engines/titanic/messages/messages.h


diff --git a/engines/titanic/game/missiveomat.cpp b/engines/titanic/game/missiveomat.cpp
index 9fac83a..8f491ca 100644
--- a/engines/titanic/game/missiveomat.cpp
+++ b/engines/titanic/game/missiveomat.cpp
@@ -75,15 +75,13 @@ void CMissiveOMat::load(SimpleFile *file) {
 }
 
 bool CMissiveOMat::EnterViewMsg(CEnterViewMsg *msg) {
-	CMissiveOMatActionMsg actionMsg(9);
+	CMissiveOMatActionMsg actionMsg(MESSAGE_9);
 	actionMsg.execute(this);
 	return true;
 }
 
 bool CMissiveOMat::KeyCharMsg(CKeyCharMsg *msg) {
 	CTreeItem *loginControl = findRoom()->findByName("MissiveOMat Login Control");
-	CTreeItem *welcome = findRoom()->findByName("MissiveOMat Welcome");
-	CTreeItem *scrollUp = findRoom()->findByName("MissiveOMat ScrollUp Button");
 	CEditControlMsg editMsg;
 
 	switch (_mode) {
@@ -162,6 +160,12 @@ bool CMissiveOMat::KeyCharMsg(CKeyCharMsg *msg) {
 				editMsg._mode = EDIT_CLEAR;
 				editMsg.execute(loginControl);
 
+				CRoomItem *room = findRoom();
+				CTreeItem *welcome = room->findByName("MissiveOMat Welcome");
+				CTreeItem *scrollUp = room->findByName("MissiveOMat ScrollUp Button");
+				CTreeItem *scrollDown = room->findByName("MissiveOMat ScrollDown Button");
+				CTreeItem *ok = room->findByName("MissiveOMat OK Button");
+
 				getTextCursor()->hide();
 				editMsg._mode = EDIT_HIDE;
 				editMsg.execute(loginControl);
@@ -174,9 +178,9 @@ bool CMissiveOMat::KeyCharMsg(CKeyCharMsg *msg) {
 				editMsg.execute(welcome);
 
 				editMsg._mode = EDIT_SHOW;
-				editMsg._text = "MissiveOMat OK Button";
-				editMsg.execute(welcome);
+				editMsg.execute(ok);
 				editMsg.execute(scrollUp);
+				editMsg.execute(scrollDown);
 			} else {
 				// Credentials were invalid, so access denied
 				_mode = MMODE_DENIED;
@@ -296,15 +300,15 @@ bool CMissiveOMat::MissiveOMatActionMsg(CMissiveOMatActionMsg *msg) {
 		_mode = MMODE_USERNAME;
 		_account = NO_ACCOUNT;
 
-		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"
+		static const char *const WIDGETS[8] = {
+			"MissiveOMat Login Control", "MissiveOMat Welcome",
+			"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) {
+		for (int idx = 0; idx < 8; ++idx) {
 			editMsg._mode = EDIT_INIT;
 			editMsg._param = 12;
 			editMsg.execute(WIDGETS[idx]);
diff --git a/engines/titanic/game/missiveomat.h b/engines/titanic/game/missiveomat.h
index 1c8e94d..c8441ed 100644
--- a/engines/titanic/game/missiveomat.h
+++ b/engines/titanic/game/missiveomat.h
@@ -27,12 +27,6 @@
 
 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
-};
-
 enum MissiveOMatMode {
 	MMODE_USERNAME = 1,
 	MMODE_PASSWORD = 2,
diff --git a/engines/titanic/game/missiveomat_button.cpp b/engines/titanic/game/missiveomat_button.cpp
index b7ad7f8..8c1f6c5 100644
--- a/engines/titanic/game/missiveomat_button.cpp
+++ b/engines/titanic/game/missiveomat_button.cpp
@@ -40,7 +40,7 @@ void CMissiveOMatButton::save(SimpleFile *file, int indent) {
 
 void CMissiveOMatButton::load(SimpleFile *file) {
 	file->readNumber();
-	_buttonId = file->readNumber();
+	_buttonId = (MissiveOMatAction)file->readNumber();
 
 	CEditControl::load(file);
 }
diff --git a/engines/titanic/game/missiveomat_button.h b/engines/titanic/game/missiveomat_button.h
index 6dbfd4c..b029f6c 100644
--- a/engines/titanic/game/missiveomat_button.h
+++ b/engines/titanic/game/missiveomat_button.h
@@ -24,6 +24,7 @@
 #define TITANIC_MISSIVEOMAT_BUTTON_H
 
 #include "titanic/gfx/edit_control.h"
+#include "titanic/messages/messages.h"
 
 namespace Titanic {
 
@@ -33,10 +34,10 @@ class CMissiveOMatButton : public CEditControl {
 	bool VisibleMsg(CVisibleMsg *msg);
 	bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg);
 public:
-	int _buttonId;
+	MissiveOMatAction _buttonId;
 public:
 	CLASSDEF;
-	CMissiveOMatButton() : CEditControl(), _buttonId(2) {}
+	CMissiveOMatButton() : CEditControl(), _buttonId(MESSAGE_SHOW) {}
 
 	/**
 	 * Save the data for the class to file
diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h
index a6e4a38..0cbb4b0 100644
--- a/engines/titanic/messages/messages.h
+++ b/engines/titanic/messages/messages.h
@@ -216,6 +216,12 @@ public:
 	}
 };
 
+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
+};
+
 MESSAGE1(CActMsg, CString, action, "");
 MESSAGE1(CActivationmsg, CString, value, "");
 MESSAGE1(CAddHeadPieceMsg, CString, value, "NULL");
@@ -279,7 +285,7 @@ MESSAGE1(CLoadSuccessMsg, int, ticks, 0);
 MESSAGE1(CLockPhonographMsg, int, value, 0);
 MESSAGE0(CMaitreDDefeatedMsg);
 MESSAGE0(CMaitreDHappyMsg);
-MESSAGE1(CMissiveOMatActionMsg, int, action, 0);
+MESSAGE1(CMissiveOMatActionMsg, MissiveOMatAction, action, MESSAGE_NONE);
 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