xoreos  0.0.5
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Engines::Jade::Module Class Reference

A Jade module. More...

#include <module.h>

Inheritance diagram for Engines::Jade::Module:
Inheritance graph
[legend]
Collaboration diagram for Engines::Jade::Module:
Collaboration graph
[legend]

Classes

struct  Action
 

Public Member Functions

 Module (::Engines::Console &console)
 
 ~Module ()
 
void clear ()
 Clear the whole context. More...
 
bool isLoaded () const
 Is a module currently loaded and ready to run? More...
 
bool isRunning () const
 Is a module currently running? More...
 
void load (const Common::UString &module)
 Load a module. More...
 
void usePC (Creature *pc)
 Use this character as the player character. More...
 
void exit ()
 Exit the currently running module. More...
 
const Common::UStringgetName () const
 Return the module's name. More...
 
AreagetCurrentArea ()
 Return the area the PC is currently in. More...
 
CreaturegetPC ()
 Return the currently playing PC. More...
 
void showMenu ()
 Show the ingame main menu. More...
 
bool startConversation (const Common::UString &conv, Creature &pc, Object &obj, bool noWidescreen=false, bool resetZoom=true)
 Start a conversation. More...
 
void delayScript (const Common::UString &script, const Aurora::NWScript::ScriptState &state, Aurora::NWScript::Object *owner, Aurora::NWScript::Object *triggerer, uint32 delay)
 
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 &module)
 Move the player character to this object within this area. More...
 
void movedPC ()
 Notify the module that the PC was moved. More...
 
void enter ()
 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::Jade::ObjectContainer
 ObjectContainer ()
 
 ~ObjectContainer ()
 
void clearObjects ()
 
void addObject (Jade::Object &object)
 Add an object to this container. More...
 
void removeObject (Jade::Object &object)
 Remove an object from this container. More...
 
::Aurora::NWScript::ObjectgetFirstObjectByType (ObjectType type) const
 Return the first object of this type. More...
 
::Aurora::NWScript::ObjectSearchfindObjectsByType (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...
 
ObjectgetObjectByID (uint32 id) const
 Find a specific object by ID. More...
 
ObjectgetFirstObject () const
 Return the first object. More...
 
ObjectgetFirstObjectByTag (const Common::UString &tag) const
 Return the first object with this tag. More...
 
ObjectSearchfindObjects () const
 Return a search context to iterate over all objects. More...
 
ObjectSearchfindObjectsByTag (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 std::list< Events::EventEventQueue
 
typedef std::multiset< ActionActionQueue
 

Private Member Functions

void unload (bool completeUnload=true)
 Unload the whole shebang. More...
 
void unloadPC ()
 
void unloadArea ()
 
void load ()
 
void loadArea ()
 
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 enterArea ()
 
void leaveArea ()
 
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...
 
std::list< Common::ChangeID_resources
 Resources added by the current module. More...
 
Common::ScopedPtr< Creature_pc
 The player character we use. More...
 
bool _exit
 Should we exit the module? More...
 
Common::UString _module
 The current module's name. More...
 
Common::UString _newModule
 The module we should change to. More...
 
Common::ScopedPtr< Area_area
 The current module's area. More...
 
EventQueue _eventQueue
 
ActionQueue _delayedActions
 

Additional Inherited Members

- Static Public Member Functions inherited from Engines::Jade::ObjectContainer
static Jade::ObjecttoObject (::Aurora::NWScript::Object *object)
 
static AreatoArea (Aurora::NWScript::Object *object)
 
static WaypointtoWaypoint (Aurora::NWScript::Object *object)
 
static PlaceabletoPlaceable (Aurora::NWScript::Object *object)
 
static CreaturetoCreature (Aurora::NWScript::Object *object)
 
static CreaturetoPC (Aurora::NWScript::Object *object)
 
static LocationtoLocation (Aurora::NWScript::EngineType *engineType)
 
static EventtoEvent (Aurora::NWScript::EngineType *engineType)
 
- Protected Member Functions inherited from Aurora::NWScript::ObjectContainer
void lock ()
 
void unlock ()
 

Detailed Description

A Jade module.

Definition at line 53 of file module.h.

Member Typedef Documentation

◆ ActionQueue

typedef std::multiset<Action> Engines::Jade::Module::ActionQueue
private

Definition at line 153 of file module.h.

◆ EventQueue

Definition at line 152 of file module.h.

Member Enumeration Documentation

◆ ActionType

Enumerator
kActionNone 
kActionScript 

Definition at line 133 of file module.h.

Constructor & Destructor Documentation

◆ Module()

Engines::Jade::Module::Module ( ::Engines::Console console)

Definition at line 50 of file module.cpp.

◆ ~Module()

Engines::Jade::Module::~Module ( )

Definition at line 55 of file module.cpp.

References clear().

Here is the call graph for this function:

Member Function Documentation

◆ addEvent()

void Engines::Jade::Module::addEvent ( const Events::Event event)

Add a single event for consideration into the event queue.

Definition at line 236 of file module.cpp.

References _eventQueue.

◆ changeModule()

void Engines::Jade::Module::changeModule ( const Common::UString module)
private

Schedule a change to a new module.

Definition at line 171 of file module.cpp.

References _newModule, Common::UString::c_str(), getName(), and warning().

Referenced by load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear()

void Engines::Jade::Module::clear ( )

Clear the whole context.

Definition at line 62 of file module.cpp.

References unload().

Referenced by ~Module().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ delayScript()

void Engines::Jade::Module::delayScript ( const Common::UString script,
const Aurora::NWScript::ScriptState state,
Aurora::NWScript::Object owner,
Aurora::NWScript::Object triggerer,
uint32  delay 
)

◆ enter()

void Engines::Jade::Module::enter ( )

Enter the loaded module, starting it.

Definition at line 196 of file module.cpp.

References _area, _console, _exit, _hasModule, _module, _pc, _running, Common::UString::c_str(), CameraMan, enterArea(), and Engines::Console::printf().

Referenced by replaceModule().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ enterArea()

void Engines::Jade::Module::enterArea ( )
private

Definition at line 222 of file module.cpp.

References _area, _pc, and Engines::Jade::kScriptOnEnter.

Referenced by enter().

Here is the caller graph for this function:

◆ exit()

void Engines::Jade::Module::exit ( )

Exit the currently running module.

Definition at line 119 of file module.cpp.

References _exit.

Referenced by Engines::Jade::Console::cmdExitModule().

Here is the caller graph for this function:

◆ getCurrentArea()

Area * Engines::Jade::Module::getCurrentArea ( )

Return the area the PC is currently in.

Definition at line 338 of file module.cpp.

References _area.

◆ getName()

const Common::UString & Engines::Jade::Module::getName ( ) const

Return the module's name.

Definition at line 334 of file module.cpp.

References _module.

Referenced by changeModule().

Here is the caller graph for this function:

◆ getPC()

Creature * Engines::Jade::Module::getPC ( )

Return the currently playing PC.

Definition at line 107 of file module.cpp.

References _pc.

Referenced by Engines::Jade::Area::click(), Engines::Jade::Functions::getPlayer(), and Engines::Jade::Functions::jumpTo().

Here is the caller graph for this function:

◆ handleActions()

void Engines::Jade::Module::handleActions ( )
private

Definition at line 290 of file module.cpp.

References _delayedActions, EventMan, kActionScript, and Engines::Jade::ScriptContainer::runScript().

Referenced by processEventQueue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleEvents()

void Engines::Jade::Module::handleEvents ( )
private

Definition at line 253 of file module.cpp.

References _area, _console, _eventQueue, CameraMan, FreeRoamCam, Engines::Console::isVisible(), Events::kEventKeyDown, Engines::Console::processEvent(), Engines::Console::show(), and showMenu().

Referenced by processEventQueue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isLoaded()

bool Engines::Jade::Module::isLoaded ( ) const

Is a module currently loaded and ready to run?

Definition at line 111 of file module.cpp.

References _area, _hasModule, and _pc.

◆ isRunning()

bool Engines::Jade::Module::isRunning ( ) const

Is a module currently running?

Definition at line 115 of file module.cpp.

References _exit, _running, and EventMan.

Referenced by load(), and processEventQueue().

Here is the caller graph for this function:

◆ leave()

void Engines::Jade::Module::leave ( )

Leave the running module, quitting it.

Definition at line 215 of file module.cpp.

References _exit, _running, and leaveArea().

Here is the call graph for this function:

◆ leaveArea()

void Engines::Jade::Module::leaveArea ( )
private

Definition at line 228 of file module.cpp.

References _area, _pc, and Engines::Jade::kScriptOnExit.

Referenced by leave(), and unload().

Here is the caller graph for this function:

◆ load() [1/2]

void Engines::Jade::Module::load ( const Common::UString module)

Load a module.

Definition at line 66 of file module.cpp.

References changeModule(), isRunning(), and loadModule().

Referenced by Engines::Jade::MainMenu::callbackActive(), and Engines::Jade::Console::cmdLoadModule().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load() [2/2]

void Engines::Jade::Module::load ( )
private

Definition at line 133 of file module.cpp.

References loadArea().

Referenced by loadModule().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadArea()

void Engines::Jade::Module::loadArea ( )
private

Definition at line 137 of file module.cpp.

References _area, and _module.

Referenced by load().

Here is the caller graph for this function:

◆ loadModule()

void Engines::Jade::Module::loadModule ( const Common::UString module)
private

Load the actual module.

Definition at line 78 of file module.cpp.

References _hasModule, _module, _newModule, Common::StackException::add(), Common::UString::c_str(), Common::UString::clear(), load(), and unload().

Referenced by load(), movePC(), and replaceModule().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ movedPC()

void Engines::Jade::Module::movedPC ( )

Notify the module that the PC was moved.

Definition at line 322 of file module.cpp.

References _pc, and CameraMan.

Referenced by Engines::Jade::Functions::jumpTo(), and movePC().

Here is the caller graph for this function:

◆ movePC() [1/2]

void Engines::Jade::Module::movePC ( float  x,
float  y,
float  z 
)

Move the player character to this position within the current area.

Definition at line 307 of file module.cpp.

References _pc, and movedPC().

Here is the call graph for this function:

◆ movePC() [2/2]

void Engines::Jade::Module::movePC ( const Common::UString module)

Move the player character to this object within this area.

Definition at line 315 of file module.cpp.

References _module, Common::UString::empty(), and loadModule().

Here is the call graph for this function:

◆ processEventQueue()

void Engines::Jade::Module::processEventQueue ( )

Process the current event queue.

Definition at line 240 of file module.cpp.

References handleActions(), handleEvents(), isRunning(), and replaceModule().

Here is the call graph for this function:

◆ replaceModule()

void Engines::Jade::Module::replaceModule ( )
private

Actually replace the currently running module.

Definition at line 180 of file module.cpp.

References _console, _exit, _newModule, Common::UString::empty(), enter(), Engines::Console::hide(), loadModule(), and unload().

Referenced by processEventQueue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ showMenu()

void Engines::Jade::Module::showMenu ( )

Show the ingame main menu.

Definition at line 123 of file module.cpp.

Referenced by handleEvents().

Here is the caller graph for this function:

◆ startConversation()

bool Engines::Jade::Module::startConversation ( const Common::UString conv,
Creature pc,
Object obj,
bool  noWidescreen = false,
bool  resetZoom = true 
)

Start a conversation.

Parameters
convThe dialog ResRef to use.
pcThe PC that initiated the conversation.
objThe object the PC is talking with.
noWidescreenTrue to start with short bars, false to start with tall bars
resetZoomWhether to set the zoom back to standard when starting the conversation
Returns
true if the conversation was started successfully.

Definition at line 127 of file module.cpp.

Referenced by Engines::Jade::Functions::actionStartConversation().

Here is the caller graph for this function:

◆ unload()

void Engines::Jade::Module::unload ( bool  completeUnload = true)
private

Unload the whole shebang.

Parameters
completeUnloadAlso unload the PC. true: completely quit the module false: the PC can be transferred to a new module.

Definition at line 141 of file module.cpp.

References _delayedActions, _eventQueue, _hasModule, _module, _newModule, Common::UString::clear(), leaveArea(), unloadArea(), and unloadPC().

Referenced by clear(), loadModule(), and replaceModule().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unloadArea()

void Engines::Jade::Module::unloadArea ( )
private

Definition at line 158 of file module.cpp.

References _area.

Referenced by unload().

Here is the caller graph for this function:

◆ unloadPC()

void Engines::Jade::Module::unloadPC ( )
private

Definition at line 162 of file module.cpp.

References _pc, and Engines::Jade::ObjectContainer::removeObject().

Referenced by unload(), and usePC().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ usePC()

void Engines::Jade::Module::usePC ( Creature pc)

Use this character as the player character.

Definition at line 99 of file module.cpp.

References _pc, Engines::Jade::ObjectContainer::addObject(), and unloadPC().

Here is the call graph for this function:

Member Data Documentation

◆ _area

Common::ScopedPtr<Area> Engines::Jade::Module::_area
private

The current module's area.

Definition at line 171 of file module.h.

Referenced by enter(), enterArea(), getCurrentArea(), handleEvents(), isLoaded(), leaveArea(), loadArea(), and unloadArea().

◆ _console

::Engines::Console* Engines::Jade::Module::_console
private

Definition at line 156 of file module.h.

Referenced by enter(), handleEvents(), and replaceModule().

◆ _delayedActions

ActionQueue Engines::Jade::Module::_delayedActions
private

Definition at line 174 of file module.h.

Referenced by delayScript(), handleActions(), and unload().

◆ _eventQueue

EventQueue Engines::Jade::Module::_eventQueue
private

Definition at line 173 of file module.h.

Referenced by addEvent(), handleEvents(), and unload().

◆ _exit

bool Engines::Jade::Module::_exit
private

Should we exit the module?

Definition at line 166 of file module.h.

Referenced by enter(), exit(), isRunning(), leave(), and replaceModule().

◆ _hasModule

bool Engines::Jade::Module::_hasModule
private

Do we have a module?

Definition at line 158 of file module.h.

Referenced by enter(), isLoaded(), loadModule(), and unload().

◆ _module

Common::UString Engines::Jade::Module::_module
private

The current module's name.

Definition at line 168 of file module.h.

Referenced by enter(), getName(), loadArea(), loadModule(), movePC(), and unload().

◆ _newModule

Common::UString Engines::Jade::Module::_newModule
private

The module we should change to.

Definition at line 169 of file module.h.

Referenced by changeModule(), loadModule(), replaceModule(), and unload().

◆ _pc

Common::ScopedPtr<Creature> Engines::Jade::Module::_pc
private

The player character we use.

Definition at line 164 of file module.h.

Referenced by enter(), enterArea(), getPC(), isLoaded(), leaveArea(), movedPC(), movePC(), unloadPC(), and usePC().

◆ _resources

std::list<Common::ChangeID> Engines::Jade::Module::_resources
private

Resources added by the current module.

Definition at line 162 of file module.h.

◆ _running

bool Engines::Jade::Module::_running
private

Are we currently running a module?

Definition at line 159 of file module.h.

Referenced by enter(), isRunning(), and leave().


The documentation for this class was generated from the following files: