Skip to content

Commit

Permalink
TITANIC: Renamings of transitioning counter methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Nov 13, 2016
1 parent 8221130 commit a02adba
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 28 deletions.
8 changes: 4 additions & 4 deletions engines/titanic/core/game_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1066,12 +1066,12 @@ void CGameObject::quitGame() {
getGameManager()->_gameState._quitGame = true;
}

void CGameObject::inc54() {
getGameManager()->inc54();
void CGameObject::incTransitions() {
getGameManager()->incTransitions();
}

void CGameObject::dec54() {
getGameManager()->dec54();
void CGameObject::decTransitions() {
getGameManager()->decTransitions();
}

void CGameObject::setMovieFrameRate(double rate) {
Expand Down
11 changes: 9 additions & 2 deletions engines/titanic/core/game_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,15 @@ class CGameObject : public CNamedItem {
*/
void loadImage(const CString &name, bool pendingFlag = true);

void inc54();
void dec54();
/**
* Increments the number of active transitions
*/
void incTransitions();

/**
* Decrements the number of active transitions
*/
void decTransitions();

/**
* Locks/hides the mouse
Expand Down
2 changes: 1 addition & 1 deletion engines/titanic/core/view_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ bool CViewItem::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
if (msg->_buttons & MB_LEFT) {
if (!handleMouseMsg(msg, true)) {
CGameManager *gm = getGameManager();
if (gm->test54()) {
if (gm->isntTransitioning()) {
findNode()->findRoom();

CLinkItem *linkItem = dynamic_cast<CLinkItem *>(
Expand Down
2 changes: 1 addition & 1 deletion engines/titanic/game/bridge_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ bool CBridgeView::MovieEndMsg(CMovieEndMsg *msg) {
case 0:
case 1:
setVisible(false);
dec54();
decTransitions();
break;

case 2: {
Expand Down
4 changes: 2 additions & 2 deletions engines/titanic/game/captains_wheel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ bool CCaptainsWheel::ActMsg(CActMsg *msg) {
}
} else if (msg->_action == "Go") {
if (!_fieldE0) {
inc54();
incTransitions();
_fieldE0 = false;
_fieldE4 = 1;

Expand All @@ -109,7 +109,7 @@ bool CCaptainsWheel::ActMsg(CActMsg *msg) {
}
} else if (msg->_action == "Cruise") {
if (_fieldE0) {
inc54();
incTransitions();
_fieldE0 = false;
_fieldE4 = 2;

Expand Down
4 changes: 2 additions & 2 deletions engines/titanic/game/fan_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ bool CFanControl::ActMsg(CActMsg *msg) {
_enabled = false;
else if (msg->_action == "StarlingsDead") {
_fieldC4 = 0;
dec54();
decTransitions();
_fieldCC = 0;
}

Expand Down Expand Up @@ -116,7 +116,7 @@ bool CFanControl::StatusChangeMsg(CStatusChangeMsg *msg) {
break;
case 2:
if (_fieldC4) {
inc54();
incTransitions();
_fieldCC = 1;
playMovie(12, 18, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
} else {
Expand Down
4 changes: 2 additions & 2 deletions engines/titanic/game/nav_helmet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ bool CNavHelmet::PETHelmetOnOffMsg(CPETHelmetOnOffMsg *msg) {
pet->setArea(PET_REMOTE);
}

dec54();
decTransitions();
} else {
inc54();
incTransitions();
_flag = true;
setVisible(true);
playMovie(0, 60, MOVIE_NOTIFY_OBJECT);
Expand Down
2 changes: 1 addition & 1 deletion engines/titanic/game_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ CGameManager::CGameManager(CProjectItem *project, CGameView *gameView, Audio::Mi
_inputHandler(this), _inputTranslator(&_inputHandler),
_gameState(this), _sound(this, mixer), _musicRoom(this),
_treeItem(nullptr), _soundMaker(nullptr), _movieRoom(nullptr),
_dragItem(nullptr), _field54(0), _lastDiskTicksCount(0), _tickCount2(0) {
_dragItem(nullptr), _transitionCtr(0), _lastDiskTicksCount(0), _tickCount2(0) {

CTimeEventInfo::_nextId = 0;
_movie = nullptr;
Expand Down
17 changes: 13 additions & 4 deletions engines/titanic/game_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class CGameManager {
CBackgroundSoundMaker *_soundMaker;
CMovie *_movie;
CRoomItem *_movieRoom;
int _field54;
int _transitionCtr;
CVideoSurface *_movieSurface;
uint _lastDiskTicksCount;
uint _tickCount2;
Expand Down Expand Up @@ -166,11 +166,20 @@ class CGameManager {
*/
void viewChange();

bool test54() const { return !_field54; }
/**
* Returns true if no transition is currently in progress
*/
bool isntTransitioning() const { return !_transitionCtr; }

void inc54() { ++_field54; }
/**
* Increments the number of active transitions
*/
void incTransitions() { ++_transitionCtr; }

void dec54() { --_field54; }
/**
* Decremenst the number of active transitions
*/
void decTransitions() { --_transitionCtr; }

/**
* Extends the bounds of the currently affected game display area
Expand Down
3 changes: 2 additions & 1 deletion engines/titanic/game_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void CGameState::enterView() {
_gameManager->playClip(_movieList._movieClip, oldRoom, newRoom);

_gameManager->_sound.preEnterView(newView, newRoom != oldRoom);
_gameManager->dec54();
_gameManager->decTransitions();
oldView->enterView(newView);

_movieList._view = nullptr;
Expand All @@ -135,6 +135,7 @@ void CGameState::changeView(CViewItem *newView, CMovieClip *clip) {
if (_mode == GSMODE_CUTSCENE) {
_movieList._view = newView;
_movieList._movieClip = clip;
_gameManager->incTransitions();
} else {
oldView->preEnterView(newView);
_gameManager->_gameView->setView(newView);
Expand Down
4 changes: 2 additions & 2 deletions engines/titanic/npcs/bilge_succubus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ bool CBilgeSuccUBus::PETDeliverMsg(CPETDeliverMsg *msg) {
playMovie(_startFrame12, _endFrame12, MOVIE_GAMESTATE);
playMovie(_bilgeStartFrame2, _bilgeEndFrame2, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
playMovie(_bilgeStartFrame1, _bilgeEndFrame1, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
inc54();
incTransitions();
}
} else {
startTalking(this, 230012);
Expand Down Expand Up @@ -270,7 +270,7 @@ bool CBilgeSuccUBus::MovieEndMsg(CMovieEndMsg *msg) {
startTalking(this, 150);
CBodyInBilgeRoomMsg bodyMsg;
bodyMsg.execute("Service Elevator Entity");
dec54();
decTransitions();
_field158 = 0;

} else {
Expand Down
4 changes: 2 additions & 2 deletions engines/titanic/npcs/deskbot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ bool CDeskbot::MovieEndMsg(CMovieEndMsg *msg) {
if (_npcFlags & NPCFLAG_10000) {
if (_classNum) {
petSetArea(PET_ROOMS);
dec54();
decTransitions();
unlockMouse();
playSound("z#47.wav");
_classNum = NO_CLASS;
Expand Down Expand Up @@ -170,7 +170,7 @@ bool CDeskbot::LeaveViewMsg(CLeaveViewMsg *msg) {
bool CDeskbot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) {
switch (msg->_action) {
case 19:
inc54();
incTransitions();
lockMouse();
petSetArea(PET_CONVERSATION);
playClip("ReprogramPETInHand", MOVIE_NOTIFY_OBJECT);
Expand Down
8 changes: 4 additions & 4 deletions engines/titanic/npcs/succubus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ bool CSuccUBus::PETDeliverMsg(CPETDeliverMsg *msg) {
_field158 = 0;
_field188 = 0;
_field1D8 = 1;
inc54();
incTransitions();

if (_isFeathers) {
_field19C = 0;
Expand Down Expand Up @@ -496,7 +496,7 @@ bool CSuccUBus::PETReceiveMsg(CPETReceiveMsg *msg) {
if (_startFrame4 >= 0) {
_field158 = 1;
_field1D8 = 1;
inc54();
incTransitions();
playMovie(_startFrame4, _endFrame4, MOVIE_NOTIFY_OBJECT);
}
}
Expand Down Expand Up @@ -600,7 +600,7 @@ bool CSuccUBus::MovieEndMsg(CMovieEndMsg *msg) {

if (_field1D8) {
_field1D8 = 0;
dec54();
decTransitions();
}

CSUBTransition transMsg;
Expand All @@ -616,7 +616,7 @@ bool CSuccUBus::MovieEndMsg(CMovieEndMsg *msg) {
_mailP = 0;
if (_field1D8) {
_field1D8 = 0;
dec54();
decTransitions();
}

CSUBTransition transMsg;
Expand Down

0 comments on commit a02adba

Please sign in to comment.