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