TITANIC: Implemented more game classes and music widget classes

This commit is contained in:
Paul Gilbert 2016-08-25 22:13:04 -04:00
parent 1f0b9cb68d
commit 9a71c9166b
24 changed files with 613 additions and 88 deletions

View File

@ -49,7 +49,6 @@ bool CMultiDropTarget::DropObjectMsg(CDropObjectMsg *msg) {
CStringParser parser1(_string5);
CStringParser parser2(_string6);
CString seperatorChars = ",";
int dropFrame = _dropFrame;
while (parser2.parse(_itemMatchName, seperatorChars)) {
_dropFrame = parser1.readInt();

View File

@ -21,9 +21,18 @@
*/
#include "titanic/game/music_console_button.h"
#include "titanic/core/room_item.h"
#include "titanic/sound/music_handler.h"
#include "titanic/titanic.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CMusicConsoleButton, CMusicPlayer)
ON_MESSAGE(MouseButtonDownMsg)
ON_MESSAGE(LeaveViewMsg)
ON_MESSAGE(SetMusicControlsMsg)
END_MESSAGE_MAP()
void CMusicConsoleButton::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CMusicPlayer::save(file, indent);
@ -34,4 +43,91 @@ void CMusicConsoleButton::load(SimpleFile *file) {
CMusicPlayer::load(file);
}
bool CMusicConsoleButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
if (_isActive) {
CStopMusicMsg stopMsg(this);
stopMsg.execute(this);
stopMovie();
loadFrame(0);
} else {
CStartMusicMsg startMsg(this);
startMsg.execute(this);
playMovie(MOVIE_REPEAT);
CMusicHasStartedMsg startedMsg;
startedMsg.execute("Music Room Phonograph");
if (CMusicRoom::_musicHandler->checkSound(1)
&& CMusicRoom::_musicHandler->checkSound(2)
&& CMusicRoom::_musicHandler->checkSound(3)) {
CCorrectMusicPlayedMsg correctMsg;
correctMsg.execute(findRoom());
}
}
return true;
}
bool CMusicConsoleButton::LeaveViewMsg(CLeaveViewMsg *msg) {
if (_isActive) {
CStopMusicMsg stopMsg(this);
stopMsg.execute(this);
stopMovie();
loadFrame(0);
}
return true;
}
bool CMusicConsoleButton::SetMusicControlsMsg(CSetMusicControlsMsg *msg) {
CMusicRoom *musicRoom = getMusicRoom();
CQueryMusicControlSettingMsg queryMsg;
queryMsg.execute("Bells Mute Control");
musicRoom->setItem5(BELLS, queryMsg._value == 1 ? 1 : 0);
queryMsg.execute("Bells Pitch Control");
musicRoom->setItem2(BELLS, queryMsg._value);
queryMsg.execute("Bells Speed Control");
musicRoom->setItem1(BELLS, queryMsg._value);
queryMsg.execute("Bells Inversion Control");
musicRoom->setItem4(BELLS, queryMsg._value == 0 ? 1 : 0);
queryMsg.execute("Bells Direction Control");
musicRoom->setItem3(BELLS, queryMsg._value == 0 ? 1 : 0);
queryMsg.execute("Snake Mute Control");
musicRoom->setItem5(SNAKE, queryMsg._value == 1 ? 1 : 0);
queryMsg.execute("Snake Pitch Control");
musicRoom->setItem2(SNAKE, queryMsg._value);
queryMsg.execute("Snake Speed Control");
musicRoom->setItem1(SNAKE, queryMsg._value);
queryMsg.execute("Snake Inversion Control");
musicRoom->setItem4(SNAKE, queryMsg._value == 0 ? 1 : 0);
queryMsg.execute("Snake Direction Control");
musicRoom->setItem3(SNAKE, queryMsg._value == 0 ? 1 : 0);
queryMsg.execute("Piano Mute Control");
musicRoom->setItem5(PIANO, queryMsg._value == 1 ? 1 : 0);
queryMsg.execute("Piano Pitch Control");
musicRoom->setItem2(PIANO, queryMsg._value);
queryMsg.execute("Piano Speed Control");
musicRoom->setItem1(PIANO, queryMsg._value);
queryMsg.execute("Piano Inversion Control");
musicRoom->setItem4(PIANO, queryMsg._value == 0 ? 1 : 0);
queryMsg.execute("Piano Direction Control");
musicRoom->setItem3(PIANO, queryMsg._value == 0 ? 1 : 0);
queryMsg.execute("Bass Mute Control");
musicRoom->setItem5(BASS, queryMsg._value == 1 ? 1 : 0);
queryMsg.execute("Bass Pitch Control");
musicRoom->setItem2(BASS, queryMsg._value);
queryMsg.execute("Bass Speed Control");
musicRoom->setItem1(BASS, queryMsg._value);
queryMsg.execute("Bass Inversion Control");
musicRoom->setItem4(BASS, queryMsg._value == 0 ? 1 : 0);
queryMsg.execute("Bass Direction Control");
musicRoom->setItem3(BASS, queryMsg._value == 0 ? 1 : 0);
return true;
}
} // End of namespace Titanic

View File

@ -28,6 +28,10 @@
namespace Titanic {
class CMusicConsoleButton : public CMusicPlayer {
DECLARE_MESSAGE_MAP;
bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
bool LeaveViewMsg(CLeaveViewMsg *msg);
bool SetMusicControlsMsg(CSetMusicControlsMsg *msg);
public:
CLASSDEF;

View File

@ -24,16 +24,52 @@
namespace Titanic {
BEGIN_MESSAGE_MAP(CMusicRoomStopPhonographButton, CEjectPhonographButton)
ON_MESSAGE(MouseButtonDownMsg)
ON_MESSAGE(FrameMsg)
END_MESSAGE_MAP()
void CMusicRoomStopPhonographButton::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_field100, indent);
file->writeNumberLine(_ticks, indent);
CEjectPhonographButton::save(file, indent);
}
void CMusicRoomStopPhonographButton::load(SimpleFile *file) {
file->readNumber();
_field100 = file->readNumber();
_ticks = file->readNumber();
CEjectPhonographButton::load(file);
}
bool CMusicRoomStopPhonographButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
if (!_ejected) {
loadFrame(1);
playSound(_soundName);
_readyFlag = true;
CPhonographStopMsg stopMsg;
stopMsg.execute(getParent(), nullptr, MSGFLAG_SCAN);
if (stopMsg._value2) {
_ticks = getTicksCount();
} else {
CEjectCylinderMsg ejectMsg;
ejectMsg.execute(getParent(), nullptr, MSGFLAG_SCAN);
_ejected = true;
}
}
return true;
}
bool CMusicRoomStopPhonographButton::FrameMsg(CFrameMsg *msg) {
if (_readyFlag && _ticks && msg->_ticks >= (_ticks + 100)) {
loadFrame(0);
playSound(_readySoundName);
_ticks = 0;
_readyFlag = false;
}
return true;
}
} // End of namespace Titanic

View File

@ -28,11 +28,14 @@
namespace Titanic {
class CMusicRoomStopPhonographButton : public CEjectPhonographButton {
DECLARE_MESSAGE_MAP;
bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
bool FrameMsg(CFrameMsg *msg);
private:
int _field100;
uint _ticks;
public:
CLASSDEF;
CMusicRoomStopPhonographButton() : CEjectPhonographButton(), _field100(0) {}
CMusicRoomStopPhonographButton() : CEjectPhonographButton(), _ticks(0) {}
/**
* Save the data for the class to file

View File

@ -21,9 +21,16 @@
*/
#include "titanic/game/music_system_lock.h"
#include "titanic/core/room_item.h"
#include "titanic/carry/carry.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CMusicSystemLock, CDropTarget)
ON_MESSAGE(DropObjectMsg)
ON_MESSAGE(MovieEndMsg)
END_MESSAGE_MAP()
void CMusicSystemLock::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_value, indent);
@ -36,4 +43,25 @@ void CMusicSystemLock::load(SimpleFile *file) {
CDropTarget::load(file);
}
bool CMusicSystemLock::DropObjectMsg(CDropObjectMsg *msg) {
CTreeItem *key = msg->_item->findByName("Music System Key");
if (key) {
setVisible(true);
playMovie(MOVIE_NOTIFY_OBJECT);
}
return true;
}
bool CMusicSystemLock::MovieEndMsg(CMovieEndMsg *msg) {
CTreeItem *phonograph = findRoom()->findByName("Restaurant Phonograph");
CQueryPhonographState queryMsg;
queryMsg.execute(phonograph);
CLockPhonographMsg lockMsg(queryMsg._value);
lockMsg.execute(phonograph, nullptr, MSGFLAG_SCAN);
setVisible(false);
return true;
}
} // End of namespace Titanic

View File

@ -28,6 +28,9 @@
namespace Titanic {
class CMusicSystemLock : public CDropTarget {
DECLARE_MESSAGE_MAP;
bool DropObjectMsg(CDropObjectMsg *msg);
bool MovieEndMsg(CMovieEndMsg *msg);
private:
int _value;
public:

View File

@ -24,15 +24,20 @@
namespace Titanic {
BEGIN_MESSAGE_MAP(CMusicControl, CBackground)
ON_MESSAGE(MouseButtonDownMsg)
ON_MESSAGE(MouseDoubleClickMsg)
END_MESSAGE_MAP()
CMusicControl::CMusicControl() : CBackground(),
_fieldE0(0), _fieldE4(0), _fieldE8(1), _fieldEC(1) {
_controlArea(BELLS), _controlVal(0), _controlMax(1), _fieldEC(1) {
}
void CMusicControl::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_fieldE0, indent);
file->writeNumberLine(_fieldE4, indent);
file->writeNumberLine(_fieldE8, indent);
file->writeNumberLine(_controlArea, indent);
file->writeNumberLine(_controlVal, indent);
file->writeNumberLine(_controlMax, indent);
file->writeNumberLine(_fieldEC, indent);
CBackground::save(file, indent);
@ -40,12 +45,24 @@ void CMusicControl::save(SimpleFile *file, int indent) {
void CMusicControl::load(SimpleFile *file) {
file->readNumber();
_fieldE0 = file->readNumber();
_fieldE4 = file->readNumber();
_fieldE8 = file->readNumber();
_controlArea = (MusicControlArea)file->readNumber();
_controlVal = file->readNumber();
_controlMax = file->readNumber();
_fieldEC = file->readNumber();
CBackground::load(file);
}
bool CMusicControl::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
CMusicSettingChangedMsg changedMsg;
changedMsg.execute(this);
return true;
}
bool CMusicControl::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) {
CMusicSettingChangedMsg changedMsg;
changedMsg.execute(this);
return true;
}
} // End of namespace Titanic

View File

@ -24,14 +24,18 @@
#define TITANIC_MUSIC_CONTROL_H
#include "titanic/core/background.h"
#include "titanic/sound/music_room.h"
namespace Titanic {
class CMusicControl : public CBackground {
DECLARE_MESSAGE_MAP;
bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg);
public:
int _fieldE0;
int _fieldE4;
int _fieldE8;
MusicControlArea _controlArea;
int _controlVal;
int _controlMax;
int _fieldEC;
public:
CLASSDEF;

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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "titanic/gfx/music_slider_pitch.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CMusicSliderPitch, CMusicSlider)
ON_MESSAGE(MusicSettingChangedMsg)
ON_MESSAGE(EnterViewMsg)
ON_MESSAGE(QueryMusicControlSettingMsg)
END_MESSAGE_MAP()
void CMusicSliderPitch::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CMusicSlider::save(file, indent);
}
void CMusicSliderPitch::load(SimpleFile *file) {
file->readNumber();
CMusicSlider::load(file);
}
bool CMusicSliderPitch::MusicSettingChangedMsg(CMusicSettingChangedMsg *msg) {
if (_fieldEC) {
if (++_controlVal > _controlMax)
_controlVal = 0;
loadFrame(3 - _controlVal);
playSound("z#54.wav", 50);
} else {
playSound("z#46.wav");
}
return true;
}
bool CMusicSliderPitch::EnterViewMsg(CEnterViewMsg *msg) {
loadFrame(3 - _controlVal);
return true;
}
bool CMusicSliderPitch::QueryMusicControlSettingMsg(CQueryMusicControlSettingMsg *msg) {
msg->_value = _controlVal - 2;
return true;
}
} // End of namespace Titanic

View File

@ -28,24 +28,22 @@
namespace Titanic {
class CMusicSliderPitch : public CMusicSlider {
DECLARE_MESSAGE_MAP;
bool MusicSettingChangedMsg(CMusicSettingChangedMsg *msg);
bool EnterViewMsg(CEnterViewMsg *msg);
bool QueryMusicControlSettingMsg(CQueryMusicControlSettingMsg *msg);
public:
CLASSDEF;
/**
* Save the data for the class to file
*/
virtual void save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CMusicSlider::save(file, indent);
}
virtual void save(SimpleFile *file, int indent);
/**
* Load the data for the class from file
*/
virtual void load(SimpleFile *file) {
file->readNumber();
CMusicSlider::load(file);
}
virtual void load(SimpleFile *file);
};
} // 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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "titanic/gfx/music_slider_speed.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CMusicSliderSpeed, CMusicSlider)
ON_MESSAGE(MusicSettingChangedMsg)
ON_MESSAGE(EnterViewMsg)
ON_MESSAGE(QueryMusicControlSettingMsg)
END_MESSAGE_MAP()
void CMusicSliderSpeed::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CMusicSlider::save(file, indent);
}
void CMusicSliderSpeed::load(SimpleFile *file) {
file->readNumber();
CMusicSlider::load(file);
}
bool CMusicSliderSpeed::MusicSettingChangedMsg(CMusicSettingChangedMsg *msg) {
if (_fieldEC) {
if (++_controlVal > _controlMax)
_controlVal = 0;
loadFrame(3 - _controlVal);
playSound("z#54.wav", 50);
} else {
playSound("z#46.wav");
}
return true;
}
bool CMusicSliderSpeed::EnterViewMsg(CEnterViewMsg *msg) {
loadFrame(3 - _controlVal);
return true;
}
bool CMusicSliderSpeed::QueryMusicControlSettingMsg(CQueryMusicControlSettingMsg *msg) {
msg->_value = _controlVal - 1;
return true;
}
} // End of namespace Titanic

View File

@ -27,26 +27,24 @@
namespace Titanic {
class CMusicSliderSpeed : public CMusicSlider {
public:
CLASSDEF;
class CMusicSliderSpeed : public CMusicSlider {
DECLARE_MESSAGE_MAP;
bool MusicSettingChangedMsg(CMusicSettingChangedMsg *msg);
bool EnterViewMsg(CEnterViewMsg *msg);
bool QueryMusicControlSettingMsg(CQueryMusicControlSettingMsg *msg);
public:
CLASSDEF;
/**
* Save the data for the class to file
*/
virtual void save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CMusicSlider::save(file, indent);
}
/**
* Save the data for the class to file
*/
virtual void save(SimpleFile *file, int indent);
/**
* Load the data for the class from file
*/
virtual void load(SimpleFile *file) {
file->readNumber();
CMusicSlider::load(file);
}
};
/**
* Load the data for the class from file
*/
virtual void load(SimpleFile *file);
};
} // 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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "titanic/gfx/music_switch_inversion.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CMusicSwitchInversion, CMusicSwitch)
ON_MESSAGE(MusicSettingChangedMsg)
ON_MESSAGE(EnterViewMsg)
ON_MESSAGE(QueryMusicControlSettingMsg)
END_MESSAGE_MAP()
void CMusicSwitchInversion::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CMusicSwitch::save(file, indent);
}
void CMusicSwitchInversion::load(SimpleFile *file) {
file->readNumber();
CMusicSwitch::load(file);
}
bool CMusicSwitchInversion::MusicSettingChangedMsg(CMusicSettingChangedMsg *msg) {
if (_fieldEC) {
if (++_controlVal > _controlMax)
_controlVal = 0;
loadFrame(_controlVal);
playSound("z#59.wav", 50);
} else {
playSound("z#46.wav");
}
return true;
}
bool CMusicSwitchInversion::EnterViewMsg(CEnterViewMsg *msg) {
loadFrame(_controlVal);
return true;
}
bool CMusicSwitchInversion::QueryMusicControlSettingMsg(CQueryMusicControlSettingMsg *msg) {
msg->_value = _controlVal;
return true;
}
} // End of namespace Titanic

View File

@ -28,24 +28,22 @@
namespace Titanic {
class CMusicSwitchInversion : public CMusicSwitch {
DECLARE_MESSAGE_MAP;
bool MusicSettingChangedMsg(CMusicSettingChangedMsg *msg);
bool EnterViewMsg(CEnterViewMsg *msg);
bool QueryMusicControlSettingMsg(CQueryMusicControlSettingMsg *msg);
public:
CLASSDEF;
/**
* Save the data for the class to file
*/
virtual void save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CMusicSwitch::save(file, indent);
}
virtual void save(SimpleFile *file, int indent);
/**
* Load the data for the class from file
*/
virtual void load(SimpleFile *file) {
file->readNumber();
CMusicSwitch::load(file);
}
virtual void load(SimpleFile *file);
};
} // 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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "titanic/gfx/music_switch_reverse.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CMusicSwitchReverse, CMusicSwitch)
ON_MESSAGE(MusicSettingChangedMsg)
ON_MESSAGE(EnterViewMsg)
ON_MESSAGE(QueryMusicControlSettingMsg)
END_MESSAGE_MAP()
void CMusicSwitchReverse::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CMusicSwitch::save(file, indent);
}
void CMusicSwitchReverse::load(SimpleFile *file) {
file->readNumber();
CMusicSwitch::load(file);
}
bool CMusicSwitchReverse::MusicSettingChangedMsg(CMusicSettingChangedMsg *msg) {
if (_fieldEC) {
if (++_controlVal > _controlMax)
_controlVal = 0;
loadFrame(_controlVal);
playSound("z#59.wav", 50);
} else {
playSound("z#46.wav");
}
return true;
}
bool CMusicSwitchReverse::EnterViewMsg(CEnterViewMsg *msg) {
loadFrame(_controlVal);
return true;
}
bool CMusicSwitchReverse::QueryMusicControlSettingMsg(CQueryMusicControlSettingMsg *msg) {
msg->_value = _controlVal;
return true;
}
} // End of namespace Titanic

View File

@ -27,26 +27,24 @@
namespace Titanic {
class CMusicSwitchReverse : public CMusicSwitch {
public:
CLASSDEF;
class CMusicSwitchReverse : public CMusicSwitch {
DECLARE_MESSAGE_MAP;
bool MusicSettingChangedMsg(CMusicSettingChangedMsg *msg);
bool EnterViewMsg(CEnterViewMsg *msg);
bool QueryMusicControlSettingMsg(CQueryMusicControlSettingMsg *msg);
public:
CLASSDEF;
/**
* Save the data for the class to file
*/
virtual void save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CMusicSwitch::save(file, indent);
}
/**
* Save the data for the class to file
*/
virtual void save(SimpleFile *file, int indent);
/**
* Load the data for the class from file
*/
virtual void load(SimpleFile *file) {
file->readNumber();
CMusicSwitch::load(file);
}
};
/**
* Load the data for the class from file
*/
virtual void load(SimpleFile *file);
};
} // End of namespace Titanic

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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "titanic/gfx/music_voice_mute.h"
#include "titanic/sound/music_room.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CMusicVoiceMute, CMusicControl)
ON_MESSAGE(MusicSettingChangedMsg)
ON_MESSAGE(EnterViewMsg)
ON_MESSAGE(QueryMusicControlSettingMsg)
END_MESSAGE_MAP()
bool CMusicVoiceMute::MusicSettingChangedMsg(CMusicSettingChangedMsg *msg) {
if (++_controlVal > _controlMax)
_controlVal = 0;
CMusicRoom *musicRoom = getMusicRoom();
musicRoom->setItem5(_controlArea, _controlVal == 1 ? 1 : 0);
loadFrame(1 - _controlVal);
playSound("z#55.wav", 50);
return true;
}
bool CMusicVoiceMute::EnterViewMsg(CEnterViewMsg *msg) {
loadFrame(1 - _controlVal);
CMusicRoom *musicRoom = getMusicRoom();
musicRoom->setItem5(_controlArea, _controlVal == 1 ? 1 : 0);
return true;
}
bool CMusicVoiceMute::QueryMusicControlSettingMsg(CQueryMusicControlSettingMsg *msg) {
msg->_value = _controlVal;
return true;
}
} // End of namespace Titanic

View File

@ -28,6 +28,10 @@
namespace Titanic {
class CMusicVoiceMute : public CMusicControl {
DECLARE_MESSAGE_MAP;
bool MusicSettingChangedMsg(CMusicSettingChangedMsg *msg);
bool EnterViewMsg(CEnterViewMsg *msg);
bool QueryMusicControlSettingMsg(CQueryMusicControlSettingMsg *msg);
public:
CLASSDEF;

View File

@ -306,7 +306,7 @@ MESSAGE2(CSignalObject, CString, strValue, "", int, numValue, 0);
MESSAGE2(CSpeechFallsFromTreeMsg, int, value1, 0, int, value2, 0);
MESSAGE1(CStartMusicMsg, CMusicPlayer *, musicPlayer, (CMusicPlayer *)nullptr);
MESSAGE3(CStatusChangeMsg, int, oldStatus, 0, int, newStatus, 0, bool, success, false);
MESSAGE1(CStopMusicMsg, int, value, 0);
MESSAGE1(CStopMusicMsg, CMusicPlayer *, musicPlayer, (CMusicPlayer *)nullptr);
MESSAGE4(CSubAcceptCCarryMsg, CString, string1, "", int, value1, 0, int, value2, 0, CCarry *, item, nullptr);
MESSAGE0(CSubDeliverCCarryMsg);
MESSAGE0(CSubSendCCarryMsg);

View File

@ -294,7 +294,12 @@ MODULE_OBJS := \
gfx/move_object_button.o \
gfx/music_control.o \
gfx/music_slider.o \
gfx/music_slider_pitch.o \
gfx/music_slider_speed.o \
gfx/music_switch.o \
gfx/music_switch_inversion.o \
gfx/music_switch_reverse.o \
gfx/music_voice_mute.o \
gfx/send_to_succ.o \
gfx/sgt_selector.o \
gfx/slider_button.o \

View File

@ -24,29 +24,37 @@
namespace Titanic {
BEGIN_MESSAGE_MAP(CMultiMove, CMovePlayerTo)
ON_MESSAGE(MouseButtonDownMsg)
END_MESSAGE_MAP()
CMultiMove::CMultiMove() : CMovePlayerTo() {
}
void CMultiMove::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeQuotedLine(_string1, indent);
file->writeQuotedLine(_string2, indent);
file->writeQuotedLine(_string3, indent);
file->writeQuotedLine(_string4, indent);
file->writeQuotedLine(_string5, indent);
for (int idx = 0; idx < 5; ++idx)
file->writeQuotedLine(_viewNames[idx], indent);
CMovePlayerTo::save(file, indent);
}
void CMultiMove::load(SimpleFile *file) {
file->readNumber();
_string1 = file->readString();
_string2 = file->readString();
_string3 = file->readString();
_string5 = file->readString();
_string4 = file->readString();
for (int idx = 0; idx < 5; ++idx)
_viewNames[idx] = file->readString();
CMovePlayerTo::load(file);
}
bool CMultiMove::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
lockMouse();
for (int idx = 0; idx < 5 && _viewNames[idx] != "NULL"; ++idx)
changeView(_viewNames[idx]);
unlockMouse();
return true;
}
} // End of namespace Titanic

View File

@ -28,12 +28,10 @@
namespace Titanic {
class CMultiMove : public CMovePlayerTo {
DECLARE_MESSAGE_MAP;
bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
private:
CString _string1;
CString _string2;
CString _string3;
CString _string4;
CString _string5;
CString _viewNames[5];
public:
CLASSDEF;
CMultiMove();

View File

@ -31,6 +31,8 @@ namespace Titanic {
class CGameManager;
class CSound;
enum MusicControlArea { BELLS = 0, SNAKE = 1, PIANO = 2, BASS = 3 };
class CMusicRoom {
struct Entry {
uint _val1;
@ -62,11 +64,11 @@ public:
*/
void destroyMusicHandler();
void setItem1(int index, int val) { _items[index]._val1 = val; }
void setItem2(int index, int val) { _items[index]._val2 = val; }
void setItem3(int index, int val) { _items[index]._val3 = val; }
void setItem4(int index, int val) { _items[index]._val4 = val; }
void setItem5(int index, int val) { _items[index]._val5 = val; }
void setItem1(MusicControlArea index, int val) { _items[index]._val1 = val; }
void setItem2(MusicControlArea index, int val) { _items[index]._val2 = val; }
void setItem3(MusicControlArea index, int val) { _items[index]._val3 = val; }
void setItem4(MusicControlArea index, int val) { _items[index]._val4 = val; }
void setItem5(MusicControlArea index, int val) { _items[index]._val5 = val; }
/**
* Start playing a given music number