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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
|
/* 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/npcs/titania.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CTitania, CCharacter)
ON_MESSAGE(AddHeadPieceMsg)
ON_MESSAGE(TakeHeadPieceMsg)
ON_MESSAGE(ActMsg)
ON_MESSAGE(EnterViewMsg)
ON_MESSAGE(TimerMsg)
END_MESSAGE_MAP()
CTitania::CTitania() : CCharacter() {
_speechCentre = false;
_olfactoryCentre = false;
_centralCore = false;
_visionCentre = false;
_eye1 = false;
_eye2 = false;
_ear1 = false;
_ear2 = false;
_nose = false;
_mouth = false;
_showIntro = true;
}
void CTitania::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_speechCentre, indent);
file->writeNumberLine(_olfactoryCentre, indent);
file->writeNumberLine(_auditoryCentre, indent);
file->writeNumberLine(_centralCore, indent);
file->writeNumberLine(_visionCentre, indent);
file->writeNumberLine(_eye1, indent);
file->writeNumberLine(_eye2, indent);
file->writeNumberLine(_ear1, indent);
file->writeNumberLine(_ear2, indent);
file->writeNumberLine(_nose, indent);
file->writeNumberLine(_mouth, indent);
file->writeNumberLine(_showIntro, indent);
CCharacter::save(file, indent);
}
void CTitania::load(SimpleFile *file) {
file->readNumber();
_speechCentre = file->readNumber();
_olfactoryCentre = file->readNumber();
_auditoryCentre = file->readNumber();
_centralCore = file->readNumber();
_visionCentre = file->readNumber();
_eye1 = file->readNumber();
_eye2 = file->readNumber();
_ear1 = file->readNumber();
_ear2 = file->readNumber();
_nose = file->readNumber();
_mouth = file->readNumber();
_showIntro = file->readNumber();
CCharacter::load(file);
}
bool CTitania::AddHeadPieceMsg(CAddHeadPieceMsg *msg) {
if (msg->_value == "VisionCentre") {
_visionCentre = true;
} else if (msg->_value == "AuditoryCentre") {
_auditoryCentre = true;
} else if (msg->_value == "OlfactoryCentre") {
_olfactoryCentre = true;
} else if (msg->_value == "SpeechCentre") {
_speechCentre = true;
} else if (msg->_value == "CentralCore") {
_centralCore = true;
} else if (msg->_value == "Eye1") {
_eye1 = true;
} else if (msg->_value == "Eye2") {
_eye2 = true;
} else if (msg->_value == "Ear1") {
_ear1 = true;
} else if (msg->_value == "Ear2") {
_ear2 = true;
} else if (msg->_value == "Mouth") {
_mouth = true;
} else if (msg->_value == "Nose") {
_nose = true;
}
CActMsg actMsg("CheckHead");
actMsg.execute(this);
return true;
}
bool CTitania::TakeHeadPieceMsg(CTakeHeadPieceMsg *msg) {
if (msg->_value == "VisionCentre") {
_visionCentre = false;
} else if (msg->_value == "AuditoryCentre") {
_auditoryCentre = false;
} else if (msg->_value == "OlfactoryCentre") {
_olfactoryCentre = false;
} else if (msg->_value == "SpeechCentre") {
_speechCentre = false;
} else if (msg->_value == "CentralCore") {
_centralCore = false;
} else if (msg->_value == "Eye1") {
_eye1 = false;
} else if (msg->_value == "Eye2") {
_eye2 = false;
} else if (msg->_value == "Ear1") {
_ear1 = false;
} else if (msg->_value == "Ear2") {
_ear2 = false;
} else if (msg->_value == "Mouth") {
_mouth = false;
} else if (msg->_value == "Nose") {
_nose = false;
}
CActMsg actMsg("CheckHead");
actMsg.execute(this);
return true;
}
bool CTitania::ActMsg(CActMsg *msg) {
if (msg->_action == "SleepTitania") {
setVisible(true);
playCutscene(52, 104);
playSound("z#47.wav", 100);
changeView("Titania.Node 7.S", "");
petShow();
enableMouse();
CSetFrameMsg frameMsg;
frameMsg.execute("Bomb");
} else if (msg->_action == "CheckHead") {
CSenseWorkingMsg workingMsg1("Not Working");
CSenseWorkingMsg workingMsg2("Not Working");
CSenseWorkingMsg workingMsg3("Not Working");
CSenseWorkingMsg workingMsg4("Not Working");
if (_eye1 && _eye2) {
workingMsg1._value = _visionCentre ? "Working" : "Random";
}
if (_ear1 && _ear2) {
workingMsg2._value = _auditoryCentre ? "Working" : "Random";
}
if (_nose) {
workingMsg4._value = _olfactoryCentre ? "Working" : "Random";
}
if (_mouth) {
workingMsg3._value = _speechCentre ? "Working" : "Random";
}
if (_centralCore && _eye1 && _eye2 && _ear1 && _ear2 && _nose && _mouth
&& _speechCentre && _olfactoryCentre && _auditoryCentre) {
playSound("z#47.wav");
CActMsg actMsg("Woken");
actMsg.execute("MouthSlot");
actMsg.execute("VisionCentreSlot");
setPassengerClass(UNCHECKED);
addTimer(1000);
} else {
workingMsg1.execute("Eye1Slot");
workingMsg1.execute("Eye2Slot");
workingMsg2.execute("Ear1Slot");
workingMsg2.execute("Ear2Slot");
workingMsg3.execute("MouthSlot");
workingMsg4.execute("NoseSlot");
}
}
return true;
}
bool CTitania::EnterViewMsg(CEnterViewMsg *msg) {
if (_showIntro) {
_showIntro = false;
disableMouse();
petHide();
CSetFrameMsg frameMsg;
frameMsg._frameNumber = 25;
frameMsg.execute("Bomb");
playCutscene(0, 52);
setVisible(false);
CActMsg actMsg("TitaniaSpeech");
actMsg.execute("TitaniaSpeech");
}
return true;
}
bool CTitania::TimerMsg(CTimerMsg *msg) {
changeView("Titania.Node 18.N", "");
startTalking("PerchedParrot", 80022);
return true;
}
} // End of namespace Titanic
|