1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #include "common/textconsole.h"
24 #include "titanic/true_talk/liftbot_script.h"
25 #include "titanic/true_talk/true_talk_manager.h"
26 #include "titanic/titanic.h"
27 #include "titanic/translation.h"
28 
29 namespace Titanic {
30 
31 int LiftbotScript::_stateIndex;
32 
33 static const int STATE_ARRAY_EN[7] = {
34 	30910, 30912, 30913, 30914, 30915, 30916, 30917
35 };
36 static const int STATE_ARRAY_DE[7] = {
37 	30919, 30921, 30922, 30923, 30924, 30925, 30926
38 };
39 
LiftbotScript(int val1,const char * charClass,int v2,const char * charName,int v3,int val2,int v4,int v5,int v6,int v7)40 LiftbotScript::LiftbotScript(int val1, const char *charClass, int v2,
41 		const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) :
42 		TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {
43 	_stateIndex = 0;
44 
45 	loadRanges("Ranges/Liftbot");
46 	loadResponses("Responses/Liftbot");
47 	setupSentences();
48 	_tagMappings.load("TagMap/Liftbot");
49 	_words.load("Words/Liftbot");
50 	_quotes.load("Quotes/Liftbot");
51 	_states.load("States/Liftbot");
52 }
53 
setupSentences()54 void LiftbotScript::setupSentences() {
55 	CTrueTalkManager::setFlags(27, 0);
56 	setupDials(getRandomNumber(40) + 60, getRandomNumber(40) + 60, 0);
57 
58 	_mappings.load("Mappings/Liftbot", 4);
59 	_entries.load("Sentences/Liftbot");
60 	_field68 = 0;
61 	_entryCount = 0;
62 }
63 
chooseResponse(const TTroomScript * roomScript,const TTsentence * sentence,uint tag)64 int LiftbotScript::chooseResponse(const TTroomScript *roomScript, const TTsentence *sentence, uint tag) {
65 	switch (tag) {
66 	case MKTAG('D', 'N', 'A', '1'):
67 	case MKTAG('H', 'H', 'G', 'Q'):
68 	case MKTAG('A', 'N', 'S', 'W'):
69 		if (_stateIndex >= 7) {
70 			selectResponse(TRANSLATE(30918, 30927));
71 			setState(2);
72 			_stateIndex = 0;
73 		} else {
74 			addResponse(TRANSLATE(STATE_ARRAY_EN[_stateIndex++],
75 				STATE_ARRAY_DE[_stateIndex++]));
76 		}
77 
78 		applyResponse();
79 		return 2;
80 
81 	case MKTAG('O', 'R', 'D', '8'):
82 		addResponse(TRANSLATE(30475, 30484));
83 		addResponse(TRANSLATE(30467, 30476));
84 		addResponse(TRANSLATE(30466, 30475));
85 		addResponse(TRANSLATE(30474, 30483));
86 		applyResponse();
87 		return SS_2;
88 
89 	default:
90 		return TTnpcScript::chooseResponse(roomScript, sentence, tag);
91 	}
92 }
93 
process(const TTroomScript * roomScript,const TTsentence * sentence)94 int LiftbotScript::process(const TTroomScript *roomScript, const TTsentence *sentence) {
95 	if (roomScript->_scriptId != 103)
96 		return 2;
97 
98 	checkItems(roomScript, sentence);
99 	int currState = getState();
100 	int sentMode = sentence->_category;
101 	TTtreeResult treeResult[32];
102 
103 	if (currState) {
104 		setState(0);
105 		bool flag1 = sentMode == 11 || sentMode == 13;
106 		bool flag2 = sentMode == 12;
107 
108 		switch (currState) {
109 		case 2:
110 			if (flag1)
111 				return addDialogueAndState(TRANSLATE(30920, 30929), 3);
112 			if (flag2)
113 				return addDialogueAndState(TRANSLATE(30919, 30928), 1);
114 			break;
115 
116 		case 3:
117 			if (flag1)
118 				return addDialogueAndState(TRANSLATE(30919, 30928), 1);
119 			break;
120 
121 		case 4:
122 			return addDialogueAndState(getDialogueId(210391), 1);
123 
124 		case 5:
125 			if (sentence->contains("reborzo") || sentence->contains("is that"))
126 				return addDialogueAndState(TRANSLATE(30515, 30524), 1);
127 			break;
128 
129 		case 6:
130 			if (sentMode == 6)
131 				return addDialogueAndState(getDialogueId(210771), 1);
132 			break;
133 
134 		case 7:
135 		case 8:
136 			if (sentMode == 6 || sentMode == 10)
137 				return addDialogueAndState(getDialogueId(210099), 1);
138 			break;
139 
140 		case 9:
141 			if (sentMode == 10 || g_vm->_trueTalkManager->_quotesTree.search(
142 				sentence->_normalizedLine.c_str(), TREE_2, &treeResult[0], 0, 0) != -1)
143 				return addDialogueAndState(getDialogueId(210970), 9);
144 			break;
145 
146 		default:
147 			break;
148 		}
149 	}
150 
151 	updateCurrentDial(true);
152 	if (processEntries(&_entries, _entryCount, roomScript, sentence) == 2)
153 		return 2;
154 
155 	if (sentence->localWord("injury") || sentence->localWord("illness")) {
156 		addResponse(getDialogueId(210059));
157 		applyResponse();
158 	} else if (processEntries(_defaultEntries, 0, roomScript, sentence) != 2
159 			&& !defaultProcess(roomScript, sentence)
160 			&& !sentence1(sentence)) {
161 		if (getDialRegion(1) != 0 && getRandomNumber(100) <= 20) {
162 			addResponse(getDialogueId(210906));
163 			addResponse(getDialogueId(210901));
164 		} else {
165 			addResponse(getDialogueId(210590));
166 		}
167 		applyResponse();
168 	}
169 
170 	return 2;
171 }
172 
scriptChanged(uint id)173 ScriptChangedResult LiftbotScript::scriptChanged(uint id) {
174 	return scriptChanged(nullptr, id);
175 }
176 
scriptChanged(const TTroomScript * roomScript,uint id)177 ScriptChangedResult LiftbotScript::scriptChanged(const TTroomScript *roomScript, uint id) {
178 	switch (id) {
179 	case 3:
180 		if (getValue(27) == 0) {
181 			addResponse(getDialogueId(210018));
182 		} else if (getStateValue()) {
183 			addResponse(getDialogueId(210682));
184 		} else {
185 			addResponse(getDialogueId(210033));
186 		}
187 		CTrueTalkManager::setFlags(27, 1);
188 		applyResponse();
189 		break;
190 
191 	case 155:
192 		selectResponse(TRANSLATE(30446, 30455));
193 		applyResponse();
194 		break;
195 
196 	case 156:
197 		if (getCurrentFloor() == 1) {
198 			addResponse(getDialogueId(210614));
199 		} else {
200 			selectResponse(TRANSLATE(30270, 30272));
201 		}
202 		applyResponse();
203 		break;
204 
205 	default:
206 		break;
207 	}
208 
209 	if (id >= 210000 && id <= (uint)TRANSLATE(211001, 211003)) {
210 		addResponse(getDialogueId(id));
211 		applyResponse();
212 	}
213 
214 	return SCR_2;
215 }
216 
handleQuote(const TTroomScript * roomScript,const TTsentence * sentence,uint tag1,uint tag2,uint remainder)217 int LiftbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence *sentence,
218 		uint tag1, uint tag2, uint remainder) {
219 	switch (tag2) {
220 	case MKTAG('A', 'D', 'V', 'T'):
221 	case MKTAG('A', 'R', 'T', 'I'):
222 	case MKTAG('A', 'R', 'T', 'Y'):
223 	case MKTAG('B', 'R', 'N', 'D'):
224 	case MKTAG('C', 'O', 'M', 'D'):
225 	case MKTAG('D', 'N', 'C', 'E'):
226 	case MKTAG('H', 'B', 'B', 'Y'):
227 	case MKTAG('L', 'I', 'T', 'R'):
228 	case MKTAG('M', 'A', 'G', 'S'):
229 	case MKTAG('M', 'C', 'P', 'Y'):
230 	case MKTAG('M', 'I', 'N', 'S'):
231 	case MKTAG('M', 'U', 'S', 'I'):
232 	case MKTAG('N', 'I', 'K', 'E'):
233 	case MKTAG('S', 'F', 'S', 'F'):
234 	case MKTAG('S', 'O', 'A', 'P'):
235 	case MKTAG('S', 'O', 'N', 'G'):
236 	case MKTAG('S', 'P', 'R', 'T'):
237 	case MKTAG('T', 'E', 'A', 'M'):
238 	case MKTAG('T', 'V', 'S', 'H'):
239 	case MKTAG('W', 'W', 'E', 'B'):
240 		tag2 = MKTAG('E', 'N', 'T', 'N');
241 		break;
242 	case MKTAG('A', 'C', 'T', 'R'):
243 	case MKTAG('A', 'C', 'T', 'S'):
244 	case MKTAG('A', 'U', 'T', 'H'):
245 	case MKTAG('B', 'A', 'R', 'K'):
246 	case MKTAG('B', 'A', 'R', 'U'):
247 	case MKTAG('B', 'L', 'F', '1'):
248 	case MKTAG('B', 'L', 'F', '2'):
249 	case MKTAG('B', 'L', 'R', '1'):
250 	case MKTAG('B', 'L', 'R', '2'):
251 	case MKTAG('B', 'L', 'P', '1'):
252 	case MKTAG('B', 'L', 'P', '2'):
253 	case MKTAG('B', 'L', 'P', '3'):
254 	case MKTAG('B', 'L', 'P', '4'):
255 	case MKTAG('B', 'L', 'T', '1'):
256 	case MKTAG('B', 'L', 'T', '2'):
257 	case MKTAG('B', 'L', 'T', '3'):
258 	case MKTAG('B', 'L', 'T', '4'):
259 	case MKTAG('B', 'L', 'T', '5'):
260 	case MKTAG('B', 'O', 'Y', 'S'):
261 	case MKTAG('C', 'O', 'P', 'S'):
262 	case MKTAG('D', 'C', 'T', 'R'):
263 	case MKTAG('F', 'A', 'M', 'E'):
264 	case MKTAG('F', 'A', 'S', 'H'):
265 	case MKTAG('G', 'I', 'R', 'L'):
266 	case MKTAG('H', 'E', 'R', 'O'):
267 	case MKTAG('H', 'O', 'S', 'T'):
268 	case MKTAG('K', 'N', 'O', 'B'):
269 	case MKTAG('N', 'H', 'R', 'O'):
270 	case MKTAG('R', 'A', 'C', 'E'):
271 	case MKTAG('S', 'C', 'I', 'T'):
272 	case MKTAG('T', 'D', 'V', 'P'):
273 	case MKTAG('T', 'W', 'A', 'T'):
274 	case MKTAG('W', 'E', 'A', 'T'):
275 		tag2 = MKTAG('P', 'R', 'S', 'N');
276 		break;
277 	case MKTAG('C', 'H', 'S', 'E'):
278 	case MKTAG('C', 'M', 'N', 'T'):
279 	case MKTAG('F', 'I', 'L', 'M'):
280 	case MKTAG('J', 'F', 'O', 'D'):
281 	case MKTAG('L', 'I', 'Q', 'D'):
282 		tag2 = MKTAG('F', 'O', 'O', 'D');
283 		break;
284 	case MKTAG('C', 'R', 'I', 'M'):
285 	case MKTAG('C', 'S', 'P', 'Y'):
286 	case MKTAG('D', 'R', 'U', 'G'):
287 		tag2 = MKTAG('V', 'B', 'A', 'D');
288 		break;
289 	case MKTAG('E', 'A', 'R', 'T'):
290 	case MKTAG('H', 'O', 'M', 'E'):
291 	case MKTAG('N', 'P', 'L', 'C'):
292 	case MKTAG('P', 'L', 'A', 'N'):
293 		tag2 = MKTAG('P', 'L', 'A', 'C');
294 		break;
295 	case MKTAG('F', 'A', 'U', 'N'):
296 	case MKTAG('F', 'I', 'S', 'H'):
297 	case MKTAG('F', 'L', 'O', 'R'):
298 		tag2 = MKTAG('N', 'A', 'T', 'R');
299 		break;
300 	case MKTAG('H', 'H', 'L', 'D'):
301 	case MKTAG('T', 'O', 'Y', 'S'):
302 	case MKTAG('W', 'E', 'A', 'P'):
303 		tag2 = MKTAG('M', 'A', 'C', 'H');
304 		break;
305 	case MKTAG('M', 'L', 'T', 'Y'):
306 	case MKTAG('P', 'G', 'R', 'P'):
307 	case MKTAG('P', 'T', 'I', 'C'):
308 		tag2 = MKTAG('G', 'R', 'U', 'P');
309 		break;
310 	case MKTAG('P', 'K', 'U', 'P'):
311 	case MKTAG('S', 'E', 'X', '1'):
312 	case MKTAG('S', 'W', 'E', 'R'):
313 		tag2 = MKTAG('R', 'U', 'D', 'E');
314 		break;
315 	case MKTAG('P', 'H', 'I', 'L'):
316 	case MKTAG('R', 'C', 'K', 'T'):
317 		tag2 = MKTAG('S', 'C', 'I', 'E');
318 		break;
319 	case MKTAG('T', 'R', 'A', '2'):
320 	case MKTAG('T', 'R', 'A', '3'):
321 		tag2 = MKTAG('T', 'R', 'A', 'V');
322 		break;
323 	default:
324 		break;
325 	}
326 
327 	return TTnpcScript::handleQuote(roomScript, sentence, tag1, tag2, remainder);
328 }
329 
updateState(uint oldId,uint newId,int index)330 int LiftbotScript::updateState(uint oldId, uint newId, int index) {
331 	for (uint idx = 0; idx < _states.size(); ++idx) {
332 		TTmapEntry &us = _states[idx];
333 		if (us._src == newId) {
334 			setState(us._dest);
335 			break;
336 		}
337 	}
338 
339 	return newId;
340 }
341 
preResponse(uint id)342 int LiftbotScript::preResponse(uint id) {
343 	if (id == (uint)TRANSLATE(30565, 30574)
344 			|| id == (uint)TRANSLATE(30566, 30575)
345 			|| id == (uint)TRANSLATE(30567, 30576)
346 			|| id == (uint)TRANSLATE(30568, 30577)
347 			|| id == (uint)TRANSLATE(30569, 30578)
348 			|| id == (uint)TRANSLATE(30570, 30579)
349 			|| id == (uint)TRANSLATE(30571, 30580))
350 		return 210901;
351 
352 	if (getDialRegion(0) == 0 && getRandomNumber(100) > 60)
353 		return 210830;
354 
355 	return 0;
356 }
357 
getDialsBitset() const358 uint LiftbotScript::getDialsBitset() const {
359 	uint bits = 0;
360 	if (!getDialRegion(1))
361 		bits = 1;
362 	if (!getDialRegion(0))
363 		bits |= 2;
364 	if (bits > 1)
365 		bits ^= 1;
366 
367 	return bits;
368 }
369 
doSentenceEntry(int val1,const int * srcIdP,const TTroomScript * roomScript,const TTsentence * sentence)370 int LiftbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence) {
371 	// Responses for each floor when asked "what floor are we on"
372 	static const int FLOOR_RESPONSE_IDS[] = {
373 		0, 210724, 210735, 210746, 210757, 210758, 210759, 210760,
374 		210761, 210762, 210725, 210726, 210727, 210728, 210729,
375 		210730, 210731, 210732, 210733, 210734, 210736, 210737,
376 		210738, 210739, 210740, 210741, 210742, 210743, 210744,
377 		210745, 210747, 210748, 210749, 210750, 210751, 210752,
378 		210753, 210754, 210755, 210756
379 	};
380 	// Responses for each lift when asked "which lift am I in"
381 	static const int LIFT_RESPONSE_IDS[] = {
382 		0, 210849, 210850, 210851, 210852, 210838, 210839, 210840, 210841, 0
383 	};
384 
385 	getState();
386 	int stateVal;
387 
388 	int state = (g_language == Common::DE_DEU && val1 > 3000 && val1 < 3020)
389 		? val1 - 3000 : val1;
390 	switch (state) {
391 	case 1:
392 		if (getValue(1) != 1)
393 			return 1;
394 		break;
395 	case 2:
396 		if (getValue(1) != 2)
397 			return 1;
398 		break;
399 	case 3:
400 		if (getValue(1) != 3)
401 			return 1;
402 		break;
403 	case 4:
404 	case 5:
405 		return !sentence1(sentence);
406 	case 6:
407 		if (sentence->localWord("big") || sentence->localWord("small")) {
408 			addResponse(getDialogueId(210215));
409 			applyResponse();
410 		} else if (sentence->localWord("my") || sentence->contains("my")
411 				|| sentence->contains("bedroom") || sentence->contains("state")
412 				|| sentence->contains("mein") || sentence->contains("schlafzimmer")) {
413 			addResponse1(CTrueTalkManager::getStateValue(4), true, 0);
414 		} else {
415 			selectResponse(210763);
416 			applyResponse();
417 		}
418 		return 2;
419 	case 7:
420 		if (!sentence->localWord("ill") && !sentence->localWord("well"))
421 			return 1;
422 		break;
423 	case 8:
424 		if (!sentence->localWord("long"))
425 			return 1;
426 		break;
427 	case 9:
428 		if (addResponse1(1, false, 0))
429 			return 2;
430 		break;
431 	case 10:
432 		if (addResponse1(39, false, 0))
433 			return 2;
434 		break;
435 	case 11:
436 		if (getState6() == 2 || getState6() == 4)
437 			return 1;
438 		break;
439 	case 12:
440 		if (getState6() == 1 || getState6() == 3)
441 			return 1;
442 		break;
443 	case 13:
444 		// What floor am I on
445 		selectResponse(FLOOR_RESPONSE_IDS[getCurrentFloor()]);
446 		applyResponse();
447 		return 2;
448 	case 14:
449 		// Which lift am I in
450 		stateVal = getState6();
451 		if (g_language == Common::EN_ANY) {
452 			if (sentence->contains("elevator") ||
453 				(!sentence->contains("lift") && getRandomNumber(100) > 60))
454 				stateVal += 4;
455 		}
456 		selectResponse(LIFT_RESPONSE_IDS[stateVal]);
457 		applyResponse();
458 		return 2;
459 	case 15:
460 		if (getRandomNumber(100) > 60) {
461 			addResponse(getDialogueId(210440));
462 		} else {
463 			addResponse(getDialogueId(210906));
464 			addResponse(getDialogueId(210901));
465 		}
466 		applyResponse();
467 		return 2;
468 	case 16:
469 		if (g_language == Common::DE_DEU)
470 			addResponse(30589);
471 		else if (sentence->contains("elevator") || sentence->contains("elavator"))
472 			addResponse(30579);
473 		else
474 			addResponse(30580);
475 		applyResponse();
476 		return 2;
477 	case 17:
478 		if (sentence->localWord("restaurant") || sentence->contains("restaurant"))
479 			return 1;
480 		break;
481 	default:
482 
483 		break;
484 	}
485 
486 	return 0;
487 }
488 
setDialRegion(int dialNum,int region)489 void LiftbotScript::setDialRegion(int dialNum, int region) {
490 	TTnpcScript::setDialRegion(dialNum, region);
491 	addResponse(getDialogueId(210688));
492 	applyResponse();
493 }
494 
getCurrentFloor() const495 int LiftbotScript::getCurrentFloor() const {
496 	int val = CTrueTalkManager::getStateValue(5);
497 	return CLIP(val, 1, 39);
498 }
499 
getState6() const500 int LiftbotScript::getState6() const {
501 	int val = CTrueTalkManager::getStateValue(6);
502 	return (val < 1 || val > 4) ? 1 : val;
503 }
504 
addDialogueAndState(int id,int state)505 int LiftbotScript::addDialogueAndState(int id, int state) {
506 	addResponse(id);
507 	applyResponse();
508 
509 	if (state != 1)
510 		setState(state);
511 	return 2;
512 }
513 
addResponse1(int index,bool flag,int id)514 int LiftbotScript::addResponse1(int index, bool flag, int id) {
515 	static const int DIALOGUE_IDS[37] = {
516 		210735, 210746, 210757, 210758, 210759, 210760, 210761, 210762,
517 		210725, 210726, 210727, 210728, 210729, 210730, 210731, 210732,
518 		210733, 210734, 210736, 210737, 210738, 210739, 210740, 210741,
519 		210742, 210743, 210744, 210745, 210747, 210748, 210749, 210750,
520 		210751, 210752, 210753, 210754, 210755
521 	};
522 
523 	int stateVal = getState6();
524 	int maxIndex = (stateVal == 2 || stateVal == 4) ? 27 : 39;
525 
526 	if (index < 1 || index > maxIndex) {
527 		addResponse(getDialogueId(maxIndex == 27 ? 210587 : 210586));
528 		applyResponse();
529 		return 1;
530 	} else if (index == getCurrentFloor()) {
531 		if (index == 1) {
532 			addResponse(TRANSLATE(30558 - (getRandomBit() ? 290 : 0),
533 				30567 - (getRandomBit() ? 297 : 0)));
534 			addResponse(getDialogueId(210589));
535 		} else {
536 			if (index == 39)
537 				addResponse(TRANSLATE(30346, 30348));
538 			addResponse(getDialogueId(210589));
539 		}
540 
541 		applyResponse();
542 		return 2;
543 	}
544 
545 	stateVal = getValue(1);
546 	if (index >= 2 && index <= 19 && stateVal > 1) {
547 		addResponse(getDialogueId(210203));
548 		applyResponse();
549 		setState(7);
550 		return true;
551 	}
552 
553 	if (index >= 20 && index <= 27 && stateVal > 2) {
554 		addResponse(getDialogueId(210210));
555 		applyResponse();
556 		setState(8);
557 		return true;
558 	}
559 
560 	if (flag) {
561 		if (index == 1) {
562 			selectResponse(TRANSLATE(30558 - (getRandomBit() ? 290 : 0),
563 				30567 - (getRandomBit() ? 297 : 0)));
564 		} else if (index == 39) {
565 			addResponse(TRANSLATE(30346, 30348));
566 		} else {
567 			if (getRandomNumber(100) > 35 && index >= 2 && index <= 38) {
568 				addResponse(getDialogueId(DIALOGUE_IDS[index - 2]));
569 			}
570 
571 			addResponse(getDialogueId(210588));
572 		}
573 
574 		if (id) {
575 			if (id == 210717 || id == 210716 || id == 210719 || id == 210718) {
576 				addResponse(getDialogueId(210720));
577 				addResponse(getDialogueId(id));
578 				addResponse(getDialogueId(210715));
579 			} else {
580 				addResponse(getDialogueId(id));
581 			}
582 		}
583 
584 		applyResponse();
585 	}
586 
587 	CTrueTalkManager::triggerAction(2, index);
588 	return flag;
589 }
590 
sentence1(const TTsentence * sentence)591 int LiftbotScript::sentence1(const TTsentence *sentence) {
592 	if (CTrueTalkManager::_v1 >= 0) {
593 		if (sentence->localWord("room")) {
594 			addResponse1(getStateValue(), true, 0);
595 		} else if (CTrueTalkManager::_v1 >= 1 && CTrueTalkManager::_v1 <= 39) {
596 			if (CTrueTalkManager::_v1 != 1 || !sentence->localWord("floor")) {
597 				addResponse1(CTrueTalkManager::_v1, true, 0);
598 			} else if (sentence->localWord("up") || sentence->localWord("above")) {
599 				addResponse1(getCurrentFloor() - 1, true, 0);
600 			} else if (sentence->localWord("down") || sentence->localWord("below")) {
601 				addResponse1(getCurrentFloor() + 1, true, 0);
602 			} else {
603 				addResponse1(CTrueTalkManager::_v1, true, 0);
604 			}
605 		}
606 		return 1;
607 	}
608 
609 	PassengerClass classNum = FIRST_CLASS;
610 	bool classSet = true;
611 	if (sentence->localWord("firstclass"))
612 		classNum = FIRST_CLASS;
613 	else if (sentence->localWord("secondclass"))
614 		classNum = SECOND_CLASS;
615 	else if (sentence->localWord("thirdclass"))
616 		classNum = THIRD_CLASS;
617 	else
618 		classSet = false;
619 
620 	uint newId = 0;
621 	int diff = 1;
622 	if (sentence->localWord("promenade")) {
623 		newId = 210718;
624 	} else if (sentence->localWord("bar")) {
625 		newId = 210894 - (getRandomBit() ? 178 : 0);
626 	} else if (sentence->localWord("musicroom")) {
627 		newId = 210897 - (getRandomBit() ? 180 : 0);
628 	} else if (sentence->localWord("creatorroom")) {
629 		newId = 210713;
630 	} else if (sentence->localWord("sculpture") || sentence->localWord("sculptureroom")) {
631 		newId = 210722;
632 	} else if (sentence->localWord("embarklobby")) {
633 		newId = 210714;
634 	} else if (sentence->localWord("parrotlobby")) {
635 		newId = 210721;
636 	} else if (sentence->localWord("arboretum")) {
637 		newId = 210711;
638 	} else if (sentence->localWord("canal")) {
639 		newId = 210896;
640 	} else if (sentence->localWord("bar")) {
641 		newId = 210894;
642 	} else if (sentence->localWord("bilgeroom")) {
643 		newId = 210895;
644 	} else if (sentence->localWord("titaniaroom")) {
645 		newId = 210723;
646 	} else if (sentence->localWord("restaurant")) {
647 		if (classNum == FIRST_CLASS) {
648 			newId = 210719;
649 			diff = 1;
650 		} else {
651 			newId = 210898;
652 			diff = -98;
653 		}
654 	} else if (sentence->localWord("topwell") || sentence->localWord("servicelift")
655 			|| sentence->localWord("bridge") || sentence->localWord("dome")
656 			|| sentence->localWord("pellerator") || sentence->localWord("top")) {
657 		diff = 1;
658 	} else {
659 		diff = -100;
660 	}
661 
662 	if (g_language == Common::EN_ANY && sentence->localWord("lobby"))
663 		diff = (getValue(1) == 0 ? 1 : 0) - 99;
664 	if (sentence->localWord("bottomofwell") || sentence->contains("bottom"))
665 		diff = 39;
666 
667 	if (diff == -99 || (diff == -100 && classSet)) {
668 		if (classNum == 1)
669 			addResponse(getDialogueId(210235));
670 		else if (classNum == 2)
671 			addResponse(getDialogueId(210241));
672 		else
673 			addResponse(getDialogueId(210242));
674 		applyResponse();
675 
676 		return 1;
677 	}
678 
679 	if (sentence->_category == 4 || sentence->localWord("find")
680 			|| sentence->contains("get to")
681 			|| sentence->contains("komme ich")
682 			|| sentence->contains("ich will zum")
683 			|| sentence->contains("ich will zur")
684 			|| sentence->contains("ich will ins")
685 			|| sentence->contains("ich will in")) {
686 		if (getCurrentFloor() != diff) {
687 			selectResponse(diff == 1 ? 210769 : 210764);
688 		} else if (!newId) {
689 			selectResponse(210764);
690 		} else if (newId > 210715 && newId <= 210719) {
691 			addResponse(getDialogueId(210720));
692 			selectResponse(getDialogueId(newId));
693 			selectResponse(210715);
694 		} else {
695 			selectResponse(newId);
696 		}
697 
698 		applyResponse();
699 		return 1;
700 	}
701 
702 	if (diff == -98) {
703 		addResponse1(getStateValue(), true, newId);
704 		return 1;
705 	} else if (diff >= 0) {
706 		addResponse1(diff, true, newId);
707 		return 1;
708 	} else if (sentence->localWord("up") || sentence->localWord("ascend")) {
709 		selectResponse(210128);
710 		applyResponse();
711 		return 1;
712 	} else if (sentence->localWord("down") || sentence->localWord("descend")) {
713 		selectResponse(210138);
714 		applyResponse();
715 		return 1;
716 	} else if (diff >= 0) {
717 		addResponse1(diff, true, newId);
718 		return 1;
719 	} else {
720 		return 0;
721 	}
722 }
723 
724 } // End of namespace Titanic
725