Skip to content

Commit

Permalink
TITANIC: Renamings for Broken Pellerator fields
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Aug 17, 2017
1 parent 7376458 commit 6c667a0
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 63 deletions.
16 changes: 8 additions & 8 deletions engines/titanic/game/broken_pell_base.cpp
Expand Up @@ -26,22 +26,22 @@ namespace Titanic {

EMPTY_MESSAGE_MAP(CBrokenPellBase, CBackground);

bool CBrokenPellBase::_v1;
int CBrokenPellBase::_v2;
bool CBrokenPellBase::_pelleratorOpen;
bool CBrokenPellBase::_gottenHose;

void CBrokenPellBase::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_v1, indent);
file->writeNumberLine(_v2, indent);
file->writeNumberLine(_exitAction, indent);
file->writeNumberLine(_pelleratorOpen, indent);
file->writeNumberLine(_gottenHose, indent);
file->writeNumberLine(_closeAction, indent);
CBackground::save(file, indent);
}

void CBrokenPellBase::load(SimpleFile *file) {
file->readNumber();
_v1 = file->readNumber();
_v2 = file->readNumber();
_exitAction = file->readNumber();
_pelleratorOpen = file->readNumber();
_gottenHose = file->readNumber();
_closeAction = (CloseAction)file->readNumber();
CBackground::load(file);
}

Expand Down
10 changes: 6 additions & 4 deletions engines/titanic/game/broken_pell_base.h
Expand Up @@ -27,16 +27,18 @@

namespace Titanic {

enum CloseAction { CLOSE_NONE = 0, CLOSE_LEFT = 1, CLOSE_RIGHT = 2 };

class CBrokenPellBase : public CBackground {
DECLARE_MESSAGE_MAP;
protected:
static bool _v1;
static int _v2;
static bool _pelleratorOpen;
static bool _gottenHose;

int _exitAction;
CloseAction _closeAction;
public:
CLASSDEF;
CBrokenPellBase() : CBackground(), _exitAction(0) {}
CBrokenPellBase() : CBackground(), _closeAction(CLOSE_NONE) {}

/**
* Save the data for the class to file
Expand Down
30 changes: 15 additions & 15 deletions engines/titanic/game/broken_pellerator.cpp
Expand Up @@ -53,16 +53,16 @@ void CBrokenPellerator::load(SimpleFile *file) {
}

bool CBrokenPellerator::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
if (_v1) {
changeView(_v2 ? _string5 : _string4);
if (_pelleratorOpen) {
changeView(_gottenHose ? _string5 : _string4);
} else {
if (_v2) {
if (_gottenHose) {
playMovie(28, 43, 0);
} else {
playMovie(0, 14, MOVIE_NOTIFY_OBJECT);
}

_v1 = true;
_pelleratorOpen = true;
}

return true;
Expand All @@ -71,7 +71,7 @@ bool CBrokenPellerator::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
bool CBrokenPellerator::LeaveViewMsg(CLeaveViewMsg *msg) {
CString name = msg->_newView->getNodeViewName();
if (name == "Node 3.S" || name == "Node 3.N") {
_v1 = false;
_pelleratorOpen = false;
loadFrame(0);
}

Expand All @@ -80,32 +80,32 @@ bool CBrokenPellerator::LeaveViewMsg(CLeaveViewMsg *msg) {

bool CBrokenPellerator::ActMsg(CActMsg *msg) {
if (msg->_action == "PlayerGetsHose") {
_v2 = 1;
_gottenHose = true;
loadFrame(43);

CStatusChangeMsg statusMsg;
statusMsg.execute("PickupHose");
} else {
_exitAction = 0;
_closeAction = CLOSE_NONE;
bool closeFlag = msg->_action == "Close";
if (msg->_action == "CloseLeft") {
closeFlag = true;
_exitAction = 1;
_closeAction = CLOSE_LEFT;
}
if (msg->_action == "CloseRight") {
closeFlag = true;
_exitAction = 2;
_closeAction = CLOSE_RIGHT;
}

if (closeFlag) {
if (_v1) {
_v1 = false;
if (_v2)
if (_pelleratorOpen) {
_pelleratorOpen = false;
if (_gottenHose)
playMovie(43, 57, MOVIE_NOTIFY_OBJECT);
else
playMovie(14, 28, MOVIE_NOTIFY_OBJECT);
} else {
switch (_exitAction) {
switch (_closeAction) {
case 1:
changeView(_exitLeftView);
break;
Expand All @@ -116,7 +116,7 @@ bool CBrokenPellerator::ActMsg(CActMsg *msg) {
break;
}

_exitAction = 0;
_closeAction = CLOSE_NONE;
}
}
}
Expand All @@ -139,7 +139,7 @@ bool CBrokenPellerator::MovieEndMsg(CMovieEndMsg *msg) {
statusMsg.execute("PickUpHose");
}

switch (_exitAction) {
switch (_closeAction) {
case 1:
changeView(_exitLeftView);
break;
Expand Down
64 changes: 32 additions & 32 deletions engines/titanic/game/broken_pellerator_froz.cpp
Expand Up @@ -34,30 +34,30 @@ END_MESSAGE_MAP()

void CBrokenPelleratorFroz::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeQuotedLine(_string2, indent);
file->writeQuotedLine(_string3, indent);
file->writeQuotedLine(_string4, indent);
file->writeQuotedLine(_string5, indent);
file->writeQuotedLine(_exitLeft, indent);
file->writeQuotedLine(_exitRight, indent);
file->writeQuotedLine(_closeUpWithoutHose, indent);
file->writeQuotedLine(_closeUpWithHose, indent);

CBrokenPellBase::save(file, indent);
}

void CBrokenPelleratorFroz::load(SimpleFile *file) {
file->readNumber();
_string2 = file->readString();
_string3 = file->readString();
_string4 = file->readString();
_string5 = file->readString();
_exitLeft = file->readString();
_exitRight = file->readString();
_closeUpWithoutHose = file->readString();
_closeUpWithHose = file->readString();

CBrokenPellBase::load(file);
}

bool CBrokenPelleratorFroz::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
if (_v1) {
changeView(_v2 ? _string5 : _string4);
if (_pelleratorOpen) {
changeView(_gottenHose ? _closeUpWithHose : _closeUpWithoutHose);
} else {
_v1 = true;
if (_v2) {
_pelleratorOpen = true;
if (_gottenHose) {
playMovie(0, 13, 0);
} else {
playMovie(43, 55, MOVIE_NOTIFY_OBJECT);
Expand All @@ -71,7 +71,7 @@ bool CBrokenPelleratorFroz::LeaveViewMsg(CLeaveViewMsg *msg) {
CString name = msg->_newView->getNodeViewName();

if (name == "Node 3.S" || name == "Node 3.E") {
_v1 = false;
_pelleratorOpen = false;
loadFrame(0);
}

Expand All @@ -80,42 +80,42 @@ bool CBrokenPelleratorFroz::LeaveViewMsg(CLeaveViewMsg *msg) {

bool CBrokenPelleratorFroz::ActMsg(CActMsg *msg) {
if (msg->_action == "PlayerGetsHose") {
_v2 = 1;
_gottenHose = true;
CStatusChangeMsg statusMsg;
statusMsg._newStatus = 0;
statusMsg.execute("FPickUpHose");
} else {
_exitAction = 0;
_closeAction = CLOSE_NONE;
bool closeFlag = msg->_action == "Close";
if (msg->_action == "CloseLeft") {
closeFlag = true;
_exitAction = 1;
_closeAction = CLOSE_LEFT;
}
if (msg->_action == "CloseRight") {
closeFlag = true;
_exitAction = 2;
_closeAction = CLOSE_RIGHT;
}

if (closeFlag) {
if (_v1) {
_v1 = false;
if (_v2)
if (_pelleratorOpen) {
_pelleratorOpen = false;
if (_gottenHose)
playMovie(29, 42, MOVIE_NOTIFY_OBJECT);
else
playMovie(72, 84, MOVIE_NOTIFY_OBJECT);
} else {
switch (_exitAction) {
case 1:
changeView(_string2);
switch (_closeAction) {
case CLOSE_LEFT:
changeView(_exitLeft);
break;
case 2:
changeView(_string3);
case CLOSE_RIGHT:
changeView(_exitRight);
break;
default:
break;
}

_exitAction = 0;
_closeAction = CLOSE_NONE;
}
}
}
Expand All @@ -136,12 +136,12 @@ bool CBrokenPelleratorFroz::MovieEndMsg(CMovieEndMsg *msg) {
statusMsg.execute("FPickUpHose");
}

if (_exitAction == 1) {
changeView(_string2);
_exitAction = 0;
} else if (_exitAction == 2) {
changeView(_string3);
_exitAction = 0;
if (_closeAction == CLOSE_LEFT) {
changeView(_exitLeft);
_closeAction = CLOSE_NONE;
} else if (_closeAction == CLOSE_RIGHT) {
changeView(_exitRight);
_closeAction = CLOSE_NONE;
}

return true;
Expand Down
8 changes: 4 additions & 4 deletions engines/titanic/game/broken_pellerator_froz.h
Expand Up @@ -34,10 +34,10 @@ class CBrokenPelleratorFroz : public CBrokenPellBase {
bool ActMsg(CActMsg *msg);
bool MovieEndMsg(CMovieEndMsg *msg);
private:
CString _string2;
CString _string3;
CString _string4;
CString _string5;
CString _exitLeft;
CString _exitRight;
CString _closeUpWithoutHose;
CString _closeUpWithHose;
public:
CLASSDEF;

Expand Down

0 comments on commit 6c667a0

Please sign in to comment.