56 _module(&module), _resRef(resRef), _visible(false),
57 _activeObject(0), _highlightAll(false) {
96 for (std::vector<Tile>::iterator t =
_tiles.begin(); t !=
_tiles.end(); ++t)
109 if (!name.
empty() && (*--name.
end() ==
'\n'))
176 for (
int i = 0; i < 3; i++)
177 if (!stinger[i].empty())
230 for (std::vector<Tile>::iterator t =
_tiles.begin(); t !=
_tiles.end(); ++t)
261 for (std::vector<Tile>::iterator t =
_tiles.begin(); t !=
_tiles.end(); ++t)
332 uint32 ambientDayVol = CLIP<uint32>(props.
getUint(
"AmbientSndDayVol" , 127), 0, 127);
333 uint32 ambientNightVol = CLIP<uint32>(props.
getUint(
"AmbientSndNightVol", 127), 0, 127);
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)));
353 for (Aurora::GFF3List::const_iterator t = tiles.begin(); t != tiles.end(); ++t, ++n) {
359 assert(n ==
_tiles.size());
399 const std::list<uint32> &ids =
object.getIDs();
401 for (std::list<uint32>::const_iterator
id = ids.begin();
id != ids.end(); ++id)
402 _objectMap.insert(std::make_pair(*
id, &
object));
459 const float tileX = x * 10.0f + 5.0f;
460 const float tileY = y * 10.0f + 5.0f;
487 object.setArea(
this);
494 for (Aurora::GFF3List::const_iterator d = list.begin(); d != list.end(); ++d) {
502 for (Aurora::GFF3List::const_iterator p = list.begin(); p != list.end(); ++p) {
510 for (Aurora::GFF3List::const_iterator d = list.begin(); d != list.end(); ++d) {
518 for (Aurora::GFF3List::const_iterator c = list.begin(); c != list.end(); ++c) {
530 bool hasMove =
false;
531 for (std::list<Events::Event>::const_iterator e =
_eventQueue.begin();
537 if (e->button.button == SDL_BUTTON_LMASK) {
539 click(e->button.x, e->button.y);
542 if (e->key.keysym.sym == SDLK_TAB)
545 if (e->key.keysym.sym == SDLK_TAB)
587 if ((x < 0) || (y < 0))
610 if (o->second->isClickable())
611 o->second->highlight(enabled);
629 if (++it == name.
end())
633 if (++it == name.
end())
Class to hold the two-dimensional array of a 2DA file.
Common::UString _resRef
The area's resref (resource ID).
Handling version V3.2/V3.3 of BioWare's GFFs (generic file format).
std::vector< Common::UString > _musicBattleStinger
Battle music stingers.
#define MKTAG(a0, a1, a2, a3)
A wrapper macro used around four character constants, like 'DATA', to ensure portability.
Creature * getPC()
Return the currently playing PC.
void checkActive(int x=-1, int y=-1)
void add(const char *s,...) GCC_PRINTF(2
ObjectList _objects
List of all objects in the area.
void setMusicDayTrack(uint32 track)
Set the music track ID playing by day.
The global graphics manager.
const Common::UString & getResRef()
Return the area's resref (resource ID).
const Common::UString & getString(size_t column) const
Return the contents of a cell as a string.
uint8 mainLight[2]
Overall colored lighting effects.
void readScripts(const Aurora::GFF3Struct &gff)
bool _highlightAll
Are we currently highlighting all objects?
bool getBool(const Common::UString &field, bool def=false) const
const Common::UString & getEnvironmentMap() const
Return the area's environment map.
void playAmbientSound(Common::UString sound="")
Play the specified sound (or the area's default) as ambient sound.
A class holding an UTF-8 string.
void stopAmbientSound()
Stop the ambient sound.
const Common::UString & getName() const
Return the object's name.
std::list< Events::Event > _eventQueue
The event queue.
Graphics::Aurora::Model * model
The tile's model.
A placeable object in a Neverwinter Nights area.
bool hasField(const Common::UString &field) const
Does this specific field exist?
Common::UString _name
The object's display name.
uint32 _height
Height of the area in tiles, as seen from top-down.
const GFF3Struct & getTopLevel() const
Returns the top-level struct.
void loadProperties(const Aurora::GFF3Struct &props)
virtual bool click(Object *triggerer=0)
The object was clicked.
Sound::ChannelHandle _ambientSound
Sound handle of the currently playing sound.
uint64 getUint(const Common::UString &field, uint64 def=0) const
void loadARE(const Aurora::GFF3Struct &are)
void show()
Show the area.
void removeFocus()
Forcibly remove the focus from the currently highlighted object.
Common::UString _musicDay
Music that plays by day.
bool isStatic() const
Is the object static (not manipulable at all)?
void highlightAll(bool enabled)
uint32 _musicDayTrack
Music track ID that plays by day.
void loadWaypoints(const Aurora::GFF3List &list)
uint32 height
The number of height transitions the tile is shifted up.
uint32 getMusicNightTrack() const
Return the music track ID playing by night.
Exception that provides a stack of explanations.
void playAmbientMusic(Common::UString music="")
Play the specified music (or the area's default) as ambient music.
Fake value for an area object.
virtual void enter()
The cursor entered the object.
void loadPlaceables(const Aurora::GFF3List &list)
Mouse button was pressed.
Keyboard key was pressed.
bool _visible
Is the area currently visible?
The context needed to run a Neverwinter Nights module.
Common::UString _tilesetName
Name of the tileset.
float _ambientNightVol
Night ambient sound volume.
Basic exceptions to throw.
Common::UString _musicNight
Music that plays by night.
void setOrientation(float x, float y, float z, float angle)
Set the current orientation of the model.
The context holding a Neverwinter Nights area.
utf8::iterator< std::string::const_iterator > iterator
const char * c_str() const
Return the (utf8 encoded) string data.
uint8 srcLight[2]
Flaming light sources.
uint32 getMusicBattleTrack() const
Return the music track ID playing in battle.
void setMusicNightTrack(uint32 track)
Set the music track ID playing by night.
Area(Module &module, const Common::UString &resRef)
Utility templates and functions.
uint32 getMusicDayTrack() const
Return the music track ID playing by day.
Common::ScopedPtr< Tileset > _tileset
The actual tileset.
uint32 _musicBattleTrack
Music track ID that plays in battle.
Handling BioWare'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...
void addEvent(const Events::Event &event)
Add a single event for consideration into the area event queue.
static const uint32 kStrRefInvalid
void loadCreatures(const Aurora::GFF3List &list)
void setActive(NWN::Object *object)
Common::UString _displayName
The area's localized display name.
void loadTile(const Aurora::GFF3Struct &t, Tile &tile)
std::vector< Tile > _tiles
The area's tiles.
The global sound manager, handling all sound output.
bool empty() const
Is the string empty?
#define TwoDAReg
Shortcut for accessing the 2da registry.
Common::UString _ambientNight
Ambient sound that plays by night.
#define SoundMan
Shortcut for accessing the sound manager.
void addObject(NWN::Object &object)
Add an object to this container.
static Common::UString createDisplayName(const Common::UString &name)
void loadDoors(const Aurora::GFF3List &list)
bool animLoop[3]
Should the tile's AnimLoop0[123] play?
void setPosition(float x, float y, float z)
Set the current position of the model.
#define CursorMan
Shortcut for accessing the cursor manager.
std::vector< const GFF3Struct * > GFF3List
Convenience class that locks a mutex on creation and unlocks it on destruction.
const Common::UString & getDisplayName()
Return the area's localized display name.
The Aurora cursor manager.
void hide()
Hide the area.
Module * _module
The module this area is in.
Sound::ChannelHandle playSound(const Common::UString &sound, Sound::SoundType soundType, bool loop, float volume, bool pitchVariance)
Play this sound resource.
An object that can be displayed by the graphics manager.
void notifyCameraMoved()
Notify the area that the camera has been moved.
NWN::Object * _activeObject
The currently active (highlighted) object.
const GFF3List & getList(const Common::UString &field) const
uint32 getID() const
Get the object's unique ID.
const TwoDARow & getRow(size_t row) const
Get a row.
virtual void leave()
The cursor left the object.
virtual void loadModel()
Load the object's model(s).
const GFF3Struct & getStruct(const Common::UString &field) const
A creature in a Neverwinter Nights area.
Common::Mutex _mutex
Mutex securing access to the area.
void stopSound()
Stop all sounds.
Common::UString _musicBattle
Music that plays in battle.
const Tileset::Tile * tile
The actual tile within the tileset.
void status(const char *s,...)
uint32 _musicNightTrack
Music track ID that plays by night.
ObjectMap _objectMap
Map of all non-static objects in the area.
void erase(iterator from, iterator to)
Erase the character within this range.
void loadGIT(const Aurora::GFF3Struct &git)
uint32 tileID
The ID of the tile within the tileset.
Common::UString getString(const Common::UString &field, const Common::UString &def="") const
NWN::Object * getObjectAt(int x, int y)
Orientation orientation
The orientation of the tile.
Generic Aurora engines utility functions.
void processEventQueue()
Process the current event queue.
void stopAmbientMusic()
Stop the ambient music.
uint32 _width
Width of the area in tiles, as seen from top-down.
Sound::ChannelHandle _ambientMusic
Sound handle of the currently playing music.
Common::UString _ambientDay
Ambient sound that plays by day.
void removeObject(NWN::Object &object)
Remove an object from this container.
void setMusicBattleTrack(uint32 track)
Set the music track ID playing in battle.
float _ambientDayVol
Day ambient sound volume.
static const Common::UString kEmptyString
Graphics::Aurora::Model * loadModelObject(const Common::UString &resref, const Common::UString &texture)
A door in a Neverwinter Nights area.
Keyboard key was released.
void loadObject(NWN::Object &object)
#define GfxMan
Shortcut for accessing the graphics manager.
Orientation
Tile orientation.
A waypoint in a Neverwinter Nights area.
const Common::UString & getName()
Return the area's localized name.
Generic Aurora engines model functions.