27 #include <boost/scope_exit.hpp> 57 _hasCampaign(false), _running(false), _exit(true), _newCampaignStandalone(false) {
158 e.
add(
"Can't load PC \"%s\"", bic.
c_str());
171 if (directory.
empty())
174 bool success =
false;
175 BOOST_SCOPE_EXIT( (&success) (this_) ) {
178 } BOOST_SCOPE_EXIT_END
186 e.
add(
"Failed to load campaign information file");
190 if (!gff->getTopLevel().hasField(
"ModNames") || !gff->getTopLevel().hasField(
"StartModule"))
193 _startModule = gff->getTopLevel().getString(
"StartModule") +
".mod";
196 for (Aurora::GFF3List::const_iterator m = modules.begin(); m != modules.end(); ++m)
197 _modules.push_back((*m)->getString(
"ModuleName") +
".mod");
199 _name = gff->getTopLevel().getString(
"DisplayName");
200 _description = gff->getTopLevel().getString(
"Description");
224 e.
add(
"Failed to load campaign's starting module");
238 _pc->clearVariables();
278 if ((event->key.keysym.sym == SDLK_d) && (event->key.keysym.mod & KMOD_CTRL)) {
331 return cam.getTopLevel().getString(
"DisplayName");
346 return cam.getTopLevel().getString(
"Description");
Handling version V3.2/V3.3 of BioWare's GFFs (generic file format).
#define ResMan
Shortcut for accessing the sound manager.
Common::UString _startModule
The module the current campaign starts in.
#define MKTAG(a0, a1, a2, a3)
A wrapper macro used around four character constants, like 'DATA', to ensure portability.
Generic Aurora engines resource utility functions.
void add(const char *s,...) GCC_PRINTF(2
void exit()
Exit the currently running campaign.
void unload(bool completeUnload=true)
Unload the whole shebang.
A class holding an UTF-8 string.
void reset(PointerType o=0)
Resets the pointer with the new value.
The global config manager.
::Engines::Console * _console
bool _hasCampaign
Do we have a campaign?
Common::ScopedPtr< Module > _module
The current module of the current campaign.
The context holding a Neverwinter Nights 2 campaign.
void changeCampaign(const Common::UString &campaign, bool standalone)
Schedule a change to a new campaign.
A simple streaming file reading class.
std::list< Common::UString > _modules
All modules used by the current campaign.
void loadCampaign(const Common::UString &campaign, bool standalone)
Load a new campaign.
Exception that provides a stack of explanations.
void loadCampaignResource(const Common::UString &campaign)
Load the actual campaign resources.
void deindexResources(Common::ChangeID &changeID)
Remove previously added resources from the ResourceManager.
UString findFirst(const UString &str, bool caseInsensitive) const
Find the first file ending with the given string.
void loadModule(const Common::UString &module)
Load a stand-alone module as a campaign.
Keyboard key was pressed.
The context needed to run a Neverwinter Nights 2 module.
Basic exceptions to throw.
void addEvent(const Events::Event &event)
Add a single event for consideration into the event queue.
A creature in a Neverwinter Nights 2 area.
const char * c_str() const
Return the (utf8 encoded) string data.
void processEventQueue()
Process the current event queue.
#define ConfigMan
Shortcut for accessing the config manager.
bool _newCampaignStandalone
Is the campaign to change to a stand-alone module?
Utility templates and functions.
const Common::UString & getDescription() const
Return the description of the current campaign.
void load(const Common::UString &campaign)
Load a campaign.
Campaign(::Engines::Console &console)
The global events manager.
Module & getModule()
Return the currently running module.
A GFF (generic file format) V3.2/V3.3 file, found in all Aurora games except Sonic Chronicles: The Da...
Types and functions related to language.
void leave()
Leave the running campaign, quitting it.
Common::UString _name
The name of the currently loaded campaign.
const Common::UString & getName() const
Return the name of the current campaign.
bool empty() const
Is the string empty?
Common::UString _newCampaign
The campaign we should change to.
Generic Aurora engines (debug) console.
void setupStandaloneModule(const Common::UString &module)
Set up the loading of a singular, stand-alone module.
void replaceCampaign()
Actually replace the currently running campaign.
std::vector< const GFF3Struct * > GFF3List
#define EventMan
Shortcut for accessing the events manager.
Common::ChangeID _resCampaign
Resources added by the campaign.
Implementing the stream reading interfaces for files.
bool _running
Are we currently running a campaign?
void indexMandatoryDirectory(const Common::UString &dir, const char *glob, int depth, uint32 priority, Common::ChangeID *changeID)
Add a directory to the resource manager, erroring out if it does not exist.
static Common::UString getDirectory(const Common::UString &campaign, bool relative)
Return the actual real directory for this campaign.
#define LangMan
Shortcut for accessing the language manager.
Common::ScopedPtr< Creature > _pc
The player character we use.
static UString relativize(const UString &basePath, const UString &path)
Return the path relative to the base path.
bool _exit
Should we exit the campaign?
bool processEvent(const Events::Event &event)
#define CameraMan
Shortcut for accessing the camera manager.
void usePC(const Common::UString &bic, bool local)
Use this character as the player character.
void clear()
Clear the whole context.
bool isRunning() const
Is a campaign currently running?
Engine utility class for free-roam camera handling.
bool isLoaded() const
Is a campaign currently loaded and ready to run?
void clear()
Clear the string's contents.
void enter()
Enter the loaded campaign, starting it.
Common::UString _description
The description of the currently loaded campaign.
The global resource manager for Aurora resources.
Utility class for manipulating file paths.
static UString findSubDirectory(const UString &directory, const UString &subDirectory, bool caseInsensitive=false)
Find a directory's subdirectory.