xoreos  0.0.5
area.cpp
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 #include "src/common/util.h"
26 #include "src/common/error.h"
27 #include "src/common/configman.h"
28 
29 #include "src/aurora/gff3file.h"
30 #include "src/aurora/2dafile.h"
31 #include "src/aurora/2dareg.h"
32 
33 #include "src/graphics/graphics.h"
34 
39 
40 #include "src/sound/sound.h"
41 
44 
45 #include "src/engines/nwn2/area.h"
46 #include "src/engines/nwn2/util.h"
51 #include "src/engines/nwn2/door.h"
53 
54 namespace Engines {
55 
56 namespace NWN2 {
57 
59  _module(&module), _resRef(resRef), _visible(false),
60  _activeObject(0), _highlightAll(false) {
61 
62  try {
63  // Load ARE and GIT
64 
65  Aurora::GFF3File are(_resRef, Aurora::kFileTypeARE, MKTAG('A', 'R', 'E', ' '));
66  loadARE(are.getTopLevel());
67 
68  Aurora::GFF3File git(_resRef, Aurora::kFileTypeGIT, MKTAG('G', 'I', 'T', ' '));
69  loadGIT(git.getTopLevel());
70 
71  } catch (...) {
72  clear();
73  throw;
74  }
75 
76  // Tell the module that we exist
77  _module->addObject(*this);
78 }
79 
81  _module->removeObject(*this);
82 
83  hide();
84 
85  removeFocus();
86 
87  clear();
88 }
89 
90 void Area::clear() {
91  // Delete objects
92  for (ObjectList::iterator o = _objects.begin(); o != _objects.end(); ++o)
93  _module->removeObject(**o);
94 
95  _objects.clear();
96 
97  // Delete tiles
98  for (std::vector<Tile>::iterator t = _tiles.begin(); t != _tiles.end(); ++t)
99  delete t->model;
100 
101  _tiles.clear();
102 
103  _terrain.reset();
104 }
105 
107  try {
108  Aurora::GFF3File are(resRef, Aurora::kFileTypeARE, MKTAG('A', 'R', 'E', ' '));
109 
110  Common::UString name = are.getTopLevel().getString("Name");
111  if (!name.empty() && (*--name.end() == '\n'))
112  name.erase(--name.end());
113 
114  return name;
115 
116  } catch (...) {
117  }
118 
119  return "";
120 }
121 
123  return _resRef;
124 }
125 
127  return NWN2::Object::getName();
128 }
129 
131  return _displayName;
132 }
133 
135  return _musicDayTrack;
136 }
137 
139  return _musicNightTrack;
140 }
141 
143  return _musicBattleTrack;
144 }
145 
147  _musicDayTrack = track;
148  _musicDay = TwoDAReg.get2DA("ambientmusic").getRow(track).getString("Resource");
149 }
150 
152  _musicNightTrack = track;
153  _musicNight = TwoDAReg.get2DA("ambientmusic").getRow(track).getString("Resource");
154 }
155 
157  _musicBattleTrack = track;
158 
160  const Aurora::TwoDAFile &ambientMusic = TwoDAReg.get2DA("ambientmusic");
161 
162  // Normal battle music
163  _musicBattle = ambientMusic.getRow(_musicBattleTrack).getString("Resource");
164 
165  // Battle stingers
166  Common::UString stinger[3];
167  stinger[0] = ambientMusic.getRow(_musicBattleTrack).getString("Stinger1");
168  stinger[1] = ambientMusic.getRow(_musicBattleTrack).getString("Stinger2");
169  stinger[2] = ambientMusic.getRow(_musicBattleTrack).getString("Stinger3");
170 
171  for (int i = 0; i < 3; i++)
172  if (!stinger[i].empty())
173  _musicBattleStinger.push_back(stinger[i]);
174  }
175 }
176 
180 }
181 
183  SoundMan.stopChannel(_ambientMusic);
184 }
185 
187  SoundMan.stopChannel(_ambientSound);
188 }
189 
192 
193  // TODO: Area::playAmbientMusic(): Day/Night
194  if (music.empty())
195  music = _musicDay;
196 
197  if (music.empty())
198  return;
199 
201 }
202 
205 
206  // TODO: Area::playAmbientSound(): Day/Night
207  if (sound.empty())
208  sound = _ambientDay;
209 
210  if (sound.empty())
211  return;
212 
214 }
215 
216 void Area::show() {
217  if (_visible)
218  return;
219 
220  loadModels();
221 
222  GfxMan.lockFrame();
223 
224  // Show tiles
225  for (std::vector<Tile>::iterator t = _tiles.begin(); t != _tiles.end(); ++t)
226  if (t->model)
227  t->model->show();
228 
229  // Show terrain
230  if (_terrain)
231  _terrain->show();
232 
233  // Show objects
234  for (ObjectList::iterator o = _objects.begin(); o != _objects.end(); ++o)
235  (*o)->show();
236 
237  GfxMan.unlockFrame();
238 
239  // Play music and sound
242 
243  _visible = true;
244 }
245 
246 void Area::hide() {
247  if (!_visible)
248  return;
249 
250  removeFocus();
251 
252  stopSound();
253 
254  GfxMan.lockFrame();
255 
256  // Hide objects
257  for (ObjectList::iterator o = _objects.begin(); o != _objects.end(); ++o)
258  (*o)->hide();
259 
260  // Hide terrain
261  if (_terrain)
262  _terrain->hide();
263 
264  // Hide tiles
265  for (std::vector<Tile>::iterator t = _tiles.begin(); t != _tiles.end(); ++t)
266  if (t->model)
267  t->model->hide();
268 
269  GfxMan.unlockFrame();
270 
271  unloadModels();
272 
273  _visible = false;
274 }
275 
277  // Tag
278 
279  _tag = are.getString("Tag");
280 
281  // Name
282 
283  _name = are.getString("Name");
284  if (!_name.empty() && (*--_name.end() == '\n'))
285  _name.erase(--_name.end());
286 
288 
289  // Tiles / Terrain
290 
291  _hasTerrain = are.getBool("HasTerrain");
292 
293  _width = are.getUint("Width");
294  _height = are.getUint("Height");
295 
296  if (_hasTerrain)
297  loadTerrain();
298 
299  if (are.hasField("TileList")) {
300  const Aurora::GFF3List &tiles = are.getList("TileList");
301  _tiles.resize(tiles.size());
302 
303  loadTiles(tiles);
304  }
305 
306  // Scripts and variables
307  readScripts(are);
308  readVarTable(are);
309 }
310 
312  // Generic properties
313  if (git.hasField("AreaProperties"))
314  loadProperties(git.getStruct("AreaProperties"));
315 
316  // Waypoints
317  if (git.hasField("WaypointList"))
318  loadWaypoints(git.getList("WaypointList"));
319 
320  // Placeables
321  if (git.hasField("Placeable List"))
322  loadPlaceables(git.getList("Placeable List"));
323 
324  // Environmental objects
325  if (git.hasField("EnvironmentList"))
326  loadEnvironment(git.getList("EnvironmentList"));
327 
328  // Doors
329  if (git.hasField("Door List"))
330  loadDoors(git.getList("Door List"));
331 
332  // Creatures
333  if (git.hasField("Creature List"))
334  loadCreatures(git.getList("Creature List"));
335 }
336 
338  // Ambient sound
339 
340  const Aurora::TwoDAFile &ambientSound = TwoDAReg.get2DA("ambientsound");
341 
342  uint32 ambientDay = props.getUint("AmbientSndDay" , Aurora::kStrRefInvalid);
343  uint32 ambientNight = props.getUint("AmbientSndNight", Aurora::kStrRefInvalid);
344 
345  _ambientDay = ambientSound.getRow(ambientDay ).getString("Resource");
346  _ambientNight = ambientSound.getRow(ambientNight).getString("Resource");
347 
348  uint32 ambientDayVol = CLIP<uint32>(props.getUint("AmbientSndDayVol" , 127), 0, 127);
349  uint32 ambientNightVol = CLIP<uint32>(props.getUint("AmbientSndNitVol", 127), 0, 127);
350 
351  _ambientDayVol = 1.25f * (1.0f - (1.0f / powf(5.0f, ambientDayVol / 127.0f)));
352  _ambientNightVol = 1.25f * (1.0f - (1.0f / powf(5.0f, ambientNightVol / 127.0f)));
353 
354  // TODO: PresetInstance0 - PresetInstance7
355 
356 
357  // Ambient music
358 
359  setMusicDayTrack (props.getUint("MusicDay" , Aurora::kStrRefInvalid));
360  setMusicNightTrack(props.getUint("MusicNight" , Aurora::kStrRefInvalid));
361 
362  // Battle music
363 
364  setMusicBattleTrack(props.getUint("MusicBattle", Aurora::kStrRefInvalid));
365 }
366 
368  try {
369  _terrain.reset(new TRXFile(_resRef));
370  } catch (...) {
372  }
373 }
374 
375 void Area::loadTiles(const Aurora::GFF3List &tiles) {
376  uint32 n = 0;
377  for (Aurora::GFF3List::const_iterator t = tiles.begin(); t != tiles.end(); ++t, ++n)
378  loadTile(**t, _tiles[n]);
379 }
380 
381 void Area::loadTile(const Aurora::GFF3Struct &t, Tile &tile) {
382  // ID
383  tile.metaTile = t.getUint("MetaTile") == 1;
384  tile.tileID = t.getUint("Appearance");
385 
386  const Aurora::GFF3Struct &pos = t.getStruct("Position");
387 
388  // Position
389  tile.position[0] = pos.getDouble("x");
390  tile.position[1] = pos.getDouble("y");
391  tile.position[2] = pos.getDouble("z");
392 
393  // Orientation
394  tile.orientation = (Orientation) t.getUint("Orientation", 0);
395 
396  // Tint
397  readTint(t, "FloorTint", tile.floorTint);
398  readTint(t, "WallTint" , tile.wallTint);
399 
400  tile.model = 0;
401 
402 
403  if (!tile.metaTile) {
404  // Normal tile
405 
406  const Aurora::TwoDAFile &tiles = TwoDAReg.get2DA("tiles");
407 
408  Common::UString tileSet = tiles.getRow(tile.tileID).getString("TileSet");
409  Common::UString tileType = tiles.getRow(tile.tileID).getString("Tile_Type");
410  int tileVar = t.getUint("Variation") + 1;
411 
412  tile.modelName = Common::UString::format("tl_%s_%s_%02d", tileSet.c_str(), tileType.c_str(), tileVar);
413  } else {
414  // "Meta tile". Spreads over the space of several normal tiles
415 
416  const Aurora::TwoDAFile &metatiles = TwoDAReg.get2DA("metatiles");
417 
418  Common::UString tileSet = metatiles.getRow(tile.tileID).getString("TileSet");
419  Common::UString name = metatiles.getRow(tile.tileID).getString("Name");
420 
421  tile.modelName = Common::UString::format("tl_%s_%s", tileSet.c_str(), name.c_str());
422  }
423 }
424 
426  loadTileModels();
427 
428  for (ObjectList::iterator o = _objects.begin(); o != _objects.end(); ++o) {
429  Engines::NWN2::Object &object = **o;
430 
431  object.loadModel();
432 
433  if (!object.isStatic()) {
434  const std::list<uint32> &ids = object.getIDs();
435 
436  for (std::list<uint32>::const_iterator id = ids.begin(); id != ids.end(); ++id)
437  _objectMap.insert(std::make_pair(*id, &object));
438  }
439  }
440 }
441 
443  _objectMap.clear();
444 
445  for (ObjectList::iterator o = _objects.begin(); o != _objects.end(); ++o)
446  (*o)->unloadModel();
447 
449 }
450 
452  for (std::vector<Tile>::iterator t = _tiles.begin(); t != _tiles.end(); ++t) {
453  if (t->modelName.empty())
454  continue;
455 
456  t->model = loadModelObject(t->modelName);
457  if (!t->model)
458  throw Common::Exception("Can't load tile model \"%s\"", t->modelName.c_str());
459 
460  // Tinting
461  if (ConfigMan.getBool("tint")) {
462  dynamic_cast<Graphics::Aurora::Model_NWN2 &>(*t->model).setTintFloor(t->floorTint);
463  dynamic_cast<Graphics::Aurora::Model_NWN2 &>(*t->model).setTintWalls(t->wallTint);
464  }
465 
466  const float rotation = -(((int) t->orientation) * 90.0f);
467 
468  t->model->setPosition(t->position[0], t->position[1], t->position[2]);
469  t->model->setOrientation(0.0f, 0.0f, 1.0f, rotation);
470 
471  // Rotate static floors back
472  const std::list<Graphics::Aurora::ModelNode *> &nodes = t->model->getNodes();
473  for (std::list<Graphics::Aurora::ModelNode *>::const_iterator n = nodes.begin(); n != nodes.end(); ++n) {
474  if (t->metaTile || !(*n)->getName().endsWith("_F"))
475  continue;
476 
477  (*n)->rotate(0.0f, 0.0f, -rotation);
478  }
479  }
480 }
481 
483  for (std::vector<Tile>::iterator t = _tiles.begin(); t != _tiles.end(); ++t) {
484  delete t->model;
485  t->model = 0;
486  }
487 }
488 
490  object.setArea(this);
491 
492  _objects.push_back(&object);
493  _module->addObject(object);
494 }
495 
497  for (Aurora::GFF3List::const_iterator d = list.begin(); d != list.end(); ++d) {
498  Waypoint *waypoint = new Waypoint(**d);
499 
500  loadObject(*waypoint);
501  }
502 }
503 
505  for (Aurora::GFF3List::const_iterator p = list.begin(); p != list.end(); ++p) {
506  Placeable *placeable = new Placeable(**p);
507 
508  loadObject(*placeable);
509  }
510 }
511 
513  for (Aurora::GFF3List::const_iterator p = list.begin(); p != list.end(); ++p) {
514  Placeable *placeable = new Placeable(**p);
515 
516  loadObject(*placeable);
517  }
518 }
519 
521  for (Aurora::GFF3List::const_iterator d = list.begin(); d != list.end(); ++d) {
522  Door *door = new Door(*_module, **d);
523 
524  loadObject(*door);
525  }
526 }
527 
529  for (Aurora::GFF3List::const_iterator c = list.begin(); c != list.end(); ++c) {
530  Creature *creature = new Creature(**c);
531 
532  loadObject(*creature);
533  }
534 }
535 
536 void Area::addEvent(const Events::Event &event) {
537  _eventQueue.push_back(event);
538 }
539 
541  bool hasMove = false;
542  for (std::list<Events::Event>::const_iterator e = _eventQueue.begin();
543  e != _eventQueue.end(); ++e) {
544 
545  if (e->type == Events::kEventMouseMove) { // Moving the mouse
546  hasMove = true;
547  } else if (e->type == Events::kEventMouseDown) { // Clicking
548  if (e->button.button == SDL_BUTTON_LMASK) {
549  checkActive(e->button.x, e->button.y);
550  click(e->button.x, e->button.y);
551  }
552  } else if (e->type == Events::kEventKeyDown) { // Holding down TAB
553  if (e->key.keysym.sym == SDLK_TAB)
554  highlightAll(true);
555  } else if (e->type == Events::kEventKeyUp) { // Releasing TAB
556  if (e->key.keysym.sym == SDLK_TAB)
557  highlightAll(false);
558  }
559  }
560 
561  _eventQueue.clear();
562 
563  if (hasMove)
564  checkActive();
565 }
566 
568  const Graphics::Renderable *obj = GfxMan.getObjectAt(x, y);
569  if (!obj)
570  return 0;
571 
572  ObjectMap::iterator o = _objectMap.find(obj->getID());
573  if (o == _objectMap.end())
574  return 0;
575 
576  return o->second;
577 }
578 
580  if (object == _activeObject)
581  return;
582 
583  if (_activeObject)
584  _activeObject->leave();
585 
586  _activeObject = object;
587 
588  if (_activeObject)
589  _activeObject->enter();
590 }
591 
592 void Area::checkActive(int x, int y) {
593  if (_highlightAll)
594  return;
595 
597 
598  if ((x < 0) || (y < 0))
599  CursorMan.getPosition(x, y);
600 
601  setActive(getObjectAt(x, y));
602 }
603 
604 void Area::click(int x, int y) {
606 
608  if (!o)
609  return;
610 
611  o->click(_module->getPC());
612 }
613 
614 void Area::highlightAll(bool enabled) {
615  if (_highlightAll == enabled)
616  return;
617 
618  _highlightAll = enabled;
619 
620  for (ObjectMap::iterator o = _objectMap.begin(); o != _objectMap.end(); ++o)
621  if (o->second->isClickable())
622  o->second->highlight(enabled);
623 }
624 
626  if (_activeObject)
627  _activeObject->leave();
628 
629  _activeObject = 0;
630 }
631 
633  checkActive();
634 }
635 
636 } // End of namespace NWN2
637 
638 } // End of namespace Engines
std::vector< Common::UString > _musicBattleStinger
Battle music stingers.
Definition: area.h:173
Class to hold the two-dimensional array of a 2DA file.
Definition: 2dafile.h:124
void loadEnvironment(const Aurora::GFF3List &list)
Definition: area.cpp:512
Handling version V3.2/V3.3 of BioWare&#39;s GFFs (generic file format).
Common::UString _musicBattle
Music that plays in battle.
Definition: area.h:170
Neverwinter Nights 2 utility functions.
#define MKTAG(a0, a1, a2, a3)
A wrapper macro used around four character constants, like &#39;DATA&#39;, to ensure portability.
Definition: endianness.h:140
void loadProperties(const Aurora::GFF3Struct &props)
Definition: area.cpp:337
ObjectList _objects
List of all objects in the area.
Definition: area.h:191
uint32 _width
Width of the area in tiles, as seen from top-down.
Definition: area.h:185
The global graphics manager.
const Common::UString & getString(size_t column) const
Return the contents of a cell as a string.
Definition: 2dafile.cpp:59
bool _hasTerrain
Does area have terrain or is it purely tile-based?
Definition: area.h:183
bool getBool(const Common::UString &field, bool def=false) const
Definition: gff3file.cpp:510
A class holding an UTF-8 string.
Definition: ustring.h:48
The global config manager.
void playAmbientMusic(Common::UString music="")
Play the specified music (or the area&#39;s default) as ambient music.
Definition: area.cpp:190
Sound::ChannelHandle _ambientMusic
Sound handle of the currently playing music.
Definition: area.h:181
void removeFocus()
Forcibly remove the focus from the currently highlighted object.
Definition: area.cpp:625
Loader for TRX, baked terrain files, found in Neverwinter Nights 2.
Definition: trxfile.h:66
void highlightAll(bool enabled)
Definition: area.cpp:614
void stopAmbientSound()
Stop the ambient sound.
Definition: area.cpp:186
virtual void loadModel()
Load the object&#39;s model(s).
Definition: object.cpp:76
bool hasField(const Common::UString &field) const
Does this specific field exist?
Definition: gff3file.cpp:400
The context holding a Neverwinter Nights 2 area.
Common::UString _musicNight
Music that plays by night.
Definition: area.h:169
void loadTile(const Aurora::GFF3Struct &t, Tile &tile)
Definition: area.cpp:381
bool _highlightAll
Are we currently highlighting all objects?
Definition: area.h:197
Sound::ChannelHandle _ambientSound
Sound handle of the currently playing sound.
Definition: area.h:180
uint32 getMusicBattleTrack() const
Return the music track ID playing in battle.
Definition: area.cpp:142
void show()
Show the area.
Definition: area.cpp:216
std::list< Events::Event > _eventQueue
The event queue.
Definition: area.h:199
void loadWaypoints(const Aurora::GFF3List &list)
Definition: area.cpp:496
Common::UString _resRef
The area&#39;s resref (resource ID).
Definition: area.h:157
const GFF3Struct & getTopLevel() const
Returns the top-level struct.
Definition: gff3file.cpp:91
const Common::UString & getName()
Return the area&#39;s localized name.
Definition: area.cpp:126
Area(Module &module, const Common::UString &resRef)
Definition: area.cpp:58
uint64 getUint(const Common::UString &field, uint64 def=0) const
Definition: gff3file.cpp:436
Orientation orientation
The tile&#39;s orientation.
Definition: area.h:139
Common::UString _name
The object&#39;s display name.
Definition: object.h:147
void stopSound()
Stop all sounds.
Definition: area.cpp:177
An object within a NWN2 area.
Definition: object.h:58
Common::Mutex _mutex
Mutex securing access to the area.
Definition: area.h:201
void readVarTable(const Aurora::GFF3List &varTable)
Read the object&#39;s variable table.
Definition: object.cpp:200
void notifyCameraMoved()
Notify the area that the camera has been moved.
Definition: area.cpp:632
uint32 _height
Height of the area in tiles, as seen from top-down.
Definition: area.h:186
void setMusicNightTrack(uint32 track)
Set the music track ID playing by night.
Definition: area.cpp:151
Mouse was moved.
Definition: types.h:48
void unloadTileModels()
Definition: area.cpp:482
Module * _module
Definition: area.h:155
virtual void leave()
The cursor left the object.
Definition: object.cpp:172
SDL_Event Event
Definition: types.h:42
void exceptionDispatcherWarning(const char *s,...)
Exception dispatcher that prints the exception as a warning, and adds another reason on top...
Definition: error.cpp:158
void addEvent(const Events::Event &event)
Add a single event for consideration into the area event queue.
Definition: area.cpp:536
Mouse button was pressed.
Definition: types.h:49
Common::UString _ambientNight
Ambient sound that plays by night.
Definition: area.h:162
void loadCreatures(const Aurora::GFF3List &list)
Definition: area.cpp:528
Keyboard key was pressed.
Definition: types.h:46
The context needed to run a Neverwinter Nights 2 module.
A 3D model in the NWN2 MDB format.
Definition: model_nwn2.h:42
float floorTint[3][4]
Tint color of the floor parts.
Definition: area.h:144
Basic exceptions to throw.
A creature in a Neverwinter Nights 2 area.
const char * c_str() const
Return the (utf8 encoded) string data.
Definition: ustring.cpp:249
uint32 _musicBattleTrack
Music track ID that plays in battle.
Definition: area.h:166
void loadTerrain()
Definition: area.cpp:367
Fake value for an area object.
Definition: types.h:53
static UString format(const char *s,...) GCC_PRINTF(1
Print formatted data into an UString object, similar to sprintf().
Definition: ustring.cpp:718
void removeObject(NWN2::Object &object)
Remove an object from this container.
Orientation
Tile orientation.
Definition: area.h:125
void loadTileModels()
Definition: area.cpp:451
#define ConfigMan
Shortcut for accessing the config manager.
Definition: configman.h:176
void readScripts(const Aurora::GFF3Struct &gff)
Definition: container.cpp:131
uint32 tileID
ID of the tile&#39;s appearance.
Definition: area.h:136
Utility templates and functions.
Engines::NWN2::Object * _activeObject
The currently active (highlighted) object.
Definition: area.h:195
void loadModels()
Definition: area.cpp:425
double getDouble(const Common::UString &field, double def=0.0) const
Definition: gff3file.cpp:514
Handling BioWare&#39;s 2DAs (two-dimensional array).
float wallTint[3][4]
Tint color of the wall parts.
Definition: area.h:145
A GFF (generic file format) V3.2/V3.3 file, found in all Aurora games except Sonic Chronicles: The Da...
Definition: gff3file.h:85
A node within a 3D model.
Common::ScopedPtr< TRXFile > _terrain
The area&#39;s terrain.
Definition: area.h:188
Common::UString _displayName
The area&#39;s localized display name.
Definition: area.h:159
void addObject(NWN2::Object &object)
Add an object to this container.
A 3D model of an object.
static const uint32 kStrRefInvalid
Definition: types.h:444
The global sound manager, handling all sound output.
bool empty() const
Is the string empty?
Definition: ustring.cpp:245
#define TwoDAReg
Shortcut for accessing the 2da registry.
Definition: 2dareg.h:101
#define SoundMan
Shortcut for accessing the sound manager.
Definition: sound.h:293
float _ambientDayVol
Day ambient sound volume.
Definition: area.h:175
StackException Exception
Definition: error.h:59
The global 2DA registry.
void checkActive(int x=-1, int y=-1)
Definition: area.cpp:592
const Common::UString & getResRef()
Return the area&#39;s resref (resource ID).
Definition: area.cpp:122
Engines::NWN2::Object * getObjectAt(int x, int y)
Definition: area.cpp:567
uint32 getMusicNightTrack() const
Return the music track ID playing by night.
Definition: area.cpp:138
void loadGIT(const Aurora::GFF3Struct &git)
Definition: area.cpp:311
ObjectMap _objectMap
Map of all non-static objects in the area.
Definition: area.h:192
void setPosition(float x, float y, float z)
Set the current position of the model.
Definition: model.cpp:250
virtual void enter()
The cursor entered the object.
Definition: object.cpp:169
#define CursorMan
Shortcut for accessing the cursor manager.
Definition: cursorman.h:129
const Common::UString & getName() const
Return the object&#39;s name.
Definition: object.cpp:88
std::vector< const GFF3Struct * > GFF3List
Definition: types.h:449
Convenience class that locks a mutex on creation and unlocks it on destruction.
Definition: mutex.h:71
The Aurora cursor manager.
Sound::ChannelHandle playSound(const Common::UString &sound, Sound::SoundType soundType, bool loop, float volume, bool pitchVariance)
Play this sound resource.
Definition: util.cpp:81
uint32 _musicNightTrack
Music track ID that plays by night.
Definition: area.h:165
void loadPlaceables(const Aurora::GFF3List &list)
Definition: area.cpp:504
bool isStatic() const
Is the object static (not manipulable at all)?
Definition: object.cpp:106
An object that can be displayed by the graphics manager.
Definition: renderable.h:42
void click(int x, int y)
Definition: area.cpp:604
const GFF3List & getList(const Common::UString &field) const
Definition: gff3file.cpp:741
void setActive(Engines::NWN2::Object *object)
Definition: area.cpp:579
Common::UString _musicDay
Music that plays by day.
Definition: area.h:168
uint32 getID() const
Get the object&#39;s unique ID.
Definition: renderable.cpp:86
Common::UString modelName
ResRef of the model.
Definition: area.h:142
bool _visible
Is the area currently visible?
Definition: area.h:178
const TwoDARow & getRow(size_t row) const
Get a row.
Definition: 2dafile.cpp:421
Dynamic area data, GFF.
Definition: types.h:89
void processEventQueue()
Process the current event queue.
Definition: area.cpp:540
Graphics::Aurora::Model * model
The tile&#39;s model.
Definition: area.h:148
void setMusicBattleTrack(uint32 track)
Set the music track ID playing in battle.
Definition: area.cpp:156
void clear()
Definition: ptrlist.h:47
A struct within a GFF3.
Definition: gff3file.h:164
bool readTint(const Aurora::GFF3Struct &gff, float t[3][4])
Definition: util.cpp:35
Common::UString _ambientDay
Ambient sound that plays by day.
Definition: area.h:161
uint32_t uint32
Definition: types.h:204
const GFF3Struct & getStruct(const Common::UString &field) const
Definition: gff3file.cpp:728
A door in a Neverwinter Nights 2 area.
Common::UString _tag
Definition: object.h:56
Static area data, GFF.
Definition: types.h:81
uint32 _musicDayTrack
Music track ID that plays by day.
Definition: area.h:164
void unloadModels()
Definition: area.cpp:442
void playAmbientSound(Common::UString sound="")
Play the specified sound (or the area&#39;s default) as ambient sound.
Definition: area.cpp:203
A placeable object in a Neverwinter Nights 2 area.
float _ambientNightVol
Night ambient sound volume.
Definition: area.h:176
uint32 getMusicDayTrack() const
Return the music track ID playing by day.
Definition: area.cpp:134
void erase(iterator from, iterator to)
Erase the character within this range.
Definition: ustring.cpp:598
Common::UString getString(const Common::UString &field, const Common::UString &def="") const
Definition: gff3file.cpp:527
Sound effect.
Definition: types.h:45
void loadARE(const Aurora::GFF3Struct &are)
Definition: area.cpp:276
Generic Aurora engines utility functions.
bool metaTile
Is this tile a meta tile?
Definition: area.h:134
std::vector< Tile > _tiles
The area&#39;s tiles.
Definition: area.h:189
void loadTiles(const Aurora::GFF3List &tiles)
Definition: area.cpp:375
Creature * getPC()
Return the currently playing PC.
Definition: module.cpp:78
Loading MDB files found in Neverwinter Nights 2.
void loadDoors(const Aurora::GFF3List &list)
Definition: area.cpp:520
Common::UString createDisplayName(const Common::UString &name)
Strip text enclosed in {} from a string.
Definition: util.cpp:68
void loadObject(Engines::NWN2::Object &object)
Definition: area.cpp:489
iterator end() const
Definition: ustring.cpp:257
Loader for Neverwinter Nights 2 baked terrain files (TRX).
Graphics::Aurora::Model * loadModelObject(const Common::UString &resref, const Common::UString &texture)
Definition: model.cpp:47
const Common::UString & getDisplayName()
Return the area&#39;s localized display name.
Definition: area.cpp:130
Keyboard key was released.
Definition: types.h:47
virtual bool click(Object *triggerer=0)
The object was clicked.
Definition: object.cpp:178
void setMusicDayTrack(uint32 track)
Set the music track ID playing by day.
Definition: area.cpp:146
#define GfxMan
Shortcut for accessing the graphics manager.
Definition: graphics.h:299
void hide()
Hide the area.
Definition: area.cpp:246
float position[3]
The tile&#39;s position.
Definition: area.h:138
A waypoint in a Neverwinter Nights 2 area.
void stopAmbientMusic()
Stop the ambient music.
Definition: area.cpp:182
Generic Aurora engines model functions.