From 90e4e8a06403dc54b862cc08676718a29fdf6f94 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 20 Feb 2017 21:15:00 -0500 Subject: TITANIC: Initial cleanup & renamings for bridge controls --- engines/titanic/game/captains_wheel.cpp | 50 ++++++++++++++++----------------- engines/titanic/game/captains_wheel.h | 6 ++-- engines/titanic/game/wheel_button.cpp | 18 ++++++------ engines/titanic/game/wheel_button.h | 4 +-- engines/titanic/game/wheel_hotspot.cpp | 22 +++++++-------- engines/titanic/game/wheel_hotspot.h | 10 +++++-- 6 files changed, 57 insertions(+), 53 deletions(-) (limited to 'engines/titanic/game') diff --git a/engines/titanic/game/captains_wheel.cpp b/engines/titanic/game/captains_wheel.cpp index 7a21047908..eabee7e418 100644 --- a/engines/titanic/game/captains_wheel.cpp +++ b/engines/titanic/game/captains_wheel.cpp @@ -34,17 +34,17 @@ BEGIN_MESSAGE_MAP(CCaptainsWheel, CBackground) END_MESSAGE_MAP() CCaptainsWheel::CCaptainsWheel() : CBackground(), - _fieldE0(0), _fieldE4(0), _fieldE8(0), _fieldEC(0), - _fieldF0(0), _fieldF4(0) { + _stopEnabled(false), _fieldE4(0), _fieldE8(0), + _cruiseEnabled(false), _goEnabled(false), _fieldF4(0) { } void CCaptainsWheel::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_stopEnabled, indent); file->writeNumberLine(_fieldE4, indent); file->writeNumberLine(_fieldE8, indent); - file->writeNumberLine(_fieldEC, indent); - file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_cruiseEnabled, indent); + file->writeNumberLine(_goEnabled, indent); file->writeNumberLine(_fieldF4, indent); CBackground::save(file, indent); @@ -52,19 +52,19 @@ void CCaptainsWheel::save(SimpleFile *file, int indent) { void CCaptainsWheel::load(SimpleFile *file) { file->readNumber(); - _fieldE0 = file->readNumber(); + _stopEnabled = file->readNumber(); _fieldE4 = file->readNumber(); _fieldE8 = file->readNumber(); - _fieldEC = file->readNumber(); - _fieldF0 = file->readNumber(); + _cruiseEnabled = file->readNumber(); + _goEnabled = file->readNumber(); _fieldF4 = file->readNumber(); CBackground::load(file); } bool CCaptainsWheel::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { - if (_fieldE0) { - _fieldE0 = false; + if (_stopEnabled) { + _stopEnabled = false; CTurnOff offMsg; offMsg.execute(this); playMovie(162, 168, 0); @@ -76,8 +76,8 @@ bool CCaptainsWheel::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { } bool CCaptainsWheel::LeaveViewMsg(CLeaveViewMsg *msg) { - if (_fieldE0) { - _fieldE0 = false; + if (_stopEnabled) { + _stopEnabled = false; CTurnOff offMsg; offMsg.execute(this); playMovie(162, 168, MOVIE_WAIT_FOR_FINISH); @@ -88,19 +88,19 @@ bool CCaptainsWheel::LeaveViewMsg(CLeaveViewMsg *msg) { bool CCaptainsWheel::ActMsg(CActMsg *msg) { if (msg->_action == "Spin") { - if (_fieldE0) { + if (_stopEnabled) { CTurnOn onMsg; onMsg.execute("RatchetySound"); playMovie(8, 142, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } } else if (msg->_action == "Honk") { - if (_fieldE0) { + if (_stopEnabled) { playMovie(150, 160, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } } else if (msg->_action == "Go") { - if (!_fieldE0) { + if (!_stopEnabled) { incTransitions(); - _fieldE0 = false; + _stopEnabled = false; _fieldE4 = 1; CTurnOff offMsg; @@ -108,9 +108,9 @@ bool CCaptainsWheel::ActMsg(CActMsg *msg) { playMovie(162, 168, MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); } } else if (msg->_action == "Cruise") { - if (_fieldE0) { + if (_stopEnabled) { incTransitions(); - _fieldE0 = false; + _stopEnabled = false; _fieldE4 = 2; CTurnOff offMsg; @@ -124,9 +124,9 @@ bool CCaptainsWheel::ActMsg(CActMsg *msg) { volumeMsg.execute("EngineSounds"); CTurnOn onMsg; onMsg.execute("EngineSounds"); - _fieldF0 = 1; + _goEnabled = true; } else if (msg->_action == "ClearDestin") { - _fieldF0 = 0; + _goEnabled = false; } return true; @@ -152,17 +152,17 @@ bool CCaptainsWheel::TurnOn(CTurnOn *msg) { signalMsg.execute("WheelSpin"); signalMsg.execute("SeagullHorn"); - if (_fieldE0) { + if (_stopEnabled) { signalMsg.execute("WheelStopButt"); signalMsg.execute("StopHotSpot"); } - if (_fieldEC) { + if (_cruiseEnabled) { signalMsg.execute("WheelCruiseButt"); signalMsg.execute("CruiseHotSpot"); } - if (_fieldF0) { + if (_goEnabled) { signalMsg.execute("WheelGoButt"); signalMsg.execute("GoHotSpot"); } @@ -172,7 +172,7 @@ bool CCaptainsWheel::TurnOn(CTurnOn *msg) { bool CCaptainsWheel::MovieEndMsg(CMovieEndMsg *msg) { if (msg->_endFrame == 8) { - _fieldE0 = true; + _stopEnabled = true; CTurnOn onMsg; onMsg.execute(this); } @@ -185,7 +185,7 @@ bool CCaptainsWheel::MovieEndMsg(CMovieEndMsg *msg) { if (msg->_endFrame == 168) { switch (_fieldE4) { case 1: { - CActMsg actMsg(starFn2() ? "GoEnd" : "Go"); + CActMsg actMsg(starIsSolved() ? "GoEnd" : "Go"); actMsg.execute("GoSequence"); break; } diff --git a/engines/titanic/game/captains_wheel.h b/engines/titanic/game/captains_wheel.h index 3aca45c21f..a8a85535d1 100644 --- a/engines/titanic/game/captains_wheel.h +++ b/engines/titanic/game/captains_wheel.h @@ -36,11 +36,11 @@ class CCaptainsWheel : public CBackground { bool TurnOn(CTurnOn *msg); bool MovieEndMsg(CMovieEndMsg *msg); public: - int _fieldE0; + bool _stopEnabled; int _fieldE4; int _fieldE8; - int _fieldEC; - int _fieldF0; + bool _cruiseEnabled; + bool _goEnabled; int _fieldF4; public: CLASSDEF; diff --git a/engines/titanic/game/wheel_button.cpp b/engines/titanic/game/wheel_button.cpp index 730a5d9005..71532e52af 100644 --- a/engines/titanic/game/wheel_button.cpp +++ b/engines/titanic/game/wheel_button.cpp @@ -31,33 +31,33 @@ BEGIN_MESSAGE_MAP(CWheelButton, CBackground) END_MESSAGE_MAP() CWheelButton::CWheelButton() : CBackground(), - _fieldE0(false), _timerId(0), _fieldE8(0) { + _blinking(false), _timerId(0), _unused5(0) { } void CWheelButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_blinking, indent); file->writeNumberLine(_timerId, indent); - file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_unused5, indent); CBackground::save(file, indent); } void CWheelButton::load(SimpleFile *file) { file->readNumber(); - _fieldE0 = file->readNumber(); + _blinking = file->readNumber(); _timerId = file->readNumber(); - _fieldE8 = file->readNumber(); + _unused5 = file->readNumber(); CBackground::load(file); } bool CWheelButton::SignalObject(CSignalObject *msg) { - bool oldFlag = _fieldE0; - _fieldE0 = msg->_numValue != 0; + bool oldBlinking = _blinking; + _blinking = msg->_numValue != 0; - if (oldFlag != _fieldE0) { - if (_fieldE0) { + if (oldBlinking != _blinking) { + if (_blinking) { _timerId = addTimer(500, 500); } else { stopAnimTimer(_timerId); diff --git a/engines/titanic/game/wheel_button.h b/engines/titanic/game/wheel_button.h index 2725e60622..7bdcecef75 100644 --- a/engines/titanic/game/wheel_button.h +++ b/engines/titanic/game/wheel_button.h @@ -33,9 +33,9 @@ class CWheelButton : public CBackground { bool TimerMsg(CTimerMsg *msg); bool LeaveViewMsg(CLeaveViewMsg *msg); public: - bool _fieldE0; + bool _blinking; int _timerId; - int _fieldE8; + int _unused5; public: CLASSDEF; CWheelButton(); diff --git a/engines/titanic/game/wheel_hotspot.cpp b/engines/titanic/game/wheel_hotspot.cpp index aeca7130b5..aec1c8b96d 100644 --- a/engines/titanic/game/wheel_hotspot.cpp +++ b/engines/titanic/game/wheel_hotspot.cpp @@ -31,36 +31,36 @@ END_MESSAGE_MAP() void CWheelHotSpot::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldE0, indent); - file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_active, indent); + file->writeNumberLine(_action, indent); CBackground::save(file, indent); } void CWheelHotSpot::load(SimpleFile *file) { file->readNumber(); - _fieldE0 = file->readNumber(); - _fieldE4 = file->readNumber(); + _active = file->readNumber(); + _action = (WheelHotspotAction)file->readNumber(); CBackground::load(file); } bool CWheelHotSpot::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { - if (_fieldE0) { + if (_active) { CActMsg actMsg; - switch (_fieldE4) { - case 1: + switch (_action) { + case WH_STOP: actMsg._action = "Stop"; actMsg.execute("CaptainsWheel"); break; - case 2: + case WH_CRUISE: actMsg._action = "Cruise"; actMsg.execute("CaptainsWheel"); break; - case 3: + case WH_GO: actMsg._action = "Go"; actMsg.execute("CaptainsWheel"); break; @@ -68,7 +68,7 @@ bool CWheelHotSpot::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { default: break; } - } else if (_fieldE4 == 3) { + } else if (_action == WH_GO) { petDisplayMessage(GO_WHERE); } @@ -76,7 +76,7 @@ bool CWheelHotSpot::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { } bool CWheelHotSpot::SignalObject(CSignalObject *msg) { - _fieldE0 = msg->_numValue != 0; + _active = msg->_numValue != 0; return true; } diff --git a/engines/titanic/game/wheel_hotspot.h b/engines/titanic/game/wheel_hotspot.h index e9071a2fa4..41da0fba81 100644 --- a/engines/titanic/game/wheel_hotspot.h +++ b/engines/titanic/game/wheel_hotspot.h @@ -27,16 +27,20 @@ namespace Titanic { +enum WheelHotspotAction { + WH_NONE = 0, WH_STOP = 1, WH_CRUISE = 2, WH_GO = 3 +}; + class CWheelHotSpot : public CBackground { DECLARE_MESSAGE_MAP; bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); bool SignalObject(CSignalObject *msg); public: - int _fieldE0; - int _fieldE4; + bool _active; + WheelHotspotAction _action; public: CLASSDEF; - CWheelHotSpot() : CBackground(), _fieldE0(0), _fieldE4(0) {} + CWheelHotSpot() : CBackground(), _active(false), _action(WH_NONE) {} /** * Save the data for the class to file -- cgit v1.2.3