From 9a71c9166b1ef8c7d0e57cfdfac6eb25f5332c69 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Aug 2016 22:13:04 -0400 Subject: TITANIC: Implemented more game classes and music widget classes --- engines/titanic/gfx/music_switch_reverse.cpp | 66 ++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 engines/titanic/gfx/music_switch_reverse.cpp (limited to 'engines/titanic/gfx/music_switch_reverse.cpp') diff --git a/engines/titanic/gfx/music_switch_reverse.cpp b/engines/titanic/gfx/music_switch_reverse.cpp new file mode 100644 index 0000000000..9fe6d51d47 --- /dev/null +++ b/engines/titanic/gfx/music_switch_reverse.cpp @@ -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 -- cgit v1.2.3