[Scummvm-cvs-logs] scummvm master -> 5b8fdfe366b9acb2fd1d80cd0839e2af61238f08
dreammaster
dreammaster at scummvm.org
Tue Aug 9 05:19:50 CEST 2016
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5b8fdfe366 TITANIC: Implemented more sound classes
Commit: 5b8fdfe366b9acb2fd1d80cd0839e2af61238f08
https://github.com/scummvm/scummvm/commit/5b8fdfe366b9acb2fd1d80cd0839e2af61238f08
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-08T23:19:42-04:00
Commit Message:
TITANIC: Implemented more sound classes
Changed paths:
engines/titanic/core/game_object.cpp
engines/titanic/core/game_object.h
engines/titanic/sound/bird_song.cpp
engines/titanic/sound/bird_song.h
engines/titanic/sound/dome_from_top_of_well.cpp
engines/titanic/sound/dome_from_top_of_well.h
engines/titanic/sound/enter_view_toggles_other_music.cpp
engines/titanic/sound/enter_view_toggles_other_music.h
engines/titanic/sound/trigger_auto_music_player.cpp
engines/titanic/sound/trigger_auto_music_player.h
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index c7742cb..95ebe6a 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -1248,6 +1248,19 @@ CRoomItem *CGameObject::getHiddenRoom() const {
return root ? root->findHiddenRoom() : nullptr;
}
+CRoomItem *CGameObject::locateRoom(const CString &name) const {
+ if (name.empty())
+ return nullptr;
+
+ CProjectItem *project = getRoot();
+ for (CRoomItem *room = project->findFirstRoom(); room; room = project->findNextRoom(room)) {
+ if (!room->getName().compareToIgnoreCase(name))
+ return room;
+ }
+
+ return nullptr;
+}
+
CGameObject *CGameObject::getHiddenObject(const CString &name) const {
CRoomItem *room = getHiddenRoom();
return room ? static_cast<CGameObject *>(findUnder(room, name)) : nullptr;
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index bcfc989..322b626 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -393,6 +393,11 @@ protected:
CRoomItem *getHiddenRoom() const;
/**
+ * Locates a room with the given name
+ */
+ CRoomItem *locateRoom(const CString &name) const;
+
+ /**
* Scan the specified room for an item by name
*/
CTreeItem *findUnder(CTreeItem *parent, const CString &name) const;
diff --git a/engines/titanic/sound/bird_song.cpp b/engines/titanic/sound/bird_song.cpp
index 7f7d0ad..53a25e2 100644
--- a/engines/titanic/sound/bird_song.cpp
+++ b/engines/titanic/sound/bird_song.cpp
@@ -24,16 +24,33 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CBirdSong, CAutoSoundPlayer)
+ ON_MESSAGE(TurnOn)
+ ON_MESSAGE(SignalObject)
+END_MESSAGE_MAP()
+
void CBirdSong::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeNumberLine(_value, indent);
+ file->writeNumberLine(_flag, indent);
CRoomAutoSoundPlayer::save(file, indent);
}
void CBirdSong::load(SimpleFile *file) {
file->readNumber();
- _value = file->readNumber();
+ _flag = file->readNumber();
CRoomAutoSoundPlayer::load(file);
}
+bool CBirdSong::TurnOn(CTurnOn *msg) {
+ if (!_flag)
+ CAutoSoundPlayer::TurnOn(msg);
+ return true;
+}
+
+bool CBirdSong::SignalObject(CSignalObject *msg) {
+ _flag = true;
+ CAutoSoundPlayer::SignalObject(msg);
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/sound/bird_song.h b/engines/titanic/sound/bird_song.h
index 35758e5..52af94b 100644
--- a/engines/titanic/sound/bird_song.h
+++ b/engines/titanic/sound/bird_song.h
@@ -28,11 +28,14 @@
namespace Titanic {
class CBirdSong : public CRoomAutoSoundPlayer {
+ DECLARE_MESSAGE_MAP;
+ bool TurnOn(CTurnOn *msg);
+ bool SignalObject(CSignalObject *msg);
public:
- int _value;
+ bool _flag;
public:
CLASSDEF;
- CBirdSong() : CRoomAutoSoundPlayer(), _value(0) {}
+ CBirdSong() : CRoomAutoSoundPlayer(), _flag(false) {}
/**
* Save the data for the class to file
diff --git a/engines/titanic/sound/dome_from_top_of_well.cpp b/engines/titanic/sound/dome_from_top_of_well.cpp
index 3721b9f..789d7fa 100644
--- a/engines/titanic/sound/dome_from_top_of_well.cpp
+++ b/engines/titanic/sound/dome_from_top_of_well.cpp
@@ -26,6 +26,14 @@ namespace Titanic {
EMPTY_MESSAGE_MAP(CDomeFromTopOfWell, CViewAutoSoundPlayer);
+CDomeFromTopOfWell::CDomeFromTopOfWell() : CViewAutoSoundPlayer() {
+ _filename = "z#227.wav";
+ _volume = 25;
+ _repeated = true;
+ _stopSeconds = 1;
+ _startSeconds = 1;
+}
+
void CDomeFromTopOfWell::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CViewAutoSoundPlayer::save(file, indent);
diff --git a/engines/titanic/sound/dome_from_top_of_well.h b/engines/titanic/sound/dome_from_top_of_well.h
index e3d2877..001f66a 100644
--- a/engines/titanic/sound/dome_from_top_of_well.h
+++ b/engines/titanic/sound/dome_from_top_of_well.h
@@ -31,6 +31,7 @@ class CDomeFromTopOfWell : public CViewAutoSoundPlayer {
DECLARE_MESSAGE_MAP;
public:
CLASSDEF;
+ CDomeFromTopOfWell();
/**
* Save the data for the class to file
diff --git a/engines/titanic/sound/enter_view_toggles_other_music.cpp b/engines/titanic/sound/enter_view_toggles_other_music.cpp
index 0b14999..2f0091a 100644
--- a/engines/titanic/sound/enter_view_toggles_other_music.cpp
+++ b/engines/titanic/sound/enter_view_toggles_other_music.cpp
@@ -24,21 +24,37 @@
namespace Titanic {
-CEnterViewTogglesOtherMusic::CEnterViewTogglesOtherMusic() : CTriggerAutoMusicPlayer(), _fieldC8(0) {
+BEGIN_MESSAGE_MAP(CEnterViewTogglesOtherMusic, CTriggerAutoMusicPlayer)
+ ON_MESSAGE(EnterViewMsg)
+END_MESSAGE_MAP()
+
+CEnterViewTogglesOtherMusic::CEnterViewTogglesOtherMusic() :
+ CTriggerAutoMusicPlayer(), _value(2) {
}
void CEnterViewTogglesOtherMusic::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeNumberLine(_fieldC8, indent);
+ file->writeNumberLine(_value, indent);
CTriggerAutoMusicPlayer::save(file, indent);
}
void CEnterViewTogglesOtherMusic::load(SimpleFile *file) {
file->readNumber();
- _fieldC8 = file->readNumber();
+ _value = file->readNumber();
CTriggerAutoMusicPlayer::load(file);
}
+bool CEnterViewTogglesOtherMusic::EnterViewMsg(CEnterViewMsg *msg) {
+ CViewItem *view = findView();
+ if (view == msg->_newView) {
+ CTriggerAutoMusicPlayerMsg triggerMsg;
+ triggerMsg._value = _value;
+ triggerMsg.execute(this);
+ }
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/sound/enter_view_toggles_other_music.h b/engines/titanic/sound/enter_view_toggles_other_music.h
index 6bbeea4..a91b1e1 100644
--- a/engines/titanic/sound/enter_view_toggles_other_music.h
+++ b/engines/titanic/sound/enter_view_toggles_other_music.h
@@ -28,8 +28,10 @@
namespace Titanic {
class CEnterViewTogglesOtherMusic : public CTriggerAutoMusicPlayer {
+ DECLARE_MESSAGE_MAP;
+ bool EnterViewMsg(CEnterViewMsg *msg);
protected:
- int _fieldC8;
+ int _value;
public:
CLASSDEF;
CEnterViewTogglesOtherMusic();
diff --git a/engines/titanic/sound/trigger_auto_music_player.cpp b/engines/titanic/sound/trigger_auto_music_player.cpp
index 21050e0..a332570 100644
--- a/engines/titanic/sound/trigger_auto_music_player.cpp
+++ b/engines/titanic/sound/trigger_auto_music_player.cpp
@@ -21,19 +21,41 @@
*/
#include "titanic/sound/trigger_auto_music_player.h"
+#include "titanic/sound/auto_music_player.h"
+#include "titanic/core/room_item.h"
namespace Titanic {
+BEGIN_MESSAGE_MAP(CTriggerAutoMusicPlayer, CGameObject)
+ ON_MESSAGE(TriggerAutoMusicPlayerMsg)
+END_MESSAGE_MAP()
+
void CTriggerAutoMusicPlayer::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeQuotedLine(_fieldBC, indent);
+ file->writeQuotedLine(_roomName, indent);
CGameObject::save(file, indent);
}
void CTriggerAutoMusicPlayer::load(SimpleFile *file) {
file->readNumber();
- _fieldBC = file->readString();
+ _roomName = file->readString();
CGameObject::load(file);
}
+bool CTriggerAutoMusicPlayer::TriggerAutoMusicPlayerMsg(CTriggerAutoMusicPlayerMsg *msg) {
+ CRoomItem *room1 = msg->_value == 1 ? locateRoom(_roomName) : findRoom();
+ CRoomItem *room2 = msg->_value == 2 ? locateRoom(_roomName) : findRoom();
+
+ CChangeMusicMsg changeMsg;
+ changeMsg._flags = 1;
+ changeMsg.execute(room1, CAutoMusicPlayer::_type,
+ MSGFLAG_CLASS_DEF | MSGFLAG_BREAK_IF_HANDLED | MSGFLAG_SCAN);
+
+ changeMsg._flags = 2;
+ changeMsg.execute(room2, CAutoMusicPlayer::_type,
+ MSGFLAG_CLASS_DEF | MSGFLAG_BREAK_IF_HANDLED | MSGFLAG_SCAN);
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/sound/trigger_auto_music_player.h b/engines/titanic/sound/trigger_auto_music_player.h
index 537e780..45631e0 100644
--- a/engines/titanic/sound/trigger_auto_music_player.h
+++ b/engines/titanic/sound/trigger_auto_music_player.h
@@ -28,8 +28,10 @@
namespace Titanic {
class CTriggerAutoMusicPlayer : public CGameObject {
+ DECLARE_MESSAGE_MAP;
+ bool TriggerAutoMusicPlayerMsg(CTriggerAutoMusicPlayerMsg *msg);
protected:
- CString _fieldBC;
+ CString _roomName;
public:
CLASSDEF;
More information about the Scummvm-git-logs
mailing list