TITANIC: Fix the steering wheel horn

This commit is contained in:
Paul Gilbert 2017-02-20 21:49:53 -05:00
parent 90e4e8a064
commit 75571a80fd
2 changed files with 27 additions and 6 deletions

View File

@ -24,20 +24,39 @@
namespace Titanic {
BEGIN_MESSAGE_MAP(CWheelSpinHorn, CWheelSpin)
ON_MESSAGE(MouseButtonDownMsg)
END_MESSAGE_MAP()
void CWheelSpinHorn::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeQuotedLine(_string1, indent);
file->writeQuotedLine(_string2, indent);
file->writeQuotedLine(_soundName, indent);
file->writeQuotedLine(_message, indent);
CWheelSpin::save(file, indent);
}
void CWheelSpinHorn::load(SimpleFile *file) {
file->readNumber();
_string1 = file->readString();
_string2 = file->readString();
_soundName = file->readString();
_message = file->readString();
CWheelSpin::load(file);
}
bool CWheelSpinHorn::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
if (_active) {
if (!_soundName.empty())
playSound(_soundName);
if (!_message.empty())
petDisplayMessage(_message);
CActMsg actMsg("Honk");
actMsg.execute("CaptainsWheel");
}
return true;
}
} // End of namespace Titanic

View File

@ -28,9 +28,11 @@
namespace Titanic {
class CWheelSpinHorn : public CWheelSpin {
DECLARE_MESSAGE_MAP;
bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
public:
CString _string1;
CString _string2;
CString _soundName;
CString _message;
public:
CLASSDEF;