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
|
/* 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 "common/file.h"
#include "titanic/true_talk/st_vocab.h"
#include "titanic/titanic.h"
namespace Titanic {
STVocab::STVocab(int val): _field0(0), _field4(0), _word(nullptr),
_fieldC(0), _field10(0), _field18(val) {
_field14 = load("STvocab.txt");
}
int STVocab::load(const CString &name) {
SimpleFile *file = g_vm->_fileReader._owner->openResource(name);
int result = 0;
int param = -1;
int mode = 0;
bool skipFlag;
while (!result && !file->eos()) {
skipFlag = false;
int param = file->readNumber();
TTString space(" ");
switch (mode) {
case 0: {
if (_word)
result = _word->readSyn(file);
skipFlag = true;
break;
}
case 1: {
TTWord2 *word = new TTWord2(space, 0, 0, 0, 0);
result = word->load(file);
_word = word;
break;
}
case 2: {
TTWord3 *word = new TTWord3(space, 0, 0, 0, 0, 0, 0);
result = word->load(file);
_word = word;
break;
}
case 3:
case 9: {
TTWord1 *word = new TTWord1(space, 0, 0, 0);
result = word->load(file, &mode);
_word = word;
break;
}
case 4:
case 5:
case 7: {
TTWord *word = new TTWord(space, 0, 0);
result = word->load(file, &mode);
_word = word;
break;
}
case 8: {
TTWord4 *word = new TTWord4(space, 0, 0, 0, 0);
result = word->load(file);
_word = word;
break;
}
case 6: {
TTWord5 *word = new TTWord5(space, 0, 0, 0, 0);
result = word->load(file);
_word = word;
break;
}
default:
result = 4;
break;
}
}
delete file;
return result;
}
} // End of namespace Titanic
|