diff options
Diffstat (limited to 'engines/titanic/game/sgt/sgt_navigation.cpp')
-rw-r--r-- | engines/titanic/game/sgt/sgt_navigation.cpp | 79 |
1 files changed, 77 insertions, 2 deletions
diff --git a/engines/titanic/game/sgt/sgt_navigation.cpp b/engines/titanic/game/sgt/sgt_navigation.cpp index 7bb64f934d..031226226f 100644 --- a/engines/titanic/game/sgt/sgt_navigation.cpp +++ b/engines/titanic/game/sgt/sgt_navigation.cpp @@ -21,9 +21,16 @@ */ #include "titanic/game/sgt/sgt_navigation.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CSGTNavigation, CGameObject) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(EnterViewMsg) +END_MESSAGE_MAP() + CSGTNavigationStatics *CSGTNavigation::_statics; void CSGTNavigation::init() { @@ -36,7 +43,7 @@ void CSGTNavigation::deinit() { void CSGTNavigation::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_statics->_changeViewFlag, indent); + file->writeNumberLine(_statics->_changeViewNum, indent); file->writeQuotedLine(_statics->_destView, indent); file->writeQuotedLine(_statics->_destRoom, indent); @@ -45,11 +52,79 @@ void CSGTNavigation::save(SimpleFile *file, int indent) { void CSGTNavigation::load(SimpleFile *file) { file->readNumber(); - _statics->_changeViewFlag = file->readNumber(); + _statics->_changeViewNum = file->readNumber(); _statics->_destView = file->readString(); _statics->_destRoom = file->readString(); CGameObject::load(file); } +bool CSGTNavigation::StatusChangeMsg(CStatusChangeMsg *msg) { + CPetControl *pet = getPetControl(); + + if (isEquals("SGTLL")) { + static const int FRAMES[7] = { 0, 149, 112, 74, 0, 36, 74 }; + _statics->_changeViewNum = msg->_newStatus; + if (pet->getRooms1CC() != _statics->_changeViewNum) { + changeView("SGTLittleLift.Node 1.N"); + } + + int startVal = pet->getRooms1CC(); + if (startVal > _statics->_changeViewNum) + playMovie(FRAMES[startVal], FRAMES[_statics->_changeViewNum], MOVIE_GAMESTATE); + else + playMovie(FRAMES[startVal + 3], FRAMES[_statics->_changeViewNum + 3], MOVIE_GAMESTATE); + + _cursorId = _statics->_changeViewNum != 1 ? CURSOR_MOVE_FORWARD : CURSOR_INVALID; + + pet->setRooms1CC(_statics->_changeViewNum); + pet->resetRoomsHighlight(); + } + + return true; +} + +bool CSGTNavigation::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (compareRoomNameTo("SgtLobby")) { + _statics->_destView = getRoomNodeName(); + _statics->_destRoom = "SgtLobby"; + changeView("SGTState.Node 1.S"); + } else if (compareRoomNameTo("SGTLittleLift")) { + if (_statics->_changeViewNum != 1) { + _statics->_destRoom = "SGTLittleLift"; + changeView("SGTState.Node 1.S"); + } + } else if (compareRoomNameTo("SGTState")) { + if (_statics->_destRoom == "SgtLobby") { + if (compareViewNameTo("SGTState.Node 2.N")) { + changeView("SGTState.Node 1.N"); + _statics->_destView += ".S"; + } else { + _statics->_destView += ".N"; + } + + changeView(_statics->_destView); + } else if (_statics->_destRoom == "SGTLittleLift") { + if (compareViewNameTo("SGTState.Node 1.S")) { + changeView("SGTLittleLift.Node 1.N"); + } else { + changeView("SGTState.Node 1.N"); + changeView("SGTLittleLift.Node 1.S"); + } + } + } + + return true; +} + +bool CSGTNavigation::EnterViewMsg(CEnterViewMsg *msg) { + if (isEquals("SGTLL")) { + static const int FRAMES[3] = { 0, 36, 74 }; + CPetControl *pet = getPetControl(); + loadFrame(FRAMES[pet->getRooms1CC() - 1]); + } + + return true; +} + } // End of namespace Titanic |