114 loadModule(module, entryLocation, entryLocationType);
134 e.
add(
"Failed loading module \"%s\"", module.
c_str());
223 int level =
ConfigMan.getInt(
"texturepack", 2);
230 status(
"Loading texture pack %d", level);
246 if (completeUnload) {
267 std::list<Common::ChangeID>::reverse_iterator r;
314 loadModule(newModule, entryLocation, entryLocationType);
328 if (!startMovie.
empty())
331 float entryX, entryY, entryZ, entryAngle;
336 _pc->setPosition(entryX, entryY, entryZ);
342 float cameraDistance, cameraPitch, cameraHeight;
343 _area->getCameraStyle(cameraDistance, cameraPitch, cameraHeight);
355 _area->notifyPCMoved();
357 GfxMan.resumeAnimations();
364 float &entryX,
float &entryY,
float &entryZ,
float &entryAngle) {
373 while (!kotorObject && search->
get()) {
375 if (!kotorObject || !(kotorObject->
getType() & location))
397 float entryDirX, entryDirY;
451 uint32 now = SDL_GetTicks();
476 if (event->key.keysym.sym == SDLK_ESCAPE) {
482 if ((event->key.keysym.sym == SDLK_d) && (event->key.keysym.mod & KMOD_CTRL)) {
495 switch (event->type) {
498 if (event->key.keysym.scancode == SDL_SCANCODE_W) {
500 }
else if (event->key.keysym.scancode == SDL_SCANCODE_S) {
515 _area->addEvent(*event);
524 _area->processEventQueue();
541 if (now < action->timestamp)
546 action->owner, action->triggerer);
556 bool haveMovement =
false;
560 _pc->getPosition(x, y, z);
577 z =
_area->evaluateElevation(newX, newY);
579 if (!
_area->testCollision(glm::vec3(x, y, z + 0.1f),
580 glm::vec3(newX, newY, z + 0.1f)))
590 _pc->playDefaultAnimation();
599 _pc->setPosition(x, y, z);
605 float x, y, z, angle;
612 load(module,
object, type);
620 _pc->getPosition(x, y, z);
629 _area->evaluateTriggers(x, y);
632 _area->notifyPCMoved();
655 action.
state = state;
656 action.
owner = owner;
702 _area->showAllRooms();
706 _area->toggleWalkmesh();
710 _area->toggleTriggers();
719 if (finalName.
empty() && owner) {
725 if (finalName.
empty())
728 _dialog->startConversation(finalName, owner);
730 if (
_dialog->isConversationActive()) {
750 if (headAnim.
empty())
Handling version V3.2/V3.3 of BioWare's GFFs (generic file format).
#define MKTAG(a0, a1, a2, a3)
A wrapper macro used around four character constants, like 'DATA', to ensure portability.
void playVideo(const Common::UString &video)
Play this video resource.
Generic Aurora engines resource utility functions.
void addEvent(const Events::Event &event)
Add a single event for consideration into the event queue.
void add(const char *s,...) GCC_PRINTF(2
A creature in a Star Wars: Knights of the Old Republic II - The Sith Lords area.
The global graphics manager.
virtual void getPosition(float &x, float &y, float &z) const
Return the object's position within its area.
Common::ScopedPtr< Area > _area
The current module's area.
virtual Object * next()=0
Move to the next object in the search context and return the previous one.
Common::UString _newModule
The module we should change to.
A class holding an UTF-8 string.
Fake value for a module object.
#define TextureMan
Shortcut for accessing the texture manager.
The global config manager.
virtual void playAnimation(const Common::UString &anim, bool restart=true, float length=0.0f, float speed=1.0f)
ActionQueue _delayedActions
Handling BioWare's RIMs (resource archives).
void unload()
Unload a currently loaded IFO.
bool _exit
Should we exit the module?
Common::UString _module
The current module's name.
void movePC(float x, float y, float z)
Move the player character to this position within the current area.
bool indexOptionalArchive(const Common::UString &file, uint32 priority, const std::vector< byte > &password, Common::ChangeID *changeID)
Area * getCurrentArea()
Return the area the PC is currently in.
The Aurora texture manager.
A simple streaming file reading class.
static const char *const texturePacks[3]
Engine utility class for camera handling where camera rotates around PC.
const GFF3Struct & getTopLevel() const
Returns the top-level struct.
bool _hasModule
Do we have a module?
void getEntryDirection(float &x, float &y) const
Return the entry direction.
void unload(bool completeUnload=true)
Unload the whole shebang.
bool getEntryObjectLocation(float &entryX, float &entryY, float &entryZ, float &entryAngle)
The context holding a Star Wars: Knights of the Old Republic II - The Sith Lords area.
const Common::UString & getString(Language language, LanguageGender gender=kLanguageGenderCurrent) const
Get the string of that language.
Exception that provides a stack of explanations.
A simple scoped smart pointer template.
void deindexResources(Common::ChangeID &changeID)
Remove previously added resources from the ResourceManager.
bool isRunning() const
Is a module currently running?
Keyboard key was pressed.
void getEntryIFOLocation(float &entryX, float &entryY, float &entryZ, float &entryAngle)
::Engines::Console * _console
Basic exceptions to throw.
void load(Common::SeekableReadStream *stream, bool repairNWNPremium=false)
Take over this stream and load an IFO out of it.
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.
void playHeadAnimation(const Common::UString &anim, bool restart=true, float length=0.0f, float speed=1.0f)
static const float kPCMovementSpeed
bool _running
Are we currently running a module?
#define ConfigMan
Shortcut for accessing the config manager.
Common::UString _name
The object's display name.
Utility templates and functions.
Common::ScopedPtr< Engines::KotOR2::IngameGUI > _ingame
The ingame gui.
An IFO (module information) file, describing global module properties in many Aurora games...
std::list< Common::ChangeID > _resources
Resources added by the current module.
void loadModule(const Common::UString &module, const Common::UString &entryLocation, ObjectType entryLocationType)
Load the actual module.
void movedPC()
Notify the module that the PC was moved.
The global events manager.
Aurora::IFOFile _ifo
The current module's IFO.
bool runScript(Script script, const Aurora::NWScript::ObjectReference owner=Aurora::NWScript::ObjectReference(), const Aurora::NWScript::ObjectReference triggerer=Aurora::NWScript::ObjectReference())
A GFF (generic file format) V3.2/V3.3 file, found in all Aurora games except Sonic Chronicles: The Da...
ObjectType _entryLocationType
The type(s) of the object in the start location for this module.
void enter()
Enter the loaded module, starting it.
Creature * getPC()
Return the currently playing PC.
const Aurora::IFOFile & getIFO() const
Return the IFO of the currently loaded module.
bool getObjectLocation(const Common::UString &object, ObjectType location, float &entryX, float &entryY, float &entryZ, float &entryAngle)
void changeModule(const Common::UString &module, const Common::UString &entryLocation, ObjectType entryLocationType)
Schedule a change to a new module.
void usePC(Creature *pc)
Use this character as the player character.
void processEventQueue()
Process the current event queue.
ObjectSearch * findObjectsByTag(const Common::UString &tag) const
Return a search context to iterate over all objects with this tag.
Common::ScopedPtr< Creature > _pc
The player character we use.
bool empty() const
Is the string empty?
Generic Aurora engines (debug) console.
A scoped plain pointer, allowing pointer-y access and normal deletion.
const Common::UString & getConversation() const
Common::UString _entryLocation
The tag of the object in the start location for this module.
void replaceModule()
Actually replace the currently running module.
std::vector< const GFF3Struct * > GFF3List
Aurora::NWScript::ScriptState state
The context needed to run a Star Wars: Knights of the Old Republic II - The Sith Lords module...
#define EventMan
Shortcut for accessing the events manager.
Implementing the stream reading interfaces for files.
Basic type definitions to handle files used in BioWare's Aurora engine.
const GFF3List & getList(const Common::UString &field) const
void clear()
Clear the whole context.
void showMenu()
Show the ingame main menu.
Aurora::NWScript::ObjectReference owner
ObjectType getType() const
Return the exact type of the object.
ObjectType
Object type, matches the bitfield in nwscript.nss.
static KotOR2::Object * toObject(::Aurora::NWScript::Object *object)
A class representing an undoable change.
Module(::Engines::Console &console)
const GFF3Struct * getGFF() const
Return the IFO's GFF struct.
const LocString & getName() const
Return the name of the module.
float _backwardsBtnPressed
bool isLoaded() const
Is a module currently loaded and ready to run?
void status(const char *s,...)
void printf(const char *s,...) GCC_PRINTF(2
bool processEvent(const Events::Event &event)
void toggleFreeRoamCamera()
#define CameraMan
Shortcut for accessing the camera manager.
Common::UString getString(const Common::UString &field, const Common::UString &def="") const
Class to hold resource data of a RIM archive file.
static float rad2deg(float rad)
Generic Aurora engines utility functions.
void readScripts(const Aurora::GFF3Struct &gff)
const Common::UString & getName() const
Return the module's name.
const Common::UString & getTag() const
Return the module's tag.
void getEntryPosition(float &x, float &y, float &z) const
Return the entry position.
const Common::UString & getEntryArea() const
Return the entry area.
Common::ChangeID _textures
Resources added by the current texture pack.
Keyboard key was released.
Engine utility class for free-roam camera handling.
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.
void exit()
Exit the currently running module.
void clickObject(Object *object)
const Common::UString & getStartMovie() const
Return the starting movie.
Aurora::NWScript::ObjectReference triggerer
void delayScript(const Common::UString &script, const Aurora::NWScript::ScriptState &state, Aurora::NWScript::Object *owner, Aurora::NWScript::Object *triggerer, uint32 delay)
const Common::UString & getName() const
Return the object's name.
bool operator<(const Action &s) const
void leave()
Leave the running module, quitting it.
void playAnimationOnActiveObject(const Common::UString &baseAnim, const Common::UString &headAnim)
#define GfxMan
Shortcut for accessing the graphics manager.
Utility class for manipulating file paths.
Common::ScopedPtr< DialogGUI > _dialog
Conversation/cutscene GUI.
An area in Star Wars: Knights of the Old Republic II - The Sith Lords, holding all objects and rooms ...
int _currentTexturePack
The current texture pack.
void playDefaultHeadAnimation()
void startConversation(const Common::UString &name, Aurora::NWScript::Object *owner=0)
static Creature * toCreature(Aurora::NWScript::Object *object)