Initial commit

This commit is contained in:
2026-02-02 04:50:13 +01:00
commit 5b11698731
22592 changed files with 7677434 additions and 0 deletions

1
engines/titanic/POTFILES Normal file
View File

@@ -0,0 +1 @@
engines/titanic/metaengine.cpp

View File

@@ -0,0 +1,202 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/arm.h"
#include "titanic/messages/messages.h"
#include "titanic/translation.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CArm, CCarry)
ON_MESSAGE(PuzzleSolvedMsg)
ON_MESSAGE(TranslateObjectMsg)
ON_MESSAGE(UseWithOtherMsg)
ON_MESSAGE(MouseDragStartMsg)
ON_MESSAGE(MaitreDHappyMsg)
ON_MESSAGE(PETGainedObjectMsg)
ON_MESSAGE(MouseDragMoveMsg)
END_MESSAGE_MAP()
CArm::CArm() : CCarry(), _heldItemName("Key"),
_puzzleUnused(0), _armUnlocked(false), _arboretumFrame(3), _unlockedFrame(0),
_armRect(220, 208, 409, 350) {
}
void CArm::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeQuotedLine(_heldItemName, indent);
file->writeNumberLine(_puzzleUnused, indent);
file->writeRect(_hookedRect, indent);
file->writeQuotedLine(_hookedTarget, indent);
file->writeNumberLine(_armUnlocked, indent);
file->writeRect(_armRect, indent);
file->writeNumberLine(_arboretumFrame, indent);
file->writeNumberLine(_unlockedFrame, indent);
CCarry::save(file, indent);
}
void CArm::load(SimpleFile *file) {
file->readNumber();
_heldItemName = file->readString();
_puzzleUnused = file->readNumber();
_hookedRect = file->readRect();
_hookedTarget = file->readString();
_armUnlocked = file->readNumber();
_armRect = file->readRect();
_arboretumFrame = file->readNumber();
_unlockedFrame = file->readNumber();
CCarry::load(file);
}
bool CArm::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) {
_puzzleUnused = 0;
_canTake = true;
CString name = getName();
if (name == "Arm1") {
CActMsg actMsg("LoseArm");
actMsg.execute("MaitreD");
CPuzzleSolvedMsg solvedMsg;
solvedMsg.execute("AuditoryCentre");
} else if (name == "Arm2") {
CPuzzleSolvedMsg solvedMsg;
solvedMsg.execute("Key");
}
return true;
}
bool CArm::TranslateObjectMsg(CTranslateObjectMsg *msg) {
Point newPos(_bounds.left + msg->_delta.x, _bounds.top + msg->_delta.y);
setPosition(newPos);
return true;
}
bool CArm::UseWithOtherMsg(CUseWithOtherMsg *msg) {
if (_heldItemName != "None") {
CShowTextMsg textMsg(ARM_ALREADY_HOLDING);
textMsg.execute("PET");
return false;
} else if (msg->_other->getName() == "GondolierLeftLever") {
CIsHookedOnMsg hookedMsg(_hookedRect, 0, getName());
hookedMsg._rect.translate(_bounds.left, _bounds.top);
hookedMsg.execute("GondolierLeftLever");
if (hookedMsg._isHooked) {
_hookedTarget = "GondolierLeftLever";
} else {
petAddToInventory();
}
} else if (msg->_other->getName() == "GondolierRightLever") {
CIsHookedOnMsg hookedMsg(_hookedRect, 0, getName());
hookedMsg._rect.translate(_bounds.left, _bounds.top);
hookedMsg.execute("GondolierRightLever");
if (hookedMsg._isHooked) {
_hookedTarget = "GondolierRightLever";
} else {
petAddToInventory();
}
} else {
petAddToInventory();
}
return true;
}
bool CArm::MouseDragStartMsg(CMouseDragStartMsg *msg) {
if (!_canTake) {
CShowTextMsg textMsg(YOU_CANT_GET_THIS);
textMsg.execute("PET");
} else if (checkStartDragging(msg)) {
hideMouse();
_centroid = msg->_mousePos - _bounds;
setPosition(msg->_mousePos - _centroid);
if (!_hookedTarget.empty()) {
CActMsg actMsg("Unhook");
actMsg.execute(_hookedTarget);
_hookedTarget.clear();
}
loadFrame(_visibleFrame);
return true;
}
return false;
}
bool CArm::MaitreDHappyMsg(CMaitreDHappyMsg *msg) {
CGameObject *petItem;
if (find(getName(), &petItem, FIND_PET)) {
if (!_armUnlocked)
playSound(TRANSLATE("z#47.wav", "z#578.wav"));
if (_heldItemName == "Key" || _heldItemName == "AuditoryCentre") {
CGameObject *heldItem = dynamic_cast<CGameObject *>(getFirstChild());
if (heldItem) {
heldItem->setVisible(true);
heldItem->petAddToInventory();
}
_visibleFrame = _unlockedFrame;
loadFrame(_visibleFrame);
_heldItemName = "None";
petInvChange();
}
}
_armUnlocked = true;
_canTake = true;
return true;
}
bool CArm::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
if (_armUnlocked) {
if (_heldItemName == "Key" || _heldItemName == "AuditoryCentre") {
CCarry *child = dynamic_cast<CCarry *>(getFirstChild());
if (child) {
_visibleFrame = _unlockedFrame;
loadFrame(_visibleFrame);
child->setVisible(true);
child->petAddToInventory();
}
_heldItemName = "None";
}
}
return true;
}
bool CArm::MouseDragMoveMsg(CMouseDragMoveMsg *msg) {
setPosition(msg->_mousePos - _centroid);
if (_heldItemName == "None" && compareViewNameTo("FrozenArboretum.Node 5.S")) {
loadFrame(_armRect.contains(msg->_mousePos) ?
_arboretumFrame : _visibleFrame);
}
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,67 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_ARM_H
#define TITANIC_ARM_H
#include "titanic/carry/carry.h"
#include "titanic/messages/messages.h"
#include "titanic/messages/mouse_messages.h"
#include "titanic/messages/pet_messages.h"
namespace Titanic {
class CArm : public CCarry {
DECLARE_MESSAGE_MAP;
bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg);
bool TranslateObjectMsg(CTranslateObjectMsg *msg);
bool UseWithOtherMsg(CUseWithOtherMsg *msg);
bool MouseDragStartMsg(CMouseDragStartMsg *msg);
bool MaitreDHappyMsg(CMaitreDHappyMsg *msg);
bool PETGainedObjectMsg(CPETGainedObjectMsg *msg);
bool MouseDragMoveMsg(CMouseDragMoveMsg *msg);
private:
CString _heldItemName;
int _puzzleUnused;
Rect _hookedRect;
CString _hookedTarget;
bool _armUnlocked;
Rect _armRect;
int _arboretumFrame;
int _unlockedFrame;
public:
CLASSDEF;
CArm();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_ARM_H */

View File

@@ -0,0 +1,46 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/auditory_centre.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CAuditoryCentre, CBrain)
ON_MESSAGE(PuzzleSolvedMsg)
END_MESSAGE_MAP()
void CAuditoryCentre::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CBrain::save(file, indent);
}
void CAuditoryCentre::load(SimpleFile *file) {
file->readNumber();
CBrain::load(file);
}
bool CAuditoryCentre::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) {
_canTake = true;
setVisible(true);
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,48 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_AUDITORY_CENTRE_H
#define TITANIC_AUDITORY_CENTRE_H
#include "titanic/carry/brain.h"
namespace Titanic {
class CAuditoryCentre : public CBrain {
DECLARE_MESSAGE_MAP;
bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg);
public:
CLASSDEF;
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_AUDITORY_CENTRE_H */

View File

@@ -0,0 +1,67 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/bowl_ear.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CBowlEar, CEar)
ON_MESSAGE(PETGainedObjectMsg)
ON_MESSAGE(ReplaceBowlAndNutsMsg)
ON_MESSAGE(NutPuzzleMsg)
ON_MESSAGE(MouseDragStartMsg)
END_MESSAGE_MAP()
void CBowlEar::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CEar::save(file, indent);
}
void CBowlEar::load(SimpleFile *file) {
file->readNumber();
CEar::load(file);
}
bool CBowlEar::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
CBowlStateChangeMsg changeMsg(3);
changeMsg.execute("ParrotNutBowlActor");
return CEar::PETGainedObjectMsg(msg);
}
bool CBowlEar::ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg) {
setVisible(false);
return true;
}
bool CBowlEar::NutPuzzleMsg(CNutPuzzleMsg *msg) {
if (msg->_action == "BowlUnlocked")
_canTake = true;
return true;
}
bool CBowlEar::MouseDragStartMsg(CMouseDragStartMsg *msg) {
setVisible(true);
return CEar::MouseDragStartMsg(msg);
}
} // End of namespace Titanic

View File

@@ -0,0 +1,51 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_BOWL_EAR_H
#define TITANIC_BOWL_EAR_H
#include "titanic/carry/ear.h"
namespace Titanic {
class CBowlEar : public CEar {
DECLARE_MESSAGE_MAP;
bool PETGainedObjectMsg(CPETGainedObjectMsg *msg);
bool ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg);
bool NutPuzzleMsg(CNutPuzzleMsg *msg);
bool MouseDragStartMsg(CMouseDragStartMsg *msg);
public:
CLASSDEF;
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_BOWL_EAR_H */

View File

@@ -0,0 +1,135 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/brain.h"
#include "titanic/game/brain_slot.h"
#include "titanic/translation.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CBrain, CCarry)
ON_MESSAGE(UseWithOtherMsg)
ON_MESSAGE(VisibleMsg)
ON_MESSAGE(MouseDragStartMsg)
ON_MESSAGE(PassOnDragStartMsg)
ON_MESSAGE(PETGainedObjectMsg)
END_MESSAGE_MAP()
CBrain::CBrain() : CCarry(), _pieceAdded(false), _perchGained(false) {
}
void CBrain::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writePoint(_pos1, indent);
file->writeNumberLine(_pieceAdded, indent);
file->writeNumberLine(_perchGained, indent);
CCarry::save(file, indent);
}
void CBrain::load(SimpleFile *file) {
file->readNumber();
_pos1 = file->readPoint();
_pieceAdded = file->readNumber();
_perchGained = file->readNumber();
CCarry::load(file);
}
bool CBrain::UseWithOtherMsg(CUseWithOtherMsg *msg) {
CBrainSlot *slot = dynamic_cast<CBrainSlot *>(msg->_other);
if (!slot)
return CCarry::UseWithOtherMsg(msg);
if (isEquals("CentralCore")) {
setVisible(false);
petMoveToHiddenRoom();
CAddHeadPieceMsg headpieceMsg(getName());
headpieceMsg.execute("CentralCoreSlot");
} else if (!slot->_occupied && slot->getName() != "CentralCoreSlot") {
// Brain card goes into vacant slot
setVisible(false);
petMoveToHiddenRoom();
CAddHeadPieceMsg headpieceMsg(getName());
headpieceMsg.execute(msg->_other);
playSound(TRANSLATE("z#116.wav", "z#647.wav"));
setPosition(Point(0, 0));
setVisible(false);
_pieceAdded = true;
} else {
// Trying to put brain card into an already occupied slot
petAddToInventory();
}
return true;
}
bool CBrain::VisibleMsg(CVisibleMsg *msg) {
setVisible(msg->_visible);
return true;
}
bool CBrain::MouseDragStartMsg(CMouseDragStartMsg *msg) {
if (!checkStartDragging(msg))
return false;
if (_pieceAdded) {
CTakeHeadPieceMsg headpieceMsg(getName());
headpieceMsg.execute("TitaniaControl");
_pieceAdded = false;
setVisible(true);
moveToView();
setPosition(Point(msg->_mousePos.x - _bounds.width() / 2,
msg->_mousePos.y - _bounds.height() / 2));
}
return CCarry::MouseDragStartMsg(msg);
}
bool CBrain::PassOnDragStartMsg(CPassOnDragStartMsg *msg) {
if (_pieceAdded) {
CTakeHeadPieceMsg headpieceMsg(getName());
headpieceMsg.execute("TitaniaControl");
_pieceAdded = false;
setVisible(true);
moveToView();
setPosition(Point(msg->_mousePos.x - _bounds.width() / 2,
msg->_mousePos.y - _bounds.height() / 2));
}
return CCarry::PassOnDragStartMsg(msg);
}
bool CBrain::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
if (!_perchGained) {
if (getName() == "Perch") {
incParrotResponse();
_perchGained = true;
}
}
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,60 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_BRAIN_H
#define TITANIC_BRAIN_H
#include "titanic/carry/carry.h"
#include "titanic/messages/messages.h"
#include "titanic/messages/mouse_messages.h"
#include "titanic/messages/pet_messages.h"
namespace Titanic {
class CBrain : public CCarry {
DECLARE_MESSAGE_MAP;
bool UseWithOtherMsg(CUseWithOtherMsg *msg);
bool VisibleMsg(CVisibleMsg *msg);
bool MouseDragStartMsg(CMouseDragStartMsg *msg);
bool PassOnDragStartMsg(CPassOnDragStartMsg *msg);
bool PETGainedObjectMsg(CPETGainedObjectMsg *msg);
private:
Point _pos1;
bool _pieceAdded;
bool _perchGained;
public:
CLASSDEF;
CBrain();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_BRAIN_H */

View File

@@ -0,0 +1,95 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/bridge_piece.h"
#include "titanic/game/ship_setting.h"
#include "titanic/translation.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CBridgePiece, CCarry)
ON_MESSAGE(UseWithOtherMsg)
ON_MESSAGE(PassOnDragStartMsg)
END_MESSAGE_MAP()
CBridgePiece::CBridgePiece() : CCarry(), _field140(0) {
}
void CBridgePiece::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeQuotedLine(_string6, indent);
file->writePoint(_pos3, indent);
file->writeNumberLine(_field140, indent);
CCarry::save(file, indent);
}
void CBridgePiece::load(SimpleFile *file) {
file->readNumber();
_string6 = file->readString();
_pos3 = file->readPoint();
_field140 = file->readNumber();
CCarry::load(file);
}
bool CBridgePiece::UseWithOtherMsg(CUseWithOtherMsg *msg) {
CShipSetting *shipSetting = dynamic_cast<CShipSetting *>(msg->_other);
if (!shipSetting) {
return CCarry::UseWithOtherMsg(msg);
} else if (shipSetting->_itemName != "NULL") {
petAddToInventory();
return true;
} else {
setVisible(false);
playSound(TRANSLATE("z#54.wav", "z#585.wav"));
setPosition(shipSetting->_pos1);
shipSetting->_itemName = getName();
petMoveToHiddenRoom();
CAddHeadPieceMsg headpieceMsg(shipSetting->getName() == _string6 ?
"Enable" : "Disable");
CSetFrameMsg frameMsg;
CString name = getName();
if (name == "ChickenBridge") {
frameMsg._frameNumber = 1;
} else if (name == "FanBridge") {
frameMsg._frameNumber = 2;
} else if (name == "SeasonBridge") {
frameMsg._frameNumber = 3;
} else if (name == "BeamBridge") {
frameMsg._frameNumber = 4;
}
frameMsg.execute(shipSetting);
headpieceMsg.execute(shipSetting);
return true;
}
}
bool CBridgePiece::PassOnDragStartMsg(CPassOnDragStartMsg *msg) {
setVisible(true);
moveToView();
return CCarry::PassOnDragStartMsg(msg);
}
} // End of namespace Titanic

View File

@@ -0,0 +1,54 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_BRIDGE_PIECE_H
#define TITANIC_BRIDGE_PIECE_H
#include "titanic/carry/carry.h"
namespace Titanic {
class CBridgePiece : public CCarry {
DECLARE_MESSAGE_MAP;
bool UseWithOtherMsg(CUseWithOtherMsg *msg);
bool PassOnDragStartMsg(CPassOnDragStartMsg *msg);
private:
CString _string6;
Point _pos3;
int _field140;
public:
CLASSDEF;
CBridgePiece();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_BRIDGE_PIECE_H */

View File

@@ -0,0 +1,245 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/carry.h"
#include "titanic/debugger.h"
#include "titanic/messages/messages.h"
#include "titanic/npcs/character.h"
#include "titanic/npcs/succubus.h"
#include "titanic/pet_control/pet_control.h"
#include "titanic/titanic.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CCarry, CGameObject)
ON_MESSAGE(MouseDragStartMsg)
ON_MESSAGE(MouseDragMoveMsg)
ON_MESSAGE(MouseDragEndMsg)
ON_MESSAGE(UseWithCharMsg)
ON_MESSAGE(LeaveViewMsg)
ON_MESSAGE(UseWithOtherMsg)
ON_MESSAGE(VisibleMsg)
ON_MESSAGE(MouseButtonDownMsg)
ON_MESSAGE(RemoveFromGameMsg)
ON_MESSAGE(MoveToStartPosMsg)
ON_MESSAGE(EnterViewMsg)
ON_MESSAGE(PassOnDragStartMsg)
END_MESSAGE_MAP()
CCarry::CCarry() : CGameObject(), _unused5(0), _canTake(true),
_unusedR(0), _unusedG(0), _unusedB(0), _itemFrame(0),
_enterFrame(0), _enterFrameSet(false), _visibleFrame(0),
_npcUse("None"), _fullViewName("NULL"),
_doesNothingMsg(g_vm->_strings[DOESNT_DO_ANYTHING]),
_doesntWantMsg(g_vm->_strings[DOESNT_WANT_THIS]) {
}
void CCarry::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeQuotedLine(_npcUse, indent);
file->writePoint(_origPos, indent);
file->writeQuotedLine(_fullViewName, indent);
file->writeNumberLine(_unused5, indent);
file->writeNumberLine(_canTake, indent);
file->writeQuotedLine(_doesNothingMsg, indent);
file->writeQuotedLine(_doesntWantMsg, indent);
file->writePoint(_centroid, indent);
file->writeNumberLine(_unusedR, indent);
file->writeNumberLine(_unusedG, indent);
file->writeNumberLine(_unusedB, indent);
file->writeNumberLine(_itemFrame, indent);
file->writeQuotedLine(_unused6, indent);
file->writeNumberLine(_enterFrame, indent);
file->writeNumberLine(_enterFrameSet, indent);
file->writeNumberLine(_visibleFrame, indent);
CGameObject::save(file, indent);
}
void CCarry::load(SimpleFile *file) {
file->readNumber();
_npcUse = file->readString();
_origPos = file->readPoint();
_fullViewName = file->readString();
_unused5 = file->readNumber();
_canTake = file->readNumber();
_doesNothingMsg = file->readString();
_doesntWantMsg = file->readString();
_centroid = file->readPoint();
_unusedR = file->readNumber();
_unusedG = file->readNumber();
_unusedB = file->readNumber();
_itemFrame = file->readNumber();
_unused6 = file->readString();
_enterFrame = file->readNumber();
_enterFrameSet = file->readNumber();
_visibleFrame = file->readNumber();
CGameObject::load(file);
}
bool CCarry::MouseDragStartMsg(CMouseDragStartMsg *msg) {
CString name = getName();
debugC(DEBUG_BASIC, kDebugScripts, "MosueDragStartMsg - %s", name.c_str());
if (_canTake) {
if (checkStartDragging(msg)) {
CPassOnDragStartMsg startMsg(msg->_mousePos);
startMsg.execute(this);
return true;
}
} else {
if (_visible) {
CShowTextMsg textMsg(YOU_CANT_GET_THIS);
textMsg.execute("PET");
}
}
return false;
}
bool CCarry::MouseDragMoveMsg(CMouseDragMoveMsg *msg) {
setPosition(msg->_mousePos - _centroid);
return true;
}
bool CCarry::MouseDragEndMsg(CMouseDragEndMsg *msg) {
debugC(DEBUG_BASIC, kDebugScripts, "MouseDragEndMsg");
showMouse();
if (msg->_dropTarget) {
if (msg->_dropTarget->isPet()) {
petAddToInventory();
return true;
}
CCharacter *npc = dynamic_cast<CCharacter *>(msg->_dropTarget);
if (npc) {
CUseWithCharMsg charMsg(npc);
charMsg.execute(this, nullptr, 0);
return true;
}
CDropObjectMsg dropMsg(this);
if (dropMsg.execute(msg->_dropTarget))
return true;
// Fall back on a use with other message
CUseWithOtherMsg otherMsg(msg->_dropTarget);
if (otherMsg.execute(this, nullptr, 0))
return true;
}
if (!compareViewNameTo(_fullViewName) || msg->_mousePos.y >= 360) {
sleep(250);
petAddToInventory();
} else {
setPosition(_origPos);
loadFrame(_itemFrame);
}
return true;
}
bool CCarry::UseWithCharMsg(CUseWithCharMsg *msg) {
CSuccUBus *succubus = dynamic_cast<CSuccUBus *>(msg->_character);
if (succubus) {
CSubAcceptCCarryMsg carryMsg;
carryMsg._item = this;
carryMsg.execute(succubus);
} else {
CShowTextMsg textMsg(_doesntWantMsg);
textMsg.execute("PET");
petAddToInventory();
}
return true;
}
bool CCarry::LeaveViewMsg(CLeaveViewMsg *msg) {
return true;
}
bool CCarry::UseWithOtherMsg(CUseWithOtherMsg *msg) {
CShowTextMsg textMsg(_doesNothingMsg);
textMsg.execute("PET");
if (!compareViewNameTo(_fullViewName) || _bounds.top >= 360) {
sleep(250);
petAddToInventory();
} else {
setPosition(_origPos);
}
return true;
}
bool CCarry::VisibleMsg(CVisibleMsg *msg) {
setVisible(msg->_visible);
if (msg->_visible && _visibleFrame != -1)
loadFrame(_visibleFrame);
return true;
}
bool CCarry::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
return true;
}
bool CCarry::RemoveFromGameMsg(CRemoveFromGameMsg *msg) {
setPosition(Point(0, 0));
setVisible(false);
return true;
}
bool CCarry::MoveToStartPosMsg(CMoveToStartPosMsg *msg) {
setPosition(_origPos);
return true;
}
bool CCarry::EnterViewMsg(CEnterViewMsg *msg) {
if (!_enterFrameSet) {
loadFrame(_enterFrame);
_enterFrameSet = true;
}
return true;
}
bool CCarry::PassOnDragStartMsg(CPassOnDragStartMsg *msg) {
hideMouse();
if (_visibleFrame != -1)
loadFrame(_visibleFrame);
if (msg->_value3) {
_centroid.x = _bounds.width() / 2;
_centroid.y = _bounds.height() / 2;
} else {
_centroid = msg->_mousePos - _bounds;
}
setPosition(getMousePos() - _centroid);
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,79 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_CARRY_H
#define TITANIC_CARRY_H
#include "titanic/core/game_object.h"
#include "titanic/messages/messages.h"
#include "titanic/messages/mouse_messages.h"
namespace Titanic {
class CCarry : public CGameObject {
DECLARE_MESSAGE_MAP;
bool MouseDragStartMsg(CMouseDragStartMsg *msg);
bool MouseDragMoveMsg(CMouseDragMoveMsg *msg);
bool MouseDragEndMsg(CMouseDragEndMsg *msg);
bool UseWithCharMsg(CUseWithCharMsg *msg);
bool LeaveViewMsg(CLeaveViewMsg *msg);
bool UseWithOtherMsg(CUseWithOtherMsg *msg);
bool VisibleMsg(CVisibleMsg *msg);
bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
bool RemoveFromGameMsg(CRemoveFromGameMsg *msg);
bool MoveToStartPosMsg(CMoveToStartPosMsg *msg);
bool EnterViewMsg(CEnterViewMsg *msg);
bool PassOnDragStartMsg(CPassOnDragStartMsg *msg);
private:
int _unused5;
CString _doesNothingMsg;
CString _doesntWantMsg;
int _unusedR, _unusedG, _unusedB;
int _itemFrame;
CString _unused6;
int _enterFrame;
bool _enterFrameSet;
protected:
Point _centroid;
int _visibleFrame;
public:
CString _npcUse;
bool _canTake;
Point _origPos;
CString _fullViewName;
public:
CLASSDEF;
CCarry();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_CARRY_H */

View File

@@ -0,0 +1,237 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/carry_parrot.h"
#include "titanic/core/project_item.h"
#include "titanic/core/room_item.h"
#include "titanic/game/cage.h"
#include "titanic/npcs/parrot.h"
#include "titanic/npcs/succubus.h"
#include "titanic/pet_control/pet_control.h"
#include "titanic/translation.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CCarryParrot, CCarry)
ON_MESSAGE(PETGainedObjectMsg)
ON_MESSAGE(TimerMsg)
ON_MESSAGE(IsParrotPresentMsg)
ON_MESSAGE(LeaveViewMsg)
ON_MESSAGE(MouseDragEndMsg)
ON_MESSAGE(PassOnDragStartMsg)
ON_MESSAGE(PreEnterViewMsg)
ON_MESSAGE(UseWithCharMsg)
ON_MESSAGE(ActMsg)
END_MESSAGE_MAP()
CCarryParrot::CCarryParrot() : CCarry(), _parrotName("PerchedParrot"),
_timerId(0), _freeCounter(0), _feathersFlag(false) {
}
void CCarryParrot::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeQuotedLine(_parrotName, indent);
file->writeNumberLine(_timerId, indent);
file->writeNumberLine(_freeCounter, indent);
file->writeNumberLine(_feathersFlag, indent);
CCarry::save(file, indent);
}
void CCarryParrot::load(SimpleFile *file) {
file->readNumber();
_parrotName = file->readString();
_timerId = file->readNumber();
_freeCounter = file->readNumber();
_feathersFlag = file->readNumber();
CCarry::load(file);
}
bool CCarryParrot::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
CParrot::_state = PARROT_4;
CActMsg actMsg("Shut");
actMsg.execute("ParrotCage");
return true;
}
bool CCarryParrot::TimerMsg(CTimerMsg *msg) {
if (CParrot::_state == PARROT_1 || CParrot::_state == PARROT_4) {
if (++_freeCounter >= 30) {
CActMsg actMsg("FreeParrot");
actMsg.execute(this);
}
}
return true;
}
bool CCarryParrot::IsParrotPresentMsg(CIsParrotPresentMsg *msg) {
msg->_isPresent = true;
return true;
}
bool CCarryParrot::LeaveViewMsg(CLeaveViewMsg *msg) {
if (_visible) {
setVisible(false);
_canTake = false;
CParrot::_state = PARROT_ESCAPED;
}
return true;
}
bool CCarryParrot::MouseDragEndMsg(CMouseDragEndMsg *msg) {
stopMovie();
if (msg->_mousePos.y >= 360) {
petAddToInventory();
} else if (compareViewNameTo("ParrotLobby.Node 1.N")) {
if (msg->_mousePos.x >= 75 && msg->_mousePos.x <= 565 &&
!CParrot::_takeOff && !CCage::_open) {
setVisible(false);
_canTake = false;
CTreeItem *perchedParrot = findUnder(getRoot(), "PerchedParrot");
detach();
addUnder(perchedParrot);
stopSoundChannel(true);
CPutParrotBackMsg backMsg(msg->_mousePos.x);
backMsg.execute(perchedParrot);
} else {
setVisible(false);
_canTake = false;
CParrot::_state = PARROT_ESCAPED;
playSound(TRANSLATE("z#475.wav", "z#212.wav"));
stopSoundChannel(true);
moveUnder(findRoom());
CActMsg actMsg("Shut");
actMsg.execute("ParrotCage");
}
} else {
CCharacter *character = dynamic_cast<CCharacter *>(msg->_dropTarget);
if (character) {
CUseWithCharMsg charMsg(character);
charMsg.execute(this, nullptr, 0);
} else {
setVisible(false);
_canTake = false;
playSound(TRANSLATE("z#475.wav", "z#212.wav"));
stopSoundChannel(true);
moveUnder(findRoom());
}
}
showMouse();
return true;
}
bool CCarryParrot::PassOnDragStartMsg(CPassOnDragStartMsg *msg) {
if (CParrot::_state != PARROT_MAILED) {
moveToView();
setPosition(Point(0, 0));
setVisible(true);
playClip("Pick Up", MOVIE_STOP_PREVIOUS);
playClip("Flapping", MOVIE_REPEAT);
stopTimer(_timerId);
_timerId = addTimer(1000, 1000);
_freeCounter = 0;
CParrot::_state = PARROT_1;
msg->_value3 = 1;
return CCarry::PassOnDragStartMsg(msg);
}
CTrueTalkNPC *npc = dynamic_cast<CTrueTalkNPC *>(getRoot()->findByName(_parrotName));
if (npc)
startTalking(npc, 0x446BF);
_canTake = false;
CProximity prox(Audio::Mixer::kSpeechSoundType);
playSound(TRANSLATE("z#475.wav", "z#212.wav"), prox);
moveUnder(findRoom());
CParrot::_state = PARROT_ESCAPED;
msg->_value4 = 1;
return true;
}
bool CCarryParrot::PreEnterViewMsg(CPreEnterViewMsg *msg) {
loadSurface();
CCarryParrot *parrot = dynamic_cast<CCarryParrot *>(getRoot()->findByName("CarryParrot"));
if (parrot)
parrot->_canTake = false;
return true;
}
bool CCarryParrot::UseWithCharMsg(CUseWithCharMsg *msg) {
CSuccUBus *succubus = dynamic_cast<CSuccUBus *>(msg->_character);
if (succubus)
CParrot::_state = PARROT_MAILED;
return CCarry::UseWithCharMsg(msg);
}
bool CCarryParrot::ActMsg(CActMsg *msg) {
if (msg->_action == "FreeParrot" && (CParrot::_state == PARROT_4 || CParrot::_state == PARROT_1)) {
CTrueTalkNPC *npc = dynamic_cast<CTrueTalkNPC *>(getRoot()->findByName(_parrotName));
if (npc)
startTalking(npc, 0x446BF);
setVisible(false);
_canTake = false;
if (CParrot::_state == PARROT_4) {
playSound(TRANSLATE("z#475.wav", "z#212.wav"));
if (!_feathersFlag) {
CCarry *feathers = dynamic_cast<CCarry *>(getRoot()->findByName("Feathers"));
if (feathers) {
feathers->setVisible(true);
feathers->petAddToInventory();
}
_feathersFlag = true;
}
CPetControl *pet = getPetControl();
pet->removeFromInventory(this);
pet->setAreaChangeType(1);
moveUnder(getRoom());
} else {
CActMsg actMsg("Shut");
actMsg.execute("ParrotCage");
}
CParrot::_state = PARROT_ESCAPED;
stopAnimTimer(_timerId);
_timerId = 0;
}
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,65 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_CARRY_PARROT_H
#define TITANIC_CARRY_PARROT_H
#include "titanic/carry/carry.h"
#include "titanic/messages/messages.h"
#include "titanic/messages/mouse_messages.h"
#include "titanic/messages/pet_messages.h"
namespace Titanic {
class CCarryParrot : public CCarry {
DECLARE_MESSAGE_MAP;
bool PETGainedObjectMsg(CPETGainedObjectMsg *msg);
bool TimerMsg(CTimerMsg *msg);
bool IsParrotPresentMsg(CIsParrotPresentMsg *msg);
bool LeaveViewMsg(CLeaveViewMsg *msg);
bool MouseDragEndMsg(CMouseDragEndMsg *msg);
bool PassOnDragStartMsg(CPassOnDragStartMsg *msg);
bool PreEnterViewMsg(CPreEnterViewMsg *msg);
bool UseWithCharMsg(CUseWithCharMsg *msg);
bool ActMsg(CActMsg *msg);
private:
CString _parrotName;
int _timerId;
int _freeCounter;
bool _feathersFlag;
public:
CLASSDEF;
CCarryParrot();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_CARRY_PARROT_H */

View File

@@ -0,0 +1,94 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/central_core.h"
#include "titanic/npcs/parrot.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CCentralCore, CBrain)
ON_MESSAGE(UseWithOtherMsg)
ON_MESSAGE(DropZoneLostObjectMsg)
ON_MESSAGE(DropZoneGotObjectMsg)
END_MESSAGE_MAP()
void CCentralCore::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CBrain::save(file, indent);
}
void CCentralCore::load(SimpleFile *file) {
file->readNumber();
CBrain::load(file);
}
bool CCentralCore::UseWithOtherMsg(CUseWithOtherMsg *msg) {
CString name = msg->_other->getName();
if (name == "HammerDispensorButton") {
CPuzzleSolvedMsg solvedMsg;
solvedMsg.execute("BigHammer");
} else if (name == "SpeechCentre") {
CShowTextMsg textMsg(DOES_NOT_REACH);
textMsg.execute("PET");
}
return CBrain::UseWithOtherMsg(msg);
}
bool CCentralCore::DropZoneLostObjectMsg(CDropZoneLostObjectMsg *msg) {
CString name = msg->_object->getName();
if (name == "PerchCoreHolder") {
CParrot::_takeOff = true;
if (isEquals("CentralCore"))
CParrot::_coreReplaced = false;
CActMsg actMsg("LosePerch");
actMsg.execute("ParrotLobbyController");
} else if (name == "PerchHolder") {
CActMsg actMsg("LoseStick");
actMsg.execute("ParrotLobbyController");
}
return true;
}
bool CCentralCore::DropZoneGotObjectMsg(CDropZoneGotObjectMsg *msg) {
CString name = msg->_object->getName();
if (name == "PerchCoreHolder") {
CParrot::_takeOff = false;
if (isEquals("CentralCore")) {
CParrot::_coreReplaced = true;
CActMsg actMsg("CoreReplaced");
actMsg.execute("ParrotCage");
}
CActMsg actMsg("GainPerch");
actMsg.execute("ParrotLobbyController");
} else if (name == "PerchHolder") {
CActMsg actMsg("GainStick");
actMsg.execute("ParrotLobbyController");
}
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,50 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_CENTRAL_CORE_H
#define TITANIC_CENTRAL_CORE_H
#include "titanic/carry/brain.h"
namespace Titanic {
class CCentralCore : public CBrain {
DECLARE_MESSAGE_MAP;
bool UseWithOtherMsg(CUseWithOtherMsg *msg);
bool DropZoneLostObjectMsg(CDropZoneLostObjectMsg *msg);
bool DropZoneGotObjectMsg(CDropZoneGotObjectMsg *msg);
public:
CLASSDEF;
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_CENTRAL_CORE_H */

View File

@@ -0,0 +1,227 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/chicken.h"
#include "titanic/game/sauce_dispensor.h"
#include "titanic/npcs/succubus.h"
#include "titanic/pet_control/pet_control.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CChicken, CCarry)
ON_MESSAGE(UseWithOtherMsg)
ON_MESSAGE(UseWithCharMsg)
ON_MESSAGE(ActMsg)
ON_MESSAGE(VisibleMsg)
ON_MESSAGE(TimerMsg)
ON_MESSAGE(PETGainedObjectMsg)
ON_MESSAGE(ParrotTriesChickenMsg)
ON_MESSAGE(MouseDragEndMsg)
ON_MESSAGE(PETObjectStateMsg)
ON_MESSAGE(PETLostObjectMsg)
END_MESSAGE_MAP()
int CChicken::_temperature;
#define HOT_TEMPERATURE 120
CChicken::CChicken() : CCarry(), _condiment("None"),
_greasy(true), _inactive(false), _timerId(0) {
}
void CChicken::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_greasy, indent);
file->writeQuotedLine(_condiment, indent);
file->writeNumberLine(_temperature, indent);
file->writeNumberLine(_inactive, indent);
file->writeNumberLine(_timerId, indent);
CCarry::save(file, indent);
}
void CChicken::load(SimpleFile *file) {
file->readNumber();
_greasy = file->readNumber();
_condiment = file->readString();
_temperature = file->readNumber();
_inactive = file->readNumber();
_timerId = file->readNumber();
CCarry::load(file);
}
bool CChicken::UseWithOtherMsg(CUseWithOtherMsg *msg) {
if (msg->_other->getName() == "Napkin") {
if (_greasy || _condiment != "None") {
CActMsg actMsg("Clean");
actMsg.execute(this);
petAddToInventory();
} else {
CShowTextMsg textMsg(CHICKEN_ALREADY_CLEAN);
textMsg.execute("PET");
}
petAddToInventory();
} else {
CSauceDispensor *dispensor = dynamic_cast<CSauceDispensor *>(msg->_other);
if (dispensor && _condiment == "None") {
setVisible(false);
CUse use(this);
use.execute(msg->_other);
} else {
return CCarry::UseWithOtherMsg(msg);
}
}
return true;
}
bool CChicken::UseWithCharMsg(CUseWithCharMsg *msg) {
CSuccUBus *succubus = dynamic_cast<CSuccUBus *>(msg->_character);
if (succubus) {
setPosition(Point(330, 300));
CSubAcceptCCarryMsg acceptMsg;
acceptMsg._item = this;
acceptMsg.execute(succubus);
} else {
petAddToInventory();
}
return true;
}
bool CChicken::ActMsg(CActMsg *msg) {
if (msg->_action == "GoToPET") {
setVisible(true);
petAddToInventory();
} else if (msg->_action == "Tomato") {
_condiment = "Tomato";
loadFrame(4);
_visibleFrame = 4;
} else if (msg->_action == "Mustard") {
_condiment = "Mustard";
loadFrame(5);
_visibleFrame = 5;
} else if (msg->_action == "Bird") {
_condiment = "Bird";
loadFrame(2);
_visibleFrame = 2;
} else if (msg->_action == "None") {
setVisible(false);
} else if (msg->_action == "Clean") {
_condiment = "None";
loadFrame(3);
_greasy = false;
_visibleFrame = 3;
} else if (msg->_action == "Dispense Chicken") {
_condiment = "None";
_inactive = false;
_greasy = true;
loadFrame(1);
_visibleFrame = 1;
_temperature = HOT_TEMPERATURE;
} else if (msg->_action == "Hot") {
_temperature = HOT_TEMPERATURE;
} else if (msg->_action == "Eaten") {
setVisible(false);
petMoveToHiddenRoom();
_inactive = true;
}
return true;
}
bool CChicken::VisibleMsg(CVisibleMsg *msg) {
setVisible(msg->_visible);
if (msg->_visible)
loadFrame(_visibleFrame);
return true;
}
bool CChicken::TimerMsg(CTimerMsg *msg) {
// Check whether chicken has been mailed
CGameObject *obj = getMailManFirstObject();
while (obj && obj->getName() != "Chicken")
obj = getMailManNextObject(obj);
// If chicken is not mailed, and still hot, cool it down a bit
if (!obj && _temperature > 0)
--_temperature;
// If chicken is cooled, refresh the inventory, just in case
// the user had the hot chicken selected
if (!_temperature) {
petInvChange();
stopTimer(_timerId);
}
return true;
}
bool CChicken::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
stopTimer(_timerId);
_timerId = addTimer(1000, 1000);
return true;
}
bool CChicken::ParrotTriesChickenMsg(CParrotTriesChickenMsg *msg) {
if (_temperature > 0)
msg->_isHot = true;
if (_condiment == "Tomato") {
msg->_condiment = 1;
} else if (_condiment == "Mustard") {
msg->_condiment = 2;
} else if (_condiment == "Bird") {
msg->_condiment = 3;
}
return true;
}
bool CChicken::MouseDragEndMsg(CMouseDragEndMsg *msg) {
if (_inactive) {
showMouse();
return true;
} else {
return CCarry::MouseDragEndMsg(msg);
}
}
bool CChicken::PETObjectStateMsg(CPETObjectStateMsg *msg) {
if (_temperature > 0)
msg->_value = 2;
return true;
}
bool CChicken::PETLostObjectMsg(CPETLostObjectMsg *msg) {
if (compareViewNameTo("ParrotLobby.Node 1.N")) {
CActMsg actMsg("StartChickenDrag");
actMsg.execute("PerchedParrot");
}
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,67 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_CHICKEN_H
#define TITANIC_CHICKEN_H
#include "titanic/carry/carry.h"
#include "titanic/messages/messages.h"
#include "titanic/messages/pet_messages.h"
namespace Titanic {
class CChicken : public CCarry {
DECLARE_MESSAGE_MAP;
bool UseWithOtherMsg(CUseWithOtherMsg *msg);
bool UseWithCharMsg(CUseWithCharMsg *msg);
bool ActMsg(CActMsg *msg);
bool VisibleMsg(CVisibleMsg *msg);
bool TimerMsg(CTimerMsg *msg);
bool PETGainedObjectMsg(CPETGainedObjectMsg *msg);
bool ParrotTriesChickenMsg(CParrotTriesChickenMsg *msg);
bool MouseDragEndMsg(CMouseDragEndMsg *msg);
bool PETObjectStateMsg(CPETObjectStateMsg *msg);
bool PETLostObjectMsg(CPETLostObjectMsg *msg);
public:
static int _temperature;
public:
bool _greasy;
CString _condiment;
bool _inactive;
int _timerId;
public:
CLASSDEF;
CChicken();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_CHICKEN_H */

View File

@@ -0,0 +1,78 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/crushed_tv.h"
#include "titanic/npcs/character.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CCrushedTV, CCarry)
ON_MESSAGE(ActMsg)
ON_MESSAGE(UseWithCharMsg)
ON_MESSAGE(MouseDragStartMsg)
END_MESSAGE_MAP()
CCrushedTV::CCrushedTV() : CCarry() {
}
void CCrushedTV::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CCarry::save(file, indent);
}
void CCrushedTV::load(SimpleFile *file) {
file->readNumber();
CCarry::load(file);
}
bool CCrushedTV::ActMsg(CActMsg *msg) {
if (msg->_action == "SmashTV") {
setVisible(true);
_canTake = true;
}
return true;
}
bool CCrushedTV::UseWithCharMsg(CUseWithCharMsg *msg) {
if (msg->_character->getName() == "Barbot" && msg->_character->_visible) {
setVisible(false);
CActMsg actMsg("CrushedTV");
actMsg.execute(msg->_character);
return true;
} else {
return CCarry::UseWithCharMsg(msg);
}
}
bool CCrushedTV::MouseDragStartMsg(CMouseDragStartMsg *msg) {
if (!checkStartDragging(msg)) {
return false;
} else if (compareViewNameTo("BottomOfWell.Node 7.N")) {
changeView("BottomOfWell.Node 12.N", "");
CActMsg actMsg("TelevisionTaken");
actMsg.execute("BOWTelevisionMonitor");
}
return CCarry::MouseDragStartMsg(msg);
}
} // End of namespace Titanic

View File

@@ -0,0 +1,53 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_CRUSHED_TV_H
#define TITANIC_CRUSHED_TV_H
#include "titanic/carry/carry.h"
#include "titanic/messages/messages.h"
#include "titanic/messages/mouse_messages.h"
namespace Titanic {
class CCrushedTV : public CCarry {
DECLARE_MESSAGE_MAP;
bool ActMsg(CActMsg *msg);
bool UseWithCharMsg(CUseWithCharMsg *msg);
bool MouseDragStartMsg(CMouseDragStartMsg *msg);
public:
CLASSDEF;
CCrushedTV();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_CRUSHED_TV_H */

View File

@@ -0,0 +1,68 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/ear.h"
#include "titanic/game/head_slot.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CEar, CHeadPiece)
ON_MESSAGE(ActMsg)
ON_MESSAGE(UseWithOtherMsg)
END_MESSAGE_MAP()
CEar::CEar() : CHeadPiece() {
}
void CEar::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CHeadPiece::save(file, indent);
}
void CEar::load(SimpleFile *file) {
file->readNumber();
CHeadPiece::load(file);
}
bool CEar::ActMsg(CActMsg *msg) {
if (msg->_action == "MusicSolved")
_canTake = true;
return true;
}
bool CEar::UseWithOtherMsg(CUseWithOtherMsg *msg) {
CHeadSlot *slot = dynamic_cast<CHeadSlot *>(msg->_other);
if (slot) {
setVisible(false);
petMoveToHiddenRoom();
setPosition(Point(0, 0));
CAddHeadPieceMsg addMsg(getName());
if (addMsg._value != "NULL")
addMsg.execute(addMsg._value == "Ear1" ? "Ear1Slot" : "Ear2Slot");
return true;
} else {
return CCarry::UseWithOtherMsg(msg);
}
}
} // End of namespace Titanic

View File

@@ -0,0 +1,50 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_EAR_H
#define TITANIC_EAR_H
#include "titanic/carry/head_piece.h"
namespace Titanic {
class CEar : public CHeadPiece {
DECLARE_MESSAGE_MAP;
bool ActMsg(CActMsg *msg);
bool UseWithOtherMsg(CUseWithOtherMsg *msg);
public:
CLASSDEF;
CEar();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_EAR_H */

View File

@@ -0,0 +1,142 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/eye.h"
#include "titanic/game/head_slot.h"
#include "titanic/game/light.h"
#include "titanic/game/television.h"
#include "titanic/game/transport/lift.h"
#include "titanic/pet_control/pet_control.h"
#include "titanic/translation.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CEye, CHeadPiece)
ON_MESSAGE(UseWithOtherMsg)
ON_MESSAGE(UseWithCharMsg)
ON_MESSAGE(ActMsg)
ON_MESSAGE(PETGainedObjectMsg)
ON_MESSAGE(PassOnDragStartMsg)
END_MESSAGE_MAP()
CEye::CEye() : CHeadPiece(), _eyeFlag(false) {
}
void CEye::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_eyeFlag, indent);
CHeadPiece::save(file, indent);
}
void CEye::load(SimpleFile *file) {
file->readNumber();
_eyeFlag = file->readNumber();
CHeadPiece::load(file);
}
bool CEye::UseWithOtherMsg(CUseWithOtherMsg *msg) {
CHeadSlot *slot = dynamic_cast<CHeadSlot *>(msg->_other);
if (slot) {
petMoveToHiddenRoom();
_flag = true;
CAddHeadPieceMsg headMsg(getName());
if (headMsg._value != "NULL")
headMsg.execute(isEquals("Eye1") ? "Eye1Slot" : "Eye2Slot");
} else if (msg->_other->isEquals("LiftbotWithoutHead")) {
CPetControl *pet = getPetControl();
if (!CLift::_hasHead && pet->getRoomsElevatorNum() == 4) {
_eyeFlag = true;
setPosition(_origPos);
setVisible(false);
CActMsg actMsg1(getName());
actMsg1.execute("GetLiftEye");
CTelevision::_eyeFlag = true;
CActMsg actMsg2("AddWrongHead");
actMsg2.execute("FaultyLiftbot");
}
} else {
return CCarry::UseWithOtherMsg(msg);
}
return true;
}
bool CEye::UseWithCharMsg(CUseWithCharMsg *msg) {
CLift *lift = dynamic_cast<CLift *>(msg->_character);
if (lift && lift->getName() == "Well") {
CPetControl *pet = getPetControl();
if (!CLift::_hasHead && pet->getRoomsElevatorNum() == 4) {
_eyeFlag = true;
setPosition(_origPos);
setVisible(false);
CActMsg actMsg1(getName());
actMsg1.execute("GetLiftEye");
CActMsg actMsg2("AddWrongHead");
actMsg2.execute(msg->_character);
}
return true;
} else {
return CHeadPiece::UseWithCharMsg(msg);
}
}
bool CEye::ActMsg(CActMsg *msg) {
if (msg->_action == "BellbotGetLight") {
setVisible(true);
petAddToInventory();
playSound(TRANSLATE("z#47.wav", "z#578.wav"));
CActMsg actMsg("Eye Removed");
actMsg.execute("1stClassState", CLight::_type,
MSGFLAG_CLASS_DEF | MSGFLAG_SCAN);
} else {
_eyeFlag = false;
CActMsg actMsg("LoseHead");
actMsg.execute("FaultyLiftbot");
}
return true;
}
bool CEye::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
if (isEquals("Eye1"))
CTelevision::_channel4Glyph = false;
return CHeadPiece::PETGainedObjectMsg(msg);
}
bool CEye::PassOnDragStartMsg(CPassOnDragStartMsg *msg) {
setVisible(true);
if (_eyeFlag)
CTelevision::_eyeFlag = false;
else if (isEquals("Eye1"))
CTelevision::_channel4Glyph = false;
return CHeadPiece::PassOnDragStartMsg(msg);
}
} // End of namespace Titanic

View File

@@ -0,0 +1,55 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_EYE_H
#define TITANIC_EYE_H
#include "titanic/carry/head_piece.h"
namespace Titanic {
class CEye : public CHeadPiece {
DECLARE_MESSAGE_MAP;
bool UseWithOtherMsg(CUseWithOtherMsg *msg);
bool UseWithCharMsg(CUseWithCharMsg *msg);
bool ActMsg(CActMsg *msg);
bool PETGainedObjectMsg(CPETGainedObjectMsg *msg);
bool PassOnDragStartMsg(CPassOnDragStartMsg *msg);
private:
bool _eyeFlag;
public:
CLASSDEF;
CEye();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_EYE_H */

View File

@@ -0,0 +1,41 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/feathers.h"
namespace Titanic {
EMPTY_MESSAGE_MAP(CFeathers, CCarry);
CFeathers::CFeathers() : CCarry() {
}
void CFeathers::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CCarry::save(file, indent);
}
void CFeathers::load(SimpleFile *file) {
file->readNumber();
CCarry::load(file);
}
} // End of namespace Titanic

View File

@@ -0,0 +1,48 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_FEATHERS_H
#define TITANIC_FEATHERS_H
#include "titanic/carry/carry.h"
namespace Titanic {
class CFeathers : public CCarry {
DECLARE_MESSAGE_MAP;
public:
CLASSDEF;
CFeathers();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_FEATHERS_H */

View File

@@ -0,0 +1,97 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/fruit.h"
#include "titanic/npcs/character.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CFruit, CCarry)
ON_MESSAGE(UseWithCharMsg)
ON_MESSAGE(LemonFallsFromTreeMsg)
ON_MESSAGE(UseWithOtherMsg)
ON_MESSAGE(FrameMsg)
END_MESSAGE_MAP()
CFruit::CFruit() : CCarry(), _field12C(0),
_field130(0), _field134(0), _field138(0) {
}
void CFruit::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_field12C, indent);
file->writeNumberLine(_field130, indent);
file->writeNumberLine(_field134, indent);
file->writeNumberLine(_field138, indent);
CCarry::save(file, indent);
}
void CFruit::load(SimpleFile *file) {
file->readNumber();
_field12C = file->readNumber();
_field130 = file->readNumber();
_field134 = file->readNumber();
_field138 = file->readNumber();
CCarry::load(file);
}
bool CFruit::UseWithCharMsg(CUseWithCharMsg *msg) {
if (msg->_character->isEquals("Barbot") && msg->_character->_visible) {
CActMsg actMsg("Fruit");
actMsg.execute(msg->_character);
_canTake = false;
setVisible(false);
return true;
} else {
return CCarry::UseWithCharMsg(msg);
}
}
bool CFruit::LemonFallsFromTreeMsg(CLemonFallsFromTreeMsg *msg) {
setVisible(true);
dragMove(msg->_pt);
_field130 = 1;
return true;
}
bool CFruit::UseWithOtherMsg(CUseWithOtherMsg *msg) {
petAddToInventory();
return true;
}
bool CFruit::FrameMsg(CFrameMsg *msg) {
if (_field130) {
if (_bounds.top > 240) {
_field130 = 0;
_field134 = 1;
}
makeDirty();
_bounds.top += 3;
makeDirty();
}
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,57 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_FRUIT_H
#define TITANIC_FRUIT_H
#include "titanic/carry/carry.h"
namespace Titanic {
class CFruit : public CCarry {
DECLARE_MESSAGE_MAP;
bool UseWithCharMsg(CUseWithCharMsg *msg);
bool LemonFallsFromTreeMsg(CLemonFallsFromTreeMsg *msg);
bool UseWithOtherMsg(CUseWithOtherMsg *msg);
bool FrameMsg(CFrameMsg *msg);
private:
int _field12C;
int _field130;
int _field134;
int _field138;
public:
CLASSDEF;
CFruit();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_FRUIT_H */

View File

@@ -0,0 +1,160 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/glass.h"
#include "titanic/carry/chicken.h"
#include "titanic/game/sauce_dispensor.h"
#include "titanic/npcs/character.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CGlass, CCarry)
ON_MESSAGE(UseWithOtherMsg)
ON_MESSAGE(UseWithCharMsg)
ON_MESSAGE(ActMsg)
ON_MESSAGE(MouseDragEndMsg)
ON_MESSAGE(TurnOn)
ON_MESSAGE(TurnOff)
END_MESSAGE_MAP()
CGlass::CGlass() : CCarry(), _condiment("None") {
}
void CGlass::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeQuotedLine(_condiment, indent);
CCarry::save(file, indent);
}
void CGlass::load(SimpleFile *file) {
file->readNumber();
_condiment = file->readString();
CCarry::load(file);
}
bool CGlass::UseWithOtherMsg(CUseWithOtherMsg *msg) {
CSauceDispensor *dispensor = dynamic_cast<CSauceDispensor *>(msg->_other);
CChicken *chicken = dynamic_cast<CChicken *>(msg->_other);
if (dispensor && _condiment == "None") {
CUse useMsg(this);
useMsg.execute(dispensor);
} else if (msg->_other->isEquals("Chicken") && _condiment == "None") {
if (chicken->_condiment != "None") {
if (!chicken->_greasy) {
CActMsg actMsg(_condiment);
actMsg.execute("Chicken");
}
_condiment = "None";
loadFrame(0);
_visibleFrame = 0;
}
petAddToInventory();
} else if (msg->_other->isEquals("Napkin") && _condiment == "None") {
petAddToInventory();
_condiment = "None";
loadFrame(0);
_visibleFrame = 0;
} else {
petAddToInventory();
}
return true;
}
bool CGlass::UseWithCharMsg(CUseWithCharMsg *msg) {
if (msg->_character->isEquals("Barbot") && msg->_character->_visible) {
CActMsg actMsg(_condiment);
setVisible(false);
if (_condiment != "Bird")
setPosition(_origPos);
actMsg.execute(msg->_character);
} else {
petAddToInventory();
}
return true;
}
bool CGlass::ActMsg(CActMsg *msg) {
if (msg->_action == "GoToPET") {
setVisible(true);
petAddToInventory();
} else if (msg->_action == "Mustard") {
_condiment = "Mustard";
loadFrame(1);
_visibleFrame = 1;
} else if (msg->_action == "Tomato") {
_condiment = "Tomato";
loadFrame(2);
_visibleFrame = 2;
} else if (msg->_action == "Bird") {
_condiment = "Bird";
loadFrame(3);
_visibleFrame = 3;
} else if (msg->_action == "InTitilator") {
_condiment = "None";
loadFrame(0);
_visibleFrame = 0;
}
return true;
}
bool CGlass::MouseDragEndMsg(CMouseDragEndMsg *msg) {
showMouse();
if (msg->_dropTarget) {
if (msg->_dropTarget->isPet()) {
petAddToInventory();
} else {
CCharacter *npc = dynamic_cast<CCharacter *>(msg->_dropTarget);
if (npc) {
CUseWithCharMsg useMsg(npc);
useMsg.execute(this);
} else {
CUseWithOtherMsg otherMsg(msg->_dropTarget);
otherMsg.execute(this);
}
}
} else if (compareViewNameTo(_fullViewName) && msg->_mousePos.y < 360) {
setPosition(_origPos);
} else {
petAddToInventory();
}
return true;
}
bool CGlass::TurnOn(CTurnOn *msg) {
setVisible(true);
return true;
}
bool CGlass::TurnOff(CTurnOff *msg) {
setVisible(false);
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,56 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_GLASS_H
#define TITANIC_GLASS_H
#include "titanic/carry/carry.h"
namespace Titanic {
class CGlass : public CCarry {
DECLARE_MESSAGE_MAP;
bool UseWithOtherMsg(CUseWithOtherMsg *msg);
bool UseWithCharMsg(CUseWithCharMsg *msg);
bool ActMsg(CActMsg *msg);
bool MouseDragEndMsg(CMouseDragEndMsg *msg);
bool TurnOn(CTurnOn *msg);
bool TurnOff(CTurnOff *msg);
public:
CString _condiment;
public:
CLASSDEF;
CGlass();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_GLASS_H */

View File

@@ -0,0 +1,62 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/hammer.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CHammer, CCarry)
ON_MESSAGE(PuzzleSolvedMsg)
ON_MESSAGE(UseWithOtherMsg)
END_MESSAGE_MAP()
CHammer::CHammer() : CCarry() {
}
void CHammer::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CCarry::save(file, indent);
}
void CHammer::load(SimpleFile *file) {
file->readNumber();
CCarry::load(file);
}
bool CHammer::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) {
_canTake = true;
return true;
}
bool CHammer::UseWithOtherMsg(CUseWithOtherMsg *msg) {
CString name = msg->_other->getName();
if (name == "LongStickDispenser") {
CPuzzleSolvedMsg solvedMsg;
solvedMsg.execute("LongStickDispenser");
} else if (name == "Bomb") {
CActMsg actMsg("Hit");
actMsg.execute("Bomb");
}
return CCarry::UseWithOtherMsg(msg);
}
} // End of namespace Titanic

View File

@@ -0,0 +1,50 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_HAMMER_H
#define TITANIC_HAMMER_H
#include "titanic/carry/carry.h"
namespace Titanic {
class CHammer : public CCarry {
DECLARE_MESSAGE_MAP;
bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg);
bool UseWithOtherMsg(CUseWithOtherMsg *msg);
public:
CLASSDEF;
CHammer();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_HAMMER_H */

View File

@@ -0,0 +1,97 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/head_piece.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CHeadPiece, CCarry)
ON_MESSAGE(SenseWorkingMsg)
ON_MESSAGE(PETGainedObjectMsg)
ON_MESSAGE(MouseDragStartMsg)
END_MESSAGE_MAP()
CHeadPiece::CHeadPiece() : CCarry(), _string6("Not Working"),
_flag(false), _field13C(false) {
}
void CHeadPiece::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_flag, indent);
file->writeQuotedLine(_string6, indent);
file->writeNumberLine(_field13C, indent);
CCarry::save(file, indent);
}
void CHeadPiece::load(SimpleFile *file) {
file->readNumber();
_flag = file->readNumber();
_string6 = file->readString();
_field13C = file->readNumber();
CCarry::load(file);
}
bool CHeadPiece::SenseWorkingMsg(CSenseWorkingMsg *msg) {
_string6 = msg->_value;
return true;
}
bool CHeadPiece::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
_visibleFrame = 1;
if (!_field13C) {
incParrotResponse();
_field13C = true;
}
// WORKAROUND: This fixes a bug in the original where if head pieces
// were removed from Titania after adding, she would still reactivate
CTakeHeadPieceMsg takeMsg(getName());
takeMsg.execute("TitaniaControl");
return true;
}
bool CHeadPiece::MouseDragStartMsg(CMouseDragStartMsg *msg) {
if (!checkPoint(msg->_mousePos, false, true)) {
return false;
} else if (!_canTake) {
return true;
}
if (_flag) {
setVisible(true);
moveToView();
setPosition(Point(msg->_mousePos.x - _bounds.width() / 2,
msg->_mousePos.y - _bounds.height() / 2));
CTakeHeadPieceMsg takeMsg(getName());
if (takeMsg._value != "NULL")
takeMsg.execute("TitaniaControl");
_flag = false;
}
return CCarry::MouseDragStartMsg(msg);
}
} // End of namespace Titanic

View File

@@ -0,0 +1,56 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_HEAD_PIECE_H
#define TITANIC_HEAD_PIECE_H
#include "titanic/carry/carry.h"
#include "titanic/messages/pet_messages.h"
namespace Titanic {
class CHeadPiece : public CCarry {
DECLARE_MESSAGE_MAP;
bool SenseWorkingMsg(CSenseWorkingMsg *msg);
bool PETGainedObjectMsg(CPETGainedObjectMsg *msg);
bool MouseDragStartMsg(CMouseDragStartMsg *msg);
protected:
bool _flag;
CString _string6;
bool _field13C;
public:
CLASSDEF;
CHeadPiece();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_HEAD_PIECE_H */

View File

@@ -0,0 +1,119 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/hose.h"
#include "titanic/npcs/succubus.h"
#include "titanic/titanic.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CHose, CCarry)
ON_MESSAGE(DropZoneGotObjectMsg)
ON_MESSAGE(PumpingMsg)
ON_MESSAGE(UseWithCharMsg)
ON_MESSAGE(HoseConnectedMsg)
ON_MESSAGE(DropZoneLostObjectMsg)
END_MESSAGE_MAP()
CHoseStatics *CHose::_statics;
void CHose::init() {
_statics = new CHoseStatics();
}
void CHose::deinit() {
delete _statics;
}
CHose::CHose() : CCarry() {
}
void CHose::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_statics->_actionVal, indent);
file->writeQuotedLine(_statics->_actionTarget, indent);
file->writeQuotedLine(_unused1, indent);
CCarry::save(file, indent);
}
void CHose::load(SimpleFile *file) {
file->readNumber();
_statics->_actionVal = file->readNumber();
_statics->_actionTarget = file->readString();
_unused1 = file->readString();
CCarry::load(file);
}
bool CHose::DropZoneGotObjectMsg(CDropZoneGotObjectMsg *msg) {
_statics->_actionTarget = msg->_object->getName();
CPumpingMsg pumpingMsg;
pumpingMsg._value = _statics->_actionVal;
pumpingMsg.execute(_statics->_actionTarget);
CHoseConnectedMsg connectedMsg;
connectedMsg._connected = true;
connectedMsg.execute(this);
return true;
}
bool CHose::PumpingMsg(CPumpingMsg *msg) {
_statics->_actionVal = msg->_value;
if (!_statics->_actionTarget.empty()) {
CPumpingMsg pumpingMsg;
pumpingMsg._value = _statics->_actionVal;
pumpingMsg.execute(_statics->_actionTarget);
}
return true;
}
bool CHose::UseWithCharMsg(CUseWithCharMsg *msg) {
CSuccUBus *succubus = dynamic_cast<CSuccUBus *>(msg->_character);
if (!_statics->_actionVal && succubus) {
CHoseConnectedMsg connectedMsg(1, this);
if (connectedMsg.execute(succubus))
return true;
}
return CCarry::UseWithCharMsg(msg);
}
bool CHose::HoseConnectedMsg(CHoseConnectedMsg *msg) {
if (msg->_connected) {
CHose *hose = dynamic_cast<CHose *>(findChildInstanceOf(CHose::_type));
if (hose) {
hose->setVisible(true);
hose->petAddToInventory();
}
}
return true;
}
bool CHose::DropZoneLostObjectMsg(CDropZoneLostObjectMsg *msg) {
CPumpingMsg pumpingMsg;
pumpingMsg._value = 0;
pumpingMsg.execute(msg->_object);
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,65 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_HOSE_H
#define TITANIC_HOSE_H
#include "titanic/carry/carry.h"
namespace Titanic {
struct CHoseStatics {
int _actionVal;
CString _actionTarget;
CHoseStatics() : _actionVal(0) {}
};
class CHose : public CCarry {
DECLARE_MESSAGE_MAP;
bool DropZoneGotObjectMsg(CDropZoneGotObjectMsg *msg);
bool PumpingMsg(CPumpingMsg *msg);
bool UseWithCharMsg(CUseWithCharMsg *msg);
bool HoseConnectedMsg(CHoseConnectedMsg *msg);
bool DropZoneLostObjectMsg(CDropZoneLostObjectMsg *msg);
protected:
CString _unused1;
public:
static CHoseStatics *_statics;
public:
CLASSDEF;
CHose();
static void init();
static void deinit();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_HOSE_H */

View File

@@ -0,0 +1,43 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/hose_end.h"
namespace Titanic {
EMPTY_MESSAGE_MAP(CHoseEnd, CHose);
CHoseEnd::CHoseEnd() : CHose() {
}
void CHoseEnd::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeQuotedLine(_unused1, indent);
CHose::save(file, indent);
}
void CHoseEnd::load(SimpleFile *file) {
file->readNumber();
_unused1 = file->readString();
CHose::load(file);
}
} // End of namespace Titanic

View File

@@ -0,0 +1,48 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_HOSE_END_H
#define TITANIC_HOSE_END_H
#include "titanic/carry/hose.h"
namespace Titanic {
class CHoseEnd : public CHose {
DECLARE_MESSAGE_MAP;
public:
CLASSDEF;
CHoseEnd();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_HOSE_END_H */

View File

@@ -0,0 +1,59 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/key.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CKey, CCarry)
ON_MESSAGE(PuzzleSolvedMsg)
ON_MESSAGE(UseWithOtherMsg)
END_MESSAGE_MAP()
CKey::CKey() : CCarry() {
}
void CKey::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CCarry::save(file, indent);
}
void CKey::load(SimpleFile *file) {
file->readNumber();
CCarry::load(file);
}
bool CKey::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) {
_canTake = true;
setVisible(true);
return true;
}
bool CKey::UseWithOtherMsg(CUseWithOtherMsg *msg) {
if (msg->_other->getName() == "1stClassPhono") {
CActMsg actMsg("Unlock");
actMsg.execute(msg->_other);
}
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,50 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_KEY_H
#define TITANIC_KEY_H
#include "titanic/carry/carry.h"
namespace Titanic {
class CKey : public CCarry {
DECLARE_MESSAGE_MAP;
bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg);
bool UseWithOtherMsg(CUseWithOtherMsg *msg);
public:
CLASSDEF;
CKey();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_KEY_H */

View File

@@ -0,0 +1,104 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/liftbot_head.h"
#include "titanic/game/transport/lift.h"
#include "titanic/pet_control/pet_control.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CLiftbotHead, CCarry)
ON_MESSAGE(UseWithOtherMsg)
ON_MESSAGE(UseWithCharMsg)
ON_MESSAGE(MouseDragStartMsg)
END_MESSAGE_MAP()
CLiftbotHead::CLiftbotHead() : CCarry(), _flag(false) {
}
void CLiftbotHead::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_flag, indent);
CCarry::save(file, indent);
}
void CLiftbotHead::load(SimpleFile *file) {
file->readNumber();
_flag = file->readNumber();
CCarry::load(file);
}
bool CLiftbotHead::UseWithOtherMsg(CUseWithOtherMsg *msg) {
if (msg->_other->getName() == "LiftbotWithoutHead") {
CPetControl *pet = getPetControl();
if (!CLift::_hasHead && pet->getRoomsElevatorNum() == 4) {
_flag = true;
CActMsg actMsg("AddRightHead");
actMsg.execute("FaultyLiftbot");
setVisible(false);
} else {
petAddToInventory();
}
return true;
} else {
return CCarry::UseWithOtherMsg(msg);
}
}
bool CLiftbotHead::UseWithCharMsg(CUseWithCharMsg *msg) {
CLift *lift = dynamic_cast<CLift *>(msg->_character);
if (lift) {
CPetControl *pet = getPetControl();
if (lift->isEquals("Well") && !CLift::_hasHead && pet->getRoomsElevatorNum() == 4) {
_flag = true;
CActMsg actMsg("AddRightHead");
actMsg.execute(lift);
setVisible(false);
return true;
}
}
return CCarry::UseWithCharMsg(msg);
}
bool CLiftbotHead::MouseDragStartMsg(CMouseDragStartMsg *msg) {
if (!checkStartDragging(msg)) {
return false;
} else if (compareViewNameTo("BottomOfWell.Node 8.N")) {
changeView("BottomOfWell.Node 13.N");
moveToView();
CActMsg actMsg("LiftbotHeadTaken");
actMsg.execute("BOWLiftbotHeadMonitor");
return CCarry::MouseDragStartMsg(msg);
} else if (_flag) {
_flag = false;
CActMsg actMsg("LoseHead");
actMsg.execute("FaultyLiftbot");
}
return CCarry::MouseDragStartMsg(msg);
}
} // End of namespace Titanic

View File

@@ -0,0 +1,53 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_LIFTBOT_HEAD_H
#define TITANIC_LIFTBOT_HEAD_H
#include "titanic/carry/carry.h"
namespace Titanic {
class CLiftbotHead : public CCarry {
DECLARE_MESSAGE_MAP;
bool UseWithOtherMsg(CUseWithOtherMsg *msg);
bool UseWithCharMsg(CUseWithCharMsg *msg);
bool MouseDragStartMsg(CMouseDragStartMsg *msg);
private:
bool _flag;
public:
CLASSDEF;
CLiftbotHead();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_LIFTBOT_HEAD_H */

View File

@@ -0,0 +1,72 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/long_stick.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CLongStick, CCarry)
ON_MESSAGE(UseWithOtherMsg)
ON_MESSAGE(PuzzleSolvedMsg)
ON_MESSAGE(LeaveViewMsg)
END_MESSAGE_MAP()
CLongStick::CLongStick() : CCarry() {
}
void CLongStick::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CCarry::save(file, indent);
}
void CLongStick::load(SimpleFile *file) {
file->readNumber();
CCarry::load(file);
}
bool CLongStick::UseWithOtherMsg(CUseWithOtherMsg *msg) {
if (msg->_other->isEquals("SpeechCentre")) {
CPuzzleSolvedMsg puzzleMsg;
puzzleMsg.execute(msg->_other);
} else if (msg->_other->isEquals("LongStickDispenser")) {
petDisplayMessage(1, ALREADY_HAVE_STICK);
} else if (msg->_other->isEquals("Bomb")) {
CActMsg actMsg("Hit");
actMsg.execute("Bomb");
} else {
return CCarry::UseWithOtherMsg(msg);
}
petAddToInventory();
return true;
}
bool CLongStick::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) {
_canTake = true;
return true;
}
bool CLongStick::LeaveViewMsg(CLeaveViewMsg *msg) {
setVisible(false);
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,51 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_LONG_STICK_H
#define TITANIC_LONG_STICK_H
#include "titanic/carry/carry.h"
namespace Titanic {
class CLongStick : public CCarry {
DECLARE_MESSAGE_MAP;
bool UseWithOtherMsg(CUseWithOtherMsg *msg);
bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg);
bool LeaveViewMsg(CLeaveViewMsg *msg);
public:
CLASSDEF;
CLongStick();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_LONG_STICK_H */

View File

@@ -0,0 +1,94 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/magazine.h"
#include "titanic/npcs/deskbot.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CMagazine, CCarry)
ON_MESSAGE(UseWithCharMsg)
ON_MESSAGE(MouseDoubleClickMsg)
ON_MESSAGE(VisibleMsg)
ON_MESSAGE(UseWithOtherMsg)
END_MESSAGE_MAP()
CMagazine::CMagazine() : CCarry() {
}
void CMagazine::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_field12C, indent);
file->writeNumberLine(_field130, indent);
CCarry::save(file, indent);
}
void CMagazine::load(SimpleFile *file) {
file->readNumber();
_field12C = file->readNumber();
_field130 = file->readNumber();
CCarry::load(file);
}
bool CMagazine::UseWithCharMsg(CUseWithCharMsg *msg) {
// WORKAROUND: Slight difference to original to ensure that when the
// magazine is used on an incorrect char, it's returned to inventory
CDeskbot *deskbot = dynamic_cast<CDeskbot *>(msg->_character);
if (deskbot && deskbot->_deskbotActive) {
setVisible(false);
setPosition(Point(1000, 1000));
CActMsg actMsg("2ndClassUpgrade");
actMsg.execute("Deskbot");
return true;
}
return CCarry::UseWithCharMsg(msg);
}
bool CMagazine::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) {
return true;
}
bool CMagazine::VisibleMsg(CVisibleMsg *msg) {
setVisible(msg->_visible);
return true;
}
bool CMagazine::UseWithOtherMsg(CUseWithOtherMsg *msg) {
// WORKAROUND: Slight difference to original to ensure that when the
// magazine is used on an incorrect object, it's returned to inventory
if (msg->_other->getName() == "SwitchOnDeskbot") {
CDeskbot *deskbot = dynamic_cast<CDeskbot *>(msg->_other);
if (deskbot && deskbot->_deskbotActive) {
setVisible(false);
setPosition(Point(1000, 1000));
CActMsg actMsg("2ndClassUpgrade");
actMsg.execute("Deskbot");
return true;
}
}
return CCarry::UseWithOtherMsg(msg);
}
} // End of namespace Titanic

View File

@@ -0,0 +1,57 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_MAGAZINE_H
#define TITANIC_MAGAZINE_H
#include "titanic/carry/carry.h"
#include "titanic/messages/messages.h"
#include "titanic/messages/mouse_messages.h"
namespace Titanic {
class CMagazine : public CCarry {
DECLARE_MESSAGE_MAP;
bool UseWithCharMsg(CUseWithCharMsg *msg);
bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg);
bool VisibleMsg(CVisibleMsg *msg);
bool UseWithOtherMsg(CUseWithOtherMsg *msg);
private:
int _field12C;
int _field130;
public:
CLASSDEF;
CMagazine();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_MAGAZINE_H */

View File

@@ -0,0 +1,67 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/maitred_left_arm.h"
#include "titanic/npcs/true_talk_npc.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CMaitreDLeftArm, CArm)
ON_MESSAGE(MouseButtonDownMsg)
ON_MESSAGE(MouseDragStartMsg)
END_MESSAGE_MAP()
void CMaitreDLeftArm::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_flag, indent);
CArm::save(file, indent);
}
void CMaitreDLeftArm::load(SimpleFile *file) {
file->readNumber();
_flag = file->readNumber();
CArm::load(file);
}
bool CMaitreDLeftArm::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
if (!_flag) {
CTrueTalkNPC *maitreD = dynamic_cast<CTrueTalkNPC *>(findRoomObject("MaitreD"));
startTalking(maitreD, 126);
startTalking(maitreD, 127);
}
return true;
}
bool CMaitreDLeftArm::MouseDragStartMsg(CMouseDragStartMsg *msg) {
if (checkPoint(msg->_mousePos) && !_flag) {
CVisibleMsg visibleMsg;
visibleMsg.execute("MD left arm background image");
_flag = true;
CArmPickedUpFromTableMsg takenMsg;
takenMsg.execute("Restaurant Table Pan Handler", nullptr, MSGFLAG_SCAN);
}
return CArm::MouseDragStartMsg(msg);
}
} // End of namespace Titanic

View File

@@ -0,0 +1,52 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_LEFT_ARM_H
#define TITANIC_LEFT_ARM_H
#include "titanic/carry/arm.h"
namespace Titanic {
class CMaitreDLeftArm : public CArm {
DECLARE_MESSAGE_MAP;
bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
bool MouseDragStartMsg(CMouseDragStartMsg *msg);
private:
bool _flag;
public:
CLASSDEF;
CMaitreDLeftArm() : CArm(), _flag(false) {}
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_LEFT_ARM_H */

View File

@@ -0,0 +1,48 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/maitred_right_arm.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CMaitreDRightArm, CArm)
ON_MESSAGE(DropZoneLostObjectMsg)
END_MESSAGE_MAP()
void CMaitreDRightArm::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CArm::save(file, indent);
}
void CMaitreDRightArm::load(SimpleFile *file) {
file->readNumber();
CArm::load(file);
}
bool CMaitreDRightArm::DropZoneLostObjectMsg(CDropZoneLostObjectMsg *msg) {
CActMsg actMsg("LoseArm");
actMsg.execute("MaitreDBody");
actMsg.execute("MaitreD Arm Holder");
_canTake = true;
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,48 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_MAITRED_RIGHT_ARM_H
#define TITANIC_MAITRED_RIGHT_ARM_H
#include "titanic/carry/arm.h"
namespace Titanic {
class CMaitreDRightArm : public CArm {
DECLARE_MESSAGE_MAP;
bool DropZoneLostObjectMsg(CDropZoneLostObjectMsg *msg);
public:
CLASSDEF;
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_MAITRED_RIGHT_ARM_H */

View File

@@ -0,0 +1,84 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/mouth.h"
#include "titanic/game/head_slot.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CMouth, CHeadPiece)
ON_MESSAGE(UseWithOtherMsg)
ON_MESSAGE(MovieEndMsg)
ON_MESSAGE(PETGainedObjectMsg)
END_MESSAGE_MAP()
CMouth::CMouth() : CHeadPiece() {
}
void CMouth::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CHeadPiece::save(file, indent);
}
void CMouth::load(SimpleFile *file) {
file->readNumber();
CHeadPiece::load(file);
}
bool CMouth::UseWithOtherMsg(CUseWithOtherMsg *msg) {
CHeadSlot *slot = dynamic_cast<CHeadSlot *>(msg->_other);
if (!slot)
return CHeadPiece::UseWithOtherMsg(msg);
_flag = true;
setVisible(false);
setPosition(Point(0, 0));
petMoveToHiddenRoom();
CAddHeadPieceMsg addMsg(getName());
if (addMsg._value != "NULL")
addMsg.execute("MouthSlot");
return true;
}
bool CMouth::MovieEndMsg(CMovieEndMsg *msg) {
return true;
}
bool CMouth::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
_visibleFrame = 2;
loadFrame(2);
setVisible(true);
if (!_field13C) {
incParrotResponse();
_field13C = true;
}
// WORKAROUND: If Mouth is removed from Titania after inserting,
// message the Titania control so it can be flagged as removed
CTakeHeadPieceMsg headpieceMsg(getName());
headpieceMsg.execute("TitaniaControl");
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,51 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_MOUTH_H
#define TITANIC_MOUTH_H
#include "titanic/carry/head_piece.h"
namespace Titanic {
class CMouth : public CHeadPiece {
DECLARE_MESSAGE_MAP;
bool UseWithOtherMsg(CUseWithOtherMsg *msg);
bool MovieEndMsg(CMovieEndMsg *msg);
bool PETGainedObjectMsg(CPETGainedObjectMsg *msg);
public:
CLASSDEF;
CMouth();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_MOUTH_H */

View File

@@ -0,0 +1,59 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/napkin.h"
#include "titanic/carry/chicken.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CNapkin, CCarry)
ON_MESSAGE(UseWithOtherMsg)
END_MESSAGE_MAP()
CNapkin::CNapkin() : CCarry() {
}
void CNapkin::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CCarry::save(file, indent);
}
void CNapkin::load(SimpleFile *file) {
file->readNumber();
CCarry::load(file);
}
bool CNapkin::UseWithOtherMsg(CUseWithOtherMsg *msg) {
CChicken *chicken = dynamic_cast<CChicken *>(msg->_other);
if (chicken) {
if (chicken->_condiment != "None" || chicken->_greasy) {
CActMsg actMsg("Clean");
actMsg.execute("Chicken");
} else {
petDisplayMessage(CHICKEN_IS_CLEAN);
}
}
petAddToInventory();
return CCarry::UseWithOtherMsg(msg);
}
} // End of namespace Titanic

View File

@@ -0,0 +1,50 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_NAPKIN_H
#define TITANIC_NAPKIN_H
#include "titanic/carry/carry.h"
#include "titanic/messages/messages.h"
namespace Titanic {
class CNapkin : public CCarry {
DECLARE_MESSAGE_MAP;
bool UseWithOtherMsg(CUseWithOtherMsg *msg);
public:
CLASSDEF;
CNapkin();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_NAPKIN_H */

View File

@@ -0,0 +1,64 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/nose.h"
#include "titanic/game/head_slot.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CNose, CHeadPiece)
ON_MESSAGE(ChangeSeasonMsg)
ON_MESSAGE(UseWithOtherMsg)
END_MESSAGE_MAP()
CNose::CNose() : CHeadPiece() {
}
void CNose::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CHeadPiece::save(file, indent);
}
void CNose::load(SimpleFile *file) {
file->readNumber();
CHeadPiece::load(file);
}
bool CNose::ChangeSeasonMsg(CChangeSeasonMsg *msg) {
// WORKAROUND: Redundant code in original skipped
return true;
}
bool CNose::UseWithOtherMsg(CUseWithOtherMsg *msg) {
CHeadSlot *slot = dynamic_cast<CHeadSlot *>(msg->_other);
if (!slot)
return CCarry::UseWithOtherMsg(msg);
petMoveToHiddenRoom();
_flag = false;
CAddHeadPieceMsg addMsg(getName());
if (addMsg._value != "NULL")
addMsg.execute("NoseSlot");
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,50 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_NOSE_H
#define TITANIC_NOSE_H
#include "titanic/carry/head_piece.h"
namespace Titanic {
class CNose : public CHeadPiece {
DECLARE_MESSAGE_MAP;
bool ChangeSeasonMsg(CChangeSeasonMsg *msg);
bool UseWithOtherMsg(CUseWithOtherMsg *msg);
public:
CLASSDEF;
CNose();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_NOSE_H */

View File

@@ -0,0 +1,53 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/note.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CNote, CCarry)
ON_MESSAGE(MouseDoubleClickMsg)
END_MESSAGE_MAP()
CNote::CNote() : CCarry(), _field138(1) {
}
void CNote::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeQuotedLine(_string6, indent);
file->writeNumberLine(_field138, indent);
CCarry::save(file, indent);
}
void CNote::load(SimpleFile *file) {
file->readNumber();
_string6 = file->readString();
_field138 = file->readNumber();
CCarry::load(file);
}
bool CNote::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) {
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,53 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_NOTE_H
#define TITANIC_NOTE_H
#include "titanic/carry/carry.h"
#include "titanic/messages/messages.h"
namespace Titanic {
class CNote : public CCarry {
DECLARE_MESSAGE_MAP;
bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg);
private:
CString _string6;
int _field138;
public:
CLASSDEF;
CNote();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_NOTE_H */

View File

@@ -0,0 +1,41 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/parcel.h"
namespace Titanic {
EMPTY_MESSAGE_MAP(CParcel, CCarry);
CParcel::CParcel() : CCarry() {
}
void CParcel::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CCarry::save(file, indent);
}
void CParcel::load(SimpleFile *file) {
file->readNumber();
CCarry::load(file);
}
} // End of namespace Titanic

View File

@@ -0,0 +1,48 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_PARCEL_H
#define TITANIC_PARCEL_H
#include "titanic/carry/carry.h"
namespace Titanic {
class CParcel : public CCarry {
DECLARE_MESSAGE_MAP;
public:
CLASSDEF;
CParcel();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_PARCEL_H */

View File

@@ -0,0 +1,49 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/perch.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CPerch, CCentralCore)
ON_MESSAGE(UseWithOtherMsg)
END_MESSAGE_MAP()
void CPerch::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CCentralCore::save(file, indent);
}
void CPerch::load(SimpleFile *file) {
file->readNumber();
CCentralCore::load(file);
}
bool CPerch::UseWithOtherMsg(CUseWithOtherMsg *msg) {
if (msg->_other->isEquals("SpeechCentre")) {
CShowTextMsg textMsg(DOES_NOT_REACH);
textMsg.execute("PET");
}
return CCentralCore::UseWithOtherMsg(msg);
}
} // End of namespace Titanic

View File

@@ -0,0 +1,48 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_PERCH_H
#define TITANIC_PERCH_H
#include "titanic/carry/central_core.h"
namespace Titanic {
class CPerch : public CCentralCore {
DECLARE_MESSAGE_MAP;
bool UseWithOtherMsg(CUseWithOtherMsg *msg);
public:
CLASSDEF;
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_PERCH_H */

View File

@@ -0,0 +1,204 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/phonograph_cylinder.h"
#include "titanic/game/phonograph.h"
#include "titanic/sound/music_room.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CPhonographCylinder, CCarry)
ON_MESSAGE(UseWithOtherMsg)
ON_MESSAGE(QueryCylinderMsg)
ON_MESSAGE(RecordOntoCylinderMsg)
ON_MESSAGE(SetMusicControlsMsg)
ON_MESSAGE(ErasePhonographCylinderMsg)
END_MESSAGE_MAP()
CPhonographCylinder::CPhonographCylinder() : CCarry(),
_bellsMuteControl(false), _bellsPitchControl(0),
_bellsSpeedControl(0), _bellsDirectionControl(false),
_bellsInversionControl(false), _snakeMuteControl(false),
_snakeSpeedControl(0), _snakePitchControl(0),
_snakeInversionControl(false), _snakeDirectionControl(false),
_pianoMuteControl(false), _pianoSpeedControl(0),
_pianoPitchControl(0), _pianoInversionControl(false),
_pianoDirectionControl(false), _bassMuteControl(false),
_bassSpeedControl(0), _bassPitchControl(0),
_bassInversionControl(false) {
}
void CPhonographCylinder::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeQuotedLine(_itemName, indent);
file->writeNumberLine(_bellsMuteControl, indent);
file->writeNumberLine(_bellsPitchControl, indent);
file->writeNumberLine(_bellsSpeedControl, indent);
file->writeNumberLine(_bellsDirectionControl, indent);
file->writeNumberLine(_bellsInversionControl, indent);
file->writeNumberLine(_snakeMuteControl, indent);
file->writeNumberLine(_snakeSpeedControl, indent);
file->writeNumberLine(_snakePitchControl, indent);
file->writeNumberLine(_snakeInversionControl, indent);
file->writeNumberLine(_snakeDirectionControl, indent);
file->writeNumberLine(_pianoMuteControl, indent);
file->writeNumberLine(_pianoSpeedControl, indent);
file->writeNumberLine(_pianoPitchControl, indent);
file->writeNumberLine(_pianoInversionControl, indent);
file->writeNumberLine(_pianoDirectionControl, indent);
file->writeNumberLine(_bassMuteControl, indent);
file->writeNumberLine(_bassSpeedControl, indent);
file->writeNumberLine(_bassPitchControl, indent);
file->writeNumberLine(_bassInversionControl, indent);
file->writeNumberLine(_bassDirectionControl, indent);
CCarry::save(file, indent);
}
void CPhonographCylinder::load(SimpleFile *file) {
file->readNumber();
_itemName = file->readString();
_bellsMuteControl = file->readNumber();
_bellsPitchControl = file->readNumber();
_bellsSpeedControl = file->readNumber();
_bellsDirectionControl = file->readNumber();
_bellsInversionControl = file->readNumber();
_snakeMuteControl = file->readNumber();
_snakeSpeedControl = file->readNumber();
_snakePitchControl = file->readNumber();
_snakeInversionControl = file->readNumber();
_snakeDirectionControl = file->readNumber();
_pianoMuteControl = file->readNumber();
_pianoSpeedControl = file->readNumber();
_pianoPitchControl = file->readNumber();
_pianoInversionControl = file->readNumber();
_pianoDirectionControl = file->readNumber();
_bassMuteControl = file->readNumber();
_bassSpeedControl = file->readNumber();
_bassPitchControl = file->readNumber();
_bassInversionControl = file->readNumber();
_bassDirectionControl = file->readNumber();
CCarry::load(file);
}
bool CPhonographCylinder::UseWithOtherMsg(CUseWithOtherMsg *msg) {
CPhonograph *phonograph = dynamic_cast<CPhonograph *>(msg->_other);
if (phonograph) {
// Below is redundant, since original never actually executes message
CSetVarMsg varMsg("m_RecordStatus", 1);
return true;
} else {
return CCarry::UseWithOtherMsg(msg);
}
}
bool CPhonographCylinder::QueryCylinderMsg(CQueryCylinderMsg *msg) {
msg->_name = _itemName;
return true;
}
bool CPhonographCylinder::RecordOntoCylinderMsg(CRecordOntoCylinderMsg *msg) {
_itemName = "STMusic";
CQueryMusicControlSettingMsg queryMsg;
queryMsg.execute("Bells Mute Control");
_bellsMuteControl = queryMsg._value;
queryMsg.execute("Bells Pitch Control");
_bellsPitchControl = queryMsg._value;
queryMsg.execute("Bells Speed Control");
_bellsSpeedControl = queryMsg._value;
queryMsg.execute("Bells Direction Control");
_bellsDirectionControl = queryMsg._value;
queryMsg.execute("Bells Inversion Control");
_bellsInversionControl = queryMsg._value;
queryMsg.execute("Snake Mute Control");
_snakeMuteControl = queryMsg._value;
queryMsg.execute("Snake Speed Control");
_snakeSpeedControl = queryMsg._value;
queryMsg.execute("Snake Pitch Control");
_snakePitchControl = queryMsg._value;
queryMsg.execute("Snake Inversion Control");
_snakeInversionControl = queryMsg._value;
queryMsg.execute("Snake Direction Control");
_snakeDirectionControl = queryMsg._value;
queryMsg.execute("Piano Mute Control");
_pianoMuteControl = queryMsg._value;
queryMsg.execute("Piano Speed Control");
_pianoSpeedControl = queryMsg._value;
queryMsg.execute("Piano Pitch Control");
_pianoPitchControl = queryMsg._value;
queryMsg.execute("Piano Inversion Control");
_pianoInversionControl = queryMsg._value;
queryMsg.execute("Piano Direction Control");
_pianoDirectionControl = queryMsg._value;
queryMsg.execute("Bass Mute Control");
_bassMuteControl = queryMsg._value;
queryMsg.execute("Bass Speed Control");
_bassSpeedControl = queryMsg._value;
queryMsg.execute("Bass Pitch Control");
_bassPitchControl = queryMsg._value;
queryMsg.execute("Bass Inversion Control");
_bassInversionControl = queryMsg._value;
queryMsg.execute("Bass Direction Control");
_bassDirectionControl = queryMsg._value;
return true;
}
bool CPhonographCylinder::SetMusicControlsMsg(CSetMusicControlsMsg *msg) {
if (!_itemName.hasPrefix("STMusic"))
return true;
CMusicRoom *musicRoom = getMusicRoom();
musicRoom->setMuteControl(BELLS, _bellsMuteControl);
musicRoom->setPitchControl(BELLS, _bellsPitchControl);
musicRoom->setSpeedControl(BELLS, _bellsSpeedControl);
musicRoom->setInversionControl(BELLS, _bellsInversionControl);
musicRoom->setDirectionControl(BELLS, _bellsDirectionControl);
musicRoom->setMuteControl(SNAKE, _snakeMuteControl);
musicRoom->setPitchControl(SNAKE, _snakePitchControl);
musicRoom->setSpeedControl(SNAKE, _snakeSpeedControl);
musicRoom->setInversionControl(SNAKE, _snakeInversionControl);
musicRoom->setDirectionControl(SNAKE, _snakeDirectionControl);
musicRoom->setMuteControl(PIANO, _pianoMuteControl);
musicRoom->setPitchControl(PIANO, _pianoPitchControl);
musicRoom->setSpeedControl(PIANO, _pianoSpeedControl);
musicRoom->setInversionControl(PIANO, _pianoInversionControl);
musicRoom->setDirectionControl(PIANO, _pianoDirectionControl);
musicRoom->setMuteControl(BASS, _bassMuteControl);
musicRoom->setPitchControl(BASS, _bassPitchControl);
musicRoom->setSpeedControl(BASS, _bassSpeedControl);
musicRoom->setInversionControl(BASS, _bassInversionControl);
musicRoom->setDirectionControl(BASS, _bassDirectionControl);
return true;
}
bool CPhonographCylinder::ErasePhonographCylinderMsg(CErasePhonographCylinderMsg *msg) {
_itemName.clear();
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,75 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_PHONOGRAPH_CYLINDER_H
#define TITANIC_PHONOGRAPH_CYLINDER_H
#include "titanic/carry/carry.h"
namespace Titanic {
class CPhonographCylinder : public CCarry {
DECLARE_MESSAGE_MAP;
bool UseWithOtherMsg(CUseWithOtherMsg *msg);
bool QueryCylinderMsg(CQueryCylinderMsg *msg);
bool RecordOntoCylinderMsg(CRecordOntoCylinderMsg *msg);
bool SetMusicControlsMsg(CSetMusicControlsMsg *msg);
bool ErasePhonographCylinderMsg(CErasePhonographCylinderMsg *msg);
private:
CString _itemName;
int _bellsPitchControl;
int _bellsSpeedControl;
bool _bellsMuteControl;
bool _bellsDirectionControl;
bool _bellsInversionControl;
int _snakeSpeedControl;
int _snakePitchControl;
bool _snakeMuteControl;
bool _snakeInversionControl;
bool _snakeDirectionControl;
int _pianoSpeedControl;
int _pianoPitchControl;
bool _pianoMuteControl;
bool _pianoInversionControl;
bool _pianoDirectionControl;
int _bassSpeedControl;
int _bassPitchControl;
bool _bassMuteControl;
bool _bassInversionControl;
bool _bassDirectionControl;
public:
CLASSDEF;
CPhonographCylinder();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_PHONOGRAPH_CYLINDER_H */

View File

@@ -0,0 +1,65 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/phonograph_ear.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CPhonographEar, CEar)
ON_MESSAGE(CorrectMusicPlayedMsg)
ON_MESSAGE(PETGainedObjectMsg)
ON_MESSAGE(TimerMsg)
END_MESSAGE_MAP()
void CPhonographEar::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_replacementEar, indent);
CEar::save(file, indent);
}
void CPhonographEar::load(SimpleFile *file) {
file->readNumber();
_replacementEar = file->readNumber();
CEar::load(file);
}
bool CPhonographEar::CorrectMusicPlayedMsg(CCorrectMusicPlayedMsg *msg) {
_canTake = true;
return true;
}
bool CPhonographEar::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
if (_replacementEar) {
// Start a timer to add a replacement ear to the Phonograph
_replacementEar = false;
addTimer(1000);
}
return CEar::PETGainedObjectMsg(msg);
}
bool CPhonographEar::TimerMsg(CTimerMsg *msg) {
CVisibleMsg visibleMsg;
visibleMsg.execute("Replacement Phonograph Ear");
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,53 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_PHONOGRAPH_EAR_H
#define TITANIC_PHONOGRAPH_EAR_H
#include "titanic/carry/ear.h"
namespace Titanic {
class CPhonographEar : public CEar {
DECLARE_MESSAGE_MAP;
bool CorrectMusicPlayedMsg(CCorrectMusicPlayedMsg *msg);
bool PETGainedObjectMsg(CPETGainedObjectMsg *msg);
bool TimerMsg(CTimerMsg *msg);
private:
bool _replacementEar;
public:
CLASSDEF;
CPhonographEar() : CEar(), _replacementEar(true) {}
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_PHONOGRAPH_EYE_H */

View File

@@ -0,0 +1,103 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/photograph.h"
#include "titanic/core/dont_save_file_item.h"
#include "titanic/core/room_item.h"
#include "titanic/translation.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CPhotograph, CCarry)
ON_MESSAGE(MouseDragStartMsg)
ON_MESSAGE(MouseDragEndMsg)
ON_MESSAGE(PETGainedObjectMsg)
ON_MESSAGE(ActMsg)
END_MESSAGE_MAP()
int CPhotograph::_v1;
CPhotograph::CPhotograph() : CCarry(), _field12C(0), _field130(0) {
}
void CPhotograph::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_field12C, indent);
file->writeNumberLine(_v1, indent);
file->writeNumberLine(_field130, indent);
CCarry::save(file, indent);
}
void CPhotograph::load(SimpleFile *file) {
file->readNumber();
_field12C = file->readNumber();
_v1 = file->readNumber();
_field130 = file->readNumber();
CCarry::load(file);
}
bool CPhotograph::MouseDragEndMsg(CMouseDragEndMsg *msg) {
_v1 = 0;
CGameObject *target = msg->_dropTarget;
if (target && target->isEquals("NavigationComputer")) {
moveUnder(getDontSave());
makeDirty();
playSound(TRANSLATE("a#46.wav", "a#39.wav"));
starFn(STAR_SET_REFERENCE);
showMouse();
return true;
} else {
return CCarry::MouseDragEndMsg(msg);
}
}
bool CPhotograph::MouseDragStartMsg(CMouseDragStartMsg *msg) {
if (checkPoint(msg->_mousePos, true, true)) {
_v1 = true;
CActMsg actMsg("PlayerPicksUpPhoto");
actMsg.execute("Doorbot");
}
return CCarry::MouseDragStartMsg(msg);
}
bool CPhotograph::PETGainedObjectMsg(CPETGainedObjectMsg *msg) {
if (getRoom()->isEquals("Home")) {
CActMsg actMsg("PlayerPutsPhotoInPET");
actMsg.execute("Doorbot");
}
return true;
}
bool CPhotograph::ActMsg(CActMsg *msg) {
if (msg->_action == "BecomeGettable") {
_canTake = true;
_cursorId = CURSOR_HAND;
}
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,60 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_PHOTOGRAPH_H
#define TITANIC_PHOTOGRAPH_H
#include "titanic/carry/carry.h"
#include "titanic/messages/messages.h"
#include "titanic/messages/mouse_messages.h"
#include "titanic/messages/pet_messages.h"
namespace Titanic {
class CPhotograph : public CCarry {
DECLARE_MESSAGE_MAP;
bool MouseDragEndMsg(CMouseDragEndMsg *msg);
bool MouseDragStartMsg(CMouseDragStartMsg *msg);
bool PETGainedObjectMsg(CPETGainedObjectMsg *msg);
bool ActMsg(CActMsg *msg);
private:
static int _v1;
private:
int _field12C;
int _field130;
public:
CLASSDEF;
CPhotograph();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_PHOTOGRAPH_H */

View File

@@ -0,0 +1,59 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/plug_in.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CPlugIn, CCarry)
ON_MESSAGE(UseWithOtherMsg)
END_MESSAGE_MAP()
CPlugIn::CPlugIn() : CCarry(), _unused(0) {
}
void CPlugIn::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_unused, indent);
CCarry::save(file, indent);
}
void CPlugIn::load(SimpleFile *file) {
file->readNumber();
_unused = file->readNumber();
CCarry::load(file);
}
bool CPlugIn::UseWithOtherMsg(CUseWithOtherMsg *msg) {
CGameObject *other = msg->_other;
CString otherName = other->getName();
if (otherName == "PET") {
return CCarry::UseWithOtherMsg(msg);
} else if (isEquals("DatasideTransporter")) {
CShowTextMsg textMsg(INCORRECTLY_CALIBRATED);
textMsg.execute("PET");
}
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,51 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_PLUG_IN_H
#define TITANIC_PLUG_IN_H
#include "titanic/carry/carry.h"
namespace Titanic {
class CPlugIn : public CCarry {
DECLARE_MESSAGE_MAP;
bool UseWithOtherMsg(CUseWithOtherMsg *msg);
private:
int _unused;
public:
CLASSDEF;
CPlugIn();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_PLUG_IN_H */

View File

@@ -0,0 +1,82 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/speech_centre.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CSpeechCentre, CBrain)
ON_MESSAGE(PuzzleSolvedMsg)
ON_MESSAGE(ChangeSeasonMsg)
ON_MESSAGE(SpeechFallsFromTreeMsg)
ON_MESSAGE(FrameMsg)
END_MESSAGE_MAP()
void CSpeechCentre::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_field13C, indent);
file->writeQuotedLine(_season, indent);
file->writeNumberLine(_field14C, indent);
CBrain::save(file, indent);
}
void CSpeechCentre::load(SimpleFile *file) {
file->readNumber();
_field13C = file->readNumber();
_season = file->readString();
_field14C = file->readNumber();
CBrain::load(file);
}
bool CSpeechCentre::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) {
if (_field13C == 1 && _season == "Autumn")
_canTake = true;
return true;
}
bool CSpeechCentre::ChangeSeasonMsg(CChangeSeasonMsg *msg) {
_season = msg->_season;
return true;
}
bool CSpeechCentre::SpeechFallsFromTreeMsg(CSpeechFallsFromTreeMsg *msg) {
setVisible(true);
dragMove(msg->_pos);
_field14C = true;
return true;
}
bool CSpeechCentre::FrameMsg(CFrameMsg *msg) {
if (_field14C) {
if (_bounds.top > 200)
_field14C = false;
makeDirty();
_bounds.top += 3;
makeDirty();
}
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,57 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_SPEECH_CENTRE_H
#define TITANIC_SPEECH_CENTRE_H
#include "titanic/carry/brain.h"
namespace Titanic {
class CSpeechCentre : public CBrain {
DECLARE_MESSAGE_MAP;
bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg);
bool ChangeSeasonMsg(CChangeSeasonMsg *msg);
bool SpeechFallsFromTreeMsg(CSpeechFallsFromTreeMsg *msg);
bool FrameMsg(CFrameMsg *msg);
private:
int _field13C;
CString _season;
int _field14C;
public:
CLASSDEF;
CSpeechCentre() : CBrain(), _season("Summer"),
_field13C(1), _field14C(0) {}
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_SPEECH_CENTRE_H */

View File

@@ -0,0 +1,47 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/sweets.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CSweets, CCarry)
ON_MESSAGE(MouseButtonUpMsg)
END_MESSAGE_MAP()
CSweets::CSweets() : CCarry() {
}
void CSweets::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CCarry::save(file, indent);
}
void CSweets::load(SimpleFile *file) {
file->readNumber();
CCarry::load(file);
}
bool CSweets::MouseButtonUpMsg(CMouseButtonUpMsg *msg) {
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,50 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_SWEETS_H
#define TITANIC_SWEETS_H
#include "titanic/carry/carry.h"
#include "titanic/messages/mouse_messages.h"
namespace Titanic {
class CSweets : public CCarry {
DECLARE_MESSAGE_MAP;
bool MouseButtonUpMsg(CMouseButtonUpMsg *msg);
public:
CLASSDEF;
CSweets();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_SWEETS_H */

View File

@@ -0,0 +1,65 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/carry/vision_centre.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CVisionCentre, CBrain)
ON_MESSAGE(PuzzleSolvedMsg)
ON_MESSAGE(MouseButtonDownMsg)
ON_MESSAGE(MouseDragStartMsg)
END_MESSAGE_MAP()
void CVisionCentre::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CBrain::save(file, indent);
}
void CVisionCentre::load(SimpleFile *file) {
file->readNumber();
CBrain::load(file);
}
bool CVisionCentre::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) {
_canTake = true;
return true;
}
bool CVisionCentre::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
if (_canTake) {
return CBrain::MouseButtonDownMsg(msg);
} else {
petDisplayMessage(1, NICE_IF_TAKE_BUT_CANT);
return true;
}
}
bool CVisionCentre::MouseDragStartMsg(CMouseDragStartMsg *msg) {
if (_canTake) {
return CBrain::MouseDragStartMsg(msg);
} else {
petDisplayMessage(1, NICE_IF_TAKE_BUT_CANT);
return true;
}
}
} // End of namespace Titanic

View File

@@ -0,0 +1,50 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_VISION_CENTRE_H
#define TITANIC_VISION_CENTRE_H
#include "titanic/carry/brain.h"
namespace Titanic {
class CVisionCentre : public CBrain {
DECLARE_MESSAGE_MAP;
bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg);
bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
bool MouseDragStartMsg(CMouseDragStartMsg *msg);
public:
CLASSDEF;
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_VISION_CENTRE_H */

View File

@@ -0,0 +1,3 @@
# This file is included from the main "configure" script
# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] [components]
add_engine titanic "Starship Titanic" yes "" "" "16bit jpeg highres mad indeo45"

View File

@@ -0,0 +1,242 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/continue_save_dialog.h"
#include "titanic/support/movie_manager.h"
#include "titanic/titanic.h"
#include "common/error.h"
#include "common/str-array.h"
#include "graphics/screen.h"
#include "backends/keymapper/keymapper.h"
namespace Titanic {
#define SAVEGAME_SLOTS_COUNT 5
#define RESTORE_X 346
#define RESTORE_Y 94
#define START_X 370
#define START_Y 276
CContinueSaveDialog::CContinueSaveDialog() {
g_vm->_events->addTarget(this);
_highlightedSlot = _selectedSlot = -999;
_restoreState = _startState = -1;
_mouseDown = false;
_evilTwinShown = false;
for (int idx = 0; idx < SAVEGAME_SLOTS_COUNT; ++idx) {
Rect slotRect = getSlotBounds(idx);
_slotNames[idx].setFontNumber(0);
_slotNames[idx].setBounds(slotRect);
_slotNames[idx].resize(3);
_slotNames[idx].setMaxCharsPerLine(22);
_slotNames[idx].setHasBorder(false);
_slotNames[idx].setup();
}
}
CContinueSaveDialog::~CContinueSaveDialog() {
g_vm->_events->removeTarget();
}
void CContinueSaveDialog::addSavegame(int slot, const CString &name) {
if (_saves.size() < SAVEGAME_SLOTS_COUNT) {
_slotNames[_saves.size()].setText(name);
_saves.push_back(SaveEntry(slot, name));
}
}
Rect CContinueSaveDialog::getSlotBounds(int index) {
return Rect(360, 164 + index * 19, 556, 180 + index * 19);
}
int CContinueSaveDialog::show() {
Common::Keymapper *keymapper = g_vm->getEventManager()->getKeymapper();
keymapper->getKeymap("cont-save")->setEnabled(true);
// Load images for the dialog
loadImages();
// Render the view
render();
// Event loop waiting for selection
while (!g_vm->shouldQuit() && _selectedSlot == -999) {
g_vm->_events->pollEventsAndWait();
if (g_vm->_loadSaveSlot != -1)
_selectedSlot = g_vm->_loadSaveSlot;
}
if (g_vm->shouldQuit())
_selectedSlot = -2;
keymapper->getKeymap("cont-save")->setEnabled(false);
return _selectedSlot;
}
void CContinueSaveDialog::loadImages() {
_backdrop.load("Bitmap/BACKDROP");
_evilTwin.load("Bitmap/EVILTWIN");
_restoreD.load("Bitmap/RESTORED");
_restoreU.load("Bitmap/RESTOREU");
_restoreF.load("Bitmap/RESTOREF");
_startD.load("Bitmap/STARTD");
_startU.load("Bitmap/STARTU");
_startF.load("Bitmap/STARTF");
}
void CContinueSaveDialog::render() {
Graphics::Screen &screen = *g_vm->_screen;
screen.clear();
screen.blitFrom(_backdrop, Common::Point(48, 22));
CScreenManager::_screenManagerPtr->setSurfaceBounds(SURFACE_PRIMARY,
Rect(48, 22, 48 + _backdrop.w, 22 + _backdrop.h));
if (_evilTwinShown)
screen.blitFrom(_evilTwin, Common::Point(78, 59));
_restoreState = _startState = -1;
renderButtons();
renderSlots();
}
void CContinueSaveDialog::renderButtons() {
Graphics::Screen &screen = *g_vm->_screen;
Rect restoreRect(RESTORE_X, RESTORE_Y, RESTORE_X + _restoreU.w, RESTORE_Y + _restoreU.h);
Rect startRect(START_X, START_Y, START_X + _startU.w, START_Y + _startU.h);
// Determine the current state for the buttons
int restoreState, startState;
if (!restoreRect.contains(_mousePos))
restoreState = 0;
else
restoreState = _mouseDown ? 1 : 2;
if (!startRect.contains(_mousePos))
startState = 0;
else
startState = _mouseDown ? 1 : 2;
// Draw the start button
if (startState != _startState) {
_startState = startState;
switch (_startState) {
case 0:
screen.blitFrom(_startU, Common::Point(START_X, START_Y));
break;
case 1:
screen.blitFrom(_startD, Common::Point(START_X, START_Y));
break;
case 2:
screen.blitFrom(_startF, Common::Point(START_X, START_Y));
break;
default:
break;
}
}
// Draw the restore button
if (restoreState != _restoreState) {
_restoreState = restoreState;
switch (_restoreState) {
case 0:
screen.blitFrom(_restoreU, Common::Point(RESTORE_X, RESTORE_Y));
break;
case 1:
screen.blitFrom(_restoreD, Common::Point(RESTORE_X, RESTORE_Y));
break;
case 2:
screen.blitFrom(_restoreF, Common::Point(RESTORE_X, RESTORE_Y));
break;
default:
break;
}
}
}
void CContinueSaveDialog::renderSlots() {
for (int idx = 0; idx < (int)_saves.size(); ++idx) {
byte rgb = (_highlightedSlot == idx) ? 255 : 0;
_slotNames[idx].setColor(rgb, rgb, rgb);
_slotNames[idx].setLineColor(0, rgb, rgb, rgb);
_slotNames[idx].draw(CScreenManager::_screenManagerPtr);
}
}
void CContinueSaveDialog::mouseMove(const Point &mousePos) {
_mousePos = mousePos;
renderButtons();
}
void CContinueSaveDialog::leftButtonDown(const Point &mousePos) {
Rect eye1(188, 190, 192, 195), eye2(209, 192, 213, 197);
if (g_vm->_events->isSpecialPressed(MK_SHIFT) &&
(eye1.contains(mousePos) || eye2.contains(mousePos))) {
// Show the Easter Egg "Evil Twin"
_evilTwinShown = true;
render();
} else {
// Standard mouse handling
_mouseDown = true;
mouseMove(mousePos);
}
}
void CContinueSaveDialog::leftButtonUp(const Point &mousePos) {
Rect restoreRect(RESTORE_X, RESTORE_Y, RESTORE_X + _restoreU.w, RESTORE_Y + _restoreU.h);
Rect startRect(START_X, START_Y, START_X + _startU.w, START_Y + _startU.h);
_mouseDown = false;
if (_evilTwinShown) {
_evilTwinShown = false;
render();
return;
}
if (restoreRect.contains(mousePos)) {
// Flag to exit dialog and load highlighted slot. If no slot was
// selected explicitly, then fall back on loading the first slot
_selectedSlot = (_highlightedSlot == -999) ? _saves[0]._slot :
_saves[_highlightedSlot]._slot;
} else if (startRect.contains(mousePos)) {
// Start a new game
_selectedSlot = -1;
} else {
// Check whether a filled in slot was selected
for (uint idx = 0; idx < _saves.size(); ++idx) {
if (getSlotBounds(idx).contains(mousePos)) {
_highlightedSlot = idx;
render();
break;
}
}
}
}
void CContinueSaveDialog::actionStart(Common::CustomEventType action) {
if (action == kActionQuit)
_selectedSlot = EXIT_GAME;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,102 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_CONTINUE_SAVE_DIALOG_H
#define TITANIC_CONTINUE_SAVE_DIALOG_H
#include "common/array.h"
#include "titanic/events.h"
#include "titanic/support/image.h"
#include "titanic/support/rect.h"
#include "titanic/support/string.h"
#include "titanic/gfx/text_control.h"
namespace Titanic {
#define EXIT_GAME -2
class CContinueSaveDialog : public CEventTarget {
struct SaveEntry {
int _slot;
CString _name;
SaveEntry() : _slot(0) {}
SaveEntry(int slot, const CString &name) : _slot(slot), _name(name) {}
};
private:
Common::Array<SaveEntry> _saves;
CTextControl _slotNames[5];
int _highlightedSlot, _selectedSlot;
Point _mousePos;
bool _evilTwinShown;
bool _mouseDown;
int _restoreState, _startState;
Image _backdrop;
Image _evilTwin;
Image _restoreD, _restoreU, _restoreF;
Image _startD, _startU, _startF;
private:
/**
* Load the images
*/
void loadImages();
/**
* Render the dialog
*/
void render();
/**
* Render the buttons
*/
void renderButtons();
/**
* Render the slots
*/
void renderSlots();
/**
* Get the area to draw a slot name in
*/
Rect getSlotBounds(int index);
public:
CContinueSaveDialog();
~CContinueSaveDialog() override;
void mouseMove(const Point &mousePos) override;
void leftButtonDown(const Point &mousePos) override;
void leftButtonUp(const Point &mousePos) override;
void actionStart(Common::CustomEventType action) override;
/**
* Add a savegame to the list to be displayed
*/
void addSavegame(int slot, const CString &name);
/**
* Show the dialog and wait for a slot to be selected
*/
int show();
};
} // End of namespace Titanic
#endif /* TITANIC_CONTINUE_SAVE_DIALOG_H */

View File

@@ -0,0 +1,77 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/core/background.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CBackground, CGameObject)
ON_MESSAGE(StatusChangeMsg)
ON_MESSAGE(SetFrameMsg)
ON_MESSAGE(VisibleMsg)
END_MESSAGE_MAP()
CBackground::CBackground() : CGameObject(), _startFrame(0), _endFrame(0), _isBlocking(false) {
}
void CBackground::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_startFrame, indent);
file->writeNumberLine(_endFrame, indent);
file->writeQuotedLine(_string1, indent);
file->writeQuotedLine(_string2, indent);
file->writeNumberLine(_isBlocking, indent);
CGameObject::save(file, indent);
}
void CBackground::load(SimpleFile *file) {
file->readNumber();
_startFrame = file->readNumber();
_endFrame = file->readNumber();
_string1 = file->readString();
_string2 = file->readString();
_isBlocking = file->readNumber();
CGameObject::load(file);
}
bool CBackground::StatusChangeMsg(CStatusChangeMsg *msg) {
setVisible(true);
if (_isBlocking) {
playMovie(_startFrame, _endFrame, MOVIE_WAIT_FOR_FINISH);
} else {
playMovie(_startFrame, _endFrame, 0);
}
return true;
}
bool CBackground::SetFrameMsg(CSetFrameMsg *msg) {
loadFrame(msg->_frameNumber);
return true;
}
bool CBackground::VisibleMsg(CVisibleMsg *msg) {
setVisible(!_visible);
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,58 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_BACKGROUND_H
#define TITANIC_BACKGROUND_H
#include "titanic/core/game_object.h"
#include "titanic/messages/messages.h"
namespace Titanic {
class CBackground : public CGameObject {
DECLARE_MESSAGE_MAP;
bool StatusChangeMsg(CStatusChangeMsg *msg);
bool SetFrameMsg(CSetFrameMsg *msg);
bool VisibleMsg(CVisibleMsg *msg);
protected:
int _startFrame;
int _endFrame;
CString _string1;
CString _string2;
bool _isBlocking;
public:
CLASSDEF;
CBackground();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_BACKGROUND_H */

View File

@@ -0,0 +1,55 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/core/click_responder.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CClickResponder, CGameObject)
ON_MESSAGE(MouseButtonDownMsg)
END_MESSAGE_MAP()
void CClickResponder::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeQuotedLine(_message, indent);
file->writeQuotedLine(_soundName, indent);
CGameObject::save(file, indent);
}
void CClickResponder::load(SimpleFile *file) {
file->readNumber();
_message = file->readString();
_soundName = file->readString();
CGameObject::load(file);
}
bool CClickResponder::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
if (!_soundName.empty())
playSound(_soundName);
if (!_message.empty())
petDisplayMessage(_message);
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,50 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_CLICK_RESPONDER_H
#define TITANIC_CLICK_RESPONDER_H
#include "titanic/core/game_object.h"
namespace Titanic {
class CClickResponder : public CGameObject {
DECLARE_MESSAGE_MAP;
bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
protected:
CString _message, _soundName;
public:
CLASSDEF;
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_CLICK_RESPONDER_H */

View File

@@ -0,0 +1,36 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/core/dont_save_file_item.h"
namespace Titanic {
EMPTY_MESSAGE_MAP(CDontSaveFileItem, CFileItem);
void CDontSaveFileItem::save(SimpleFile *file, int indent) {
file->writeNumberLine(0, indent);
}
void CDontSaveFileItem::load(SimpleFile *file) {
file->readNumber();
}
} // End of namespace Titanic

View File

@@ -0,0 +1,52 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_DONT_SAVE_FILE_ITEM_H
#define TITANIC_DONT_SAVE_FILE_ITEM_H
#include "titanic/core/file_item.h"
namespace Titanic {
class CDontSaveFileItem : public CFileItem {
DECLARE_MESSAGE_MAP;
public:
CLASSDEF;
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
/**
* Returns true if the item is a file item
*/
bool isFileItem() const override { return false; }
};
} // End of namespace Titanic
#endif /* TITANIC_DONT_SAVE_FILE_ITEM_H */

View File

@@ -0,0 +1,191 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/core/drop_target.h"
#include "titanic/carry/carry.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CDropTarget, CGameObject)
ON_MESSAGE(DropObjectMsg)
ON_MESSAGE(MouseDragStartMsg)
ON_MESSAGE(EnterViewMsg)
ON_MESSAGE(VisibleMsg)
ON_MESSAGE(DropZoneLostObjectMsg)
END_MESSAGE_MAP()
CDropTarget::CDropTarget() : CGameObject(), _itemFrame(0),
_itemMatchStartsWith(false), _hideItem(false), _dropEnabled(false), _dropFrame(0),
_dragFrame(0), _dragCursorId(CURSOR_ARROW), _dropCursorId(CURSOR_HAND),
_clipFlags(20) {
}
void CDropTarget::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writePoint(_pos1, indent);
file->writeNumberLine(_itemFrame, indent);
file->writeQuotedLine(_itemMatchName, indent);
file->writeNumberLine(_itemMatchStartsWith, indent);
file->writeQuotedLine(_soundName, indent);
file->writeNumberLine(_hideItem, indent);
file->writeQuotedLine(_itemName, indent);
file->writeNumberLine(_dropEnabled, indent);
file->writeNumberLine(_dropFrame, indent);
file->writeNumberLine(_dragFrame, indent);
file->writeQuotedLine(_clipName, indent);
file->writeNumberLine(_dragCursorId, indent);
file->writeNumberLine(_dropCursorId, indent);
file->writeNumberLine(_clipFlags, indent);
CGameObject::save(file, indent);
}
void CDropTarget::load(SimpleFile *file) {
file->readNumber();
_pos1 = file->readPoint();
_itemFrame = file->readNumber();
_itemMatchName = file->readString();
_itemMatchStartsWith = file->readNumber();
_soundName = file->readString();
_hideItem = file->readNumber();
_itemName = file->readString();
_dropEnabled = file->readNumber();
_dropFrame = file->readNumber();
_dragFrame = file->readNumber();
_clipName = file->readString();
_dragCursorId = (CursorId)file->readNumber();
_dropCursorId = (CursorId)file->readNumber();
_clipFlags = file->readNumber();
CGameObject::load(file);
}
bool CDropTarget::DropObjectMsg(CDropObjectMsg *msg) {
if (!_itemName.empty()) {
if (msg->_item->getName() != _itemName) {
if (findByName(_itemName, true))
return false;
}
}
if (!msg->_item->isEquals(_itemMatchName, _itemMatchStartsWith))
return false;
msg->_item->detach();
msg->_item->addUnder(this);
msg->_item->setPosition(Point(_bounds.left, _bounds.top));
msg->_item->loadFrame(_itemFrame);
if (_hideItem)
msg->_item->setVisible(false);
_itemName = msg->_item->getName();
CDropZoneGotObjectMsg gotMsg(this);
gotMsg.execute(msg->_item);
playSound(_soundName);
if (_clipName.empty()) {
loadFrame(_dropFrame);
} else {
playClip(_clipName, _clipFlags);
}
_cursorId = _dropCursorId;
return true;
}
bool CDropTarget::MouseDragStartMsg(CMouseDragStartMsg *msg) {
CTreeItem *dragItem = msg->_dragItem;
if (!checkStartDragging(msg))
return false;
msg->_dragItem = dragItem;
CGameObject *obj = dynamic_cast<CGameObject *>(findByName(_itemName));
if (_itemName.empty() || _dropEnabled || !obj)
return false;
CDropZoneLostObjectMsg lostMsg;
lostMsg._object = this;
lostMsg.execute(obj);
loadFrame(_dragFrame);
_cursorId = _dragCursorId;
if (obj->_visible) {
msg->execute(obj);
} else {
msg->_dragItem = obj;
CPassOnDragStartMsg passMsg(msg->_mousePos, 1);
passMsg.execute(obj);
obj->setVisible(true);
}
return true;
}
bool CDropTarget::EnterViewMsg(CEnterViewMsg *msg) {
if (!_itemName.empty()) {
CGameObject *obj = dynamic_cast<CGameObject *>(findByName(_itemName));
if (!obj) {
loadFrame(_dragFrame);
_cursorId = _dragCursorId;
} else if (_clipName.empty()) {
loadFrame(_dropFrame);
_cursorId = _dropCursorId;
} else {
playClip(_clipName, _clipFlags);
_cursorId = _dropCursorId;
}
}
return true;
}
bool CDropTarget::VisibleMsg(CVisibleMsg *msg) {
setVisible(msg->_visible);
_dropEnabled = !msg->_visible;
return true;
}
bool CDropTarget::DropZoneLostObjectMsg(CDropZoneLostObjectMsg *msg) {
if (!_itemName.empty()) {
CGameObject *obj = dynamic_cast<CGameObject *>(findByName(_itemName));
if (obj) {
if (msg->_object) {
obj->detach();
obj->addUnder(msg->_object);
} else if (dynamic_cast<CCarry *>(obj)) {
obj->petAddToInventory();
}
obj->setVisible(true);
CDropZoneLostObjectMsg lostMsg(this);
lostMsg.execute(obj);
}
loadFrame(_dragFrame);
_cursorId = _dragCursorId;
}
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,68 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_DROP_TARGET_H
#define TITANIC_DROP_TARGET_H
#include "titanic/core/game_object.h"
namespace Titanic {
class CDropTarget : public CGameObject {
DECLARE_MESSAGE_MAP;
bool DropObjectMsg(CDropObjectMsg *msg);
bool MouseDragStartMsg(CMouseDragStartMsg *msg);
bool EnterViewMsg(CEnterViewMsg *msg);
bool VisibleMsg(CVisibleMsg *msg);
bool DropZoneLostObjectMsg(CDropZoneLostObjectMsg *msg);
protected:
Point _pos1;
int _itemFrame;
CString _itemMatchName;
bool _itemMatchStartsWith;
CString _soundName;
bool _hideItem;
CString _itemName;
bool _dropEnabled;
int _dropFrame;
int _dragFrame;
CString _clipName;
CursorId _dragCursorId;
CursorId _dropCursorId;
uint _clipFlags;
public:
CLASSDEF;
CDropTarget();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
} // End of namespace Titanic
#endif /* TITANIC_DROP_TARGET_H */

View File

@@ -0,0 +1,48 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/core/file_item.h"
namespace Titanic {
EMPTY_MESSAGE_MAP(CFileItem, CTreeItem);
void CFileItem::save(SimpleFile *file, int indent) {
file->writeNumberLine(0, indent);
CTreeItem::save(file, indent);
}
void CFileItem::load(SimpleFile *file) {
file->readNumber();
CTreeItem::load(file);
}
CString CFileItem::formFilename() const {
return "";
}
CString CFileItem::getFilename() const {
//dynamic_cast<CFileItem *>(getRoot())->formDataPath();
return _filename;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,66 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_FILE_ITEM_H
#define TITANIC_FILE_ITEM_H
#include "titanic/support/string.h"
#include "titanic/core/list.h"
#include "titanic/core/tree_item.h"
namespace Titanic {
class CFileItem: public CTreeItem {
DECLARE_MESSAGE_MAP;
private:
CString _filename;
public:
CLASSDEF;
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
/**
* Returns true if the item is a file item
*/
bool isFileItem() const override { return true; }
/**
* Form a filename for the file item
*/
CString formFilename() const;
/**
* Get a string?
*/
CString getFilename() const;
};
} // End of namespace Titanic
#endif /* TITANIC_FILE_ITEM_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,56 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/core/game_object_desc_item.h"
namespace Titanic {
CGameObjectDescItem::CGameObjectDescItem(): CTreeItem() {
}
void CGameObjectDescItem::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
_clipList.save(file, indent);
file->writeQuotedLine(_name, indent);
file->writeQuotedLine(_string2, indent);
_list1.save(file, indent);
_list2.save(file, indent);
CTreeItem::save(file, indent);
}
void CGameObjectDescItem::load(SimpleFile *file) {
int val = file->readNumber();
if (val != 1) {
if (val)
_clipList.load(file);
_name = file->readString();
_string2 = file->readString();
_list1.load(file);
_list1.load(file);
}
CTreeItem::load(file);
}
} // End of namespace Titanic

View File

@@ -0,0 +1,60 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_GAME_OBJECT_DESK_ITEM_H
#define TITANIC_GAME_OBJECT_DESK_ITEM_H
#include "titanic/support/movie_clip.h"
#include "titanic/core/tree_item.h"
#include "titanic/core/list.h"
namespace Titanic {
class CGameObjectDescItem : public CTreeItem {
protected:
CString _name;
CString _string2;
List<ListItem> _list1;
List<ListItem> _list2;
CMovieClipList _clipList;
public:
CLASSDEF;
CGameObjectDescItem();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
/**
* Gets the name of the item, if any
*/
const CString getName() const override { return _name; }
};
} // End of namespace Titanic
#endif /* TITANIC_GAME_OBJECT_DESK_ITEM_H */

View File

@@ -0,0 +1,205 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/core/link_item.h"
#include "titanic/core/node_item.h"
#include "titanic/core/project_item.h"
#include "titanic/core/view_item.h"
namespace Titanic {
EMPTY_MESSAGE_MAP(CLinkItem, CNamedItem);
Movement CLinkItem::getMovementFromCursor(CursorId cursorId) {
if (cursorId == CURSOR_MOVE_LEFT)
return TURN_LEFT;
else if (cursorId == CURSOR_MOVE_RIGHT)
return TURN_RIGHT;
else if (cursorId == CURSOR_MOVE_FORWARD || cursorId == CURSOR_MOVE_THROUGH ||
cursorId == CURSOR_DOWN || cursorId == CURSOR_LOOK_UP ||
cursorId == CURSOR_LOOK_DOWN || cursorId == CURSOR_MAGNIFIER)
return MOVE_FORWARDS;
else if (cursorId == CURSOR_BACKWARDS)
return MOVE_BACKWARDS;
else
return MOVE_NONE;
}
CLinkItem::CLinkItem() : CNamedItem() {
_roomNumber = -1;
_nodeNumber = -1;
_viewNumber = -1;
_linkMode = 0;
_cursorId = CURSOR_ARROW;
_name = "Link";
}
CString CLinkItem::formName() {
CViewItem *view = findView();
CNodeItem *node = view->findNode();
CRoomItem *room = node->findRoom();
CViewItem *destView = getDestView();
CNodeItem *destNode = destView->findNode();
CRoomItem *destRoom = destNode->findRoom();
switch (_linkMode) {
case 1:
return CString::format("_PANL,%d,%s,%s", node->_nodeNumber,
view->getName().c_str(), destView->getName().c_str());
case 2:
return CString::format("_PANR,%d,%s,%s", node->_nodeNumber,
view->getName().c_str(), destView->getName().c_str());
case 3:
return CString::format("_TRACK,%d,%s,%d,%s",
node->_nodeNumber, view->getName().c_str(),
destNode->_nodeNumber, destView->getName().c_str());
case 4:
return CString::format("_EXIT,%d,%d,%s,%d,%d,%s",
room->_roomNumber, node->_nodeNumber, view->getName().c_str(),
destRoom->_roomNumber, destNode->_nodeNumber, destView->getName().c_str());
default:
return getName().c_str();
}
}
void CLinkItem::save(SimpleFile *file, int indent) {
file->writeNumberLine(2, indent);
file->writeQuotedLine("L", indent);
file->writeNumberLine(_cursorId, indent + 1);
file->writeNumberLine(_linkMode, indent + 1);
file->writeNumberLine(_roomNumber, indent + 1);
file->writeNumberLine(_nodeNumber, indent + 1);
file->writeNumberLine(_viewNumber, indent + 1);
file->writeQuotedLine("Hotspot", indent + 1);
file->writeNumberLine(_bounds.left, indent + 2);
file->writeNumberLine(_bounds.top, indent + 2);
file->writeNumberLine(_bounds.right, indent + 2);
file->writeNumberLine(_bounds.bottom, indent + 2);
CNamedItem::save(file, indent);
}
void CLinkItem::load(SimpleFile *file) {
int val = file->readNumber();
file->readBuffer();
switch (val) {
case 2:
_cursorId = (CursorId)file->readNumber();
// Intentional fall-through
case 1:
_linkMode = file->readNumber();
// Intentional fall-through
case 0:
_roomNumber = file->readNumber();
_nodeNumber = file->readNumber();
_viewNumber = file->readNumber();
file->readBuffer();
_bounds.left = file->readNumber();
_bounds.top = file->readNumber();
_bounds.right = file->readNumber();
_bounds.bottom = file->readNumber();
break;
default:
break;
}
CNamedItem::load(file);
if (val < 2) {
switch (_linkMode) {
case 2:
_cursorId = CURSOR_MOVE_LEFT;
break;
case 3:
_cursorId = CURSOR_MOVE_RIGHT;
break;
case 5:
_cursorId = CURSOR_MOVE_FORWARD;
break;
default:
_cursorId = CURSOR_MOVE_THROUGH;
break;
}
}
}
bool CLinkItem::connectsTo(CViewItem *destView) const {
CNodeItem *destNode = destView->findNode();
CRoomItem *destRoom = destNode->findRoom();
return _viewNumber == destView->_viewNumber &&
_nodeNumber == destNode->_nodeNumber &&
_roomNumber == destRoom->_roomNumber;
}
void CLinkItem::setDestination(int roomNumber, int nodeNumber,
int viewNumber, int linkMode) {
_roomNumber = roomNumber;
_nodeNumber = nodeNumber;
_viewNumber = viewNumber;
_linkMode = linkMode;
_name = formName();
}
CViewItem *CLinkItem::getDestView() const {
return getRoot()->findView(_roomNumber, _nodeNumber, _viewNumber);
}
CNodeItem *CLinkItem::getDestNode() const {
return getDestView()->findNode();
}
CRoomItem *CLinkItem::getDestRoom() const {
return getDestNode()->findRoom();
}
CMovieClip *CLinkItem::getClip() const {
return findRoom()->findClip(getName());
}
Movement CLinkItem::getMovement() const {
if (_bounds.isEmpty())
return MOVE_NONE;
return getMovementFromCursor(_cursorId);
}
bool CLinkItem::findPoint(Quadrant quadrant, Point &pt) {
if (_bounds.isEmpty())
return false;
pt = _bounds.getPoint(quadrant);
return true;
}
} // End of namespace Titanic

View File

@@ -0,0 +1,116 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_LINK_ITEM_H
#define TITANIC_LINK_ITEM_H
#include "titanic/support/mouse_cursor.h"
#include "titanic/core/named_item.h"
#include "titanic/support/movie_clip.h"
#include "titanic/messages/messages.h"
namespace Titanic {
class CViewItem;
class CNodeItem;
class CRoomItem;
class CLinkItem : public CNamedItem {
DECLARE_MESSAGE_MAP;
private:
/**
* Returns a new name for the link item, based on the
* current values for it's destination
*/
CString formName();
protected:
int _roomNumber;
int _nodeNumber;
int _viewNumber;
int _linkMode;
public:
Rect _bounds;
CursorId _cursorId;
public:
static Movement getMovementFromCursor(CursorId cursorId);
public:
CLASSDEF;
CLinkItem();
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
/**
* Returns true if the given item connects to another specified view
*/
bool connectsTo(CViewItem *destView) const override;
/**
* Set the destination for the link item
*/
virtual void setDestination(int roomNumber, int nodeNumber,
int viewNumber, int linkMode);
/**
* Get the destination view for the link item
*/
virtual CViewItem *getDestView() const;
/**
* Get the destination node for the link item
*/
virtual CNodeItem *getDestNode() const;
/**
* Get the destination view for the link item
*/
virtual CRoomItem *getDestRoom() const;
/**
* Get the movie clip, if any, that's used when the link is used
*/
CMovieClip *getClip() const;
/**
* Get the movement, if any, the cursor represents
*/
Movement getMovement() const;
/**
* Returns a point that falls within the link. Used for simulating
* mouse clicks for movement when arrow keys are pressed
* @param quadrant Quadrant (edge) to return point for
* @param pt Return point
* @returns True if a point was found
*/
bool findPoint(Quadrant quadrant, Point &pt);
};
} // End of namespace Titanic
#endif /* TITANIC_LINK_ITEM_H */

View File

@@ -0,0 +1,34 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/core/list.h"
namespace Titanic {
void ListItem::save(SimpleFile *file, int indent) {
file->writeNumberLine(0, indent);
}
void ListItem::load(SimpleFile *file) {
file->readNumber();
}
} // End of namespace Titanic

163
engines/titanic/core/list.h Normal file
View File

@@ -0,0 +1,163 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_LIST_H
#define TITANIC_LIST_H
#include "common/scummsys.h"
#include "common/list.h"
#include "titanic/support/simple_file.h"
#include "titanic/core/saveable_object.h"
namespace Titanic {
/**
* Base list item class
*/
class ListItem: public CSaveableObject {
public:
CLASSDEF;
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
};
/**
* List item macro for managed pointers an item
*/
#define PTR_LIST_ITEM(T) class T##ListItem : public ListItem { \
public: T *_item; \
T##ListItem() : _item(nullptr) {} \
T##ListItem(T *item) : _item(item) {} \
virtual ~T##ListItem() { delete _item; } \
}
template<typename T>
class PtrListItem : public ListItem {
public:
T *_item;
public:
PtrListItem() : _item(nullptr) {}
PtrListItem(T *item) : _item(item) {}
~PtrListItem() override { delete _item; }
};
template<typename T>
class List : public CSaveableObject, public Common::List<T *> {
public:
~List() override { destroyContents(); }
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override {
file->writeNumberLine(0, indent);
// Write out number of items
file->writeQuotedLine("L", indent);
file->writeNumberLine(Common::List<T *>::size(), indent);
// Iterate through writing entries
typename Common::List<T *>::iterator i;
for (i = Common::List<T *>::begin(); i != Common::List<T *>::end(); ++i) {
ListItem *item = *i;
item->saveHeader(file, indent);
item->save(file, indent + 1);
item->saveFooter(file, indent);
}
}
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override {
file->readNumber();
file->readBuffer();
Common::List<T *>::clear();
uint count = file->readNumber();
for (uint idx = 0; idx < count; ++idx) {
// Validate the class start header
if (!file->isClassStart())
error("Unexpected class end");
// Get item's class name and use it to instantiate an item
CString className = file->readString();
T *newItem = dynamic_cast<T *>(CSaveableObject::createInstance(className));
if (!newItem)
error("Could not create instance of %s", className.c_str());
// Load the item's data and add it to the list
newItem->load(file);
Common::List<T *>::push_back(newItem);
// Validate the class end footer
if (file->isClassStart())
error("Unexpected class start");
}
}
/**
* Clear the list and destroy any items in it
*/
void destroyContents() {
typename Common::List<T *>::iterator i;
for (i = Common::List<T *>::begin();
i != Common::List<T *>::end(); ++i) {
CSaveableObject *obj = *i;
delete obj;
}
Common::List<T *>::clear();
}
/**
* Add a new item to the list of the type the list contains
*/
T *add() {
T *item = new T();
Common::List<T *>::push_back(item);
return item;
}
bool contains(const T *item) const {
for (typename Common::List<T *>::const_iterator i = Common::List<T *>::begin();
i != Common::List<T *>::end(); ++i) {
if (*i == item)
return true;
}
return false;
}
};
} // End of namespace Titanic
#endif /* TITANIC_LIST_H */

View File

@@ -0,0 +1,80 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "titanic/core/mail_man.h"
namespace Titanic {
void CMailMan::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_value, indent);
CGameObject::save(file, indent);
}
void CMailMan::load(SimpleFile *file) {
file->readNumber();
_value = file->readNumber();
CGameObject::load(file);
}
CGameObject *CMailMan::getFirstObject() const {
return dynamic_cast<CGameObject *>(getFirstChild());
}
CGameObject *CMailMan::getNextObject(CGameObject *prior) const {
if (!prior || prior->getParent() != this)
return nullptr;
return dynamic_cast<CGameObject *>(prior->getNextSibling());
}
void CMailMan::addMail(CGameObject *obj, uint destRoomFlags) {
obj->detach();
obj->addUnder(this);
setMailDest(obj, destRoomFlags);
}
void CMailMan::setMailDest(CGameObject *obj, uint roomFlags) {
obj->_destRoomFlags = roomFlags;
obj->_roomFlags = 0;
obj->_isPendingMail = true;
}
CGameObject *CMailMan::findMail(uint roomFlags) const {
for (CGameObject *obj = getFirstObject(); obj; obj = getNextObject(obj)) {
if (obj->_isPendingMail && obj->_destRoomFlags == roomFlags)
return obj;
}
return nullptr;
}
void CMailMan::sendMail(uint currRoomFlags, uint newRoomFlags) {
for (CGameObject *obj = getFirstObject(); obj; obj = getNextObject(obj)) {
if (obj->_isPendingMail && obj->_destRoomFlags == currRoomFlags) {
obj->_isPendingMail = false;
obj->_roomFlags = newRoomFlags;
break;
}
}
}
} // End of namespace Titanic

View File

@@ -0,0 +1,83 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TITANIC_MAIL_MAN_H
#define TITANIC_MAIL_MAN_H
#include "titanic/core/game_object.h"
namespace Titanic {
class CMailMan : public CGameObject {
public:
int _value;
public:
CLASSDEF;
CMailMan() : CGameObject(), _value(1) {}
/**
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) override;
/**
* Load the data for the class from file
*/
void load(SimpleFile *file) override;
/**
* Get the first game object stored in the PET
*/
CGameObject *getFirstObject() const;
/**
* Get the next game object stored in the PET following
* the passed game object
*/
CGameObject *getNextObject(CGameObject *prior) const;
/**
* Add an object to the mail list
*/
void addMail(CGameObject *obj, uint destRoomFlags);
/**
* Sets the mail destination for an object
*/
static void setMailDest(CGameObject *obj, uint roomFlags);
/**
* Scan the mail list for a specified item
*/
CGameObject *findMail(uint roomFlags) const;
/**
* Sends a pending mail object to a given destination
*/
void sendMail(uint currRoomFlags, uint newRoomFlags);
void resetValue() { _value = 0; }
};
} // End of namespace Titanic
#endif /* TITANIC_MAIL_MAN_H */

Some files were not shown because too many files have changed in this diff Show More