xoreos  0.0.5
trxfile.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 ENGINES_NWN2_TRXFILE_H
26 #define ENGINES_NWN2_TRXFILE_H
27 
28 #include <list>
29 #include <vector>
30 
31 #include "src/common/types.h"
32 #include "src/common/ptrlist.h"
33 
34 namespace Common {
35  class UString;
36  class SeekableReadStream;
37 }
38 
39 namespace Graphics {
40  namespace Aurora {
41  class GeometryObject;
42  }
43 }
44 
45 namespace Engines {
46 
47 namespace NWN2 {
48 
66 class TRXFile {
67 public:
68  TRXFile(const Common::UString &resRef);
69  ~TRXFile();
70 
71  void show();
72  void hide();
73 
74 private:
76  struct Packet {
80  };
81 
83 
84 
85  bool _visible;
86 
89 
92 
93 
95 
96  // Loading helpers
97 
99  void loadDirectory(Common::SeekableReadStream &trx, std::vector<Packet> &packets);
101  void loadPackets(Common::SeekableReadStream &trx, std::vector<Packet> &packets);
103  void loadPacket(Common::SeekableReadStream &trx, Packet &packet);
104 
105  // The packets
106 
108  void loadTRWH(Common::SeekableReadStream &trx, Packet &packet);
110  void loadTRRN(Common::SeekableReadStream &trx, Packet &packet);
112  void loadWATR(Common::SeekableReadStream &trx, Packet &packet);
114  void loadASWM(Common::SeekableReadStream &trx, Packet &packet);
115 };
116 
117 } // End of namespace NWN2
118 
119 } // End of namespace Engines
120 
121 #endif // ENGINES_NWN2_TRXFILE_H
uint32 type
Type of the packet (TRWH, TRRN, WATR, ASWM).
Definition: trxfile.h:77
Definition: 2dafile.h:39
void loadPackets(Common::SeekableReadStream &trx, std::vector< Packet > &packets)
Load the packets.
Definition: trxfile.cpp:127
A class holding an UTF-8 string.
Definition: ustring.h:48
Common::PtrList< Graphics::Aurora::GeometryObject > ObjectList
Definition: trxfile.h:82
uint32 size
Size of the packet.
Definition: trxfile.h:79
Loader for TRX, baked terrain files, found in Neverwinter Nights 2.
Definition: trxfile.h:66
A list storing pointer to objects, with automatic deletion.
void loadTRWH(Common::SeekableReadStream &trx, Packet &packet)
Load TRWH (size information) packets.
Definition: trxfile.cpp:156
void loadASWM(Common::SeekableReadStream &trx, Packet &packet)
Load ASWM (walk mesh) packets.
Definition: trxfile.cpp:321
void loadTRRN(Common::SeekableReadStream &trx, Packet &packet)
Load TRRN (terrain tile) packets.
Definition: trxfile.cpp:166
ObjectList _terrain
Definition: trxfile.h:90
Low-level type definitions to handle fixed width types portably.
uint32 offset
Offset to the contents of the packet.
Definition: trxfile.h:78
A packet within a TRX file.
Definition: trxfile.h:76
void loadWATR(Common::SeekableReadStream &trx, Packet &packet)
Load WATR (water tile) packets.
Definition: trxfile.cpp:245
TRXFile(const Common::UString &resRef)
Definition: trxfile.cpp:46
void loadPacket(Common::SeekableReadStream &trx, Packet &packet)
Load one packets.
Definition: trxfile.cpp:143
uint32_t uint32
Definition: types.h:204
void load(Common::SeekableReadStream &trx)
Definition: trxfile.cpp:96
ObjectList _water
Definition: trxfile.h:91
void loadDirectory(Common::SeekableReadStream &trx, std::vector< Packet > &packets)
Load the packets directory.
Definition: trxfile.cpp:117
Interface for a seekable & readable data stream.
Definition: readstream.h:265