diff options
author | Paul Gilbert | 2017-01-03 17:23:33 -0500 |
---|---|---|
committer | Paul Gilbert | 2017-01-03 17:23:33 -0500 |
commit | e2dba404a611fd33c522c4a462c4493ce0a52208 (patch) | |
tree | dcabd542bb5539799321770d384fd77fe20053a4 /engines | |
parent | 759f69fe1ef445feddb28a1410c4e0821ae7ac40 (diff) | |
download | scummvm-rg350-e2dba404a611fd33c522c4a462c4493ce0a52208.tar.gz scummvm-rg350-e2dba404a611fd33c522c4a462c4493ce0a52208.tar.bz2 scummvm-rg350-e2dba404a611fd33c522c4a462c4493ce0a52208.zip |
TITANIC: Cleanup and fixes for starling puret
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/game/fan_control.cpp | 35 | ||||
-rw-r--r-- | engines/titanic/game/fan_control.h | 6 | ||||
-rw-r--r-- | engines/titanic/npcs/starlings.cpp | 17 | ||||
-rw-r--r-- | engines/titanic/npcs/starlings.h | 3 |
4 files changed, 35 insertions, 26 deletions
diff --git a/engines/titanic/game/fan_control.cpp b/engines/titanic/game/fan_control.cpp index b3c3b2e816..823bf946d4 100644 --- a/engines/titanic/game/fan_control.cpp +++ b/engines/titanic/game/fan_control.cpp @@ -32,17 +32,17 @@ BEGIN_MESSAGE_MAP(CFanControl, CGameObject) ON_MESSAGE(TimerMsg) END_MESSAGE_MAP() -CFanControl::CFanControl() : CGameObject(), _state(-1), - _enabled(false), _fieldC4(0), _fieldC8(false), _fieldCC(0) { +CFanControl::CFanControl() : CGameObject(), _state(-1), _enabled(false), + _starlings(false), _fanOn(false), _starlingsDying(false) { } void CFanControl::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_state, indent); file->writeNumberLine(_enabled, indent); - file->writeNumberLine(_fieldC4, indent); - file->writeNumberLine(_fieldC8, indent); - file->writeNumberLine(_fieldCC, indent); + file->writeNumberLine(_starlings, indent); + file->writeNumberLine(_fanOn, indent); + file->writeNumberLine(_starlingsDying, indent); CGameObject::save(file, indent); } @@ -51,9 +51,9 @@ void CFanControl::load(SimpleFile *file) { file->readNumber(); _state = file->readNumber(); _enabled = file->readNumber(); - _fieldC4 = file->readNumber(); - _fieldC8 = file->readNumber(); - _fieldCC = file->readNumber(); + _starlings = file->readNumber(); + _fanOn = file->readNumber(); + _starlingsDying = file->readNumber(); CGameObject::load(file); } @@ -64,22 +64,23 @@ bool CFanControl::ActMsg(CActMsg *msg) { else if (msg->_action == "DisableObject") _enabled = false; else if (msg->_action == "StarlingsDead") { - _fieldC4 = 0; + _starlings = false; decTransitions(); - _fieldCC = 0; + _starlingsDying = false; } return true; } bool CFanControl::StatusChangeMsg(CStatusChangeMsg *msg) { - if (!_fieldCC) { + if (!_starlingsDying) { playSound("z#42.wav"); if (_enabled) { switch (msg->_newStatus) { case 1: - _fieldC8 = !_fieldC8; - if (_fieldC8) { + // Fan Power button + _fanOn = !_fanOn; + if (_fanOn) { playMovie(6, 8, 0); _state = 0; } else { @@ -104,7 +105,8 @@ bool CFanControl::StatusChangeMsg(CStatusChangeMsg *msg) { break; case 2: - if (_fieldC8) { + // Fan Speed button + if (_fanOn) { _state = (_state + 1) % 4; switch (_state) { case 0: @@ -115,9 +117,10 @@ bool CFanControl::StatusChangeMsg(CStatusChangeMsg *msg) { playMovie(8, 12, 0); break; case 2: - if (_fieldC4) { + if (_starlings) { + // It's puret time incTransitions(); - _fieldCC = 1; + _starlingsDying = true; playMovie(12, 18, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); } else { playMovie(12, 18, 0); diff --git a/engines/titanic/game/fan_control.h b/engines/titanic/game/fan_control.h index 1f7402db12..063243c164 100644 --- a/engines/titanic/game/fan_control.h +++ b/engines/titanic/game/fan_control.h @@ -37,9 +37,9 @@ class CFanControl : public CGameObject { public: int _state; bool _enabled; - int _fieldC4; - bool _fieldC8; - int _fieldCC; + bool _starlings; + bool _fanOn; + bool _starlingsDying; public: CLASSDEF; CFanControl(); diff --git a/engines/titanic/npcs/starlings.cpp b/engines/titanic/npcs/starlings.cpp index 7e5907f577..ff1c40cf29 100644 --- a/engines/titanic/npcs/starlings.cpp +++ b/engines/titanic/npcs/starlings.cpp @@ -29,34 +29,39 @@ BEGIN_MESSAGE_MAP(CStarlings, CCharacter) ON_MESSAGE(StatusChangeMsg) END_MESSAGE_MAP() -CStarlings::CStarlings() : CCharacter(), _enabled(false) { +bool CStarlings::_dead; + +CStarlings::CStarlings() : CCharacter() { } void CStarlings::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_enabled, indent); + file->writeNumberLine(_dead, indent); CCharacter::save(file, indent); } void CStarlings::load(SimpleFile *file) { file->readNumber(); - _enabled = file->readNumber(); + _dead = file->readNumber(); CCharacter::load(file); } bool CStarlings::EnterViewMsg(CEnterViewMsg *msg) { - if (_enabled) + if (_dead) + // Tis but a flesh wound setVisible(false); else + // Repeatedly play the starlings flying playMovie(MOVIE_REPEAT); return true; } bool CStarlings::StatusChangeMsg(CStatusChangeMsg *msg) { - _enabled = msg->_newStatus == 1; - setVisible(!_enabled); + // I'm not dead.. I'm getting better. + _dead = msg->_newStatus == 1; + setVisible(!_dead); return true; } diff --git a/engines/titanic/npcs/starlings.h b/engines/titanic/npcs/starlings.h index 1998e6490d..4885777087 100644 --- a/engines/titanic/npcs/starlings.h +++ b/engines/titanic/npcs/starlings.h @@ -32,7 +32,8 @@ class CStarlings : public CCharacter { bool EnterViewMsg(CEnterViewMsg *msg); bool StatusChangeMsg(CStatusChangeMsg *msg); private: - bool _enabled; + // This needs to be static to be shared across all starling instances + static bool _dead; public: CLASSDEF; CStarlings(); |