Initial commit
This commit is contained in:
78
engines/titanic/game/gondolier/gondolier_base.cpp
Normal file
78
engines/titanic/game/gondolier/gondolier_base.cpp
Normal 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/game/gondolier/gondolier_base.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
BEGIN_MESSAGE_MAP(CGondolierBase, CGameObject)
|
||||
ON_MESSAGE(PuzzleSolvedMsg)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
bool CGondolierBase::_chestOpen;
|
||||
bool CGondolierBase::_puzzleSolved;
|
||||
int CGondolierBase::_volume1;
|
||||
int CGondolierBase::_slider1;
|
||||
int CGondolierBase::_volume2;
|
||||
int CGondolierBase::_slider2;
|
||||
bool CGondolierBase::_rightSliderHooked;
|
||||
bool CGondolierBase::_leftSliderHooked;
|
||||
bool CGondolierBase::_priorLeftSliderHooked;
|
||||
bool CGondolierBase::_priorRightSliderHooked;
|
||||
|
||||
void CGondolierBase::save(SimpleFile *file, int indent) {
|
||||
file->writeNumberLine(1, indent);
|
||||
file->writeNumberLine(_chestOpen, indent);
|
||||
file->writeNumberLine(_puzzleSolved, indent);
|
||||
file->writeNumberLine(_volume1, indent);
|
||||
file->writeNumberLine(_slider1, indent);
|
||||
file->writeNumberLine(_rightSliderHooked, indent);
|
||||
file->writeNumberLine(_volume2, indent);
|
||||
file->writeNumberLine(_slider2, indent);
|
||||
file->writeNumberLine(_leftSliderHooked, indent);
|
||||
file->writeNumberLine(_priorLeftSliderHooked, indent);
|
||||
file->writeNumberLine(_priorRightSliderHooked, indent);
|
||||
|
||||
CGameObject::save(file, indent);
|
||||
}
|
||||
|
||||
void CGondolierBase::load(SimpleFile *file) {
|
||||
file->readNumber();
|
||||
_chestOpen = file->readNumber();
|
||||
_puzzleSolved = file->readNumber();
|
||||
_volume1 = file->readNumber();
|
||||
_slider1 = file->readNumber();
|
||||
_leftSliderHooked = file->readNumber();
|
||||
_volume2 = file->readNumber();
|
||||
_slider2 = file->readNumber();
|
||||
_rightSliderHooked = file->readNumber();
|
||||
_priorLeftSliderHooked = file->readNumber();
|
||||
_priorRightSliderHooked = file->readNumber();
|
||||
|
||||
CGameObject::load(file);
|
||||
}
|
||||
|
||||
bool CGondolierBase::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) {
|
||||
_puzzleSolved = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
} // End of namespace Titanic
|
||||
59
engines/titanic/game/gondolier/gondolier_base.h
Normal file
59
engines/titanic/game/gondolier/gondolier_base.h
Normal 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TITANIC_GONDOLIER_BASE_H
|
||||
#define TITANIC_GONDOLIER_BASE_H
|
||||
|
||||
#include "titanic/core/game_object.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
class CGondolierBase : public CGameObject {
|
||||
DECLARE_MESSAGE_MAP;
|
||||
bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg);
|
||||
protected:
|
||||
static bool _chestOpen;
|
||||
static bool _puzzleSolved;
|
||||
static int _volume1;
|
||||
static int _slider1;
|
||||
static int _volume2;
|
||||
static int _slider2;
|
||||
static bool _leftSliderHooked;
|
||||
static bool _rightSliderHooked;
|
||||
static bool _priorLeftSliderHooked;
|
||||
static bool _priorRightSliderHooked;
|
||||
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_GONDOLIER_BASE_H */
|
||||
65
engines/titanic/game/gondolier/gondolier_chest.cpp
Normal file
65
engines/titanic/game/gondolier/gondolier_chest.cpp
Normal 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/game/gondolier/gondolier_chest.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
BEGIN_MESSAGE_MAP(CGondolierChest, CGondolierBase)
|
||||
ON_MESSAGE(MouseButtonDownMsg)
|
||||
ON_MESSAGE(MovieEndMsg)
|
||||
ON_MESSAGE(MouseDragStartMsg)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
void CGondolierChest::save(SimpleFile *file, int indent) {
|
||||
file->writeNumberLine(1, indent);
|
||||
CGondolierBase::save(file, indent);
|
||||
}
|
||||
|
||||
void CGondolierChest::load(SimpleFile *file) {
|
||||
file->readNumber();
|
||||
CGondolierBase::load(file);
|
||||
}
|
||||
|
||||
bool CGondolierChest::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
|
||||
if (!_chestOpen)
|
||||
playMovie(0, 14, MOVIE_NOTIFY_OBJECT);
|
||||
else if (msg->_mousePos.y < 330)
|
||||
return false;
|
||||
else if (!_leftSliderHooked && !_rightSliderHooked) {
|
||||
playMovie(14, 29, 0);
|
||||
_chestOpen = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGondolierChest::MovieEndMsg(CMovieEndMsg *msg) {
|
||||
if (msg->_endFrame == 14)
|
||||
_chestOpen = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGondolierChest::MouseDragStartMsg(CMouseDragStartMsg *msg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // End of namespace Titanic
|
||||
50
engines/titanic/game/gondolier/gondolier_chest.h
Normal file
50
engines/titanic/game/gondolier/gondolier_chest.h
Normal 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_GONDOLIER_CHEST_H
|
||||
#define TITANIC_GONDOLIER_CHEST_H
|
||||
|
||||
#include "titanic/game/gondolier/gondolier_base.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
class CGondolierChest : public CGondolierBase {
|
||||
DECLARE_MESSAGE_MAP;
|
||||
bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
|
||||
bool MovieEndMsg(CMovieEndMsg *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_GONDOLIER_CHEST_H */
|
||||
57
engines/titanic/game/gondolier/gondolier_face.cpp
Normal file
57
engines/titanic/game/gondolier/gondolier_face.cpp
Normal 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "titanic/game/gondolier/gondolier_face.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
BEGIN_MESSAGE_MAP(CGondolierFace, CGondolierBase)
|
||||
ON_MESSAGE(EnterViewMsg)
|
||||
ON_MESSAGE(StatusChangeMsg)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
void CGondolierFace::save(SimpleFile *file, int indent) {
|
||||
file->writeNumberLine(1, indent);
|
||||
file->writeNumberLine(_flag, indent);
|
||||
CGondolierBase::save(file, indent);
|
||||
}
|
||||
|
||||
void CGondolierFace::load(SimpleFile *file) {
|
||||
file->readNumber();
|
||||
_flag = file->readNumber();
|
||||
CGondolierBase::load(file);
|
||||
}
|
||||
|
||||
bool CGondolierFace::EnterViewMsg(CEnterViewMsg *msg) {
|
||||
if (_flag)
|
||||
playMovie(MOVIE_REPEAT);
|
||||
else
|
||||
setVisible(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGondolierFace::StatusChangeMsg(CStatusChangeMsg *msg) {
|
||||
_flag = msg->_newStatus != 1;
|
||||
setVisible(_flag);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // End of namespace Titanic
|
||||
52
engines/titanic/game/gondolier/gondolier_face.h
Normal file
52
engines/titanic/game/gondolier/gondolier_face.h
Normal 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_GONDOLIER_FACE_H
|
||||
#define TITANIC_GONDOLIER_FACE_H
|
||||
|
||||
#include "titanic/game/gondolier/gondolier_base.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
class CGondolierFace : public CGondolierBase {
|
||||
DECLARE_MESSAGE_MAP;
|
||||
bool EnterViewMsg(CEnterViewMsg *msg);
|
||||
bool StatusChangeMsg(CStatusChangeMsg *msg);
|
||||
private:
|
||||
bool _flag;
|
||||
public:
|
||||
CLASSDEF;
|
||||
CGondolierFace() : CGondolierBase(), _flag(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_GONDOLIER_FACE_H */
|
||||
197
engines/titanic/game/gondolier/gondolier_mixer.cpp
Normal file
197
engines/titanic/game/gondolier/gondolier_mixer.cpp
Normal file
@@ -0,0 +1,197 @@
|
||||
/* 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/game/gondolier/gondolier_mixer.h"
|
||||
#include "titanic/core/room_item.h"
|
||||
#include "titanic/translation.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
BEGIN_MESSAGE_MAP(CGondolierMixer, CGondolierBase)
|
||||
ON_MESSAGE(EnterRoomMsg)
|
||||
ON_MESSAGE(LeaveRoomMsg)
|
||||
ON_MESSAGE(TurnOn)
|
||||
ON_MESSAGE(TurnOff)
|
||||
ON_MESSAGE(SetVolumeMsg)
|
||||
ON_MESSAGE(SignalObject)
|
||||
ON_MESSAGE(LoadSuccessMsg)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
CGondolierMixer::CGondolierMixer() : CGondolierBase(),
|
||||
_soundName1("c#0.wav"), _soundName2("c#1.wav"),
|
||||
_soundHandle1(-1), _soundHandle2(-1), _fieldC4(0), _fieldC8(0),
|
||||
_soundActive(false) {
|
||||
}
|
||||
|
||||
void CGondolierMixer::save(SimpleFile *file, int indent) {
|
||||
file->writeNumberLine(1, indent);
|
||||
file->writeNumberLine(_soundHandle1, indent);
|
||||
file->writeNumberLine(_soundHandle2, indent);
|
||||
file->writeNumberLine(_fieldC4, indent);
|
||||
file->writeNumberLine(_fieldC8, indent);
|
||||
file->writeQuotedLine(_soundName1, indent);
|
||||
file->writeQuotedLine(_soundName2, indent);
|
||||
file->writeNumberLine(_soundActive, indent);
|
||||
|
||||
CGondolierBase::save(file, indent);
|
||||
}
|
||||
|
||||
void CGondolierMixer::load(SimpleFile *file) {
|
||||
file->readNumber();
|
||||
_soundHandle1 = file->readNumber();
|
||||
_soundHandle2 = file->readNumber();
|
||||
_fieldC4 = file->readNumber();
|
||||
_fieldC8 = file->readNumber();
|
||||
_soundName1 = file->readString();
|
||||
_soundName2 = file->readString();
|
||||
_soundActive = file->readNumber();
|
||||
|
||||
CGondolierBase::load(file);
|
||||
}
|
||||
|
||||
bool CGondolierMixer::EnterRoomMsg(CEnterRoomMsg *msg) {
|
||||
CRoomItem *parentRoom = dynamic_cast<CRoomItem *>(getParent());
|
||||
if (parentRoom == msg->_newRoom) {
|
||||
CTurnOn onMsg;
|
||||
onMsg.execute(this);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGondolierMixer::LeaveRoomMsg(CLeaveRoomMsg *msg) {
|
||||
CRoomItem *parentRoom = dynamic_cast<CRoomItem *>(getParent());
|
||||
if (parentRoom == msg->_oldRoom) {
|
||||
CTurnOff offMsg;
|
||||
offMsg.execute(this);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGondolierMixer::TurnOn(CTurnOn *msg) {
|
||||
if (!_puzzleSolved) {
|
||||
if (_soundHandle1 == -1) {
|
||||
_soundHandle1 = playSound(_soundName1, _volume1 * _slider1 / 10, 0, true);
|
||||
_soundActive = true;
|
||||
}
|
||||
|
||||
if (_soundHandle2 == -1) {
|
||||
_soundHandle2 = playSound(_soundName2, _volume2 * _slider2 / 10, 0, true);
|
||||
_soundActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGondolierMixer::TurnOff(CTurnOff *msg) {
|
||||
// TODO: The stopSound calls should really be 2 seconds,
|
||||
// but doing so stops the changeover of mixers working when
|
||||
// going from the Arboretum room to FrozenArboretum.
|
||||
if (_soundHandle1 != -1) {
|
||||
if (isSoundActive(_soundHandle1))
|
||||
stopSound(_soundHandle1, 0);
|
||||
|
||||
_soundHandle1 = -1;
|
||||
_soundActive = false;
|
||||
}
|
||||
|
||||
if (_soundHandle2 != -1) {
|
||||
if (isSoundActive(_soundHandle2))
|
||||
stopSound(_soundHandle2, 0);
|
||||
|
||||
_soundHandle2 = -1;
|
||||
_soundActive = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGondolierMixer::SetVolumeMsg(CSetVolumeMsg *msg) {
|
||||
if (!_puzzleSolved) {
|
||||
_volume1 = _volume2 = msg->_volume;
|
||||
|
||||
if (_soundHandle1 != -1 && isSoundActive(_soundHandle1))
|
||||
setSoundVolume(_soundHandle1, msg->_volume * _slider1 / 10, 2);
|
||||
if (_soundHandle2 != -1 && isSoundActive(_soundHandle2))
|
||||
setSoundVolume(_soundHandle2, msg->_volume * _slider2 / 10, 2);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGondolierMixer::SignalObject(CSignalObject *msg) {
|
||||
if (!_puzzleSolved) {
|
||||
if (msg->_strValue == "Fly") {
|
||||
_slider1 = CLIP(msg->_numValue, 0, 10);
|
||||
|
||||
if (!_rightSliderHooked) {
|
||||
_slider2 = 10 - _slider1;
|
||||
CStatusChangeMsg statusMsg;
|
||||
statusMsg._newStatus = _slider2;
|
||||
statusMsg.execute("GondolierRightLever");
|
||||
}
|
||||
}
|
||||
|
||||
if (msg->_strValue == "Tos") {
|
||||
_slider2 = CLIP(msg->_numValue, 0, 10);
|
||||
|
||||
if (!_leftSliderHooked) {
|
||||
_slider1 = 10 - _slider2;
|
||||
CStatusChangeMsg statusMsg;
|
||||
statusMsg._newStatus = _slider1;
|
||||
statusMsg.execute("GondolierLeftLever");
|
||||
}
|
||||
}
|
||||
|
||||
if (!_slider1 && !_slider2 && _leftSliderHooked && _rightSliderHooked) {
|
||||
_puzzleSolved = true;
|
||||
CStatusChangeMsg statusMsg;
|
||||
statusMsg._newStatus = 1;
|
||||
statusMsg.execute("GondolierFace");
|
||||
CTurnOff offMsg;
|
||||
offMsg.execute(this);
|
||||
CVisibleMsg visibleMsg;
|
||||
visibleMsg.execute("Mouth");
|
||||
|
||||
playSound(TRANSLATE("z#47.wav", "z#578.wav"));
|
||||
} else {
|
||||
CSetVolumeMsg volumeMsg(_volume1, 2);
|
||||
volumeMsg.execute(this);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGondolierMixer::LoadSuccessMsg(CLoadSuccessMsg *msg) {
|
||||
if (_soundActive) {
|
||||
_soundActive = 0;
|
||||
_soundHandle1 = _soundHandle2 = -1;
|
||||
CTurnOn onMsg;
|
||||
onMsg.execute(this);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // End of namespace Titanic
|
||||
64
engines/titanic/game/gondolier/gondolier_mixer.h
Normal file
64
engines/titanic/game/gondolier/gondolier_mixer.h
Normal 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TITANIC_GONDOLIER_MIXER_H
|
||||
#define TITANIC_GONDOLIER_MIXER_H
|
||||
|
||||
#include "titanic/game/gondolier/gondolier_base.h"
|
||||
#include "titanic/messages/messages.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
class CGondolierMixer : public CGondolierBase {
|
||||
DECLARE_MESSAGE_MAP;
|
||||
bool EnterRoomMsg(CEnterRoomMsg *msg);
|
||||
bool LeaveRoomMsg(CLeaveRoomMsg *msg);
|
||||
bool TurnOn(CTurnOn *msg);
|
||||
bool TurnOff(CTurnOff *msg);
|
||||
bool SetVolumeMsg(CSetVolumeMsg *msg);
|
||||
bool SignalObject(CSignalObject *msg);
|
||||
bool LoadSuccessMsg(CLoadSuccessMsg *msg);
|
||||
private:
|
||||
int _soundHandle1;
|
||||
int _soundHandle2;
|
||||
int _fieldC4;
|
||||
int _fieldC8;
|
||||
CString _soundName1;
|
||||
CString _soundName2;
|
||||
bool _soundActive;
|
||||
public:
|
||||
CLASSDEF;
|
||||
CGondolierMixer();
|
||||
|
||||
/**
|
||||
* 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_GONDOLIER_MIXER_H */
|
||||
222
engines/titanic/game/gondolier/gondolier_slider.cpp
Normal file
222
engines/titanic/game/gondolier/gondolier_slider.cpp
Normal file
@@ -0,0 +1,222 @@
|
||||
/* 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/game/gondolier/gondolier_slider.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
/**
|
||||
* Y offsets within slider for each successive thumbnail position
|
||||
*/
|
||||
static const int Y_OFFSETS[11] = { 0, 0, 1, 4, 9, 15, 21, 27, 32, 35, 36 };
|
||||
|
||||
BEGIN_MESSAGE_MAP(CGondolierSlider, CGondolierBase)
|
||||
ON_MESSAGE(MouseButtonDownMsg)
|
||||
ON_MESSAGE(MouseDragMoveMsg)
|
||||
ON_MESSAGE(EnterViewMsg)
|
||||
ON_MESSAGE(MouseDragStartMsg)
|
||||
ON_MESSAGE(StatusChangeMsg)
|
||||
ON_MESSAGE(MouseDragEndMsg)
|
||||
ON_MESSAGE(IsHookedOnMsg)
|
||||
ON_MESSAGE(FrameMsg)
|
||||
ON_MESSAGE(SignalObject)
|
||||
ON_MESSAGE(ActMsg)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
CGondolierSlider::CGondolierSlider() : CGondolierBase(),
|
||||
_sliderIndex(0), _stringUnused("NULL"), _sliderNum(0), _dragging(false) {
|
||||
}
|
||||
|
||||
void CGondolierSlider::save(SimpleFile *file, int indent) {
|
||||
file->writeNumberLine(1, indent);
|
||||
file->writeRect(_rectUnused, indent);
|
||||
file->writeRect(_thumbRect, indent);
|
||||
file->writeRect(_defaultThumbRect, indent);
|
||||
file->writeNumberLine(_sliderIndex, indent);
|
||||
file->writeQuotedLine(_stringUnused, indent);
|
||||
file->writeNumberLine(_sliderNum, indent);
|
||||
file->writeQuotedLine(_armName, indent);
|
||||
file->writeQuotedLine(_signalTarget, indent);
|
||||
file->writeNumberLine(_dragging, indent);
|
||||
|
||||
CGondolierBase::save(file, indent);
|
||||
}
|
||||
|
||||
void CGondolierSlider::load(SimpleFile *file) {
|
||||
file->readNumber();
|
||||
_rectUnused = file->readRect();
|
||||
_thumbRect = file->readRect();
|
||||
_defaultThumbRect = file->readRect();
|
||||
_sliderIndex = file->readNumber();
|
||||
_stringUnused = file->readString();
|
||||
_sliderNum = file->readNumber();
|
||||
_armName = file->readString();
|
||||
_signalTarget = file->readString();
|
||||
_dragging = file->readNumber();
|
||||
|
||||
CGondolierBase::load(file);
|
||||
}
|
||||
|
||||
bool CGondolierSlider::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
|
||||
if (!_chestOpen)
|
||||
return false;
|
||||
if (_sliderNum ? _leftSliderHooked : _rightSliderHooked)
|
||||
return false;
|
||||
|
||||
return _thumbRect.contains(msg->_mousePos);
|
||||
}
|
||||
|
||||
bool CGondolierSlider::MouseDragMoveMsg(CMouseDragMoveMsg *msg) {
|
||||
if (!(_sliderNum ? _leftSliderHooked : _rightSliderHooked)) {
|
||||
int minVal = 0x7FFFFFFF;
|
||||
int foundIndex = -1;
|
||||
int yp = (_defaultThumbRect.top + _defaultThumbRect.bottom) / 2
|
||||
+ _bounds.top - msg->_mousePos.y;
|
||||
|
||||
for (int idx = 0; idx < 11; ++idx) {
|
||||
int yDiff = ABS(yp + Y_OFFSETS[idx]);
|
||||
|
||||
if (yDiff < minVal) {
|
||||
minVal = yDiff;
|
||||
foundIndex = idx;
|
||||
}
|
||||
}
|
||||
|
||||
if (foundIndex >= 0) {
|
||||
_sliderIndex = foundIndex;
|
||||
CSignalObject signalMsg;
|
||||
signalMsg.execute(this);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGondolierSlider::EnterViewMsg(CEnterViewMsg *msg) {
|
||||
CSignalObject signalMsg;
|
||||
signalMsg.execute(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGondolierSlider::MouseDragStartMsg(CMouseDragStartMsg *msg) {
|
||||
if (!_chestOpen)
|
||||
return false;
|
||||
if (_sliderNum ? _leftSliderHooked : _rightSliderHooked)
|
||||
return false;
|
||||
|
||||
_dragging = checkStartDragging(msg);
|
||||
return _dragging;
|
||||
}
|
||||
|
||||
bool CGondolierSlider::StatusChangeMsg(CStatusChangeMsg *msg) {
|
||||
_sliderIndex = CLIP(10 - msg->_newStatus, 0, 10);
|
||||
_thumbRect = _defaultThumbRect;
|
||||
_thumbRect.translate(_bounds.left, _bounds.top);
|
||||
_thumbRect.translate(0, Y_OFFSETS[_sliderIndex]);
|
||||
|
||||
loadFrame(_sliderIndex);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGondolierSlider::MouseDragEndMsg(CMouseDragEndMsg *msg) {
|
||||
_dragging = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGondolierSlider::IsHookedOnMsg(CIsHookedOnMsg *msg) {
|
||||
if (_sliderNum ? _leftSliderHooked : _rightSliderHooked)
|
||||
return false;
|
||||
|
||||
if (!_thumbRect.intersects(msg->_rect)) {
|
||||
_armName = CString();
|
||||
msg->_isHooked = false;
|
||||
} else {
|
||||
_armName = msg->_armName;
|
||||
if (_sliderNum) {
|
||||
_leftSliderHooked = _priorLeftSliderHooked = true;
|
||||
} else {
|
||||
_rightSliderHooked = _priorRightSliderHooked = true;
|
||||
}
|
||||
|
||||
msg->_isHooked = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGondolierSlider::FrameMsg(CFrameMsg *msg) {
|
||||
if (_sliderNum ? _leftSliderHooked : _rightSliderHooked) {
|
||||
if (_sliderIndex < 10) {
|
||||
++_sliderIndex;
|
||||
CSignalObject signalMsg;
|
||||
signalMsg.execute(this);
|
||||
|
||||
int yp = 0;
|
||||
if (_sliderIndex > 0)
|
||||
yp = Y_OFFSETS[_sliderIndex] - Y_OFFSETS[_sliderIndex - 1];
|
||||
|
||||
if (!_armName.empty()) {
|
||||
CTranslateObjectMsg transMsg;
|
||||
transMsg._delta = Point(0, yp);
|
||||
transMsg.execute(_armName);
|
||||
}
|
||||
}
|
||||
} else if (_sliderNum ? _priorRightSliderHooked : _priorLeftSliderHooked) {
|
||||
if (!_dragging && !_puzzleSolved && _sliderIndex > 0) {
|
||||
--_sliderIndex;
|
||||
CSignalObject signalMsg;
|
||||
signalMsg.execute(this);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGondolierSlider::SignalObject(CSignalObject *msg) {
|
||||
_sliderIndex = CLIP(_sliderIndex, 0, 10);
|
||||
_thumbRect = _defaultThumbRect;
|
||||
_thumbRect.translate(_bounds.left, _bounds.top);
|
||||
_thumbRect.translate(0, Y_OFFSETS[_sliderIndex]);
|
||||
loadFrame(_sliderIndex);
|
||||
|
||||
CSignalObject signalMsg;
|
||||
signalMsg._numValue = 10 - _sliderIndex;
|
||||
signalMsg._strValue = _sliderNum ? "Fly" : "Tos";
|
||||
signalMsg.execute(_signalTarget);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGondolierSlider::ActMsg(CActMsg *msg) {
|
||||
if (msg->_action == "Unhook") {
|
||||
if (_sliderNum) {
|
||||
_leftSliderHooked = _priorLeftSliderHooked = false;
|
||||
_priorRightSliderHooked = _rightSliderHooked;
|
||||
} else {
|
||||
_rightSliderHooked = _priorRightSliderHooked = false;
|
||||
_priorLeftSliderHooked = _leftSliderHooked;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // End of namespace Titanic
|
||||
68
engines/titanic/game/gondolier/gondolier_slider.h
Normal file
68
engines/titanic/game/gondolier/gondolier_slider.h
Normal 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_GONDOLIER_SLIDER_H
|
||||
#define TITANIC_GONDOLIER_SLIDER_H
|
||||
|
||||
#include "titanic/game/gondolier/gondolier_base.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
class CGondolierSlider : public CGondolierBase {
|
||||
DECLARE_MESSAGE_MAP;
|
||||
bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
|
||||
bool MouseDragMoveMsg(CMouseDragMoveMsg *msg);
|
||||
bool EnterViewMsg(CEnterViewMsg *msg);
|
||||
bool MouseDragStartMsg(CMouseDragStartMsg *msg);
|
||||
bool StatusChangeMsg(CStatusChangeMsg *msg);
|
||||
bool MouseDragEndMsg(CMouseDragEndMsg *msg);
|
||||
bool IsHookedOnMsg(CIsHookedOnMsg *msg);
|
||||
bool FrameMsg(CFrameMsg *msg);
|
||||
bool SignalObject(CSignalObject *msg);
|
||||
bool ActMsg(CActMsg *msg);
|
||||
private:
|
||||
Rect _rectUnused;
|
||||
Rect _thumbRect;
|
||||
Rect _defaultThumbRect;
|
||||
int _sliderIndex;
|
||||
CString _stringUnused;
|
||||
int _sliderNum;
|
||||
CString _armName;
|
||||
CString _signalTarget;
|
||||
bool _dragging;
|
||||
public:
|
||||
CLASSDEF;
|
||||
CGondolierSlider();
|
||||
|
||||
/**
|
||||
* 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_GONDOLIER_SLIDER_H */
|
||||
Reference in New Issue
Block a user