diff options
author | Paul Gilbert | 2016-03-28 22:25:15 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-03-28 22:25:15 -0400 |
commit | 471737a41a4f75a65ed0f7e49f6b30e361232bae (patch) | |
tree | 8d5642719aa2d4cf37ffc761052bc0dfe0c674b8 /engines/titanic/game/cdrom.cpp | |
parent | 73204984098c96ecc28a1367a5da9613e7103a35 (diff) | |
download | scummvm-rg350-471737a41a4f75a65ed0f7e49f6b30e361232bae.tar.gz scummvm-rg350-471737a41a4f75a65ed0f7e49f6b30e361232bae.tar.bz2 scummvm-rg350-471737a41a4f75a65ed0f7e49f6b30e361232bae.zip |
TITANIC: Implemented CCDROM and various support stuff
Diffstat (limited to 'engines/titanic/game/cdrom.cpp')
-rw-r--r-- | engines/titanic/game/cdrom.cpp | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/engines/titanic/game/cdrom.cpp b/engines/titanic/game/cdrom.cpp index 40e8ed05d8..d4e4eac4d1 100644 --- a/engines/titanic/game/cdrom.cpp +++ b/engines/titanic/game/cdrom.cpp @@ -21,6 +21,8 @@ */ #include "titanic/game/cdrom.h" +#include "titanic/core/room_item.h" +#include "titanic/game/cdrom_tray.h" namespace Titanic { @@ -29,14 +31,50 @@ CCDROM::CCDROM() : CGameObject() { void CCDROM::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); - file->writePoint(_pos1, indent); + file->writePoint(_tempPos, indent); CGameObject::save(file, indent); } void CCDROM::load(SimpleFile *file) { file->readNumber(); - _pos1 = file->readPoint(); + _tempPos = file->readPoint(); CGameObject::load(file); } +bool CCDROM::handleMessage(CMouseDragStartMsg &msg) { + if (checkStartDragging(&msg)) { + _tempPos = msg._mousePos - _bounds; + setPosition(msg._mousePos - _tempPos); + return true; + } else { + return false; + } +} + +bool CCDROM::handleMessage(CMouseDragEndMsg &msg) { + if (msg._dropTarget && msg._dropTarget->getName() == "newComputer") { + CCDROMTray *newTray = dynamic_cast<CCDROMTray *>(getRoom()->findByName("newTray")); + + if (newTray->_state && newTray->_string1 == "None") { + CActMsg actMsg(getName()); + actMsg.execute(newTray); + } + } + + resetPosition(); + return true; +} + +bool CCDROM::handleMessage(CMouseDragMoveMsg &msg) { + setPosition(msg._mousePos - _tempPos); + return true; +} + +bool CCDROM::handleMessage(CActMsg &msg) { + if (msg._action == "Ejected") + setVisible(true); + + return true; +} + } // End of namespace Titanic |