59 _module(&module), _resRef(resRef), _visible(false),
60 _activeObject(0), _highlightAll(false) {
98 for (std::vector<Tile>::iterator t =
_tiles.begin(); t !=
_tiles.end(); ++t)
111 if (!name.
empty() && (*--name.
end() ==
'\n'))
171 for (
int i = 0; i < 3; i++)
172 if (!stinger[i].empty())
225 for (std::vector<Tile>::iterator t =
_tiles.begin(); t !=
_tiles.end(); ++t)
265 for (std::vector<Tile>::iterator t =
_tiles.begin(); t !=
_tiles.end(); ++t)
301 _tiles.resize(tiles.size());
325 if (git.
hasField(
"EnvironmentList"))
348 uint32 ambientDayVol = CLIP<uint32>(props.
getUint(
"AmbientSndDayVol" , 127), 0, 127);
349 uint32 ambientNightVol = CLIP<uint32>(props.
getUint(
"AmbientSndNitVol", 127), 0, 127);
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)));
377 for (Aurora::GFF3List::const_iterator t = tiles.begin(); t != tiles.end(); ++t, ++n)
410 int tileVar = t.
getUint(
"Variation") + 1;
434 const std::list<uint32> &ids =
object.getIDs();
436 for (std::list<uint32>::const_iterator
id = ids.begin();
id != ids.end(); ++id)
437 _objectMap.insert(std::make_pair(*
id, &
object));
452 for (std::vector<Tile>::iterator t =
_tiles.begin(); t !=
_tiles.end(); ++t) {
453 if (t->modelName.empty())
466 const float rotation = -(((int) t->orientation) * 90.0f);
468 t->model->
setPosition(t->position[0], t->position[1], t->position[2]);
469 t->model->setOrientation(0.0f, 0.0f, 1.0f, rotation);
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"))
477 (*n)->rotate(0.0f, 0.0f, -rotation);
483 for (std::vector<Tile>::iterator t =
_tiles.begin(); t !=
_tiles.end(); ++t) {
490 object.setArea(
this);
497 for (Aurora::GFF3List::const_iterator d = list.begin(); d != list.end(); ++d) {
505 for (Aurora::GFF3List::const_iterator p = list.begin(); p != list.end(); ++p) {
513 for (Aurora::GFF3List::const_iterator p = list.begin(); p != list.end(); ++p) {
521 for (Aurora::GFF3List::const_iterator d = list.begin(); d != list.end(); ++d) {
529 for (Aurora::GFF3List::const_iterator c = list.begin(); c != list.end(); ++c) {
541 bool hasMove =
false;
542 for (std::list<Events::Event>::const_iterator e =
_eventQueue.begin();
548 if (e->button.button == SDL_BUTTON_LMASK) {
550 click(e->button.x, e->button.y);
553 if (e->key.keysym.sym == SDLK_TAB)
556 if (e->key.keysym.sym == SDLK_TAB)
598 if ((x < 0) || (y < 0))
621 if (o->second->isClickable())
622 o->second->highlight(enabled);
std::vector< Common::UString > _musicBattleStinger
Battle music stingers.
Class to hold the two-dimensional array of a 2DA file.
void loadEnvironment(const Aurora::GFF3List &list)
Handling version V3.2/V3.3 of BioWare's GFFs (generic file format).
Common::UString _musicBattle
Music that plays in battle.
Neverwinter Nights 2 utility functions.
#define MKTAG(a0, a1, a2, a3)
A wrapper macro used around four character constants, like 'DATA', to ensure portability.
void loadProperties(const Aurora::GFF3Struct &props)
ObjectList _objects
List of all objects in the area.
uint32 _width
Width of the area in tiles, as seen from top-down.
The global graphics manager.
const Common::UString & getString(size_t column) const
Return the contents of a cell as a string.
bool _hasTerrain
Does area have terrain or is it purely tile-based?
bool getBool(const Common::UString &field, bool def=false) const
A class holding an UTF-8 string.
The global config manager.
void playAmbientMusic(Common::UString music="")
Play the specified music (or the area's default) as ambient music.
Sound::ChannelHandle _ambientMusic
Sound handle of the currently playing music.
void removeFocus()
Forcibly remove the focus from the currently highlighted object.
Loader for TRX, baked terrain files, found in Neverwinter Nights 2.
void highlightAll(bool enabled)
void stopAmbientSound()
Stop the ambient sound.
virtual void loadModel()
Load the object's model(s).
bool hasField(const Common::UString &field) const
Does this specific field exist?
The context holding a Neverwinter Nights 2 area.
Common::UString _musicNight
Music that plays by night.
void loadTile(const Aurora::GFF3Struct &t, Tile &tile)
bool _highlightAll
Are we currently highlighting all objects?
Sound::ChannelHandle _ambientSound
Sound handle of the currently playing sound.
uint32 getMusicBattleTrack() const
Return the music track ID playing in battle.
void show()
Show the area.
std::list< Events::Event > _eventQueue
The event queue.
void loadWaypoints(const Aurora::GFF3List &list)
Common::UString _resRef
The area's resref (resource ID).
const GFF3Struct & getTopLevel() const
Returns the top-level struct.
const Common::UString & getName()
Return the area's localized name.
Area(Module &module, const Common::UString &resRef)
uint64 getUint(const Common::UString &field, uint64 def=0) const
Orientation orientation
The tile's orientation.
Common::UString _name
The object's display name.
void stopSound()
Stop all sounds.
An object within a NWN2 area.
Common::Mutex _mutex
Mutex securing access to the area.
void readVarTable(const Aurora::GFF3List &varTable)
Read the object's variable table.
void notifyCameraMoved()
Notify the area that the camera has been moved.
uint32 _height
Height of the area in tiles, as seen from top-down.
void setMusicNightTrack(uint32 track)
Set the music track ID playing by night.
virtual void leave()
The cursor left the object.
void exceptionDispatcherWarning(const char *s,...)
Exception dispatcher that prints the exception as a warning, and adds another reason on top...
void addEvent(const Events::Event &event)
Add a single event for consideration into the area event queue.
Mouse button was pressed.
Common::UString _ambientNight
Ambient sound that plays by night.
void loadCreatures(const Aurora::GFF3List &list)
Keyboard key was pressed.
The context needed to run a Neverwinter Nights 2 module.
A 3D model in the NWN2 MDB format.
float floorTint[3][4]
Tint color of the floor parts.
Basic exceptions to throw.
A creature in a Neverwinter Nights 2 area.
const char * c_str() const
Return the (utf8 encoded) string data.
uint32 _musicBattleTrack
Music track ID that plays in battle.
Fake value for an area object.
static UString format(const char *s,...) GCC_PRINTF(1
Print formatted data into an UString object, similar to sprintf().
void removeObject(NWN2::Object &object)
Remove an object from this container.
Orientation
Tile orientation.
#define ConfigMan
Shortcut for accessing the config manager.
void readScripts(const Aurora::GFF3Struct &gff)
uint32 tileID
ID of the tile's appearance.
Utility templates and functions.
Engines::NWN2::Object * _activeObject
The currently active (highlighted) object.
double getDouble(const Common::UString &field, double def=0.0) const
Handling BioWare's 2DAs (two-dimensional array).
float wallTint[3][4]
Tint color of the wall parts.
A GFF (generic file format) V3.2/V3.3 file, found in all Aurora games except Sonic Chronicles: The Da...
A node within a 3D model.
Common::ScopedPtr< TRXFile > _terrain
The area's terrain.
Common::UString _displayName
The area's localized display name.
void addObject(NWN2::Object &object)
Add an object to this container.
static const uint32 kStrRefInvalid
The global sound manager, handling all sound output.
bool empty() const
Is the string empty?
#define TwoDAReg
Shortcut for accessing the 2da registry.
#define SoundMan
Shortcut for accessing the sound manager.
float _ambientDayVol
Day ambient sound volume.
void checkActive(int x=-1, int y=-1)
const Common::UString & getResRef()
Return the area's resref (resource ID).
Engines::NWN2::Object * getObjectAt(int x, int y)
uint32 getMusicNightTrack() const
Return the music track ID playing by night.
void loadGIT(const Aurora::GFF3Struct &git)
ObjectMap _objectMap
Map of all non-static objects in the area.
void setPosition(float x, float y, float z)
Set the current position of the model.
virtual void enter()
The cursor entered the object.
#define CursorMan
Shortcut for accessing the cursor manager.
const Common::UString & getName() const
Return the object's name.
std::vector< const GFF3Struct * > GFF3List
Convenience class that locks a mutex on creation and unlocks it on destruction.
The Aurora cursor manager.
Sound::ChannelHandle playSound(const Common::UString &sound, Sound::SoundType soundType, bool loop, float volume, bool pitchVariance)
Play this sound resource.
uint32 _musicNightTrack
Music track ID that plays by night.
void loadPlaceables(const Aurora::GFF3List &list)
bool isStatic() const
Is the object static (not manipulable at all)?
An object that can be displayed by the graphics manager.
const GFF3List & getList(const Common::UString &field) const
void setActive(Engines::NWN2::Object *object)
Common::UString _musicDay
Music that plays by day.
uint32 getID() const
Get the object's unique ID.
Common::UString modelName
ResRef of the model.
bool _visible
Is the area currently visible?
const TwoDARow & getRow(size_t row) const
Get a row.
void processEventQueue()
Process the current event queue.
Graphics::Aurora::Model * model
The tile's model.
void setMusicBattleTrack(uint32 track)
Set the music track ID playing in battle.
bool readTint(const Aurora::GFF3Struct &gff, float t[3][4])
Common::UString _ambientDay
Ambient sound that plays by day.
const GFF3Struct & getStruct(const Common::UString &field) const
A door in a Neverwinter Nights 2 area.
uint32 _musicDayTrack
Music track ID that plays by day.
void playAmbientSound(Common::UString sound="")
Play the specified sound (or the area's default) as ambient sound.
A placeable object in a Neverwinter Nights 2 area.
float _ambientNightVol
Night ambient sound volume.
uint32 getMusicDayTrack() const
Return the music track ID playing by day.
void erase(iterator from, iterator to)
Erase the character within this range.
Common::UString getString(const Common::UString &field, const Common::UString &def="") const
void loadARE(const Aurora::GFF3Struct &are)
Generic Aurora engines utility functions.
bool metaTile
Is this tile a meta tile?
std::vector< Tile > _tiles
The area's tiles.
void loadTiles(const Aurora::GFF3List &tiles)
Creature * getPC()
Return the currently playing PC.
Loading MDB files found in Neverwinter Nights 2.
void loadDoors(const Aurora::GFF3List &list)
Common::UString createDisplayName(const Common::UString &name)
Strip text enclosed in {} from a string.
void loadObject(Engines::NWN2::Object &object)
Loader for Neverwinter Nights 2 baked terrain files (TRX).
Graphics::Aurora::Model * loadModelObject(const Common::UString &resref, const Common::UString &texture)
const Common::UString & getDisplayName()
Return the area's localized display name.
Keyboard key was released.
virtual bool click(Object *triggerer=0)
The object was clicked.
void setMusicDayTrack(uint32 track)
Set the music track ID playing by day.
#define GfxMan
Shortcut for accessing the graphics manager.
void hide()
Hide the area.
float position[3]
The tile's position.
A waypoint in a Neverwinter Nights 2 area.
void stopAmbientMusic()
Stop the ambient music.
Generic Aurora engines model functions.