xoreos  0.0.5
ifofile.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_IFOFILE_H
26 #define AURORA_IFOFILE_H
27 
28 #include <vector>
29 
30 #include <boost/noncopyable.hpp>
31 
32 #include "src/common/types.h"
33 #include "src/common/scopedptr.h"
34 #include "src/common/ustring.h"
35 
36 #include "src/aurora/locstring.h"
37 
38 namespace Common {
39  class SeekableReadStream;
40 }
41 
42 namespace Aurora {
43 
44 class GFF3File;
45 class GFF3Struct;
46 
69 class IFOFile : boost::noncopyable {
70 public:
71  IFOFile();
72  ~IFOFile();
73 
81  void load(Common::SeekableReadStream *stream, bool repairNWNPremium = false);
89  void load(bool repairNWNPremium = false);
91  void unload();
92 
94  const GFF3Struct *getGFF() const;
95 
96  // .--- General properties
98  uint32 getVersion() const;
100  uint32 getCreatorID() const;
101 
102  bool isSave() const;
103 
105  const Common::UString &getTag() const;
106 
108  const LocString &getName() const;
110  const LocString &getDescription() const;
111 
113  const Common::UString &getTLK() const;
114  // '---
115 
116  // .--- Module requirements
118  void getMinVersion(int &major, int &minor) const;
119 
126  uint16 getExpansions() const;
127 
133  const std::vector<Common::UString> &getHAKs() const;
134  // '---
135 
136  // .--- Entry behaviour
138  const Common::UString &getStartMovie() const;
139 
141  const Common::UString &getEntryArea() const;
143  void getEntryPosition (float &x, float &y, float &z) const;
145  void getEntryDirection(float &x, float &y) const;
146  // '---
147 
148  // .--- Module elements
150  const std::vector<Common::UString> &getAreas() const;
152  const std::vector<Common::UString> &getNSSCache() const;
153 
155  const std::vector<Common::UString> &getQuests() const;
157  const std::vector<Common::UString> &getQuestDBs() const;
158 
160  const std::vector<Common::UString> &getStoryNPCs() const;
162  const std::vector<Common::UString> &getMonsterNPCs() const;
163  // '---
164 
165  // .--- Time management
167  void getStartTime(uint8 &hour, uint8 &day, uint8 &month, uint32 &year) const;
168 
169  uint8 getDawnHour() const;
170  uint8 getDuskHour() const;
171 
173  uint32 getMinutesPerHour() const;
174  // '---
175 
176  // .--- Weather
182  int32 getRainChance() const;
184  int32 getSnowChance() const;
185  // '---
186 
187  // .--- Combat behaviour
189  float getXPScale() const;
190  // '---
191 
192 private:
194 
195  byte _id[32];
196 
198 
201 
204 
207 
209 
210  bool _isSave;
211 
213 
215 
217 
218  float _entryX;
219  float _entryY;
220  float _entryZ;
221  float _entryDirX;
222  float _entryDirY;
223 
224  std::vector<Common::UString> _haks;
225  std::vector<Common::UString> _areas;
226  std::vector<Common::UString> _nssCache;
227 
228  std::vector<Common::UString> _quests;
229  std::vector<Common::UString> _questDBs;
230 
231  std::vector<Common::UString> _storyNPCs;
232  std::vector<Common::UString> _monsterNPCs;
233 
236 
238 
243 
248 
249  float _xpScale;
250 
251  void clear();
252 
253  void parseVersion(const Common::UString &version);
254 };
255 
256 } // End of namespace Aurora
257 
258 #endif // AURORA_IFOFILE_H
uint8 _hourDawn
The hour dawn starts.
Definition: ifofile.h:234
bool isSave() const
Is the module a save file?
Definition: ifofile.cpp:259
int32 _maxWeatherIntensity
Maximum weather intensity.
Definition: ifofile.h:245
const Common::UString & getTLK() const
Return the custom TLK table this module uses.
Definition: ifofile.cpp:275
Definition: 2dafile.h:39
uint32 getMinutesPerHour() const
Return the number of real time minutes per game hour.
Definition: ifofile.cpp:350
A class holding an UTF-8 string.
Definition: ustring.h:48
int32 getMaxWeatherIntensity() const
Return the maximum weather intensity.
Definition: ifofile.cpp:358
uint32 _creatorID
ID of the IFO file creator.
Definition: ifofile.h:203
A localized string.
Definition: locstring.h:43
std::vector< Common::UString > _storyNPCs
List of story NPCs used in the module.
Definition: ifofile.h:231
void unload()
Unload a currently loaded IFO.
Definition: ifofile.cpp:97
Common::UString _entryArea
The area the PC starts in.
Definition: ifofile.h:216
uint8_t uint8
Definition: types.h:200
uint32 getCreatorID() const
Return the ID of the IFO file creator.
Definition: ifofile.cpp:255
float _entryZ
The Z position the PC starts in.
Definition: ifofile.h:220
Common::UString _customTLK
The custom TLK the module uses.
Definition: ifofile.h:212
const LocString & getDescription() const
Return the description of the module.
Definition: ifofile.cpp:271
std::vector< Common::UString > _monsterNPCs
List of monster NPCs used in the module.
Definition: ifofile.h:232
int32 _snowChance
Chance for snow.
Definition: ifofile.h:247
void getEntryDirection(float &x, float &y) const
Return the entry direction.
Definition: ifofile.cpp:302
int _minVersionMajor
Minimum major game version this module needs.
Definition: ifofile.h:205
void getMinVersion(int &major, int &minor) const
Return the minimum game version the module needs to run.
Definition: ifofile.cpp:279
uint8 _minutesPerHour
Number of real time minutes per game hour.
Definition: ifofile.h:237
int _minVersionMinor
Minimum minor game version this module needs.
Definition: ifofile.h:206
A simple scoped smart pointer template.
std::vector< Common::UString > _nssCache
Scripts that should be cached.
Definition: ifofile.h:226
float _entryDirY
The Y orientation the PC starts in.
Definition: ifofile.h:222
Common::UString _tag
The module&#39;s tag.
Definition: ifofile.h:197
std::vector< Common::UString > _areas
Areas found in the module.
Definition: ifofile.h:225
const std::vector< Common::UString > & getHAKs() const
Return the list of required HAK files.
Definition: ifofile.cpp:307
void load(Common::SeekableReadStream *stream, bool repairNWNPremium=false)
Take over this stream and load an IFO out of it.
Definition: ifofile.cpp:101
const std::vector< Common::UString > & getQuestDBs() const
Returns the list of quest databases used in the module.
Definition: ifofile.cpp:323
std::vector< Common::UString > _questDBs
List of quest databases used in the module.
Definition: ifofile.h:229
const std::vector< Common::UString > & getNSSCache() const
Return the list of NSS (script) files that should be cached.
Definition: ifofile.cpp:315
byte _id[32]
The module&#39;s unique ID.
Definition: ifofile.h:195
Common::UString _startMovie
The movie the module starts with.
Definition: ifofile.h:214
float getXPScale() const
Get the number creature kill XP is multiplied by.
Definition: ifofile.cpp:370
uint16_t uint16
Definition: types.h:202
An IFO (module information) file, describing global module properties in many Aurora games...
Definition: ifofile.h:69
const std::vector< Common::UString > & getStoryNPCs() const
Returns the list of story NPCs used in the module.
Definition: ifofile.cpp:327
float _entryX
The X position the PC starts in.
Definition: ifofile.h:218
std::vector< Common::UString > _haks
HAKs required by the module.
Definition: ifofile.h:224
uint8 getDawnHour() const
Return the hour dawn starts.
Definition: ifofile.cpp:342
const std::vector< Common::UString > & getAreas() const
Return the list of areas in the module.
Definition: ifofile.cpp:311
float _entryDirX
The X orientation the PC starts in.
Definition: ifofile.h:221
uint8 _startDay
Day the module starts.
Definition: ifofile.h:240
Low-level type definitions to handle fixed width types portably.
A scoped plain pointer, allowing pointer-y access and normal deletion.
Definition: scopedptr.h:120
uint8 _startMonth
Month the module starts.
Definition: ifofile.h:241
void parseVersion(const Common::UString &version)
Definition: ifofile.cpp:239
Handling BioWare&#39;s localized strings.
void getStartTime(uint8 &hour, uint8 &day, uint8 &month, uint32 &year) const
Return the module&#39;s starting time.
Definition: ifofile.cpp:335
uint32 _startYear
Year the module starts.
Definition: ifofile.h:242
Unicode string handling.
uint8 _hourDusk
The hour dusk starts.
Definition: ifofile.h:235
A struct within a GFF3.
Definition: gff3file.h:164
LocString _name
The module&#39;s localized name.
Definition: ifofile.h:199
const GFF3Struct * getGFF() const
Return the IFO&#39;s GFF struct.
Definition: ifofile.cpp:244
uint32_t uint32
Definition: types.h:204
const LocString & getName() const
Return the name of the module.
Definition: ifofile.cpp:267
float _xpScale
The number creature kill XP is multiplied by.
Definition: ifofile.h:249
const std::vector< Common::UString > & getQuests() const
Returns the list of quests used in the module.
Definition: ifofile.cpp:319
void clear()
Definition: ifofile.cpp:51
int32 getMinWeatherIntensity() const
Return the minimum weather intensity.
Definition: ifofile.cpp:354
uint32 _version
Version of this IFO file.
Definition: ifofile.h:202
int32 getRainChance() const
Return the chance that it&#39;s going to rain.
Definition: ifofile.cpp:362
const std::vector< Common::UString > & getMonsterNPCs() const
Returns the list of monster NPCs used in the module.
Definition: ifofile.cpp:331
int32 _rainChance
Chance for rain.
Definition: ifofile.h:246
uint8 _startHour
Hour the module starts.
Definition: ifofile.h:239
uint16 _expansions
Bitfield of required expansions.
Definition: ifofile.h:208
const Common::UString & getTag() const
Return the module&#39;s tag.
Definition: ifofile.cpp:263
uint16 getExpansions() const
Return the list of required expansions.
Definition: ifofile.cpp:284
void getEntryPosition(float &x, float &y, float &z) const
Return the entry position.
Definition: ifofile.cpp:296
int32 _minWeatherIntensity
Minimum weather intensity.
Definition: ifofile.h:244
const Common::UString & getEntryArea() const
Return the entry area.
Definition: ifofile.cpp:292
float _entryY
The Y position the PC starts in.
Definition: ifofile.h:219
Common::ScopedPtr< GFF3File > _gff
The module.ifo GFF.
Definition: ifofile.h:193
Interface for a seekable & readable data stream.
Definition: readstream.h:265
const Common::UString & getStartMovie() const
Return the starting movie.
Definition: ifofile.cpp:288
std::vector< Common::UString > _quests
List of quests used in the module.
Definition: ifofile.h:228
int32 getSnowChance() const
Return the chance that it&#39;s going to snow.
Definition: ifofile.cpp:366
LocString _description
The module&#39;s localized description.
Definition: ifofile.h:200
uint32 getVersion() const
Return the version of this IFO file.
Definition: ifofile.cpp:251
bool _isSave
Is this module a save?
Definition: ifofile.h:210
uint8 byte
Definition: types.h:209
uint8 getDuskHour() const
Return the hour dusk starts.
Definition: ifofile.cpp:346
int32_t int32
Definition: types.h:203