xoreos
0.0.5
|
#include <module.h>
Classes | |
struct | Action |
Public Member Functions | |
Module (::Engines::Console &console) | |
~Module () | |
bool | isLoaded () const |
Is a module currently loaded and ready to run? More... | |
bool | isRunning () const |
Is a module currently running? More... | |
const Aurora::IFOFile & | getIFO () const |
Return the IFO of the currently loaded module. More... | |
const Common::UString & | getName () const |
Return the module's name. More... | |
const Common::UString & | getDescription () const |
Return the module's description. More... | |
Area * | getCurrentArea () |
Return the area the PC is currently in. More... | |
Creature * | getPC () |
Return the currently playing PC. More... | |
void | delayScript (const Common::UString &script, const Aurora::NWScript::ScriptState &state, Aurora::NWScript::Object *owner, Aurora::NWScript::Object *triggerer, uint32 delay) |
void | movePC (const Common::UString &area) |
Move the player character to this area. More... | |
void | movePC (float x, float y, float z) |
Move the player character to this position within the current area. More... | |
void | movePC (const Common::UString &area, float x, float y, float z) |
Move the player character to this position within this area. More... | |
void | movePC (Area *area, float x, float y, float z) |
Move the player character to this position within this area. More... | |
void | movedPC () |
Notify the module that the PC was moved. More... | |
void | clear () |
Clear the whole context. More... | |
void | load (const Common::UString &module) |
Load a module. More... | |
void | exit () |
Exit the currently running module. More... | |
void | enter (Creature &pc, bool isNewCampaign=true) |
Enter the loaded module, starting it. More... | |
void | leave () |
Leave the running module, quitting it. More... | |
void | addEvent (const Events::Event &event) |
Add a single event for consideration into the event queue. More... | |
void | processEventQueue () |
Process the current event queue. More... | |
Public Member Functions inherited from Engines::NWN2::Object | |
Object (ObjectType type=kObjectTypeInvalid) | |
virtual | ~Object () |
ObjectType | getType () const |
Return the exact type of the object. More... | |
virtual void | loadModel () |
Load the object's model(s). More... | |
virtual void | unloadModel () |
Unload the object's model(s). More... | |
virtual void | show () |
Show the object's model(s). More... | |
virtual void | hide () |
Hide the object's model(s). More... | |
const std::list< uint32 > & | getIDs () const |
Return the object's model IDs. More... | |
const Common::UString & | getName () const |
Return the object's name. More... | |
const Common::UString & | getDescription () const |
Return the object's description. More... | |
const Common::UString & | getConversation () const |
Return the object's default conversation (DLG). More... | |
const Aurora::SSFFile * | getSSF () |
Return the object's sound set. More... | |
bool | isStatic () const |
Is the object static (not manipulable at all)? More... | |
bool | isUsable () const |
Can the object be used by the PC? More... | |
bool | isClickable () const |
Can the player click the object? More... | |
Area * | getArea () const |
Return the area this object is currently in. More... | |
void | setArea (Area *) |
Set the area this object is currently in. More... | |
virtual void | getPosition (float &x, float &y, float &z) const |
Return the object's position within its area. More... | |
virtual void | getOrientation (float &x, float &y, float &z, float &angle) const |
Return the object's orientation. More... | |
virtual void | setPosition (float x, float y, float z) |
Set the object's position within its area. More... | |
virtual void | setOrientation (float x, float y, float z, float angle) |
Set the object's orientation. More... | |
Location | getLocation () const |
Create a Location out of the object's area, position and orientation. More... | |
virtual void | enter () |
The cursor entered the object. More... | |
virtual void | highlight (bool enabled) |
(Un)Highlight the object. More... | |
virtual bool | click (Object *triggerer=0) |
The object was clicked. More... | |
void | speakString (const Common::UString &string, uint32 volume) |
Speak the specified string. More... | |
void | speakOneLiner (Common::UString conv, Object *tokenTarget=0) |
Speak an one-liner from the specified conversation file. More... | |
void | stopSound () |
Stop the current object sound. More... | |
void | playSound (const Common::UString &sound, bool pitchVariance=false) |
Play an object sound. More... | |
Public Member Functions inherited from Aurora::NWScript::Object | |
Object () | |
uint32 | getID () const |
const Common::UString & | getTag () const |
Public Member Functions inherited from Aurora::NWScript::VariableContainer | |
VariableContainer () | |
virtual | ~VariableContainer () |
bool | hasVariable (const Common::UString &var) const |
Variable & | getVariable (const Common::UString &var, Type type=kTypeVoid) |
const Variable & | getVariable (const Common::UString &var) const |
void | setVariable (const Common::UString &var, const Variable &value) |
void | removeVariable (const Common::UString &var) |
void | clearVariables () |
Public Member Functions inherited from Engines::NWN2::ScriptContainer | |
ScriptContainer () | |
~ScriptContainer () | |
const Common::UString & | getScript (Script script) const |
bool | hasScript (Script script) const |
bool | runScript (Script script, const Aurora::NWScript::ObjectReference owner=Aurora::NWScript::ObjectReference(), const Aurora::NWScript::ObjectReference triggerer=Aurora::NWScript::ObjectReference()) |
Public Member Functions inherited from Engines::NWN2::ObjectContainer | |
ObjectContainer () | |
~ObjectContainer () | |
void | clearObjects () |
void | addObject (NWN2::Object &object) |
Add an object to this container. More... | |
void | removeObject (NWN2::Object &object) |
Remove an object from this container. More... | |
::Aurora::NWScript::Object * | getFirstObjectByType (ObjectType type) const |
Return the first object of this type. More... | |
::Aurora::NWScript::ObjectSearch * | findObjectsByType (ObjectType type) const |
Return a search context to iterate over all objects of this type. More... | |
Public Member Functions inherited from Aurora::NWScript::ObjectContainer | |
ObjectContainer () | |
~ObjectContainer () | |
void | clearObjects () |
void | addObject (Object &object) |
Add an object to this container. More... | |
void | removeObject (Object &object) |
Remove an object from this container. More... | |
Object * | getObjectByID (uint32 id) const |
Find a specific object by ID. More... | |
Object * | getFirstObject () const |
Return the first object. More... | |
Object * | getFirstObjectByTag (const Common::UString &tag) const |
Return the first object with this tag. More... | |
ObjectSearch * | findObjects () const |
Return a search context to iterate over all objects. More... | |
ObjectSearch * | findObjectsByTag (const Common::UString &tag) const |
Return a search context to iterate over all objects with this tag. More... | |
Private Types | |
enum | ActionType { kActionNone = 0, kActionScript = 1 } |
typedef Common::PtrMap< Common::UString, Area > | AreaMap |
typedef std::list< Events::Event > | EventQueue |
typedef std::multiset< Action > | ActionQueue |
Private Member Functions | |
void | unload () |
Unload the whole shebang. More... | |
void | unloadModule () |
Unload the module. More... | |
void | unloadPC () |
Unload the PC. More... | |
void | unloadTLK () |
Unload the TLK used by the module. More... | |
void | unloadHAKs () |
Unload the HAKs required by the module. More... | |
void | unloadAreas () |
Unload the areas. More... | |
void | checkXPs () |
Do we have all expansions needed for the module? More... | |
void | checkHAKs () |
Do we have all HAKs needed for the module? More... | |
void | loadTLK () |
Load the TLK used by the module. More... | |
void | loadHAKs () |
Load the HAKs required by the module. More... | |
void | loadAreas () |
Load the areas. More... | |
void | enterArea () |
Enter a new area. More... | |
void | loadModule (const Common::UString &module) |
Load the actual module. More... | |
void | changeModule (const Common::UString &module) |
Schedule a change to a new module. More... | |
void | replaceModule () |
Actually replace the currently running module. More... | |
void | handleEvents () |
void | handleActions () |
Private Attributes | |
::Engines::Console * | _console |
bool | _hasModule |
Do we have a module? More... | |
bool | _running |
Are we currently running a module? More... | |
bool | _exit |
Should we exit the module? More... | |
Common::ChangeID | _resModule |
Resources added by the module. More... | |
Common::ChangeID | _resTLK |
Resources added for the custom TLK. More... | |
std::vector< Common::ChangeID > | _resHAKs |
Resources added by the HAKs of the module. More... | |
Aurora::IFOFile | _ifo |
The module's IFO. More... | |
Creature * | _pc |
The player character we use. More... | |
AreaMap | _areas |
The areas in the current module. More... | |
Common::UString | _newArea |
The new area to enter. More... | |
Area * | _currentArea |
The current area. More... | |
bool | _ranPCSpawn |
Did we run the PC spawn script? More... | |
Common::UString | _newModule |
The module we should change to. More... | |
EventQueue | _eventQueue |
ActionQueue | _delayedActions |
Additional Inherited Members | |
Protected Member Functions inherited from Engines::NWN2::Object | |
void | loadSSF () |
Load the object's sound set. More... | |
void | readVarTable (const Aurora::GFF3List &varTable) |
Read the object's variable table. More... | |
void | readVarTable (const Aurora::GFF3Struct &gff) |
Protected Member Functions inherited from Engines::NWN2::ScriptContainer | |
void | clearScripts () |
void | readScripts (const Aurora::GFF3Struct &gff) |
void | readScripts (const ScriptContainer &container) |
Protected Member Functions inherited from Aurora::NWScript::ObjectContainer | |
void | lock () |
void | unlock () |
Protected Attributes inherited from Engines::NWN2::Object | |
ObjectType | _type |
The object's type. More... | |
Common::UString | _name |
The object's display name. More... | |
Common::UString | _description |
The object's description. More... | |
Common::UString | _conversation |
The object's default conversation. More... | |
uint32 | _soundSet |
The object's sound set, as an index into soundset.2da. More... | |
Common::ScopedPtr< Aurora::SSFFile > | _ssf |
The object's sound set. More... | |
bool | _static |
Is the object static? More... | |
bool | _usable |
Is the object usable? More... | |
std::list< uint32 > | _ids |
The object's model IDs. More... | |
Area * | _area |
The area the object is currently in. More... | |
float | _position [3] |
The object's position. More... | |
float | _orientation [4] |
The object's orientation. More... | |
Sound::ChannelHandle | _sound |
The currently playing object sound. More... | |
Protected Attributes inherited from Aurora::NWScript::Object | |
uint32 | _id |
Common::UString | _tag |
|
private |
|
private |
|
private |
|
private |
Engines::NWN2::Module::Module | ( | ::Engines::Console & | console | ) |
Definition at line 58 of file module.cpp.
Engines::NWN2::Module::~Module | ( | ) |
Definition at line 63 of file module.cpp.
References clear().
void Engines::NWN2::Module::addEvent | ( | const Events::Event & | event | ) |
Add a single event for consideration into the event queue.
Definition at line 244 of file module.cpp.
References _eventQueue.
|
private |
Schedule a change to a new module.
Definition at line 157 of file module.cpp.
References _newModule.
Referenced by load().
|
private |
Do we have all HAKs needed for the module?
Definition at line 149 of file module.cpp.
References _ifo, Aurora::IFOFile::getHAKs(), and ResMan.
Referenced by loadModule().
|
private |
Do we have all expansions needed for the module?
Definition at line 135 of file module.cpp.
References _ifo, ConfigMan, and Aurora::IFOFile::getExpansions().
Referenced by loadModule().
void Engines::NWN2::Module::clear | ( | ) |
Clear the whole context.
Definition at line 70 of file module.cpp.
References unload().
Referenced by ~Module().
void Engines::NWN2::Module::delayScript | ( | const Common::UString & | script, |
const Aurora::NWScript::ScriptState & | state, | ||
Aurora::NWScript::Object * | owner, | ||
Aurora::NWScript::Object * | triggerer, | ||
uint32 | delay | ||
) |
Definition at line 496 of file module.cpp.
References _delayedActions, EventMan, kActionScript, Engines::NWN2::Module::Action::owner, Engines::NWN2::Module::Action::script, Engines::NWN2::Module::Action::state, Engines::NWN2::Module::Action::timestamp, Engines::NWN2::Module::Action::triggerer, and Engines::NWN2::Module::Action::type.
Referenced by Engines::NWN2::Functions::actionDoCommand(), Engines::NWN2::Functions::assignCommand(), and Engines::NWN2::Functions::delayCommand().
void Engines::NWN2::Module::enter | ( | Creature & | pc, |
bool | isNewCampaign = true |
||
) |
Enter the loaded module, starting it.
Definition at line 180 of file module.cpp.
References _console, _exit, _ifo, Engines::NWN2::Object::_name, _newArea, _pc, _ranPCSpawn, _running, Common::StackException::add(), Engines::NWN2::ObjectContainer::addObject(), Common::UString::c_str(), CameraMan, Common::UString::empty(), Aurora::IFOFile::getEntryArea(), Aurora::IFOFile::getEntryDirection(), Aurora::IFOFile::getEntryPosition(), Engines::NWN2::Object::getName(), Aurora::IFOFile::getStartMovie(), isLoaded(), Engines::NWN2::kScriptEnter, Engines::NWN2::kScriptModuleLoad, Engines::NWN2::kScriptModuleStart, loadAreas(), loadHAKs(), Engines::NWN2::Creature::loadModel(), loadTLK(), Engines::playVideo(), Engines::Console::printf(), Common::rad2deg(), Engines::NWN2::ScriptContainer::runScript(), Engines::NWN2::Creature::setOrientation(), and Engines::NWN2::Creature::setPosition().
|
private |
Enter a new area.
Definition at line 262 of file module.cpp.
References _areas, _console, _currentArea, _exit, _newArea, _pc, _ranPCSpawn, Common::UString::c_str(), Common::UString::empty(), EventMan, Engines::NWN2::Area::getDisplayName(), Engines::NWN2::Area::getName(), Engines::NWN2::Area::getResRef(), Engines::NWN2::Creature::hide(), Engines::NWN2::Area::hide(), Engines::NWN2::kScriptEnter, Engines::NWN2::kScriptExit, Engines::NWN2::kScriptPCLoaded, Engines::Console::printf(), Engines::NWN2::ScriptContainer::runScript(), Engines::NWN2::Object::setArea(), Engines::NWN2::Creature::show(), Engines::NWN2::Area::show(), and warning().
Referenced by processEventQueue().
void Engines::NWN2::Module::exit | ( | ) |
Exit the currently running module.
Area * Engines::NWN2::Module::getCurrentArea | ( | ) |
Return the area the PC is currently in.
Definition at line 74 of file module.cpp.
References _currentArea.
const Common::UString & Engines::NWN2::Module::getDescription | ( | ) | const |
Return the module's description.
Definition at line 492 of file module.cpp.
References Engines::NWN2::Object::getDescription().
|
static |
Definition at line 529 of file module.cpp.
References ConfigMan, Aurora::GFF3Struct::getString(), Aurora::GFF3File::getTopLevel(), Aurora::kFileTypeIFO, and MKTAG.
const Aurora::IFOFile & Engines::NWN2::Module::getIFO | ( | ) | const |
Return the IFO of the currently loaded module.
Definition at line 484 of file module.cpp.
References _ifo.
Referenced by Engines::NWN2::Console::cmdGotoArea(), Engines::NWN2::Console::cmdListAreas(), and Engines::NWN2::Console::updateAreas().
const Common::UString & Engines::NWN2::Module::getName | ( | ) | const |
Return the module's name.
Definition at line 488 of file module.cpp.
References Engines::NWN2::Object::getName().
Referenced by Engines::NWN2::Console::cmdListModules().
|
static |
Definition at line 512 of file module.cpp.
References ConfigMan, Aurora::GFF3Struct::getString(), Aurora::GFF3File::getTopLevel(), Aurora::kFileTypeIFO, and MKTAG.
Creature * Engines::NWN2::Module::getPC | ( | ) |
Return the currently playing PC.
Definition at line 78 of file module.cpp.
References _pc.
Referenced by Engines::NWN2::Area::click(), Engines::NWN2::Functions::getFactionLeader(), Engines::NWN2::Functions::getFirstPC(), Engines::NWN2::Functions::getIsRosterMember(), Engines::NWN2::Functions::getTag(), and Engines::NWN2::Functions::jumpTo().
|
private |
Definition at line 319 of file module.cpp.
References _delayedActions, EventMan, kActionScript, and Engines::NWN2::ScriptContainer::runScript().
Referenced by processEventQueue().
|
private |
Definition at line 310 of file module.cpp.
References _currentArea, _eventQueue, Engines::NWN2::Area::addEvent(), and Engines::NWN2::Area::processEventQueue().
Referenced by processEventQueue().
bool Engines::NWN2::Module::isLoaded | ( | ) | const |
Is a module currently loaded and ready to run?
Definition at line 82 of file module.cpp.
References _hasModule.
Referenced by enter().
bool Engines::NWN2::Module::isRunning | ( | ) | const |
Is a module currently running?
Definition at line 86 of file module.cpp.
References _exit, _newArea, _running, Common::UString::empty(), and EventMan.
Referenced by load(), and processEventQueue().
|
virtual |
Leave the running module, quitting it.
Reimplemented from Engines::NWN2::Object.
Definition at line 235 of file module.cpp.
References _exit, _pc, _running, Engines::NWN2::kScriptExit, Engines::NWN2::ScriptContainer::runScript(), and unloadPC().
void Engines::NWN2::Module::load | ( | const Common::UString & | module | ) |
Load a module.
Definition at line 90 of file module.cpp.
References changeModule(), isRunning(), and loadModule().
Referenced by Engines::NWN2::Functions::startNewModule().
|
private |
Load the areas.
Definition at line 389 of file module.cpp.
References _areas, _ifo, Common::StackException::add(), Aurora::IFOFile::getAreas(), and status().
Referenced by enter().
|
private |
Load the HAKs required by the module.
Definition at line 372 of file module.cpp.
References _ifo, _resHAKs, Aurora::IFOFile::getHAKs(), and Engines::indexMandatoryArchive().
Referenced by enter().
|
private |
Load the actual module.
Definition at line 102 of file module.cpp.
References _hasModule, _ifo, Engines::NWN2::Object::_name, _newModule, _resModule, Aurora::NWScript::Object::_tag, Common::StackException::add(), Common::UString::c_str(), checkHAKs(), checkXPs(), Common::UString::clear(), Common::UString::empty(), Aurora::IFOFile::getGFF(), Aurora::IFOFile::getName(), Aurora::LocString::getString(), Aurora::IFOFile::getTag(), Engines::indexMandatoryArchive(), Aurora::IFOFile::isSave(), Aurora::IFOFile::load(), Engines::NWN2::ScriptContainer::readScripts(), Engines::NWN2::Object::readVarTable(), and unload().
Referenced by load(), and replaceModule().
|
private |
Load the TLK used by the module.
Definition at line 361 of file module.cpp.
References _ifo, _resTLK, Common::UString::empty(), Aurora::IFOFile::getTLK(), and TalkMan.
Referenced by enter().
void Engines::NWN2::Module::movedPC | ( | ) |
Notify the module that the PC was moved.
Definition at line 468 of file module.cpp.
References _newArea, _pc, CameraMan, Common::UString::clear(), Engines::NWN2::Object::getArea(), Engines::NWN2::Object::getPosition(), and Engines::NWN2::Area::getResRef().
Referenced by Engines::NWN2::Functions::jumpTo(), and movePC().
void Engines::NWN2::Module::movePC | ( | const Common::UString & | area | ) |
Move the player character to this area.
Definition at line 428 of file module.cpp.
References _pc, and Engines::NWN2::Object::getPosition().
Referenced by Engines::NWN2::Door::click(), Engines::NWN2::Console::cmdGotoArea(), Engines::NWN2::Console::cmdMove(), and movePC().
void Engines::NWN2::Module::movePC | ( | float | x, |
float | y, | ||
float | z | ||
) |
Move the player character to this position within the current area.
Definition at line 438 of file module.cpp.
References _currentArea, _pc, and movePC().
void Engines::NWN2::Module::movePC | ( | const Common::UString & | area, |
float | x, | ||
float | y, | ||
float | z | ||
) |
Move the player character to this position within this area.
Definition at line 445 of file module.cpp.
References _areas, _pc, and movePC().
void Engines::NWN2::Module::movePC | ( | Area * | area, |
float | x, | ||
float | y, | ||
float | z | ||
) |
Move the player character to this position within this area.
Definition at line 458 of file module.cpp.
References _pc, movedPC(), Engines::NWN2::Object::setArea(), and Engines::NWN2::Creature::setPosition().
void Engines::NWN2::Module::processEventQueue | ( | ) |
Process the current event queue.
Definition at line 248 of file module.cpp.
References enterArea(), handleActions(), handleEvents(), isRunning(), and replaceModule().
|
private |
Actually replace the currently running module.
Definition at line 161 of file module.cpp.
References _console, _exit, _newModule, _pc, Common::UString::empty(), Engines::NWN2::Object::enter(), Engines::Console::hide(), loadModule(), and unload().
Referenced by processEventQueue().
|
private |
Unload the whole shebang.
Definition at line 336 of file module.cpp.
References unloadAreas(), unloadHAKs(), unloadModule(), unloadPC(), and unloadTLK().
Referenced by clear(), loadModule(), and replaceModule().
|
private |
Unload the areas.
Definition at line 411 of file module.cpp.
References _areas, _currentArea, _newArea, Common::PtrMap< Key, T, Compare, Deallocator >::clear(), and Common::UString::clear().
Referenced by unload().
|
private |
Unload the HAKs required by the module.
Definition at line 381 of file module.cpp.
References _resHAKs, and Engines::deindexResources().
Referenced by unload().
|
private |
Unload the module.
Definition at line 344 of file module.cpp.
References _delayedActions, _eventQueue, _exit, _hasModule, _ifo, _newModule, _resModule, _running, Aurora::NWScript::Object::_tag, Common::UString::clear(), Engines::deindexResources(), and Aurora::IFOFile::unload().
Referenced by unload().
|
private |
Unload the PC.
Definition at line 418 of file module.cpp.
References _pc, Engines::NWN2::Creature::hide(), and Engines::NWN2::ObjectContainer::removeObject().
Referenced by leave(), and unload().
|
private |
Unload the TLK used by the module.
Definition at line 368 of file module.cpp.
References _resTLK, and TalkMan.
Referenced by unload().
|
private |
The areas in the current module.
Definition at line 172 of file module.h.
Referenced by enterArea(), loadAreas(), movePC(), and unloadAreas().
|
private |
Definition at line 153 of file module.h.
Referenced by enter(), enterArea(), and replaceModule().
|
private |
The current area.
Definition at line 174 of file module.h.
Referenced by enterArea(), getCurrentArea(), handleEvents(), movePC(), and unloadAreas().
|
private |
Definition at line 181 of file module.h.
Referenced by delayScript(), handleActions(), and unloadModule().
|
private |
Definition at line 180 of file module.h.
Referenced by addEvent(), handleEvents(), and unloadModule().
|
private |
Should we exit the module?
Definition at line 157 of file module.h.
Referenced by enter(), enterArea(), isRunning(), leave(), replaceModule(), and unloadModule().
|
private |
Do we have a module?
Definition at line 155 of file module.h.
Referenced by isLoaded(), loadModule(), and unloadModule().
|
private |
The module's IFO.
Definition at line 167 of file module.h.
Referenced by checkHAKs(), checkXPs(), enter(), getIFO(), loadAreas(), loadHAKs(), loadModule(), loadTLK(), and unloadModule().
|
private |
The new area to enter.
Definition at line 173 of file module.h.
Referenced by enter(), enterArea(), isRunning(), movedPC(), and unloadAreas().
|
private |
The module we should change to.
Definition at line 178 of file module.h.
Referenced by changeModule(), loadModule(), replaceModule(), and unloadModule().
|
private |
The player character we use.
Definition at line 170 of file module.h.
Referenced by enter(), enterArea(), getPC(), leave(), movedPC(), movePC(), replaceModule(), and unloadPC().
|
private |
Did we run the PC spawn script?
Definition at line 176 of file module.h.
Referenced by enter(), and enterArea().
|
private |
Resources added by the HAKs of the module.
Definition at line 165 of file module.h.
Referenced by loadHAKs(), and unloadHAKs().
|
private |
Resources added by the module.
Definition at line 160 of file module.h.
Referenced by loadModule(), and unloadModule().
|
private |
Resources added for the custom TLK.
Definition at line 162 of file module.h.
Referenced by loadTLK(), and unloadTLK().
|
private |
Are we currently running a module?
Definition at line 156 of file module.h.
Referenced by enter(), isRunning(), leave(), and unloadModule().