diff options
author | Paul Gilbert | 2016-12-31 01:11:10 -0500 |
---|---|---|
committer | Paul Gilbert | 2016-12-31 01:11:10 -0500 |
commit | 1fb69e99bd8d88d458f151af4008b9a7419b0060 (patch) | |
tree | 8bfce12bdd2fec63d518be406d910556dbe9843a /engines/titanic | |
parent | ea536d2ad29a64a660f785893f521b44689c5474 (diff) | |
download | scummvm-rg350-1fb69e99bd8d88d458f151af4008b9a7419b0060.tar.gz scummvm-rg350-1fb69e99bd8d88d458f151af4008b9a7419b0060.tar.bz2 scummvm-rg350-1fb69e99bd8d88d458f151af4008b9a7419b0060.zip |
TITANIC: Workaround for MissiveOMat text not initialising in original
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/gfx/edit_control.cpp | 45 | ||||
-rw-r--r-- | engines/titanic/gfx/edit_control.h | 2 |
2 files changed, 24 insertions, 23 deletions
diff --git a/engines/titanic/gfx/edit_control.cpp b/engines/titanic/gfx/edit_control.cpp index 3f3c4d4035..c9b87c97c8 100644 --- a/engines/titanic/gfx/edit_control.cpp +++ b/engines/titanic/gfx/edit_control.cpp @@ -29,7 +29,7 @@ BEGIN_MESSAGE_MAP(CEditControl, CGameObject) END_MESSAGE_MAP() CEditControl::CEditControl() : CGameObject(), _fieldBC(false), _fontNumber(0), _fieldD4(2), - _textR(0), _textG(0), _textB(0), _fieldF0(0), _fieldF4(0) { + _textR(0), _textG(0), _textB(0), _fieldF0(0), _isPassword(false) { } void CEditControl::save(SimpleFile *file, int indent) { @@ -46,7 +46,7 @@ void CEditControl::save(SimpleFile *file, int indent) { file->writeNumberLine(_textB, indent); file->writeQuotedLine(_text, indent); file->writeNumberLine(_fieldF0, indent); - file->writeNumberLine(_fieldF4, indent); + file->writeNumberLine(_isPassword, indent); CGameObject::save(file, indent); } @@ -65,33 +65,34 @@ void CEditControl::load(SimpleFile *file) { _textB = file->readNumber(); _text = file->readString(); _fieldF0 = file->readNumber(); - _fieldF4 = file->readNumber(); + _isPassword = file->readNumber(); CGameObject::load(file); } bool CEditControl::EditControlMsg(CEditControlMsg *msg) { switch (msg->_mode) { - case 0: - if (!_editLeft) { - _editHeight = _bounds.height(); - _editBottom = _bounds.bottom; - _editLeft = _bounds.left + _bounds.width() / 2; - _maxTextChars = msg->_param; - setTextFontNumber(_fontNumber); + case 0: { + // WORKAROUND: Fix original bug where MissiveOMat username & password + // text weren't initialised after the first time you use the MissiveOMat + _editHeight = _bounds.height(); + _editBottom = _bounds.bottom; + _editLeft = _bounds.left + _bounds.width() / 2; + _maxTextChars = msg->_param; + setTextFontNumber(_fontNumber); - CEditControlMsg ctlMsg; - ctlMsg._mode = 10; - ctlMsg._param = _fieldD4; - ctlMsg.execute(this); + CEditControlMsg ctlMsg; + ctlMsg._mode = 10; + ctlMsg._param = _fieldD4; + ctlMsg.execute(this); - ctlMsg._mode = 11; - ctlMsg._textR = _textR; - ctlMsg._textG = _textG; - ctlMsg._textB = _textB; - ctlMsg.execute(this); - } + ctlMsg._mode = 11; + ctlMsg._textR = _textR; + ctlMsg._textG = _textG; + ctlMsg._textB = _textB; + ctlMsg.execute(this); break; + } case 1: { _text = ""; @@ -169,7 +170,7 @@ bool CEditControl::EditControlMsg(CEditControlMsg *msg) { else _fieldF0 = 0; - _fieldF4 = msg->_param & 0x10; + _isPassword = (msg->_param & 0x10) != 0; CEditControlMsg ctlMsg; ctlMsg._mode = 14; ctlMsg.execute(this); @@ -190,7 +191,7 @@ bool CEditControl::EditControlMsg(CEditControlMsg *msg) { case 14: { makeDirty(); - CString str = _fieldF4 ? CString('*', _text.size()) : _text; + CString str = _isPassword ? CString('*', _text.size()) : _text; setText(str); int textWidth = getTextWidth(); diff --git a/engines/titanic/gfx/edit_control.h b/engines/titanic/gfx/edit_control.h index 6c02f7afb9..ce36f9b108 100644 --- a/engines/titanic/gfx/edit_control.h +++ b/engines/titanic/gfx/edit_control.h @@ -43,7 +43,7 @@ protected: byte _textB; CString _text; int _fieldF0; - int _fieldF4; + bool _isPassword; public: CLASSDEF; CEditControl(); |