121 loadModule(module, entryLocation, entryLocationType);
145 e.
add(
"Failed loading module \"%s\"", module.
c_str());
150 float mapPt1X, mapPt1Y, mapPt2X, mapPt2Y;
151 float worldPt1X, worldPt1Y, worldPt2X, worldPt2Y;
153 northAxis =
_area->getNorthAxis();
154 _area->getMapPoint1(mapPt1X, mapPt1Y);
155 _area->getMapPoint2(mapPt2X, mapPt2Y);
156 _area->getWorldPoint1(worldPt1X, worldPt1Y);
157 _area->getWorldPoint2(worldPt2X, worldPt2Y);
164 _ingame->setMinimap(mapId, northAxis,
165 worldPt1X, worldPt1Y, worldPt2X, worldPt2Y,
166 mapPt1X, mapPt1Y, mapPt2X, mapPt2Y);
261 const int level =
ConfigMan.getInt(
"texturepack");
270 status(
"Loading texture pack %d", level);
274 if (oldTexturePack != -1)
288 if (completeUnload) {
314 std::list<Common::ChangeID>::reverse_iterator r;
361 loadModule(newModule, entryLocation, entryLocationType);
372 if (!startMovie.
empty())
375 float entryX, entryY, entryZ, entryAngle;
381 _pc->getPosition(entryX, entryY, entryZ);
384 _pc->setPosition(entryX, entryY, entryZ);
386 _ingame->setPosition(entryX, entryY);
402 float cameraDistance, cameraPitch, cameraHeight;
403 _area->getCameraStyle(cameraDistance, cameraPitch, cameraHeight);
415 _area->notifyPCMoved();
417 GfxMan.resumeAnimations();
426 float &entryX,
float &entryY,
float &entryZ,
float &entryAngle) {
435 while (!kotorObject && search->
get()) {
437 if (!kotorObject || !(kotorObject->
getType() & location))
459 float entryDirX, entryDirY;
538 uint32 now = SDL_GetTicks();
573 if (event->key.keysym.sym == SDLK_ESCAPE) {
579 if ((event->key.keysym.sym == SDLK_d) && (event->key.keysym.mod & KMOD_CTRL)) {
586 switch (event->type) {
589 if (event->key.keysym.scancode == SDL_SCANCODE_W) {
591 }
else if (event->key.keysym.scancode == SDL_SCANCODE_S) {
607 _area->addEvent(*event);
616 _area->processEventQueue();
631 bool haveMovement =
false;
635 _pc->getPosition(x, y, z);
637 float moveRate =
_pc->getRunRate();
653 z =
_area->evaluateElevation(
_pc.get(), newX, newY);
655 if (!
_area->testCollision(glm::vec3(x, y, z + 0.1f),
656 glm::vec3(newX, newY, z + 0.1f)))
662 const float *position =
CameraMan.getPosition();
663 SoundMan.setListenerPosition(position[0], position[1], position[2]);
664 const float *orientation =
CameraMan.getOrientation();
665 SoundMan.setListenerOrientation(orientation[0], orientation[1], orientation[2], 0.0f, 1.0f, 0.0f);
673 _pc->playDefaultAnimation();
684 if (now < action->timestamp)
689 action->owner, action->triggerer);
699 _pc->setPosition(x, y, z);
706 float x, y, z, angle;
713 load(module,
object, type);
721 _pc->getPosition(x, y, z);
730 _area->evaluateTriggers(x, y);
733 _area->notifyPCMoved();
741 _party.push_back(creature);
744 _ingame->setPartyLeader(creature);
745 else if (
_party.size() == 2)
746 _ingame->setPartyMember1(creature);
747 else if (
_party.size() == 3)
748 _ingame->setPartyMember2(creature);
752 _pc->getPosition(x, y, z);
765 if (index >= static_cast<int>(
_party.size()) || index < 0)
768 std::list<Creature *>::iterator iter =
_party.begin();
769 std::advance(iter, index);
774 std::list<Creature *>::iterator iter =
_party.begin();
776 std::advance(iter, npc);
792 _pc->getPosition(x, y, z);
810 for (std::map<int, Common::UString>::iterator i =
_availableParty.begin();
834 for (
int i = 0; i < 10; ++i)
841 for (
int i = 0; i < 10; ++i)
852 std::map<int, Common::UString>::iterator i =
_availableParty.find(slot);
868 _ingame->setReturnQueryStrref(
id);
872 _ingame->setReturnEnabled(enabled);
880 std::map<Common::UString, bool>::const_iterator iter =
_globalBooleans.find(
id);
892 std::map<Common::UString, int>::const_iterator iter =
_globalNumbers.find(
id);
919 action.
state = state;
920 action.
owner = owner;
966 _area->showAllRooms();
970 _area->toggleWalkmesh();
974 _area->toggleTriggers();
993 if (finalName.
empty() && owner) {
999 if (finalName.
empty())
1002 _dialog->startConversation(finalName, owner);
1004 if (
_dialog->isConversationActive()) {
1024 if (headAnim.
empty())
1037 inv = &
_pc->getInventory();
1066 _pc->playDefaultAnimation();
A creature in a Star Wars: Knights of the Old Republic area.
void show()
Show the creature's model.
Handling version V3.2/V3.3 of BioWare's GFFs (generic file format).
void addToParty(Creature *creature)
Add a creature to the party.
#define MKTAG(a0, a1, a2, a3)
A wrapper macro used around four character constants, like 'DATA', to ensure portability.
void delayScript(const Common::UString &script, const Aurora::NWScript::ScriptState &state, Aurora::NWScript::Object *owner, Aurora::NWScript::Object *triggerer, uint32 delay)
void playVideo(const Common::UString &video)
Play this video resource.
Generic Aurora engines resource utility functions.
void add(const char *s,...) GCC_PRINTF(2
std::map< Common::UString, int > _globalNumbers
virtual Object * next()=0
Move to the next object in the search context and return the previous one.
void setGlobalNumber(const Common::UString &id, int value)
Get a global number.
void loadSavedGame(SavedGame *save)
A class holding an UTF-8 string.
Common::UString _module
The current module's name.
#define TextureMan
Shortcut for accessing the texture manager.
std::list< Common::ChangeID > _resources
Resources added by the current module.
void enter()
Enter the loaded module, starting it.
The global config manager.
void addItemToActiveObject(const Common::UString &item, int count)
Handling BioWare's RIMs (resource archives).
void unload()
Unload a currently loaded IFO.
bool isRunning() const
Is a module currently running?
bool indexOptionalArchive(const Common::UString &file, uint32 priority, const std::vector< byte > &password, Common::ChangeID *changeID)
The Aurora texture manager.
const Common::UString & getConversation() const
bool _running
Are we currently running a module?
A simple streaming file reading class.
bool operator<(const Action &s) const
iterator getPosition(size_t n) const
Convert a numerical position into an iterator.
Module(::Engines::Console &console)
Engine utility class for camera handling where camera rotates around PC.
virtual void playAnimation(const Common::UString &anim, bool restart=true, float length=0.0f, float speed=1.0f)
const GFF3Struct & getTopLevel() const
Returns the top-level struct.
ObjectType
Object type, matches the bitfield in nwscript.nss.
void getEntryDirection(float &x, float &y) const
Return the entry direction.
void processEventQueue()
Process the current event queue.
void setReturnQueryStrref(uint32 id)
Set the string for the return dialog.
virtual void hide()
Hide the GUI.
void showMenu()
Show the ingame main menu.
Inventory & getInventory()
iterator findFirst(uint32 c) const
void playHeadAnimation(const Common::UString &anim, bool restart=true, float length=0.0f, float speed=1.0f)
ObjectType getType() const
Return the exact type of the object.
const Common::UString & getString(Language language, LanguageGender gender=kLanguageGenderCurrent) const
Get the string of that language.
Common::UString _entryLocation
The tag of the object in the start location for this module.
static const char *const texturePacks[3]
Exception that provides a stack of explanations.
std::list< Creature * > _party
void changeModule(const Common::UString &module, const Common::UString &entryLocation, ObjectType entryLocationType)
Schedule a change to a new module.
void deindexResources(Common::ChangeID &changeID)
Remove previously added resources from the ResourceManager.
const Aurora::IFOFile & getIFO() const
Return the IFO of the currently loaded module.
void exceptionDispatcherWarning(const char *s,...)
Exception dispatcher that prints the exception as a warning, and adds another reason on top...
void setReturnStrref(uint32 id)
Set the return string for the 'Return to Ebon Hawk' button.
std::map< Common::UString, bool > _globalBooleans
Keyboard key was pressed.
void loadModule(const Common::UString &module, const Common::UString &entryLocation, ObjectType entryLocationType)
Load the actual module.
bool close(Object *closer)
The closer object closes this placeable.
Basic exceptions to throw.
void load(Common::SeekableReadStream *stream, bool repairNWNPremium=false)
Take over this stream and load an IFO out of it.
Common::ChangeID _textures
Resources added by the current texture pack.
bool contains(const UString &what) const
UString substr(iterator from, iterator to) const
void indexMandatoryArchive(const Common::UString &file, uint32 priority, const std::vector< byte > &password, Common::ChangeID *changeID)
const char * c_str() const
Return the (utf8 encoded) string data.
Aurora::NWScript::ObjectReference triggerer
void replaceModule()
Actually replace the currently running module.
void toggleFreeRoamCamera()
const Common::UString & getName() const
Return the object's name.
#define ConfigMan
Shortcut for accessing the config manager.
Common::UString slotTemplate[10]
Common::ScopedPtr< DialogGUI > _dialog
Conversation/cutscene GUI.
Utility templates and functions.
void switchPlayerCharacter(int npc)
Switch the player character.
Common::UString _name
The object's display name.
An IFO (module information) file, describing global module properties in many Aurora games...
Common::ScopedPtr< Graphics::Aurora::FadeQuad > _fade
const Common::UString & getConversation() const
Get the conversation for this object.
Aurora::NWScript::ScriptState state
The global events manager.
A GFF (generic file format) V3.2/V3.3 file, found in all Aurora games except Sonic Chronicles: The Da...
const Common::UString & getName() const
Return the module's name.
ObjectSearch * findObjectsByTag(const Common::UString &tag) const
Return a search context to iterate over all objects with this tag.
The global sound manager, handling all sound output.
bool empty() const
Is the string empty?
bool runScript(Script script, const Aurora::NWScript::ObjectReference owner=Aurora::NWScript::ObjectReference(), const Aurora::NWScript::ObjectReference triggerer=Aurora::NWScript::ObjectReference())
Generic Aurora engines (debug) console.
ObjectType _entryLocationType
The type(s) of the object in the start location for this module.
#define SoundMan
Shortcut for accessing the sound manager.
void unload(bool completeUnload=true)
Unload the whole shebang.
A scoped plain pointer, allowing pointer-y access and normal deletion.
Aurora::NWScript::ObjectReference owner
An area in Star Wars: Knights of the Old Republic, holding all objects and rooms within, as well as general area properties like the current background music and ambient sounds.
void startConversation(const Common::UString &name, Aurora::NWScript::Object *owner=0)
Graphics::Aurora::FadeQuad & getFadeQuad()
Return the fade quad.
Aurora::IFOFile _ifo
The current module's IFO.
void getEntryIFOLocation(float &entryX, float &entryY, float &entryZ, float &entryAngle)
The context holding a Star Wars: Knights of the Old Republic area.
std::vector< const GFF3Struct * > GFF3List
virtual void show()
Show the GUI.
Inventory & getInventory()
#define EventMan
Shortcut for accessing the events manager.
A placeable in a Star Wars: Knights of the Old Republic area.
void setReturnEnabled(bool enabled)
Enable or disable the 'Return to Ebon Hawk' button.
void addEvent(const Events::Event &event)
Add a single event for consideration into the event queue.
Implementing the stream reading interfaces for files.
void addItem(const Common::UString &tag, int count=1)
bool getEntryObjectLocation(float &entryX, float &entryY, float &entryZ, float &entryAngle)
static KotOR::Object * toObject(::Aurora::NWScript::Object *object)
void movePC(float x, float y, float z)
Move the player character to this position within the current area.
Basic type definitions to handle files used in BioWare's Aurora engine.
void addAvailablePartyMember(int slot, const Common::UString &templ)
Add available party member by template.
void clear()
Clear the whole context.
const GFF3List & getList(const Common::UString &field) const
static Placeable * toPlaceable(Aurora::NWScript::Object *object)
void loadTexturePack()
Load texture pack used by the module.
std::map< int, Common::UString > _availableParty
bool isAvailableCreature(int slot)
Check if there is a party member available for this id.
Common::ScopedPtr< IngameGUI > _ingame
The ingame ui.
A class representing an undoable change.
bool getGlobalBoolean(const Common::UString &id) const
Get a global boolean.
const GFF3Struct * getGFF() const
Return the IFO's GFF struct.
const LocString & getName() const
Return the name of the module.
static Creature * toCreature(Aurora::NWScript::Object *object)
Party selection GUI for Star Wars: Knights of the Old Republic.
void playAnimationOnActiveObject(const Common::UString &baseAnim, const Common::UString &headAnim)
void setPosition(float x, float y, float z)
Set the creature's position.
const Common::UString & getModuleName() const
void status(const char *s,...)
void printf(const char *s,...) GCC_PRINTF(2
void setGlobalBoolean(const Common::UString &id, bool value)
Set a global boolean.
bool processEvent(const Events::Event &event)
bool isLoaded() const
Is a module currently loaded and ready to run?
#define CameraMan
Shortcut for accessing the camera manager.
Common::UString getString(const Common::UString &field, const Common::UString &def="") const
void stopCameraMovement()
static Situated * toSituated(Aurora::NWScript::Object *object)
Class to hold resource data of a RIM archive file.
static float rad2deg(float rad)
bool _hasModule
Do we have a module?
Generic Aurora engines utility functions.
Conversation/cutscene GUI for Star Wars: Knights of the Old Republic.
void playDefaultHeadAnimation()
void readScripts(const Aurora::GFF3Struct &gff, bool clear=true)
void usePC(Creature *pc)
Use this character as the player character.
The context needed to run a Star Wars: Knights of the Old Republic module.
bool isObjectPartyMember(Creature *creature)
Check if the specified creature is a party member.
const Common::UString & getTag() const
Return the module's tag.
virtual void getPosition(float &x, float &y, float &z) const
Return the object's position within its area.
Common::ScopedPtr< PartySelectionGUI > _partySelection
void getEntryPosition(float &x, float &y, float &z) const
Return the entry position.
const Common::UString & getEntryArea() const
Return the entry area.
ActionQueue _delayedActions
Common::UString _newModule
The module we should change to.
Keyboard key was released.
Area * getCurrentArea()
Return the area the PC is currently in.
Creature * getPartyMember(int index)
Get a party member by index.
int getGlobalNumber(const Common::UString &id) const
Set a global number.
Fake value for a module object.
bool _exit
Should we exit the module?
void movedPC()
Notify the module that the PC was moved.
void leave()
Leave the running module, quitting it.
Engine utility class for free-roam camera handling.
void clickObject(Object *object)
Open the inventory of a container.
Handling BioWare's DLGs (dialog / conversation files).
virtual Object * get()=0
Return the current object in the search context.
void clear()
Clear the string's contents.
Common::ScopedPtr< Creature > _pc
The player character we use.
const Common::UString & getStartMovie() const
Return the starting movie.
::Engines::Console * _console
void addObject(KotOR::Object &object)
Add an object to this container.
#define GfxMan
Shortcut for accessing the graphics manager.
void removeItem(const Common::UString &tag, int count=1)
Utility class for manipulating file paths.
Common::ScopedPtr< Area > _area
The current module's area.
bool getObjectLocation(const Common::UString &object, ObjectType location, float &entryX, float &entryY, float &entryZ, float &entryAngle)
void showPartySelectionGUI(int forceNPC1, int forceNPC2)
Show the party selection GUI.
void exit()
Exit the currently running module.
size_t getPartyMemberCount()
Get the count of party members.
int _currentTexturePack
The current texture pack.
Creature * getPC()
Return the currently playing PC.
float _backwardsBtnPressed