ScummVM API documentation
dialogue_file.h
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 modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (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, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef TITANIC_DIALOGUE_FILE_H
23 #define TITANIC_DIALOGUE_FILE_H
24 
25 #include "titanic/support/simple_file.h"
26 #include "titanic/support/string.h"
27 
28 namespace Titanic {
29 
31  uint _v1, _offset;
32 
33  DialogueIndexEntry() : _v1(0), _offset(0) {}
34  void load(Common::SeekableReadStream &s);
35 };
36 
38  bool _active;
39  uint _offset, _bytesRead, _size;
40  DialogueIndexEntry *_entryPtr;
41 
42  DialogueResource() : _active(false), _offset(0),
43  _bytesRead(0), _size(0), _entryPtr(nullptr) {}
44 
48  size_t size() const { return _active ? _size : 0; }
49 };
50 
52 private:
53  File _file;
56 private:
60  DialogueResource *addToCache(int index);
61 public:
62  CDialogueFile(const CString &filename, uint count);
63  ~CDialogueFile();
64 
68  void clear();
69 
70  File *getFile() { return &_file; }
71 
76  return addToCache(index * 2);
77  }
78 
83  return addToCache(index * 2 + 1);
84  }
85 
89  bool closeEntry(DialogueResource *cacheEntry);
90 
94  bool read(DialogueResource *cacheEntry, byte *buffer, size_t bytesToRead);
95 };
96 
97 } // End of namespace Titanic
98 
99 #endif /* TITANIC_TITLE_ENGINE_H */
Definition: array.h:52
DialogueResource * openWaveEntry(int index)
Definition: dialogue_file.h:82
DialogueResource * openTextEntry(int index)
Definition: dialogue_file.h:75
Definition: stream.h:745
Definition: dialogue_file.h:37
Definition: arm.h:30
Definition: string.h:40
Definition: simple_file.h:41
size_t size() const
Definition: dialogue_file.h:48
Definition: dialogue_file.h:51
Definition: dialogue_file.h:30