45 namespace DragonAge2 {
50 using ::Aurora::GFF4File;
51 using ::Aurora::GFF4Struct;
76 read(cifPath, manifestPath);
106 if (!manifestPath.
empty())
109 _uid =
"campaign_base";
119 if (manifestPath.
empty())
142 GFF4File cif(cifFile,
kCIFID);
146 const GFF4Struct &cifTop = cif.getTopLevel();
189 std::vector<Common::UString> rims;
193 if (rims.size() != 3)
195 rim->tag.c_str(), rim->area.c_str(), (
uint) rims.size());
197 rim->environment = rims[0];
199 rim->rimFXE = rims[2];
204 rim->children.reserve(children.size());
206 for (GFF4List::const_iterator c = children.begin(); c != children.end(); ++c)
208 rim->children.push_back(
readRIMs(**c, rim.get()));
211 if (!rim->area.empty()) {
212 _areaMap.insert(std::make_pair(rim->area, rim.get()));
214 _areas.push_back(rim->area);
217 return rim.release();
240 for (Common::XMLNode::Children::const_iterator c = addinItems.begin(); c != addinItems.end(); ++c) {
241 if ((*c)->getName() ==
"addinitem") {
281 AreaMap::const_iterator a =
_areaMap.find(area);
283 return a->second->rim;
308 for (
size_t i = 0; i <
_packages.size(); i++) {
330 GFF4File cif(cifFile,
kCIFID);
334 const GFF4Struct &cifTop = cif.getTopLevel();
380 float entryPosX, entryPosY, entryPosZ, entryOrientX, entryOrientY, entryOrientZ;
391 float orientX, orientY, orientZ, orientAngle;
393 _currentArea->getEntryLocation(entryPosX, entryPosY, entryPosZ, orientX, orientY, orientZ, orientAngle);
401 CameraMan.setPosition(entryPosX, entryPosY, entryPosZ + 1.8f);
402 CameraMan.setOrientation(entryOrientX + 90.0f, entryOrientY, entryOrientZ);
468 _currentArea.reset(
new Area(*
this, area->second->area, area->second->environment, area->second->rim));
static const uint32 kCIFID
static const uint32 kVersion01
#define MKTAG(a0, a1, a2, a3)
A wrapper macro used around four character constants, like 'DATA', to ensure portability.
const Common::UString & getExtendsUID() const
Return the UID of the campaign this campaign/content extends, if any.
void leave()
Leave the campaign, ending it.
void readCIFStatic(const Common::UString &path)
A creature in a Dragon Age II area.
static void unloadTalkTables(ChangeList &changes)
Unload this set of talk tables.
void setString(Language language, LanguageGender gender, const Common::UString &str)
Set the string of that language.
A class holding an UTF-8 string.
Class to parse a ReadStream into a simple XML tree.
virtual void enter()
The cursor entered the object.
Common::UString _entryClientScript
Creature * getPC() const
Return the currently playing PC.
const UString & getName() const
const Aurora::LocString & getDescription() const
The context holding a Dragon Age II area.
bool isEnabled() const
Is this Campaign enabled?
Creature * _pc
The player character we use.
A simple streaming file reading class.
void setPosition(float x, float y, float z)
Set the creature's position.
void enableEvents(bool enabled)
Enable/Disable the handling of all events.
An area in Dragon Age II, holding all objects and rooms within, as well as general area properties li...
The context handling the gameplay in Dragon Age II.
void read(const Common::UString &cifPath, const Common::UString &manifestPath)
float _entryOrientation[3]
bool runScript(EventType event, const Aurora::NWScript::ObjectReference owner=Aurora::NWScript::ObjectReference(), const Aurora::NWScript::ObjectReference triggerer=Aurora::NWScript::ObjectReference())
bool isLoaded() const
Is this campaign currently loaded?
Utility templates and functions for working with strings and streams.
bool isBioWare() const
Is this an original campaign by BioWare?
const Common::UString & getString(Language language, LanguageGender gender=kLanguageGenderCurrent) const
Get the string of that language.
Common::ScopedPtr< Area > _currentArea
The current area.
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.
std::vector< Common::UString > _packages
std::vector< const GFF4Struct * > GFF4List
const Common::UString & getAreaRIM(const Common::UString &area) const
Return the RIM file containing this area.
Handling version V4.0/V4.1 of BioWare's GFFs (generic file format).
Area * getCurrentArea() const
Return the area the PC is currently in.
Basic exceptions to throw.
const char * c_str() const
Return the (utf8 encoded) string data.
Aurora::LocString _description
Utility templates and functions.
Common::ScopedPtr< RIMNode > _rimRoot
void enterArea(bool startArea=false)
static void loadTexturePack(const Common::UString &dir, uint32 priority, ChangeList &res, TextureQuality quality)
XML parsing helpers, using libxml2.
bool empty() const
Is the string empty?
#define TwoDAReg
Shortcut for accessing the 2da registry.
Common::UString _addinBase
A scoped plain pointer, allowing pointer-y access and normal deletion.
Common::UString _newArea
The new area to enter.
UString getProperty(const UString &name, const UString &def="") const
Return a certain property on this node.
Common::UString _entryScript
Implementing the stream reading interfaces for files.
Campaign(Game &game, const Common::UString &cifPath="", const Common::UString &manifestPath="", const Common::UString &addinBase="")
The context holding a Dragon Age II campaign.
std::vector< Common::UString > _areas
RIMNode(const RIMNode *p=0)
const XMLNode * findChild(const UString &name) const
Find a child node by name.
static UString getStem(const UString &p)
Return a file name's stem.
const std::vector< Common::UString > & getAreas() const
void movePC(const Common::UString &area)
Move the player character to this area.
void unload()
Unload the campaign after playing.
UString debugTag(uint32 tag, bool trim)
Create an elaborate string from an integer tag, for debugging purposes.
void status(const char *s,...)
const XMLNode & getRoot() const
Return the XML root node.
#define CameraMan
Shortcut for accessing the camera manager.
void load()
Load the campaign for playing.
void readCIFDynamic(const Common::UString &path)
RIMNode * readRIMs(const Aurora::GFF4Struct &node, const RIMNode *parent=0)
bool needsAuth() const
Does this campaign need authorization from BioWare?
const Common::UString & getUID() const
Return the unique ID of this campaign.
static const Common::UString kEmptyString
const Aurora::LocString & getName() const
void processEventQueue()
Process the current event queue.
Common::UString _entryAreaList
void loadTalkTables(const Common::UString &dir, uint32 priority, ChangeList &res)
Load all talk tables in the current language found in this directory.
void parseString(const UString &str, T &value, bool allowEmpty)
Parse a string into any POD integer, float/double or bool type.
void readVarTable(const Aurora::GFF3List &varTable)
Utility class for manipulating file paths.
void readManifest(const Common::UString &path)
void addEvent(const Events::Event &event)
Add a single event for consideration into the area event queue.
Common::UString _entryArea
void readScript(const Aurora::GFF3Struct &gff)
void loadResources(const Common::UString &dir, uint32 priority, ChangeList &res)
Load all game resource archives in the current language found in this directory.