161 for (
int i = 0; i < 3; i++)
162 if (!stinger[i].empty())
237 for (RoomList::iterator r =
_rooms.begin(); r !=
_rooms.end(); ++r)
268 for (RoomList::iterator r =
_rooms.begin(); r !=
_rooms.end(); ++r)
372 uint32 ambientDayVol = CLIP<uint32>(props.
getUint(
"AmbientSndDayVol" , 127), 0, 127);
373 uint32 ambientNightVol = CLIP<uint32>(props.
getUint(
"AmbientSndNightVol", 127), 0, 127);
375 _ambientDayVol = 1.25f * (1.0f - (1.0f / powf(5.0f, ambientDayVol / 127.0f)));
376 _ambientNightVol = 1.25f * (1.0f - (1.0f / powf(5.0f, ambientNightVol / 127.0f)));
393 for (Aurora::LYTFile::RoomArray::const_iterator r = rooms.begin(); r != rooms.end(); ++r) {
394 _rooms.push_back(
new Room(r->model, r->x, r->y, r->z));
403 const std::list<uint32> &ids =
object.getIDs();
405 for (std::list<uint32>::const_iterator
id = ids.begin();
id != ids.end(); ++id)
406 _objectMap.insert(std::make_pair(*
id, &
object));
413 for (Aurora::GFF3List::const_iterator w = list.begin(); w != list.end(); ++w) {
421 for (Aurora::GFF3List::const_iterator p = list.begin(); p != list.end(); ++p) {
430 for (Aurora::GFF3List::const_iterator d = list.begin(); d != list.end(); ++d) {
439 for (Aurora::GFF3List::const_iterator c = list.begin(); c != list.end(); ++c) {
448 for (Aurora::GFF3List::const_iterator t = list.begin(); t != list.end(); ++t) {
457 for (Aurora::GFF3List::const_iterator c = list.begin(); c != list.end(); ++c) {
469 bool hasMove =
false;
470 for (std::list<Events::Event>::const_iterator e =
_eventQueue.begin();
476 if (e->button.button == SDL_BUTTON_LMASK) {
478 click(e->button.x, e->button.y);
481 if (e->key.keysym.sym == SDLK_TAB)
484 if (e->key.keysym.sym == SDLK_TAB)
526 if ((x < 0) || (y < 0))
550 if (o->second->isClickable())
551 o->second->highlight(enabled);
566 Room *room =
object->getRoom();
572 if (room && doHighlight)
575 for (RoomList::iterator r =
_rooms.begin();
578 result = (*r)->evaluateElevation(x, y, doHighlight);
590 if ((*s)->testCollision(orig, dest))
599 for (RoomList::iterator r =
_rooms.begin();
612 for (std::vector<Trigger *>::const_iterator it =
_triggers.begin();
622 for (std::vector<Trigger *>::iterator it =
_triggers.begin();
644 for (RoomList::iterator r =
_rooms.begin();
646 if (!(*r)->isVisible())
650 for (ObjectList::iterator o =
_objects.begin();
652 if (!(*o)->isVisible())
656 GfxMan.resumeAnimations();
672 if (pcRoom == prevPCRoom)
675 std::vector<Common::UString> visRooms;
680 for (std::vector<Common::UString>::const_iterator v = va.begin();
681 v != va.end(); ++v) {
683 if (std::find(visRooms.begin(), visRooms.end(), lcResRef) == visRooms.end())
684 visRooms.push_back(lcResRef);
690 for (RoomList::iterator r =
_rooms.begin();
692 bool visible = std::find(visRooms.begin(), visRooms.end(), (*r)->getResRef()) != visRooms.end();
694 if (!(*r)->isVisible())
696 }
else if ((*r)->isVisible())
700 for (ObjectList::iterator o =
_objects.begin();
702 const Room *objRoom = (*o)->getRoom();
703 bool visible = objRoom && objRoom->
isVisible();
705 if (!(*o)->isVisible())
707 }
else if ((*o)->isVisible())
711 GfxMan.resumeAnimations();
729 for (ObjectList::iterator o =
_objects.begin();
731 if ((*o)->getTag().stricmp(tag) == 0)
738 for (std::vector<Creature *>::iterator c =
_creatures.begin();
745 std::vector<Creature *>::iterator crit = std::find(
_creatures.begin(),
_creatures.end(), object);
749 std::vector<Trigger *>::iterator tit = std::find(
_triggers.begin(),
_triggers.end(), object);
761 const std::list<uint32> &ids =
object->
getIDs();
763 for (std::list<uint32>::const_iterator
id = ids.begin();
id != ids.end(); ++id)
772 for (RoomList::const_iterator r =
_rooms.begin();
774 if ((*r)->evaluateElevation(x, y) !=
FLT_MIN)
void loadSounds(const Aurora::GFF3List &list)
Common::UString _musicDay
Music that plays by day.
A creature in a Star Wars: Knights of the Old Republic area.
int64 getSint(const Common::UString &field, int64 def=0) const
Class to hold the two-dimensional array of a 2DA file.
Handling version V3.2/V3.3 of BioWare's GFFs (generic file format).
#define ResMan
Shortcut for accessing the sound manager.
void stopAmbientSound()
Stop the ambient sound.
void loadCameraStyle(uint32 id)
const std::vector< Common::UString > & getRoomsVisibleFrom(const Common::UString &room) const
#define MKTAG(a0, a1, a2, a3)
A wrapper macro used around four character constants, like 'DATA', to ensure portability.
std::vector< Creature * > _creatures
KotOR::Object * getObjectByTag(const Common::UString &tag)
void add(const char *s,...) GCC_PRINTF(2
void playAmbientMusic(Common::UString music="")
Play the specified music (or the area's default) as ambient music.
The global graphics manager.
A waypoint in a Star Wars: Knights of the Old Republic area.
void processEventQueue()
Process the current event queue.
const Common::UString & getString(size_t column) const
Return the contents of a cell as a string.
void loadPlaceables(const Aurora::GFF3List &list)
A class holding an UTF-8 string.
uint32 _musicDayTrack
Music track ID that plays by day.
Aurora::VISFile _vis
The area's inter-room visibility description.
A room within a Star Wars: Knights of the Old Republic area.
void playAmbientSound(Common::UString sound="")
Play the specified sound (or the area's default) as ambient sound.
Fake value for an area object.
bool hasField(const Common::UString &field) const
Does this specific field exist?
void loadObject(KotOR::Object &object)
void getMapPoint1(float &x, float &y)
Get the first map point.
Common::Mutex _mutex
Mutex securing access to the area.
Area(Module &module, const Common::UString &resRef)
An ingame sound in kotor.
Common::UString _musicNight
Music that plays by night.
RoomList _rooms
All rooms in the area.
Common::UString _resRef
The area's resref (resource ID).
const GFF3Struct & getTopLevel() const
Returns the top-level struct.
uint64 getUint(const Common::UString &field, uint64 def=0) const
void getCameraStyle(float &distance, float &pitch, float &height) const
void setMusicDayTrack(uint32 track)
Set the music track ID playing by day.
float evaluateElevation(float x, float y, bool highlight=false)
ObjectMap _objectMap
Map of all non-static objects in the area.
Creature action executor for Star Wars: Knights of the Old Republic.
void loadWaypoints(const Aurora::GFF3List &list)
void loadDoors(const Aurora::GFF3List &list)
bool isStatic() const
Is the object static (not manipulable at all)?
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.
void showAllRooms()
'—
void load(Common::SeekableReadStream &vis)
Load a VIS file.
Keyboard key was pressed.
Trigger in a Star Wars: Knights of the Old Republic area.
void disableWalkmeshHighlight()
Mouse button was released.
bool testCollision(const glm::vec3 &orig, const glm::vec3 &dest) const
Basic exceptions to throw.
const char * c_str() const
Return the (utf8 encoded) string data.
uint32 _musicBattleTrack
Music track ID that plays in battle.
void highlightAll(bool enabled)
void processCreaturesActions(float dt)
Module * _module
The module this area is in.
const RoomArray & getRooms() const
Get all rooms in this layout.
void getWorldPoint1(float &x, float &y)
Get the first world point.
void hide()
Hide the object's model(s).
Utility templates and functions.
Common::UString _name
The object's display name.
void removeFocus()
Forcibly remove the focus from the currently highlighted object.
Room * getRoom()
Get a room the object is in.
Sound::ChannelHandle _ambientMusic
Sound handle of the currently playing music.
Common::UString getResRef() const
double getDouble(const Common::UString &field, double def=0.0) const
Handling BioWare's 2DAs (two-dimensional array).
void evaluateTriggers(float x, float y)
CameraStyle _cameraStyle
'—
void setMusicBattleTrack(uint32 track)
Set the music track ID playing in battle.
void loadGIT(const Aurora::GFF3Struct &git)
A GFF (generic file format) V3.2/V3.3 file, found in all Aurora games except Sonic Chronicles: The Da...
A door in a Star Wars: Knights of the Old Republic area.
void stopAmbientMusic()
Stop the ambient music.
static const uint32 kStrRefInvalid
std::vector< Room > RoomArray
Room * getRoomAt(float x, float y) const
The global sound manager, handling all sound output.
bool empty() const
Is the string empty?
#define TwoDAReg
Shortcut for accessing the 2da registry.
bool runScript(Script script, const Aurora::NWScript::ObjectReference owner=Aurora::NWScript::ObjectReference(), const Aurora::NWScript::ObjectReference triggerer=Aurora::NWScript::ObjectReference())
uint32 _musicNightTrack
Music track ID that plays by night.
const std::list< uint32 > & getIDs() const
Return the object's model IDs.
#define SoundMan
Shortcut for accessing the sound manager.
void stopSound()
Stop all sounds.
Common::UString _ambientNight
Ambient sound that plays by night.
void setActive(KotOR::Object *object)
KotOR::Object * getActiveObject()
#define CursorMan
Shortcut for accessing the cursor manager.
Aurora::LYTFile _lyt
The area's layout description.
Basic reading stream interfaces.
bool _highlightAll
Are we currently highlighting all objects?
The context holding a Star Wars: Knights of the Old Republic area.
std::vector< const GFF3Struct * > GFF3List
Convenience class that locks a mutex on creation and unlocks it on destruction.
bool _visible
Is the area currently visible?
A placeable in a Star Wars: Knights of the Old Republic area.
The Aurora cursor manager.
KotOR::Object * getObjectAt(int x, int y)
Sound::ChannelHandle _ambientSound
Sound handle of the currently playing sound.
Sound::ChannelHandle playSound(const Common::UString &sound, Sound::SoundType soundType, bool loop, float volume, bool pitchVariance)
Play this sound resource.
virtual void enter()
The cursor entered the object.
void getMapPoint2(float &x, float &y)
Get the second map point.
uint32 getMusicBattleTrack() const
Return the music track ID playing in battle.
An object that can be displayed by the graphics manager.
void addEvent(const Events::Event &event)
Add a single event for consideration into the area event queue.
const GFF3List & getList(const Common::UString &field) const
void toggleTriggers()
.— Triggers
uint32 getID() const
Get the object's unique ID.
virtual bool click(Object *triggerer=0)
The object was clicked.
const TwoDARow & getRow(size_t row) const
Get a row.
void remove(const typename std::list< T *>::value_type &val)
void loadTriggers(const Aurora::GFF3List &list)
int getNorthAxis()
Get the north axis id.
std::list< Events::Event > _eventQueue
The event queue.
float _ambientNightVol
Night ambient sound volume.
float evaluateElevation(Object *object, float x, float y, bool doHighlight=true)
const GFF3Struct & getStruct(const Common::UString &field) const
virtual void leave()
The cursor left the object.
void show()
Show the object's model(s).
std::vector< Common::UString > _musicBattleStinger
Battle music stingers.
uint32 getMusicDayTrack() const
Return the music track ID playing by day.
KotOR::Object * _activeObject
The currently active (highlighted) object.
void removeObject(KotOR::Object *object)
std::vector< Trigger * > _triggers
.— Triggers
Common::UString getString(const Common::UString &field, const Common::UString &def="") const
Generic Aurora engines utility functions.
void setRoom(Room *room)
Set a room the object is in.
void readScripts(const Aurora::GFF3Struct &gff, bool clear=true)
void loadCreatures(const Aurora::GFF3List &list)
The context needed to run a Star Wars: Knights of the Old Republic module.
ObjectList _objects
List of all objects in the area.
virtual void getPosition(float &x, float &y, float &z) const
Return the object's position within its area.
uint32 getMusicNightTrack() const
Return the music track ID playing by night.
void getWorldPoint2(float &x, float &y)
Get the second world point.
float _ambientDayVol
Day ambient sound volume.
Keyboard key was released.
void load(Common::SeekableReadStream &lyt)
Load a LYT file.
Common::UString _ambientDay
Ambient sound that plays by day.
Common::UString _musicBattle
Music that plays in battle.
void clickObject(Object *object)
Open the inventory of a container.
An object that can be displayed by the graphics manager.
void removeObject(KotOR::Object &object)
Remove an object from this container.
void loadProperties(const Aurora::GFF3Struct &props)
void notifyObjectMoved(Object &o)
void addObject(KotOR::Object &object)
Add an object to this container.
#define GfxMan
Shortcut for accessing the graphics manager.
void loadARE(const Aurora::GFF3Struct &are)
The global resource manager for Aurora resources.
static void executeActions(Creature &creature, Area &area, float dt)
void setMusicNightTrack(uint32 track)
Set the music track ID playing by night.
void checkActive(int x=-1, int y=-1)
std::list< Situated * > _situatedObjects
float getFloat(size_t column) const
Return the contents of a cell as a float.
Creature * getPC()
Return the currently playing PC.
Area data, room visibilities.
bool contains(float x, float y) const