1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
/* 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/carry/phonograph_cylinder.h"
#include "titanic/game/phonograph.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(false),
_bellsSpeedControl(false), _bellsDirectionControl(false),
_bellsInversionControl(false), _snakeMuteControl(false),
_snakeSpeedControl(false), _snakePitchControl(false),
_snakeInversionControl(false), _snakeDirectionControl(false),
_pianoMuteControl(false), _pianoSpeedControl(false),
_pianoPitchControl(false), _pianoInversionControl(false),
_pianoDirectionControl(false), _bassMuteControl(false),
_bassSpeedControl(false), _bassPitchControl(false),
_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 = static_cast<CPhonograph *>(msg->_other);
if (phonograph) {
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;
return true;
}
bool CPhonographCylinder::SetMusicControlsMsg(CSetMusicControlsMsg *msg) {
if (_itemName.left(7) == "STMusic") {
//todo
warning("TODO");
}
return true;
}
bool CPhonographCylinder::ErasePhonographCylinderMsg(CErasePhonographCylinderMsg *msg) {
_itemName.clear();
return true;
}
} // End of namespace Titanic
|