aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-10-30 08:10:36 -0400
committerPaul Gilbert2016-10-30 08:10:36 -0400
commit96153644e6b72b7d956d8a45114172a035ce24cc (patch)
tree90ab7e74078691c4d5d96ebfb8b36cda5b01f53e
parent6ffa5228c1691e5794600343b083bc922062be5f (diff)
downloadscummvm-rg350-96153644e6b72b7d956d8a45114172a035ce24cc.tar.gz
scummvm-rg350-96153644e6b72b7d956d8a45114172a035ce24cc.tar.bz2
scummvm-rg350-96153644e6b72b7d956d8a45114172a035ce24cc.zip
TITANIC: Cleanup of CServiceElevatorWIndow class
-rw-r--r--engines/titanic/game/service_elevator_window.cpp31
-rw-r--r--engines/titanic/game/service_elevator_window.h6
-rw-r--r--engines/titanic/messages/messages.h2
3 files changed, 21 insertions, 18 deletions
diff --git a/engines/titanic/game/service_elevator_window.cpp b/engines/titanic/game/service_elevator_window.cpp
index 84f2a8dfdf..d548bbf37e 100644
--- a/engines/titanic/game/service_elevator_window.cpp
+++ b/engines/titanic/game/service_elevator_window.cpp
@@ -35,25 +35,25 @@ END_MESSAGE_MAP()
static const int FACTORS[4] = { 0, 20, 100, 0 };
CServiceElevatorWindow::CServiceElevatorWindow() : CBackground(),
- _fieldE0(0), _notifyFlag(false), _fieldE8(0), _fieldEC(0) {
+ _destFloor(0), _notifyFlag(false), _isIndicator(false), _intoSpace(false) {
}
void CServiceElevatorWindow::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeNumberLine(_fieldE0, indent);
+ file->writeNumberLine(_destFloor, indent);
file->writeNumberLine(_notifyFlag, indent);
- file->writeNumberLine(_fieldE8, indent);
- file->writeNumberLine(_fieldEC, indent);
+ file->writeNumberLine(_isIndicator, indent);
+ file->writeNumberLine(_intoSpace, indent);
CBackground::save(file, indent);
}
void CServiceElevatorWindow::load(SimpleFile *file) {
file->readNumber();
- _fieldE0 = file->readNumber();
+ _destFloor = file->readNumber();
_notifyFlag = file->readNumber();
- _fieldE8 = file->readNumber();
- _fieldEC = file->readNumber();
+ _isIndicator = file->readNumber();
+ _intoSpace = file->readNumber();
CBackground::load(file);
}
@@ -61,7 +61,7 @@ void CServiceElevatorWindow::load(SimpleFile *file) {
bool CServiceElevatorWindow::ServiceElevatorFloorChangeMsg(CServiceElevatorFloorChangeMsg *msg) {
if (getView() == findView()) {
CDoorbot *doorbot = dynamic_cast<CDoorbot *>(findRoom()->findByName("Doorbot"));
- int fps = (_fieldE8 && doorbot) ? 65 : 15;
+ int fps = (_isIndicator && doorbot) ? 65 : 15;
CMovieClip *clip = _movieClips.findByName("Going Up");
if (!clip)
@@ -70,30 +70,33 @@ bool CServiceElevatorWindow::ServiceElevatorFloorChangeMsg(CServiceElevatorFloor
int count = clip->_endFrame - clip->_startFrame;
setMovieFrameRate(1.0 * count / fps);
- int startFrame = clip->_startFrame + count * FACTORS[msg->_value1] / 100;
- int endFrame = clip->_startFrame + count * FACTORS[msg->_value2] / 100;
+ int startFrame = clip->_startFrame + count * FACTORS[msg->_startFloor] / 100;
+ int endFrame = clip->_startFrame + count * FACTORS[msg->_endFloor] / 100;
if (_notifyFlag) {
+ // Service elevator indicator
playMovie(startFrame, endFrame, MOVIE_NOTIFY_OBJECT);
} else {
+ // Background outside elevator
playMovie(startFrame, endFrame, 0);
- if (_fieldEC)
+ if (_intoSpace)
playClip("Into Space");
}
}
- _fieldE0 = msg->_value2;
+ _destFloor = msg->_endFloor;
return true;
}
bool CServiceElevatorWindow::MovieEndMsg(CMovieEndMsg *msg) {
+ // Called when indicator reaches desired destination floor
CServiceElevatorMsg elevMsg(5);
elevMsg.execute(findRoom()->findByName("Service Elevator Entity"));
return true;
}
bool CServiceElevatorWindow::EnterViewMsg(CEnterViewMsg *msg) {
- if (_fieldEC) {
+ if (_intoSpace) {
playClip("Fade Up");
playMovie(1, 2, 0);
} else {
@@ -101,7 +104,7 @@ bool CServiceElevatorWindow::EnterViewMsg(CEnterViewMsg *msg) {
if (clip) {
int frameNum = clip->_startFrame + (clip->_endFrame - clip->_startFrame)
- * FACTORS[_fieldE0] / 100;
+ * FACTORS[_destFloor] / 100;
loadFrame(frameNum);
} else {
loadFrame(0);
diff --git a/engines/titanic/game/service_elevator_window.h b/engines/titanic/game/service_elevator_window.h
index ee94f0c39f..baeef5aeb8 100644
--- a/engines/titanic/game/service_elevator_window.h
+++ b/engines/titanic/game/service_elevator_window.h
@@ -33,10 +33,10 @@ class CServiceElevatorWindow : public CBackground {
bool MovieEndMsg(CMovieEndMsg *msg);
bool EnterViewMsg(CEnterViewMsg *msg);
public:
- int _fieldE0;
+ int _destFloor;
bool _notifyFlag;
- int _fieldE8;
- int _fieldEC;
+ bool _isIndicator;
+ bool _intoSpace;
public:
CLASSDEF;
CServiceElevatorWindow();
diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h
index b421e8ecb8..4b66159dc5 100644
--- a/engines/titanic/messages/messages.h
+++ b/engines/titanic/messages/messages.h
@@ -286,7 +286,7 @@ MESSAGE0(CReplaceBowlAndNutsMsg);
MESSAGE1(CRestaurantMusicChanged, CString, value, "");
MESSAGE2(CSendCCarryMsg, CString, strValue, "", int, numValue, 0);
MESSAGE1(CSenseWorkingMsg, CString, value, "Not Working");
-MESSAGE2(CServiceElevatorFloorChangeMsg, int, value1, 0, int, value2, 0);
+MESSAGE2(CServiceElevatorFloorChangeMsg, int, startFloor, 0, int, endFloor, 0);
MESSAGE0(CServiceElevatorFloorRequestMsg);
MESSAGE1(CServiceElevatorMsg, int, value, 4);
MESSAGE2(CSetChevButtonImageMsg, int, value1, 0, int, value2, 0);