xoreos  0.0.5
talktable_tlk.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos 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 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos 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 xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #ifndef AURORA_TALKTABLE_TLK_H
26 #define AURORA_TALKTABLE_TLK_H
27 
28 #include <vector>
29 
30 #include "src/common/types.h"
31 #include "src/common/scopedptr.h"
32 #include "src/common/ustring.h"
33 
34 #include "src/aurora/aurorafile.h"
35 #include "src/aurora/talktable.h"
36 
37 namespace Aurora {
38 
53 class TalkTable_TLK : public AuroraFile, public TalkTable {
54 public:
58 
60  uint32 getLanguageID() const;
61 
62  bool hasEntry(uint32 strRef) const;
63 
64  const Common::UString &getString (uint32 strRef) const;
65  const Common::UString &getSoundResRef(uint32 strRef) const;
66 
67  uint32 getSoundID(uint32 strRef) const;
68 
70  static uint32 getLanguageID(const Common::UString &file);
71 
72 
73 private:
75  enum EntryFlags {
76  kFlagTextPresent = (1 << 0),
77  kFlagSoundPresent = (1 << 1),
79  };
80 
82  struct Entry {
86 
87  // V3
91  uint32 pitchVariance; // Unused
92  float soundLength; // In seconds
93 
94  // V4
96  };
97 
98  typedef std::vector<Entry> Entries;
99 
100 
102 
104 
105  mutable Entries _entries;
106 
107  void load();
108 
109  void readEntryTableV3(uint32 stringsOffset);
110  void readEntryTableV4();
111 
112  void readString(Entry &entry) const;
113 };
114 
115 } // End of namespace Aurora
116 
117 #endif // AURORA_TALKTABLE_TLK_H
const Common::UString & getSoundResRef(uint32 strRef) const
bool hasEntry(uint32 strRef) const
std::vector< Entry > Entries
Definition: talktable_tlk.h:98
A class holding an UTF-8 string.
Definition: ustring.h:48
Base class for BioWare&#39;s talk tables.
Definition: talktable.h:52
EntryFlags
The entries&#39; flags.
Definition: talktable_tlk.h:75
A talk resource entry.
Definition: talktable_tlk.h:82
void readString(Entry &entry) const
A simple scoped smart pointer template.
Base for BioWare&#39;s Aurora engine files.
Encoding
Definition: encoding.h:37
Low-level type definitions to handle fixed width types portably.
Base class for BioWare&#39;s talk tables.
const Common::UString & getString(uint32 strRef) const
Unicode string handling.
uint32 getSoundID(uint32 strRef) const
Loading BioWare&#39;s TLK talk tables.
Definition: talktable_tlk.h:53
uint32_t uint32
Definition: types.h:204
Base class for most files found in games using BioWare&#39;s Aurora engine.
Definition: aurorafile.h:52
void readEntryTableV3(uint32 stringsOffset)
TalkTable_TLK(Common::SeekableReadStream *tlk, Common::Encoding encoding)
Take over this stream and read a TLK out of it.
Common::ScopedPtr< Common::SeekableReadStream > _tlk
uint32 getLanguageID() const
Return the language ID (ungendered) of the talk table.
Interface for a seekable & readable data stream.
Definition: readstream.h:265