aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-12-31 05:21:19 -0500
committerPaul Gilbert2016-12-31 05:21:19 -0500
commit977a4a5df150487c01abc7ea06ac76ecbf16279c (patch)
treec387682a8079f2767f967653668d9a4d8ac15ad9
parent2d3d45002b8c1495fe41b973eca5dd7900b21155 (diff)
downloadscummvm-rg350-977a4a5df150487c01abc7ea06ac76ecbf16279c.tar.gz
scummvm-rg350-977a4a5df150487c01abc7ea06ac76ecbf16279c.tar.bz2
scummvm-rg350-977a4a5df150487c01abc7ea06ac76ecbf16279c.zip
TITANIC: Further fixes and cleanup for MissiveOMat login
-rw-r--r--engines/titanic/game/missiveomat.cpp26
-rw-r--r--engines/titanic/game/missiveomat.h6
-rw-r--r--engines/titanic/game/missiveomat_button.cpp2
-rw-r--r--engines/titanic/game/missiveomat_button.h5
-rw-r--r--engines/titanic/messages/messages.h8
5 files changed, 26 insertions, 21 deletions
diff --git a/engines/titanic/game/missiveomat.cpp b/engines/titanic/game/missiveomat.cpp
index 9fac83a5ea..8f491cadf6 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 1c8e94d59c..c8441edff2 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 b7ad7f8f6f..8c1f6c51c6 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 6dbfd4cd56..b029f6ce85 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 a6e4a381b1..0cbb4b0e76 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);