157 for (
int i = 0; i < 3; i++)
158 if (!stinger[i].empty())
209 for (RoomList::iterator r =
_rooms.begin(); r !=
_rooms.end(); ++r)
240 for (RoomList::iterator r =
_rooms.begin(); r !=
_rooms.end(); ++r)
329 uint32 ambientDayVol = CLIP<uint32>(props.
getUint(
"AmbientSndDayVol" , 127), 0, 127);
330 uint32 ambientNightVol = CLIP<uint32>(props.
getUint(
"AmbientSndNightVol", 127), 0, 127);
332 _ambientDayVol = 1.25f * (1.0f - (1.0f / powf(5.0f, ambientDayVol / 127.0f)));
333 _ambientNightVol = 1.25f * (1.0f - (1.0f / powf(5.0f, ambientNightVol / 127.0f)));
350 for (Aurora::LYTFile::RoomArray::const_iterator r = rooms.begin(); r != rooms.end(); ++r) {
351 _rooms.push_back(
new Room(r->model, r->x, r->y, r->z));
360 const std::list<uint32> &ids =
object.getIDs();
362 for (std::list<uint32>::const_iterator
id = ids.begin();
id != ids.end(); ++id)
363 _objectMap.insert(std::make_pair(*
id, &
object));
370 for (Aurora::GFF3List::const_iterator w = list.begin(); w != list.end(); ++w) {
378 for (Aurora::GFF3List::const_iterator p = list.begin(); p != list.end(); ++p) {
387 for (Aurora::GFF3List::const_iterator d = list.begin(); d != list.end(); ++d) {
396 for (Aurora::GFF3List::const_iterator c = list.begin(); c != list.end(); ++c) {
404 for (Aurora::GFF3List::const_iterator t = list.begin(); t != list.end(); ++t) {
417 bool hasMove =
false;
418 for (std::list<Events::Event>::const_iterator e =
_eventQueue.begin();
424 if (e->button.button == SDL_BUTTON_LMASK) {
426 click(e->button.x, e->button.y);
429 if (e->key.keysym.sym == SDLK_TAB)
432 if (e->key.keysym.sym == SDLK_TAB)
474 if ((x < 0) || (y < 0))
498 if (o->second->isClickable())
499 o->second->highlight(enabled);
523 for (RoomList::iterator r =
_rooms.begin();
526 result = (*r)->evaluateElevation(x, y,
true);
538 if ((*s)->testCollision(orig, dest))
547 for (RoomList::iterator r =
_rooms.begin();
560 for (std::vector<Trigger *>::const_iterator it =
_triggers.begin();
570 for (std::vector<Trigger *>::iterator it =
_triggers.begin();
592 for (RoomList::iterator r =
_rooms.begin();
594 if (!(*r)->isVisible())
598 for (ObjectList::iterator o =
_objects.begin();
600 if (!(*o)->isVisible())
604 GfxMan.resumeAnimations();
620 if (pcRoom == prevPCRoom)
623 std::vector<Common::UString> visRooms;
628 for (std::vector<Common::UString>::const_iterator v = va.begin();
629 v != va.end(); ++v) {
631 if (std::find(visRooms.begin(), visRooms.end(), lcResRef) == visRooms.end())
632 visRooms.push_back(lcResRef);
638 for (RoomList::iterator r =
_rooms.begin();
640 bool visible = std::find(visRooms.begin(), visRooms.end(), (*r)->getResRef()) != visRooms.end();
642 if (!(*r)->isVisible())
644 }
else if ((*r)->isVisible())
648 for (ObjectList::iterator o =
_objects.begin();
650 const Room *objRoom = (*o)->getRoom();
651 bool visible = objRoom && objRoom->
isVisible();
653 if (!(*o)->isVisible())
655 }
else if ((*o)->isVisible())
659 GfxMan.resumeAnimations();
677 for (ObjectList::iterator o =
_objects.begin();
679 if ((*o)->getTag().stricmp(tag) == 0)
686 for (RoomList::const_iterator r =
_rooms.begin();
688 if ((*r)->evaluateElevation(x, y) !=
FLT_MIN)
uint32 _musicNightTrack
Music track ID that plays by night.
Class to hold the two-dimensional array of a 2DA file.
void addObject(KotOR2::Object &object)
Add an object to this container.
std::list< Events::Event > _eventQueue
The event queue.
Handling version V3.2/V3.3 of BioWare's GFFs (generic file format).
#define ResMan
Shortcut for accessing the sound manager.
#define MKTAG(a0, a1, a2, a3)
A wrapper macro used around four character constants, like 'DATA', to ensure portability.
float _ambientDayVol
Day ambient sound volume.
void loadCreatures(const Aurora::GFF3List &list)
bool isStatic() const
Is the object static (not manipulable at all)?
KotOR2::Object * getObjectByTag(const Common::UString &tag)
void add(const char *s,...) GCC_PRINTF(2
A room within a Star Wars: Knights of the Old Republic II - The Sith Lords area.
A creature in a Star Wars: Knights of the Old Republic II - The Sith Lords area.
void disableWalkmeshHighlight()
The global graphics manager.
virtual void getPosition(float &x, float &y, float &z) const
Return the object's position within its area.
const Common::UString & getString(size_t column) const
Return the contents of a cell as a string.
Module * _module
The module this area is in.
Room * getRoom()
Get a room the object is in.
void stopSound()
Stop all sounds.
A class holding an UTF-8 string.
Sound::ChannelHandle _ambientSound
Sound handle of the currently playing sound.
bool _highlightAll
Are we currently highlighting all objects?
Common::UString _resRef
The area's resref (resource ID).
bool hasField(const Common::UString &field) const
Does this specific field exist?
virtual bool click(Object *triggerer=0)
The object was clicked.
Common::UString _musicNight
Music that plays by night.
void evaluateTriggers(float x, float y)
void setMusicNightTrack(uint32 track)
Set the music track ID playing by night.
const GFF3Struct & getTopLevel() const
Returns the top-level struct.
void show()
Show the object's model(s).
uint64 getUint(const Common::UString &field, uint64 def=0) const
Common::UString _ambientDay
Ambient sound that plays by day.
virtual void enter()
The cursor entered the object.
std::list< Situated * > _situatedObjects
Aurora::LYTFile _lyt
The area's layout description.
The context holding a Star Wars: Knights of the Old Republic II - The Sith Lords area.
const std::vector< Common::UString > & getVisibilityArray(const Common::UString &room) const
Return the visibility array for a given room.
Exception that provides a stack of explanations.
A simple scoped smart pointer template.
bool testCollision(const glm::vec3 &orig, const glm::vec3 &dest) const
void load(Common::SeekableReadStream &vis)
Load a VIS file.
void removeObject(KotOR2::Object &object)
Remove an object from this container.
A placeable in a Star Wars: Knights of the Old Republic II - The Sith Lords area. ...
Mouse button was pressed.
void setActive(KotOR2::Object *object)
Keyboard key was pressed.
Aurora::VISFile _vis
The area's inter-room visibility description.
A door in a Star Wars: Knights of the Old Republic II - The Sith Lords area.
void loadTriggers(const Aurora::GFF3List &list)
Basic exceptions to throw.
const char * c_str() const
Return the (utf8 encoded) string data.
const RoomArray & getRooms() const
Get all rooms in this layout.
uint32 _musicDayTrack
Music track ID that plays by day.
void loadDoors(const Aurora::GFF3List &list)
Common::UString _name
The object's display name.
Utility templates and functions.
float evaluateElevation(float x, float y, bool highlight=false)
void setMusicDayTrack(uint32 track)
Set the music track ID playing by day.
ObjectList _objects
List of all objects in the area.
Handling BioWare's 2DAs (two-dimensional array).
const std::vector< Common::UString > & getRoomsVisibleFrom(const Common::UString &room) const
void loadCameraStyle(uint32 id)
void stopAmbientSound()
Stop the ambient sound.
Common::Mutex _mutex
Mutex securing access to the area.
bool runScript(Script script, const Aurora::NWScript::ObjectReference owner=Aurora::NWScript::ObjectReference(), const Aurora::NWScript::ObjectReference triggerer=Aurora::NWScript::ObjectReference())
ObjectMap _objectMap
Map of all non-static objects in the area.
A GFF (generic file format) V3.2/V3.3 file, found in all Aurora games except Sonic Chronicles: The Da...
Creature * getPC()
Return the currently playing PC.
static const uint32 kStrRefInvalid
std::vector< Room > RoomArray
void hide()
Hide the object's model(s).
void playAmbientSound(Common::UString sound="")
Play the specified sound (or the area's default) as ambient sound.
Common::UString _ambientNight
Ambient sound that plays by night.
void stopAmbientMusic()
Stop the ambient music.
void loadPlaceables(const Aurora::GFF3List &list)
The global sound manager, handling all sound output.
bool empty() const
Is the string empty?
uint32 _musicBattleTrack
Music track ID that plays in battle.
#define TwoDAReg
Shortcut for accessing the 2da registry.
void loadWaypoints(const Aurora::GFF3List &list)
void highlightAll(bool enabled)
uint32 getMusicDayTrack() const
Return the music track ID playing by day.
RoomList _rooms
All rooms in the area.
#define SoundMan
Shortcut for accessing the sound manager.
void setRoom(Room *room)
Set a room the object is in.
#define CursorMan
Shortcut for accessing the cursor manager.
Basic reading stream interfaces.
void loadGIT(const Aurora::GFF3Struct &git)
std::vector< const GFF3Struct * > GFF3List
Convenience class that locks a mutex on creation and unlocks it on destruction.
The context needed to run a Star Wars: Knights of the Old Republic II - The Sith Lords module...
float evaluateElevation(float x, float y)
The Aurora cursor manager.
Sound::ChannelHandle playSound(const Common::UString &sound, Sound::SoundType soundType, bool loop, float volume, bool pitchVariance)
Play this sound resource.
void addEvent(const Events::Event &event)
Add a single event for consideration into the area event queue.
void loadProperties(const Aurora::GFF3Struct &props)
An object that can be displayed by the graphics manager.
std::vector< Trigger * > _triggers
.— Triggers
const GFF3List & getList(const Common::UString &field) const
uint32 getID() const
Get the object's unique ID.
Fake value for an area object.
const TwoDARow & getRow(size_t row) const
Get a row.
void setMusicBattleTrack(uint32 track)
Set the music track ID playing in battle.
Common::UString getResRef() const
void processEventQueue()
Process the current event queue.
Common::UString _musicDay
Music that plays by day.
bool _visible
Is the area currently visible?
const GFF3Struct & getStruct(const Common::UString &field) const
void loadARE(const Aurora::GFF3Struct &are)
KotOR2::Object * _activeObject
The currently active (highlighted) object.
void loadObject(KotOR2::Object &object)
void playAmbientMusic(Common::UString music="")
Play the specified music (or the area's default) as ambient music.
Common::UString getString(const Common::UString &field, const Common::UString &def="") const
uint32 getMusicBattleTrack() const
Return the music track ID playing in battle.
KotOR2::Object * getActiveObject()
Generic Aurora engines utility functions.
void readScripts(const Aurora::GFF3Struct &gff)
Sound::ChannelHandle _ambientMusic
Sound handle of the currently playing music.
void notifyObjectMoved(Object &o)
A waypoint in a Star Wars: Knights of the Old Republic II - The Sith Lords area.
virtual void leave()
The cursor left the object.
uint32 getMusicNightTrack() const
Return the music track ID playing by night.
KotOR2::Object * getObjectAt(int x, int y)
void checkActive(int x=-1, int y=-1)
Keyboard key was released.
void load(Common::SeekableReadStream &lyt)
Load a LYT file.
float _ambientNightVol
Night ambient sound volume.
Area(Module &module, const Common::UString &resRef)
An object that can be displayed by the graphics manager.
void clickObject(Object *object)
Room * getRoomAt(float x, float y) const
#define GfxMan
Shortcut for accessing the graphics manager.
void removeFocus()
Forcibly remove the focus from the currently highlighted object.
The global resource manager for Aurora resources.
CameraStyle _cameraStyle
'—
float getFloat(size_t column) const
Return the contents of a cell as a float.
void getCameraStyle(float &distance, float &pitch, float &height) const
Common::UString _musicBattle
Music that plays in battle.
Area data, room visibilities.
std::vector< Common::UString > _musicBattleStinger
Battle music stingers.
bool contains(float x, float y) const