aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/gfx
diff options
context:
space:
mode:
authorPaul Gilbert2016-04-05 21:58:53 -0400
committerPaul Gilbert2016-04-05 21:58:53 -0400
commitcb2dc0c8c8ab5b73f1ea863105a514202513de35 (patch)
treeda5050645ad1790481184f66342353333b8950fa /engines/titanic/gfx
parent19e4bca41c6ecc1f4f71f04d919af75bc14f2d58 (diff)
downloadscummvm-rg350-cb2dc0c8c8ab5b73f1ea863105a514202513de35.tar.gz
scummvm-rg350-cb2dc0c8c8ab5b73f1ea863105a514202513de35.tar.bz2
scummvm-rg350-cb2dc0c8c8ab5b73f1ea863105a514202513de35.zip
TITANIC: Implementing CSTButton
Diffstat (limited to 'engines/titanic/gfx')
-rw-r--r--engines/titanic/gfx/st_button.cpp51
-rw-r--r--engines/titanic/gfx/st_button.h19
2 files changed, 53 insertions, 17 deletions
diff --git a/engines/titanic/gfx/st_button.cpp b/engines/titanic/gfx/st_button.cpp
index 44aa5cb7c5..0d17331477 100644
--- a/engines/titanic/gfx/st_button.cpp
+++ b/engines/titanic/gfx/st_button.cpp
@@ -25,39 +25,66 @@
namespace Titanic {
CSTButton::CSTButton() : CBackground() {
- _fieldE0 = 0;
- _string3 = "NULL";
+ _statusInc = 0;
+ _statusTarget = "NULL";
_fieldF0 = 0;
- _fieldF4 = 0;
+ _newStatus = 0;
_string4 = "NULL";
_string5 = "NULL";
- _field110 = 0;
+ _buttonFrame = 0;
}
void CSTButton::save(SimpleFile *file, int indent) const {
file->writeNumberLine(1, indent);
- file->writeNumberLine(_fieldE0, indent);
- file->writeQuotedLine(_string3, indent);
+ file->writeNumberLine(_statusInc, indent);
+ file->writeQuotedLine(_statusTarget, indent);
file->writeNumberLine(_fieldF0, indent);
- file->writeNumberLine(_fieldF4, indent);
+ file->writeNumberLine(_newStatus, indent);
file->writeQuotedLine(_string4, indent);
file->writeQuotedLine(_string5, indent);
- file->writeNumberLine(_field110, indent);
+ file->writeNumberLine(_buttonFrame, indent);
CBackground::save(file, indent);
}
void CSTButton::load(SimpleFile *file) {
file->readNumber();
- _fieldE0 = file->readNumber();
- _string3 = file->readString();
+ _statusInc = file->readNumber();
+ _statusTarget = file->readString();
_fieldF0 = file->readNumber();
- _fieldF4 = file->readNumber();
+ _newStatus = file->readNumber();
_string4 = file->readString();
_string5 = file->readString();
- _field110 = file->readNumber();
+ _buttonFrame = file->readNumber() != 0;
CBackground::load(file);
}
+bool CSTButton::handleMessage(CMouseButtonDownMsg &msg) {
+ changeStatus(0);
+ // TODO: Obj6c stuff
+
+ return true;
+}
+
+bool CSTButton::handleMessage(CMouseButtonUpMsg &msg) {
+ int value1 = _newStatus;
+ int value2 = _newStatus + _statusInc;
+
+ CStatusChangeMsg statusMsg(value1, value2, 0);
+ _newStatus = value2;
+ statusMsg.execute(_statusTarget);
+
+ if (statusMsg._value3) {
+ _newStatus -= _statusInc;
+ }
+
+ return true;
+}
+
+bool CSTButton::handleMessage(CEnterViewMsg &msg) {
+ loadFrame(_buttonFrame);
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/gfx/st_button.h b/engines/titanic/gfx/st_button.h
index e63d1c831c..3e2ebe07a8 100644
--- a/engines/titanic/gfx/st_button.h
+++ b/engines/titanic/gfx/st_button.h
@@ -24,18 +24,27 @@
#define TITANIC_ST_BUTTON_H
#include "titanic/core/background.h"
+#include "titanic/messages/mouse_messages.h"
+#include "titanic/messages/messages.h"
namespace Titanic {
-class CSTButton : public CBackground {
+class CSTButton : public CBackground,
+ public CMouseButtonDownMsgTarget,
+ public CMouseButtonUpMsgTarget,
+ public CEnterViewMsgTarget {
private:
- int _fieldE0;
- CString _string3;
+ int _statusInc;
+ CString _statusTarget;
int _fieldF0;
- int _fieldF4;
+ int _newStatus;
CString _string4;
CString _string5;
- int _field110;
+ int _buttonFrame;
+protected:
+ virtual bool handleMessage(CMouseButtonDownMsg &msg);
+ virtual bool handleMessage(CMouseButtonUpMsg &msg);
+ virtual bool handleMessage(CEnterViewMsg &msg);
public:
CLASSDEF
CSTButton();