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 "titanic/true_talk/title_engine.h"
24 #include "titanic/support/files_manager.h"
25 #include "titanic/titanic.h"
26 #include "titanic/translation.h"
27
28 namespace Titanic {
29
CTitleEngine()30 CTitleEngine::CTitleEngine() : _script(nullptr), _scriptHandler(nullptr) {
31 }
32
~CTitleEngine()33 CTitleEngine::~CTitleEngine() {
34 delete _script;
35 delete _scriptHandler;
36 }
37
setup(int val1,VocabMode vocabMode)38 void CTitleEngine::setup(int val1, VocabMode vocabMode) {
39 _script = new TTTitleScript();
40 _scriptHandler = new CScriptHandler(this, val1, vocabMode);
41 }
42
43 /*------------------------------------------------------------------------*/
44
STtitleEngine()45 STtitleEngine::STtitleEngine(): CTitleEngine(),
46 _responseP(nullptr), _stream(nullptr) {
47 }
48
~STtitleEngine()49 STtitleEngine::~STtitleEngine() {
50 delete _stream;
51 }
52
reset()53 void STtitleEngine::reset() {
54 _indexes.clear();
55 }
56
setup(int val1,VocabMode vocabMode)57 void STtitleEngine::setup(int val1, VocabMode vocabMode) {
58 CTitleEngine::setup(val1, TRANSLATE(VOCAB_MODE_EN, VOCAB_MODE_DE));
59 }
60
setResponse(TTscriptBase * script,TTresponse * response)61 int STtitleEngine::setResponse(TTscriptBase *script, TTresponse *response) {
62 _responseP = response;
63 _indexes.clear();
64 for (TTresponse *respP = response; respP; respP = respP->getNext()) {
65 _indexes.push_back(respP->getDialogueId());
66 }
67
68 return 0;
69 }
70
open(const CString & name)71 SimpleFile *STtitleEngine::open(const CString &name) {
72 Common::SeekableReadStream *stream = g_vm->_filesManager->getResource(
73 CString::format("TEXT/%s", name.c_str()));
74 assert(stream);
75
76 SimpleFile *file = new SimpleFile();
77 file->open(stream);
78 return file;
79 }
80
81 } // End of namespace Titanic
82