STARK: Move the resources to a separate namespace
This commit is contained in:
parent
3074dc7bef
commit
254021c602
68 changed files with 366 additions and 219 deletions
|
@ -128,27 +128,27 @@ bool Console::Cmd_ListLocations(int argc, const char **argv) {
|
|||
StarkServices::instance().archiveLoader = archiveLoader;
|
||||
|
||||
archiveLoader->load("x.xarc");
|
||||
Root *root = archiveLoader->useRoot<Root>("x.xarc");
|
||||
Resources::Root *root = archiveLoader->useRoot<Resources::Root>("x.xarc");
|
||||
|
||||
// Find all the levels
|
||||
Common::Array<Level *> levels = root->listChildren<Level>();
|
||||
Common::Array<Resources::Level *> levels = root->listChildren<Resources::Level>();
|
||||
|
||||
// Loop over the levels
|
||||
for (uint i = 0; i < levels.size(); i++) {
|
||||
Level *level = levels[i];
|
||||
Resources::Level *level = levels[i];
|
||||
|
||||
Common::String levelArchive = archiveLoader->buildArchiveName(level);
|
||||
debugPrintf("%s - %s\n", levelArchive.c_str(), level->getName().c_str());
|
||||
|
||||
// Load the detailed level archive
|
||||
archiveLoader->load(levelArchive);
|
||||
level = archiveLoader->useRoot<Level>(levelArchive);
|
||||
level = archiveLoader->useRoot<Resources::Level>(levelArchive);
|
||||
|
||||
Common::Array<Location *> locations = level->listChildren<Location>();
|
||||
Common::Array<Resources::Location *> locations = level->listChildren<Resources::Location>();
|
||||
|
||||
// Loop over the locations
|
||||
for (uint j = 0; j < locations.size(); j++) {
|
||||
Location *location = locations[j];
|
||||
Resources::Location *location = locations[j];
|
||||
|
||||
Common::String roomArchive = archiveLoader->buildArchiveName(level, location);
|
||||
debugPrintf("%s - %s\n", roomArchive.c_str(), location->getName().c_str());
|
||||
|
|
|
@ -74,10 +74,10 @@ Common::String XRCReadStream::readString() {
|
|||
return string;
|
||||
}
|
||||
|
||||
ResourceType XRCReadStream::readResourceType() {
|
||||
Resources::ResourceType XRCReadStream::readResourceType() {
|
||||
byte rawType;
|
||||
rawType = readByte();
|
||||
return ResourceType((ResourceType::Type) (rawType));
|
||||
return Resources::ResourceType((Resources::ResourceType::Type) (rawType));
|
||||
}
|
||||
|
||||
ResourceReference XRCReadStream::readResourceReference() {
|
||||
|
@ -85,7 +85,7 @@ ResourceReference XRCReadStream::readResourceReference() {
|
|||
|
||||
uint32 pathSize = readUint32LE();
|
||||
for (uint i = 0; i < pathSize; i++) {
|
||||
ResourceType type = readResourceType();
|
||||
Resources::ResourceType type = readResourceType();
|
||||
uint16 index = readUint16LE();
|
||||
|
||||
reference.addPathElement(type, index);
|
||||
|
@ -135,7 +135,7 @@ Common::String XRCReadStream::getArchiveName() const {
|
|||
return _archiveName;
|
||||
}
|
||||
|
||||
Resource *XRCReader::importTree(XARCArchive *archive) {
|
||||
Resources::Resource *XRCReader::importTree(XARCArchive *archive) {
|
||||
// Find the XRC file
|
||||
Common::ArchiveMemberList members;
|
||||
archive->listMatchingMembers(members, "*.xrc");
|
||||
|
@ -151,15 +151,15 @@ Resource *XRCReader::importTree(XARCArchive *archive) {
|
|||
XRCReadStream *xrcStream = new XRCReadStream(archive->getFilename(), stream);
|
||||
|
||||
// Import the resource tree
|
||||
Resource *root = importResource(xrcStream, nullptr);
|
||||
Resources::Resource *root = importResource(xrcStream, nullptr);
|
||||
|
||||
delete xrcStream;
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
Resource *XRCReader::importResource(XRCReadStream *stream, Resource *parent) {
|
||||
Resource *resource = createResource(stream, parent);
|
||||
Resources::Resource *XRCReader::importResource(XRCReadStream *stream, Resources::Resource *parent) {
|
||||
Resources::Resource *resource = createResource(stream, parent);
|
||||
importResourceData(stream, resource);
|
||||
importResourceChildren(stream, resource);
|
||||
|
||||
|
@ -169,9 +169,9 @@ Resource *XRCReader::importResource(XRCReadStream *stream, Resource *parent) {
|
|||
return resource;
|
||||
}
|
||||
|
||||
Resource *XRCReader::createResource(XRCReadStream *stream, Resource *parent) {
|
||||
Resources::Resource *XRCReader::createResource(XRCReadStream *stream, Resources::Resource *parent) {
|
||||
// Read the resource type and subtype
|
||||
ResourceType type = stream->readResourceType();
|
||||
Resources::ResourceType type = stream->readResourceType();
|
||||
byte subType = stream->readByte();
|
||||
|
||||
// Read the resource properties
|
||||
|
@ -179,92 +179,92 @@ Resource *XRCReader::createResource(XRCReadStream *stream, Resource *parent) {
|
|||
Common::String name = stream->readString();
|
||||
|
||||
// Create a new resource
|
||||
Resource *resource;
|
||||
Resources::Resource *resource;
|
||||
switch (type.get()) {
|
||||
case ResourceType::kRoot:
|
||||
resource = new Root(parent, subType, index, name);
|
||||
case Resources::ResourceType::kRoot:
|
||||
resource = new Resources::Root(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kLevel:
|
||||
resource = new Level(parent, subType, index, name);
|
||||
case Resources::ResourceType::kLevel:
|
||||
resource = new Resources::Level(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kLocation:
|
||||
resource = new Location(parent, subType, index, name);
|
||||
case Resources::ResourceType::kLocation:
|
||||
resource = new Resources::Location(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kLayer:
|
||||
resource = Layer::construct(parent, subType, index, name);
|
||||
case Resources::ResourceType::kLayer:
|
||||
resource = Resources::Layer::construct(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kCamera:
|
||||
resource = new Camera(parent, subType, index, name);
|
||||
case Resources::ResourceType::kCamera:
|
||||
resource = new Resources::Camera(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kFloor:
|
||||
resource = new Floor(parent, subType, index, name);
|
||||
case Resources::ResourceType::kFloor:
|
||||
resource = new Resources::Floor(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kFloorFace:
|
||||
resource = new FloorFace(parent, subType, index, name);
|
||||
case Resources::ResourceType::kFloorFace:
|
||||
resource = new Resources::FloorFace(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kItem:
|
||||
resource = Item::construct(parent, subType, index, name);
|
||||
case Resources::ResourceType::kItem:
|
||||
resource = Resources::Item::construct(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kScript:
|
||||
resource = new Script(parent, subType, index, name);
|
||||
case Resources::ResourceType::kScript:
|
||||
resource = new Resources::Script(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kAnimHierarchy:
|
||||
resource = new AnimHierarchy(parent, subType, index, name);
|
||||
case Resources::ResourceType::kAnimHierarchy:
|
||||
resource = new Resources::AnimHierarchy(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kAnim:
|
||||
resource = Anim::construct(parent, subType, index, name);
|
||||
case Resources::ResourceType::kAnim:
|
||||
resource = Resources::Anim::construct(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kDirection:
|
||||
resource = new Direction(parent, subType, index, name);
|
||||
case Resources::ResourceType::kDirection:
|
||||
resource = new Resources::Direction(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kImage:
|
||||
resource = Image::construct(parent, subType, index, name);
|
||||
case Resources::ResourceType::kImage:
|
||||
resource = Resources::Image::construct(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kAnimScript:
|
||||
resource = new AnimScript(parent, subType, index, name);
|
||||
case Resources::ResourceType::kAnimScript:
|
||||
resource = new Resources::AnimScript(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kAnimScriptItem:
|
||||
resource = new AnimScriptItem(parent, subType, index, name);
|
||||
case Resources::ResourceType::kAnimScriptItem:
|
||||
resource = new Resources::AnimScriptItem(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kSoundItem:
|
||||
resource = new Sound(parent, subType, index, name);
|
||||
case Resources::ResourceType::kSoundItem:
|
||||
resource = new Resources::Sound(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kBookmark:
|
||||
resource = new Bookmark(parent, subType, index, name);
|
||||
case Resources::ResourceType::kBookmark:
|
||||
resource = new Resources::Bookmark(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kKnowledgeSet:
|
||||
resource = new KnowledgeSet(parent, subType, index, name);
|
||||
case Resources::ResourceType::kKnowledgeSet:
|
||||
resource = new Resources::KnowledgeSet(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kKnowledge:
|
||||
resource = new Knowledge(parent, subType, index, name);
|
||||
case Resources::ResourceType::kKnowledge:
|
||||
resource = new Resources::Knowledge(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kCommand:
|
||||
resource = new Command(parent, subType, index, name);
|
||||
case Resources::ResourceType::kCommand:
|
||||
resource = new Resources::Command(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kDialog:
|
||||
resource = new Dialog(parent, subType, index, name);
|
||||
case Resources::ResourceType::kDialog:
|
||||
resource = new Resources::Dialog(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kSpeech:
|
||||
resource = new Speech(parent, subType, index, name);
|
||||
case Resources::ResourceType::kSpeech:
|
||||
resource = new Resources::Speech(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kBonesMesh:
|
||||
resource = new BonesMesh(parent, subType, index, name);
|
||||
case Resources::ResourceType::kBonesMesh:
|
||||
resource = new Resources::BonesMesh(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kScroll:
|
||||
resource = new Scroll(parent, subType, index, name);
|
||||
case Resources::ResourceType::kScroll:
|
||||
resource = new Resources::Scroll(parent, subType, index, name);
|
||||
break;
|
||||
case ResourceType::kTextureSet:
|
||||
resource = new TextureSet(parent, subType, index, name);
|
||||
case Resources::ResourceType::kTextureSet:
|
||||
resource = new Resources::TextureSet(parent, subType, index, name);
|
||||
break;
|
||||
default:
|
||||
resource = new UnimplementedResource(parent, type, subType, index, name);
|
||||
resource = new Resources::UnimplementedResource(parent, type, subType, index, name);
|
||||
break;
|
||||
}
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void XRCReader::importResourceData(XRCReadStream *stream, Resource *resource) {
|
||||
void XRCReader::importResourceData(XRCReadStream *stream, Resources::Resource *resource) {
|
||||
// Read the data length
|
||||
uint32 dataLength = stream->readUint32LE();
|
||||
|
||||
|
@ -283,7 +283,7 @@ void XRCReader::importResourceData(XRCReadStream *stream, Resource *resource) {
|
|||
}
|
||||
}
|
||||
|
||||
void XRCReader::importResourceChildren(XRCReadStream *stream, Resource *resource) {
|
||||
void XRCReader::importResourceChildren(XRCReadStream *stream, Resources::Resource *resource) {
|
||||
// Get the number of children
|
||||
uint16 numChildren = stream->readUint16LE();
|
||||
|
||||
|
@ -295,7 +295,7 @@ void XRCReader::importResourceChildren(XRCReadStream *stream, Resource *resource
|
|||
|
||||
// Read the children resources
|
||||
for (int i = 0; i < numChildren; i++) {
|
||||
Resource *child = importResource(stream, resource);
|
||||
Resources::Resource *child = importResource(stream, resource);
|
||||
|
||||
// Add child to parent
|
||||
resource->addChild(child);
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
Common::String getArchiveName() const;
|
||||
|
||||
Common::String readString();
|
||||
ResourceType readResourceType();
|
||||
Resources::ResourceType readResourceType();
|
||||
ResourceReference readResourceReference();
|
||||
Math::Vector3d readVector3();
|
||||
Common::Rect readRect();
|
||||
|
@ -72,13 +72,13 @@ public:
|
|||
/**
|
||||
* Build a resource tree from a stream
|
||||
*/
|
||||
static Resource *importTree(XARCArchive *archive);
|
||||
static Resources::Resource *importTree(XARCArchive *archive);
|
||||
|
||||
protected:
|
||||
static Resource *importResource(XRCReadStream *stream, Resource *parent);
|
||||
static Resource *createResource(XRCReadStream *stream, Resource *parent);
|
||||
static void importResourceChildren(XRCReadStream *stream, Resource *resource);
|
||||
static void importResourceData(XRCReadStream* stream, Resource* resource);
|
||||
static Resources::Resource *importResource(XRCReadStream *stream, Resources::Resource *parent);
|
||||
static Resources::Resource *createResource(XRCReadStream *stream, Resources::Resource *parent);
|
||||
static void importResourceChildren(XRCReadStream *stream, Resources::Resource *resource);
|
||||
static void importResourceData(XRCReadStream* stream, Resources::Resource* resource);
|
||||
};
|
||||
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
namespace Stark {
|
||||
|
||||
RenderEntry::RenderEntry(Resource *owner, const Common::String &name) :
|
||||
RenderEntry::RenderEntry(Resources::Resource *owner, const Common::String &name) :
|
||||
_visual(nullptr),
|
||||
_name(name),
|
||||
_owner(owner),
|
||||
|
|
|
@ -31,13 +31,16 @@
|
|||
|
||||
namespace Stark {
|
||||
|
||||
class GfxDriver;
|
||||
namespace Resources {
|
||||
class Resource;
|
||||
}
|
||||
|
||||
class GfxDriver;
|
||||
class Visual;
|
||||
|
||||
class RenderEntry {
|
||||
public:
|
||||
RenderEntry(Resource *owner, const Common::String &name);
|
||||
RenderEntry(Resources::Resource *owner, const Common::String &name);
|
||||
virtual ~RenderEntry() {};
|
||||
|
||||
void render(GfxDriver *gfx);
|
||||
|
@ -52,7 +55,7 @@ public:
|
|||
|
||||
protected:
|
||||
Common::String _name;
|
||||
Resource *_owner;
|
||||
Resources::Resource *_owner;
|
||||
|
||||
Visual *_visual;
|
||||
Common::Point _position;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
namespace Stark {
|
||||
|
||||
|
||||
ResourceReference::PathElement::PathElement(ResourceType type, uint16 index) :
|
||||
ResourceReference::PathElement::PathElement(Resources::ResourceType type, uint16 index) :
|
||||
_type(type), _index(index) {
|
||||
}
|
||||
|
||||
|
@ -43,27 +43,27 @@ Common::String ResourceReference::PathElement::describe() {
|
|||
ResourceReference::ResourceReference() {
|
||||
}
|
||||
|
||||
void ResourceReference::addPathElement(ResourceType type, uint16 index) {
|
||||
void ResourceReference::addPathElement(Resources::ResourceType type, uint16 index) {
|
||||
_path.push_back(PathElement(type, index));
|
||||
}
|
||||
|
||||
Resource *ResourceReference::resolve() const {
|
||||
Resources::Resource *ResourceReference::resolve() const {
|
||||
ResourceProvider *resourceProvider = StarkServices::instance().resourceProvider;
|
||||
Global *global = StarkServices::instance().global;
|
||||
|
||||
Resource *resource = nullptr;
|
||||
Resources::Resource *resource = nullptr;
|
||||
for (uint i = 0; i < _path.size(); i++) {
|
||||
PathElement element = _path[i];
|
||||
|
||||
switch (element.getType().get()) {
|
||||
case ResourceType::kLevel:
|
||||
case Resources::ResourceType::kLevel:
|
||||
if (element.getIndex()) {
|
||||
resource = resourceProvider->getLevel(element.getIndex());
|
||||
} else {
|
||||
resource = global->getLevel();
|
||||
}
|
||||
break;
|
||||
case ResourceType::kLocation:
|
||||
case Resources::ResourceType::kLocation:
|
||||
resource = resourceProvider->getLocation(resource->getIndex(), element.getIndex());
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
|
||||
Common::String describe();
|
||||
|
||||
void addPathElement(ResourceType type, uint16 index);
|
||||
void addPathElement(Resources::ResourceType type, uint16 index);
|
||||
|
||||
/** Resolve the reference to the actual resource */
|
||||
template <class T>
|
||||
|
@ -53,18 +53,18 @@ public:
|
|||
bool empty() const;
|
||||
|
||||
private:
|
||||
Resource *resolve() const;
|
||||
Resources::Resource *resolve() const;
|
||||
|
||||
class PathElement {
|
||||
public:
|
||||
PathElement(ResourceType type, uint16 index);
|
||||
PathElement(Resources::ResourceType type, uint16 index);
|
||||
Common::String describe();
|
||||
|
||||
ResourceType getType() const { return _type; }
|
||||
Resources::ResourceType getType() const { return _type; }
|
||||
uint16 getIndex() const { return _index; }
|
||||
|
||||
private:
|
||||
ResourceType _type;
|
||||
Resources::ResourceType _type;
|
||||
uint16 _index;
|
||||
};
|
||||
|
||||
|
@ -73,7 +73,7 @@ private:
|
|||
|
||||
template<class T>
|
||||
T* ResourceReference::resolve() const {
|
||||
return Resource::cast<T>(resolve());
|
||||
return Resources::Resource::cast<T>(resolve());
|
||||
}
|
||||
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "engines/stark/visual/smacker.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
Resource *Anim::construct(Resource *parent, byte subType, uint16 index, const Common::String &name) {
|
||||
switch (subType) {
|
||||
|
@ -338,4 +339,5 @@ void AnimSkeleton::printData() {
|
|||
debug("field_6C: %d", _field_6C);
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -30,15 +30,18 @@
|
|||
|
||||
namespace Stark {
|
||||
|
||||
class Direction;
|
||||
class Image;
|
||||
class Item;
|
||||
class SkeletonAnim;
|
||||
class VisualActor;
|
||||
class VisualSmacker;
|
||||
class Visual;
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
class Direction;
|
||||
class Image;
|
||||
class Item;
|
||||
|
||||
/**
|
||||
* Animation base class
|
||||
*
|
||||
|
@ -195,6 +198,7 @@ protected:
|
|||
VisualActor *_visual;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_ANIM_H
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "engines/stark/resources/textureset.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
AnimHierarchy::~AnimHierarchy() {
|
||||
}
|
||||
|
@ -133,4 +134,5 @@ void AnimHierarchy::printData() {
|
|||
debug("field_5C: %f", _field_5C);
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -30,11 +30,14 @@
|
|||
|
||||
namespace Stark {
|
||||
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
class Anim;
|
||||
class BonesMesh;
|
||||
class ItemVisual;
|
||||
class TextureSet;
|
||||
class XRCReadStream;
|
||||
|
||||
/**
|
||||
* An animation hierarchy is a container resource referencing the available
|
||||
|
@ -88,6 +91,7 @@ protected:
|
|||
Anim *_currentAnim;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_ANIM_HIERARCHY_H
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "engines/stark/services/services.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
AnimScript::~AnimScript() {
|
||||
}
|
||||
|
@ -135,4 +136,5 @@ void AnimScriptItem::printData() {
|
|||
debug("op: %d, duration: %d ms, operand: %d", _opcode, _duration, _operand);
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -29,9 +29,12 @@
|
|||
|
||||
namespace Stark {
|
||||
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
class Anim;
|
||||
class AnimScriptItem;
|
||||
class XRCReadStream;
|
||||
|
||||
/**
|
||||
* Animation scripts control the currently displayed frame for images animation
|
||||
|
@ -105,6 +108,7 @@ protected:
|
|||
uint32 _duration;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_ANIM_SCRIPT_H
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "engines/stark/formats/xrc.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
BonesMesh::~BonesMesh() {
|
||||
delete _actor;
|
||||
|
@ -63,4 +64,5 @@ void BonesMesh::printData() {
|
|||
debug("filename: %s", _filename.c_str());
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -32,6 +32,8 @@ namespace Stark {
|
|||
class Actor;
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
/**
|
||||
* Bone mesh resources reference a mesh usable by actor resources
|
||||
*/
|
||||
|
@ -58,6 +60,7 @@ protected:
|
|||
Actor *_actor;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_BONES_MESH_H
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "engines/stark/formats/xrc.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
Bookmark::~Bookmark() {
|
||||
}
|
||||
|
@ -47,4 +48,5 @@ void Bookmark::printData() {
|
|||
debug << "position: " << _position << "\n";
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -32,6 +32,8 @@ namespace Stark {
|
|||
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
/**
|
||||
* Bookmark resources are handles for a position on the floor field.
|
||||
*
|
||||
|
@ -57,6 +59,7 @@ protected:
|
|||
Math::Vector3d _position;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_BOOKMARK_H
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "engines/stark/services/services.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
Camera::~Camera() {
|
||||
}
|
||||
|
@ -90,4 +91,5 @@ void Camera::printData() {
|
|||
debug << "v4: " << _v4 << "\n";
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -36,6 +36,8 @@ namespace Stark {
|
|||
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
/**
|
||||
* Camera resources define the camera position, perspective parameters,
|
||||
* and look at direction.
|
||||
|
@ -69,6 +71,7 @@ protected:
|
|||
float _farClipPlane;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_CAMERA_H
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "engines/stark/services/resourceprovider.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
Command::~Command() {
|
||||
}
|
||||
|
@ -234,4 +235,5 @@ void Command::printData() {
|
|||
}
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -31,10 +31,13 @@
|
|||
|
||||
namespace Stark {
|
||||
|
||||
class Script;
|
||||
class ResourceReference;
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
class Script;
|
||||
|
||||
/**
|
||||
* Command resources are script operations.
|
||||
*
|
||||
|
@ -109,6 +112,7 @@ protected:
|
|||
Common::Array<Argument> _arguments;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_COMMAND_H
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "engines/stark/services/global.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
Dialog::~Dialog() {
|
||||
}
|
||||
|
@ -260,4 +261,5 @@ Dialog *Dialog::getNextDialog(Dialog::Reply *reply) {
|
|||
return _parent->findChildWithIndex<Dialog>(reply->_nextDialogIndex);
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -30,9 +30,12 @@
|
|||
|
||||
namespace Stark {
|
||||
|
||||
class Speech;
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
class Speech;
|
||||
|
||||
/**
|
||||
* A dialog between two characters.
|
||||
*
|
||||
|
@ -131,6 +134,7 @@ protected:
|
|||
uint32 _hasAskAbout;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_DIALOG_H
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "engines/stark/formats/xrc.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
Direction::~Direction() {
|
||||
}
|
||||
|
@ -49,4 +50,5 @@ void Direction::printData() {
|
|||
debug("field_3C: %d", _field_3C);
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -31,6 +31,8 @@ namespace Stark {
|
|||
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
class Direction : public Resource {
|
||||
public:
|
||||
static const ResourceType::Type TYPE = ResourceType::kDirection;
|
||||
|
@ -48,6 +50,7 @@ protected:
|
|||
uint32 _field_3C;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_DIRECTION_H
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "engines/stark/resources/floorface.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
Floor::Floor(Resource *parent, byte subType, uint16 index, const Common::String &name) :
|
||||
Resource(parent, subType, index, name),
|
||||
|
@ -85,4 +86,5 @@ void Floor::printData() {
|
|||
}
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -32,9 +32,12 @@
|
|||
|
||||
namespace Stark {
|
||||
|
||||
class FloorFace;
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
class FloorFace;
|
||||
|
||||
/**
|
||||
* This resource represents the floor field of a 3D layer.
|
||||
* Characters can only walk on the floor field.
|
||||
|
@ -77,6 +80,7 @@ protected:
|
|||
Common::Array<FloorFace *> _faces;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_FLOOR_H
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "engines/stark/resources/floor.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
FloorFace::FloorFace(Resource *parent, byte subType, uint16 index, const Common::String &name) :
|
||||
Resource(parent, subType, index, name),
|
||||
|
@ -123,4 +124,5 @@ void FloorFace::printData() {
|
|||
debug("indices: %d %d %d, distanceFromCamera %f, unk2 %f", _indices[0], _indices[1], _indices[2], _distanceFromCamera, _unk2);
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -34,6 +34,8 @@ namespace Stark {
|
|||
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
/**
|
||||
* A floor face is a 3D triangle used to build the floor field
|
||||
*/
|
||||
|
@ -67,6 +69,7 @@ protected:
|
|||
float _unk2;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_FLOOR_FACE_H
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "engines/stark/visual/image.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
Resource *Image::construct(Resource *parent, byte subType, uint16 index, const Common::String &name) {
|
||||
switch (subType) {
|
||||
|
@ -157,4 +158,5 @@ void ImageSub23::printData() {
|
|||
Image::printData();
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -33,6 +33,8 @@ namespace Stark {
|
|||
class Visual;
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
/**
|
||||
* A still image resource
|
||||
*/
|
||||
|
@ -100,6 +102,7 @@ protected:
|
|||
bool _noName;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_IMAGE_H
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "engines/stark/services/services.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
Resource *Item::construct(Resource *parent, byte subType, uint16 index, const Common::String &name) {
|
||||
switch (subType) {
|
||||
|
@ -547,4 +548,5 @@ void ItemSub10::printData() {
|
|||
debug("reference: %s", _reference.describe().c_str());
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -33,14 +33,17 @@
|
|||
|
||||
namespace Stark {
|
||||
|
||||
class RenderEntry;
|
||||
class Visual;
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
class Anim;
|
||||
class AnimHierarchy;
|
||||
class BonesMesh;
|
||||
class Bookmark;
|
||||
class RenderEntry;
|
||||
class TextureSet;
|
||||
class Visual;
|
||||
class XRCReadStream;
|
||||
|
||||
/**
|
||||
* A scene element
|
||||
|
@ -309,6 +312,7 @@ protected:
|
|||
Common::Point _position;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_ITEM_H
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "engines/stark/formats/xrc.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
Knowledge::~Knowledge() {
|
||||
}
|
||||
|
@ -90,4 +91,5 @@ void Knowledge::printData() {
|
|||
}
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -32,6 +32,8 @@ namespace Stark {
|
|||
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
/**
|
||||
* A game logic state value holder
|
||||
*/
|
||||
|
@ -73,6 +75,7 @@ protected:
|
|||
ResourceReference _referenceValue;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_KNOWLEDGE_H
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "engines/stark/formats/xrc.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
KnowledgeSet::~KnowledgeSet() {
|
||||
}
|
||||
|
@ -37,4 +38,5 @@ KnowledgeSet::KnowledgeSet(Resource *parent, byte subType, uint16 index, const C
|
|||
void KnowledgeSet::printData() {
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -31,6 +31,8 @@ namespace Stark {
|
|||
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
/**
|
||||
* A typed collection of Knowledge resources
|
||||
*/
|
||||
|
@ -53,6 +55,7 @@ protected:
|
|||
void printData() override;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_KNOWLEDGE_SET_H
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "common/debug.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
Resource *Layer::construct(Resource *parent, byte subType, uint16 index, const Common::String &name) {
|
||||
switch (subType) {
|
||||
|
@ -220,4 +221,5 @@ void Layer3D::printData() {
|
|||
debug("farClipPlane: %f", _farClipPlane);
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -31,9 +31,12 @@
|
|||
|
||||
namespace Stark {
|
||||
|
||||
class Item;
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
class Item;
|
||||
|
||||
/**
|
||||
* A location layer
|
||||
*
|
||||
|
@ -130,6 +133,7 @@ protected:
|
|||
Common::Array<Item *> _items;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_LAYER_H
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "engines/stark/formats/xrc.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
Level::~Level() {
|
||||
}
|
||||
|
@ -37,4 +38,5 @@ Level::Level(Resource *parent, byte subType, uint16 index, const Common::String
|
|||
void Level::printData() {
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -31,6 +31,8 @@ namespace Stark {
|
|||
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
/**
|
||||
* Levels are holder resources for the locations
|
||||
*
|
||||
|
@ -48,6 +50,7 @@ protected:
|
|||
void printData() override;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_LEVEL_H
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "engines/stark/services/services.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
Location::~Location() {
|
||||
}
|
||||
|
@ -89,4 +90,5 @@ void Location::setScrollPosition(const Common::Point &position) {
|
|||
void Location::printData() {
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -31,9 +31,12 @@
|
|||
|
||||
namespace Stark {
|
||||
|
||||
class Layer;
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
class Layer;
|
||||
|
||||
/**
|
||||
* A location is a scene of the game
|
||||
*
|
||||
|
@ -76,6 +79,7 @@ private:
|
|||
Common::Point _maxScroll;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_LOCATION_H
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "engines/stark/formats/xrc.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
ResourceType::ResourceType(Type type) {
|
||||
_type = type;
|
||||
|
@ -259,4 +260,5 @@ void UnimplementedResource::printData() {
|
|||
}
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -31,6 +31,8 @@ namespace Stark {
|
|||
class XRCReadStream;
|
||||
class ResourceSerializer;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
class ResourceType {
|
||||
public:
|
||||
enum Type {
|
||||
|
@ -363,6 +365,7 @@ T *Resource::findChildWithIndex(uint16 index, int subType) {
|
|||
return Resource::cast<T>(findChildWithIndex(T::TYPE, index, subType));
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_RESOURCE_H
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "engines/stark/formats/xrc.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
Root::~Root() {
|
||||
}
|
||||
|
@ -37,4 +38,5 @@ Root::Root(Resource *parent, byte subType, uint16 index, const Common::String &n
|
|||
void Root::printData() {
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -31,6 +31,8 @@ namespace Stark {
|
|||
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
/**
|
||||
* The top level element of the game resource tree.
|
||||
*
|
||||
|
@ -47,6 +49,7 @@ protected:
|
|||
void printData() override;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_ROOT_H
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "engines/stark/services/services.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
Script::~Script() {
|
||||
}
|
||||
|
@ -254,4 +255,5 @@ void Script::printData() {
|
|||
debug("shouldResetGameSpeed: %d", _shouldResetGameSpeed);
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -29,9 +29,12 @@
|
|||
|
||||
namespace Stark {
|
||||
|
||||
class Command;
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
class Command;
|
||||
|
||||
/**
|
||||
* A script resource
|
||||
*
|
||||
|
@ -128,6 +131,7 @@ protected:
|
|||
Resource *_suspendingResource;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_SCRIPT_H
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "engines/stark/formats/xrc.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
Scroll::~Scroll() {
|
||||
}
|
||||
|
@ -53,4 +54,5 @@ void Scroll::printData() {
|
|||
debug("bookmarkIndex: %d", _bookmarkIndex);
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -31,6 +31,8 @@ namespace Stark {
|
|||
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
/**
|
||||
* Scroll position for a location
|
||||
*/
|
||||
|
@ -53,6 +55,7 @@ protected:
|
|||
uint32 _bookmarkIndex;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_SCROLL_H
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "engines/stark/services/services.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
Sound::~Sound() {
|
||||
}
|
||||
|
@ -161,4 +162,5 @@ void Sound::printData() {
|
|||
debug("volume: %f", _volume);
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -37,6 +37,8 @@ namespace Stark {
|
|||
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
/**
|
||||
* A sound resource
|
||||
*/
|
||||
|
@ -89,6 +91,7 @@ protected:
|
|||
Audio::SoundHandle _handle;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_SOUND_H
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "engines/stark/resources/sound.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
Speech::~Speech() {
|
||||
}
|
||||
|
@ -79,4 +80,5 @@ void Speech::printData() {
|
|||
debug("character: %d", _character);
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -29,9 +29,12 @@
|
|||
|
||||
namespace Stark {
|
||||
|
||||
class Sound;
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
class Sound;
|
||||
|
||||
/**
|
||||
* Speech resource
|
||||
*
|
||||
|
@ -73,6 +76,7 @@ protected:
|
|||
Sound *_soundResource;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_SPEECH_H
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "engines/stark/texture.h"
|
||||
|
||||
namespace Stark {
|
||||
namespace Resources {
|
||||
|
||||
TextureSet::~TextureSet() {
|
||||
delete _texture;
|
||||
|
@ -64,4 +65,5 @@ void TextureSet::printData() {
|
|||
debug("filename: %s", _filename.c_str());
|
||||
}
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -32,6 +32,8 @@ namespace Stark {
|
|||
class Texture;
|
||||
class XRCReadStream;
|
||||
|
||||
namespace Resources {
|
||||
|
||||
/**
|
||||
* A texture resource
|
||||
*
|
||||
|
@ -65,6 +67,7 @@ protected:
|
|||
Texture *_texture;
|
||||
};
|
||||
|
||||
} // End of namespace Resources
|
||||
} // End of namespace Stark
|
||||
|
||||
#endif // STARK_RESOURCES_TEXTURE_SET_H
|
||||
|
|
|
@ -112,7 +112,7 @@ ArchiveLoader::LoadedArchive *ArchiveLoader::findArchive(const Common::String &a
|
|||
error("The archive with name '%s' is not loaded.", archiveName.c_str());
|
||||
}
|
||||
|
||||
Common::String ArchiveLoader::buildArchiveName(Level *level, Location *location) {
|
||||
Common::String ArchiveLoader::buildArchiveName(Resources::Level *level, Resources::Location *location) {
|
||||
Common::String archive;
|
||||
|
||||
if (!location) {
|
||||
|
|
|
@ -35,8 +35,10 @@
|
|||
|
||||
namespace Stark {
|
||||
|
||||
namespace Resources {
|
||||
class Level;
|
||||
class Location;
|
||||
}
|
||||
|
||||
/**
|
||||
* A read stream with helper functions to read usual data types
|
||||
|
@ -79,7 +81,7 @@ public:
|
|||
bool returnRoot(const Common::String &archiveName);
|
||||
|
||||
/** Build the archive filename for a level or a location */
|
||||
Common::String buildArchiveName(Level *level, Location *location = nullptr);
|
||||
Common::String buildArchiveName(Resources::Level *level, Resources::Location *location = nullptr);
|
||||
|
||||
/** Retrieve a file relative to a specified archive */
|
||||
Common::SeekableReadStream *getExternalFile(const Common::String &fileName, const Common::String &archiveName);
|
||||
|
@ -92,7 +94,7 @@ private:
|
|||
|
||||
Common::String &getFilename() { return _filename; }
|
||||
XARCArchive &getXArc() { return _xarc; }
|
||||
Resource *getRoot() { return _root; }
|
||||
Resources::Resource *getRoot() { return _root; }
|
||||
|
||||
void importResources();
|
||||
|
||||
|
@ -104,7 +106,7 @@ private:
|
|||
uint _useCount;
|
||||
Common::String _filename;
|
||||
XARCArchive _xarc;
|
||||
Resource *_root;
|
||||
Resources::Resource *_root;
|
||||
};
|
||||
|
||||
typedef Common::List<LoadedArchive *> LoadedArchiveList;
|
||||
|
@ -119,7 +121,7 @@ template <class T>
|
|||
T *ArchiveLoader::useRoot(const Common::String &archiveName) {
|
||||
LoadedArchive *archive = findArchive(archiveName);
|
||||
archive->incUsage();
|
||||
return Resource::cast<T>(archive->getRoot());
|
||||
return Resources::Resource::cast<T>(archive->getRoot());
|
||||
}
|
||||
|
||||
} // End of namespace Stark
|
||||
|
|
|
@ -36,7 +36,7 @@ DialogPlayer::DialogPlayer() :
|
|||
DialogPlayer::~DialogPlayer() {
|
||||
}
|
||||
|
||||
void DialogPlayer::run(Dialog *dialog) {
|
||||
void DialogPlayer::run(Resources::Dialog *dialog) {
|
||||
reset();
|
||||
|
||||
_currentDialog = dialog;
|
||||
|
@ -48,7 +48,7 @@ bool DialogPlayer::isRunning() {
|
|||
}
|
||||
|
||||
void DialogPlayer::buildOptions() {
|
||||
Common::Array<Dialog::Topic *> availableTopics = _currentDialog->listAvailableTopics();
|
||||
Common::Array<Resources::Dialog::Topic *> availableTopics = _currentDialog->listAvailableTopics();
|
||||
|
||||
// TODO: This is very minimal, complete
|
||||
|
||||
|
@ -76,12 +76,12 @@ void DialogPlayer::selectOption(uint32 index) {
|
|||
|
||||
switch (option._type) {
|
||||
case kOptionTypeAsk: {
|
||||
Dialog::Topic *topic = option._topic;
|
||||
Resources::Dialog::Topic *topic = option._topic;
|
||||
|
||||
// Set the current reply
|
||||
_currentReply = topic->startReply(index);
|
||||
|
||||
Speech *speech = _currentReply->getCurrentSpeech();
|
||||
Resources::Speech *speech = _currentReply->getCurrentSpeech();
|
||||
if (speech) {
|
||||
_speechReady = true;
|
||||
} else {
|
||||
|
@ -95,7 +95,7 @@ void DialogPlayer::selectOption(uint32 index) {
|
|||
}
|
||||
|
||||
void DialogPlayer::onReplyEnd() {
|
||||
Dialog *nextDialog = _currentDialog->getNextDialog(_currentReply);
|
||||
Resources::Dialog *nextDialog = _currentDialog->getNextDialog(_currentReply);
|
||||
|
||||
//TODO: Complete
|
||||
|
||||
|
@ -121,7 +121,7 @@ void DialogPlayer::update() {
|
|||
|
||||
//TODO: Complete / Refactor
|
||||
|
||||
Speech *speech = _currentReply->getCurrentSpeech();
|
||||
Resources::Speech *speech = _currentReply->getCurrentSpeech();
|
||||
if (speech && _speechReady) {
|
||||
// A new line can be played
|
||||
speech->playSound();
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
virtual ~DialogPlayer();
|
||||
|
||||
/** Enter a dialog */
|
||||
void run(Dialog *dialog);
|
||||
void run(Resources::Dialog *dialog);
|
||||
|
||||
/** Check if a dialog is running */
|
||||
bool isRunning();
|
||||
|
@ -60,7 +60,7 @@ protected:
|
|||
struct Option {
|
||||
uint32 _type;
|
||||
Common::String _caption;
|
||||
Dialog::Topic *_topic;
|
||||
Resources::Dialog::Topic *_topic;
|
||||
int32 _replyIndex;
|
||||
};
|
||||
|
||||
|
@ -73,8 +73,8 @@ protected:
|
|||
/** Clear the currently running dialog */
|
||||
void reset();
|
||||
|
||||
Dialog *_currentDialog;
|
||||
Dialog::Reply *_currentReply;
|
||||
Resources::Dialog *_currentDialog;
|
||||
Resources::Dialog::Reply *_currentReply;
|
||||
|
||||
bool _speechReady;
|
||||
Common::Array<Option> _options;
|
||||
|
|
|
@ -39,14 +39,14 @@ Global::Global() :
|
|||
}
|
||||
|
||||
int32 Global::getCurrentChapter() {
|
||||
KnowledgeSet *globalState = _level->findChildWithSubtype<KnowledgeSet>(KnowledgeSet::kState);
|
||||
Knowledge *chapter = globalState->findChildWithIndex<Knowledge>(0);
|
||||
Resources::KnowledgeSet *globalState = _level->findChildWithSubtype<Resources::KnowledgeSet>(Resources::KnowledgeSet::kState);
|
||||
Resources::Knowledge *chapter = globalState->findChildWithIndex<Resources::Knowledge>(0);
|
||||
return chapter->getIntegerValue();
|
||||
}
|
||||
|
||||
void Global::setCurrentChapter(int32 value) {
|
||||
KnowledgeSet *globalState = _level->findChildWithSubtype<KnowledgeSet>(KnowledgeSet::kState);
|
||||
Knowledge *chapter = globalState->findChildWithIndex<Knowledge>(0);
|
||||
Resources::KnowledgeSet *globalState = _level->findChildWithSubtype<Resources::KnowledgeSet>(Resources::KnowledgeSet::kState);
|
||||
Resources::Knowledge *chapter = globalState->findChildWithIndex<Resources::Knowledge>(0);
|
||||
chapter->setIntegerValue(value);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
namespace Stark {
|
||||
|
||||
namespace Resources {
|
||||
class Camera;
|
||||
class Floor;
|
||||
class ItemSub1;
|
||||
|
@ -34,6 +35,7 @@ class ItemSub10;
|
|||
class Level;
|
||||
class Location;
|
||||
class Root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Current level / location holder object
|
||||
|
@ -48,24 +50,24 @@ public:
|
|||
_interactive(nullptr) {
|
||||
}
|
||||
|
||||
Level *getLevel() const { return _level; }
|
||||
Location *getLocation() const { return _location; }
|
||||
Floor *getFloor() const { return _floor; }
|
||||
Camera *getCamera() const { return _camera; }
|
||||
ItemSub10 *getInteractive() const { return _interactive; }
|
||||
Resources::Level *getLevel() const { return _level; }
|
||||
Resources::Location *getLocation() const { return _location; }
|
||||
Resources::Floor *getFloor() const { return _floor; }
|
||||
Resources::Camera *getCamera() const { return _camera; }
|
||||
Resources::ItemSub10 *getInteractive() const { return _interactive; }
|
||||
|
||||
void setLevel(Level *level) { _level = level; }
|
||||
void setLocation(Location *location) { _location = location; }
|
||||
void setFloor(Floor *floor) { _floor = floor; }
|
||||
void setCamera(Camera *camera) { _camera = camera; }
|
||||
void setInteractive(ItemSub10 *interactive) { _interactive = interactive; }
|
||||
void setLevel(Resources::Level *level) { _level = level; }
|
||||
void setLocation(Resources::Location *location) { _location = location; }
|
||||
void setFloor(Resources::Floor *floor) { _floor = floor; }
|
||||
void setCamera(Resources::Camera *camera) { _camera = camera; }
|
||||
void setInteractive(Resources::ItemSub10 *interactive) { _interactive = interactive; }
|
||||
|
||||
private:
|
||||
Level *_level;
|
||||
Location *_location;
|
||||
ItemSub10 *_interactive;
|
||||
Floor *_floor;
|
||||
Camera *_camera;
|
||||
Resources::Level *_level;
|
||||
Resources::Location *_location;
|
||||
Resources::ItemSub10 *_interactive;
|
||||
Resources::Floor *_floor;
|
||||
Resources::Camera *_camera;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -75,21 +77,21 @@ class Global {
|
|||
public:
|
||||
Global();
|
||||
|
||||
Root *getRoot() const { return _root; }
|
||||
Level *getLevel() const { return _level; }
|
||||
Resources::Root *getRoot() const { return _root; }
|
||||
Resources::Level *getLevel() const { return _level; }
|
||||
Current *getCurrent() const { return _current; }
|
||||
bool isDebug() const { return _debug; }
|
||||
bool isFastForward() const { return _fastForward; }
|
||||
uint getMillisecondsPerGameloop() const { return _millisecondsPerGameloop; }
|
||||
ItemSub1 *getApril() const { return _april; }
|
||||
Resources::ItemSub1 *getApril() const { return _april; }
|
||||
|
||||
void setRoot(Root *root) { _root = root; }
|
||||
void setLevel(Level *level) { _level = level; }
|
||||
void setRoot(Resources::Root *root) { _root = root; }
|
||||
void setLevel(Resources::Level *level) { _level = level; }
|
||||
void setCurrent(Current *current) { _current = current; }
|
||||
void setDebug(bool debug) { _debug = debug; }
|
||||
void setFastForward(bool fastForward) { _fastForward = fastForward; }
|
||||
void setMillisecondsPerGameloop(uint millisecondsPerGameloop) { _millisecondsPerGameloop = millisecondsPerGameloop; }
|
||||
void setApril(ItemSub1 *april) { _april = april; }
|
||||
void setApril(Resources::ItemSub1 *april) { _april = april; }
|
||||
|
||||
/** Retrieve the current chapter number from the global resource tree */
|
||||
int32 getCurrentChapter();
|
||||
|
@ -98,10 +100,10 @@ public:
|
|||
void setCurrentChapter(int32 value);
|
||||
private:
|
||||
uint _millisecondsPerGameloop;
|
||||
Root *_root;
|
||||
Level *_level;
|
||||
Resources::Root *_root;
|
||||
Resources::Level *_level;
|
||||
/* Inventory *_inventory; */
|
||||
ItemSub1 *_april;
|
||||
Resources::ItemSub1 *_april;
|
||||
Current *_current;
|
||||
bool _debug;
|
||||
bool _fastForward;
|
||||
|
|
|
@ -51,29 +51,29 @@ void ResourceProvider::initGlobal() {
|
|||
_archiveLoader->load("x.xarc");
|
||||
|
||||
// Set the root tree
|
||||
Root *root = _archiveLoader->useRoot<Root>("x.xarc");
|
||||
Resources::Root *root = _archiveLoader->useRoot<Resources::Root>("x.xarc");
|
||||
_global->setRoot(root);
|
||||
|
||||
// Resource lifecycle update
|
||||
// Resources::Resource lifecycle update
|
||||
root->onAllLoaded();
|
||||
|
||||
// Find the global level node
|
||||
Level *global = root->findChildWithSubtype<Level>(1);
|
||||
Resources::Level *global = root->findChildWithSubtype<Resources::Level>(1);
|
||||
|
||||
// Load the global archive
|
||||
Common::String globalArchiveName = _archiveLoader->buildArchiveName(global);
|
||||
_archiveLoader->load(globalArchiveName);
|
||||
|
||||
// Set the global tree
|
||||
global = _archiveLoader->useRoot<Level>(globalArchiveName);
|
||||
global = _archiveLoader->useRoot<Resources::Level>(globalArchiveName);
|
||||
_stateProvider->restoreLevelState(global);
|
||||
_global->setLevel(global);
|
||||
|
||||
// Resource lifecycle update
|
||||
// Resources::Resource lifecycle update
|
||||
global->onAllLoaded();
|
||||
|
||||
//TODO: Retrieve the inventory from the global tree
|
||||
_global->setApril(global->findChildWithSubtype<ItemSub1>(Item::kItemSub1));
|
||||
_global->setApril(global->findChildWithSubtype<Resources::ItemSub1>(Resources::Item::kItemSub1));
|
||||
}
|
||||
|
||||
Current *ResourceProvider::findLevel(uint16 level) {
|
||||
|
@ -97,7 +97,7 @@ Current *ResourceProvider::findLocation(uint16 level, uint16 location) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Level *ResourceProvider::getLevel(uint16 level) {
|
||||
Resources::Level *ResourceProvider::getLevel(uint16 level) {
|
||||
Current *current = findLevel(level);
|
||||
|
||||
if (current) {
|
||||
|
@ -107,7 +107,7 @@ Level *ResourceProvider::getLevel(uint16 level) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Location *ResourceProvider::getLocation(uint16 level, uint16 location) {
|
||||
Resources::Location *ResourceProvider::getLocation(uint16 level, uint16 location) {
|
||||
Current *current = findLocation(level, location);
|
||||
|
||||
if (current) {
|
||||
|
@ -122,13 +122,13 @@ void ResourceProvider::requestLocationChange(uint16 level, uint16 location) {
|
|||
_locations.push_back(currentLocation);
|
||||
|
||||
// Retrieve the level archive name
|
||||
Root *root = _global->getRoot();
|
||||
Level *rootLevelResource = root->findChildWithIndex<Level>(level);
|
||||
Resources::Root *root = _global->getRoot();
|
||||
Resources::Level *rootLevelResource = root->findChildWithIndex<Resources::Level>(level);
|
||||
Common::String levelArchive = _archiveLoader->buildArchiveName(rootLevelResource);
|
||||
|
||||
// Load the archive, and get the resource sub-tree root
|
||||
bool newlyLoaded = _archiveLoader->load(levelArchive);
|
||||
currentLocation->setLevel(_archiveLoader->useRoot<Level>(levelArchive));
|
||||
currentLocation->setLevel(_archiveLoader->useRoot<Resources::Level>(levelArchive));
|
||||
|
||||
// If we just loaded a resource tree, restore its state
|
||||
if (newlyLoaded) {
|
||||
|
@ -137,18 +137,18 @@ void ResourceProvider::requestLocationChange(uint16 level, uint16 location) {
|
|||
}
|
||||
|
||||
// Retrieve the location archive name
|
||||
Level *levelResource = currentLocation->getLevel();
|
||||
Location *levelLocationResource = levelResource->findChildWithIndex<Location>(location);
|
||||
Resources::Level *levelResource = currentLocation->getLevel();
|
||||
Resources::Location *levelLocationResource = levelResource->findChildWithIndex<Resources::Location>(location);
|
||||
Common::String locationArchive = _archiveLoader->buildArchiveName(levelResource, levelLocationResource);
|
||||
|
||||
// Load the archive, and get the resource sub-tree root
|
||||
newlyLoaded = _archiveLoader->load(locationArchive);
|
||||
currentLocation->setLocation(_archiveLoader->useRoot<Location>(locationArchive));
|
||||
currentLocation->setLocation(_archiveLoader->useRoot<Resources::Location>(locationArchive));
|
||||
|
||||
if (currentLocation->getLocation()->has3DLayer()) {
|
||||
Layer3D *layer = currentLocation->getLocation()->findChildWithSubtype<Layer3D>(Layer::kLayer3D);
|
||||
currentLocation->setFloor(layer->findChild<Floor>());
|
||||
currentLocation->setCamera(layer->findChild<Camera>());
|
||||
Resources::Layer3D *layer = currentLocation->getLocation()->findChildWithSubtype<Resources::Layer3D>(Resources::Layer::kLayer3D);
|
||||
currentLocation->setFloor(layer->findChild<Resources::Floor>());
|
||||
currentLocation->setCamera(layer->findChild<Resources::Camera>());
|
||||
} else {
|
||||
currentLocation->setFloor(nullptr);
|
||||
currentLocation->setCamera(nullptr);
|
||||
|
@ -169,10 +169,10 @@ void ResourceProvider::performLocationChange() {
|
|||
Current *previous = _global->getCurrent();
|
||||
|
||||
// Trigger location change scripts
|
||||
runLocationChangeScripts(previous->getLevel(), Script::kCallModeExitLocation);
|
||||
runLocationChangeScripts(previous->getLocation(), Script::kCallModeExitLocation);
|
||||
runLocationChangeScripts(previous->getLevel(), Resources::Script::kCallModeExitLocation);
|
||||
runLocationChangeScripts(previous->getLocation(), Resources::Script::kCallModeExitLocation);
|
||||
|
||||
// Resource lifecycle update
|
||||
// Resources::Resource lifecycle update
|
||||
previous->getLocation()->onExitLocation();
|
||||
previous->getLevel()->onExitLocation();
|
||||
_global->getLevel()->onExitLocation();
|
||||
|
@ -189,31 +189,31 @@ void ResourceProvider::performLocationChange() {
|
|||
_restoreCurrentState = false;
|
||||
}
|
||||
|
||||
// Resource lifecycle update
|
||||
// Resources::Resource lifecycle update
|
||||
_global->getLevel()->onEnterLocation();
|
||||
current->getLevel()->onEnterLocation();
|
||||
current->getLocation()->onEnterLocation();
|
||||
|
||||
if (current->getLocation()->has3DLayer()) {
|
||||
// Fetch the scene item for April
|
||||
current->setInteractive(Resource::cast<ItemSub10>(_global->getApril()->getSceneInstance()));
|
||||
current->setInteractive(Resources::Resource::cast<Resources::ItemSub10>(_global->getApril()->getSceneInstance()));
|
||||
}
|
||||
|
||||
setAprilInitialPosition();
|
||||
|
||||
// Trigger location change scripts
|
||||
runLocationChangeScripts(current->getLevel(), Script::kCallModeEnterLocation);
|
||||
runLocationChangeScripts(current->getLocation(), Script::kCallModeEnterLocation);
|
||||
runLocationChangeScripts(current->getLevel(), Resources::Script::kCallModeEnterLocation);
|
||||
runLocationChangeScripts(current->getLocation(), Resources::Script::kCallModeEnterLocation);
|
||||
|
||||
purgeOldLocations();
|
||||
|
||||
_locationChangeRequest = false;
|
||||
}
|
||||
|
||||
void ResourceProvider::runLocationChangeScripts(Resource *resource, uint32 scriptCallMode) {
|
||||
Common::Array<Script *> script = resource->listChildrenRecursive<Script>();
|
||||
void ResourceProvider::runLocationChangeScripts(Resources::Resource *resource, uint32 scriptCallMode) {
|
||||
Common::Array<Resources::Script *> script = resource->listChildrenRecursive<Resources::Script>();
|
||||
|
||||
if (scriptCallMode == Script::kCallModeEnterLocation) {
|
||||
if (scriptCallMode == Resources::Script::kCallModeEnterLocation) {
|
||||
for (uint i = 0; i < script.size(); i++) {
|
||||
script[i]->reset();
|
||||
}
|
||||
|
@ -235,13 +235,13 @@ void ResourceProvider::setAprilInitialPosition() {
|
|||
}
|
||||
|
||||
Current *current = _global->getCurrent();
|
||||
ItemSub10 *april = current->getInteractive();
|
||||
Resources::ItemSub10 *april = current->getInteractive();
|
||||
if (!april) {
|
||||
return; // No character
|
||||
}
|
||||
|
||||
// Set the initial location for April
|
||||
Bookmark *position = _nextPositionBookmarkReference.resolve<Bookmark>();
|
||||
Resources::Bookmark *position = _nextPositionBookmarkReference.resolve<Resources::Bookmark>();
|
||||
|
||||
april->placeOnBookmark(position);
|
||||
april->setDirection(_nextDirection);
|
||||
|
|
|
@ -29,9 +29,11 @@
|
|||
|
||||
namespace Stark {
|
||||
|
||||
namespace Resources {
|
||||
class Level;
|
||||
class Location;
|
||||
class Resource;
|
||||
}
|
||||
|
||||
class ArchiveLoader;
|
||||
class Current;
|
||||
|
@ -77,10 +79,10 @@ public:
|
|||
void shutdown();
|
||||
|
||||
/** Obtain the root resource for a loaded level */
|
||||
Level *getLevel(uint16 level);
|
||||
Resources::Level *getLevel(uint16 level);
|
||||
|
||||
/** Obtain the root resource for a loaded location */
|
||||
Location *getLocation(uint16 level, uint16 location);
|
||||
Resources::Location *getLocation(uint16 level, uint16 location);
|
||||
|
||||
private:
|
||||
typedef Common::List<Current *> CurrentList;
|
||||
|
@ -90,7 +92,7 @@ private:
|
|||
|
||||
void purgeOldLocations();
|
||||
|
||||
void runLocationChangeScripts(Resource *resource, uint32 scriptCallMode);
|
||||
void runLocationChangeScripts(Resources::Resource *resource, uint32 scriptCallMode);
|
||||
void setAprilInitialPosition();
|
||||
|
||||
Global *_global;
|
||||
|
|
|
@ -75,31 +75,31 @@ void StateProvider::clear() {
|
|||
_stateStore.clear();
|
||||
}
|
||||
|
||||
void StateProvider::restoreLevelState(Level *level) {
|
||||
void StateProvider::restoreLevelState(Resources::Level *level) {
|
||||
Common::String storeKey = level->getName();
|
||||
|
||||
restoreResourceTreeState(storeKey, level, false);
|
||||
}
|
||||
|
||||
void StateProvider::restoreCurrentLevelState(Level *level) {
|
||||
void StateProvider::restoreCurrentLevelState(Resources::Level *level) {
|
||||
restoreResourceTreeState("Current", level, true);
|
||||
}
|
||||
|
||||
void StateProvider::restoreLocationState(Level *level, Location *location) {
|
||||
void StateProvider::restoreLocationState(Resources::Level *level, Resources::Location *location) {
|
||||
Common::String storeKey = level->getName() + location->getName();
|
||||
|
||||
restoreResourceTreeState(storeKey, location, false);
|
||||
}
|
||||
|
||||
void StateProvider::restoreCurrentLocationState(Level *level, Location *location) {
|
||||
void StateProvider::restoreCurrentLocationState(Resources::Level *level, Resources::Location *location) {
|
||||
restoreResourceTreeState("CurrentCurrent", location, true);
|
||||
}
|
||||
|
||||
void StateProvider::restoreGlobalState(Level *level) {
|
||||
void StateProvider::restoreGlobalState(Resources::Level *level) {
|
||||
restoreResourceTreeState("CurrentGlobal", level, true);
|
||||
}
|
||||
|
||||
void StateProvider::restoreResourceTreeState(Common::String storeKey, Resource *root, bool current) {
|
||||
void StateProvider::restoreResourceTreeState(Common::String storeKey, Resources::Resource *root, bool current) {
|
||||
if (_stateStore.contains(storeKey)) {
|
||||
ResourceTreeState *state = _stateStore[storeKey];
|
||||
|
||||
|
@ -108,7 +108,7 @@ void StateProvider::restoreResourceTreeState(Common::String storeKey, Resource *
|
|||
}
|
||||
}
|
||||
|
||||
void StateProvider::readResourceTree(Resource *resource, Common::SeekableReadStream *stream, bool current) {
|
||||
void StateProvider::readResourceTree(Resources::Resource *resource, Common::SeekableReadStream *stream, bool current) {
|
||||
// Read the resource to the source stream
|
||||
/* byte type = */ stream->readByte();
|
||||
/* byte subType = */ stream->readByte();
|
||||
|
@ -127,37 +127,37 @@ void StateProvider::readResourceTree(Resource *resource, Common::SeekableReadStr
|
|||
}
|
||||
|
||||
// Deserialize the resource children
|
||||
Common::Array<Resource *> children = resource->listChildren<Resource>();
|
||||
Common::Array<Resources::Resource *> children = resource->listChildren<Resources::Resource>();
|
||||
for (uint i = 0; i < children.size(); i++) {
|
||||
readResourceTree(children[i], stream, current);
|
||||
}
|
||||
}
|
||||
|
||||
void StateProvider::saveLevelState(Level *level) {
|
||||
void StateProvider::saveLevelState(Resources::Level *level) {
|
||||
Common::String storeKey = level->getName();
|
||||
|
||||
saveResourceTreeState(storeKey, level, false);
|
||||
}
|
||||
|
||||
void StateProvider::saveCurrentLevelState(Level *level) {
|
||||
void StateProvider::saveCurrentLevelState(Resources::Level *level) {
|
||||
saveResourceTreeState("Current", level, true);
|
||||
}
|
||||
|
||||
void StateProvider::saveLocationState(Level *level, Location *location) {
|
||||
void StateProvider::saveLocationState(Resources::Level *level, Resources::Location *location) {
|
||||
Common::String storeKey = level->getName() + location->getName();
|
||||
|
||||
saveResourceTreeState(storeKey, location, false);
|
||||
}
|
||||
|
||||
void StateProvider::saveCurrentLocationState(Level *level, Location *location) {
|
||||
void StateProvider::saveCurrentLocationState(Resources::Level *level, Resources::Location *location) {
|
||||
saveResourceTreeState("CurrentCurrent", location, true);
|
||||
}
|
||||
|
||||
void StateProvider::saveGlobalState(Level *level) {
|
||||
void StateProvider::saveGlobalState(Resources::Level *level) {
|
||||
saveResourceTreeState("CurrentGlobal", level, true);
|
||||
}
|
||||
|
||||
void StateProvider::saveResourceTreeState(Common::String storeKey, Resource *root, bool current) {
|
||||
void StateProvider::saveResourceTreeState(Common::String storeKey, Resources::Resource *root, bool current) {
|
||||
// Delete any previous data
|
||||
if (!_stateStore.contains(storeKey)) {
|
||||
delete _stateStore[storeKey];
|
||||
|
@ -172,7 +172,7 @@ void StateProvider::saveResourceTreeState(Common::String storeKey, Resource *roo
|
|||
_stateStore[storeKey] = new ResourceTreeState(stream.size(), stream.getData());
|
||||
}
|
||||
|
||||
void StateProvider::writeResourceTree(Resource *resource, Common::WriteStream *stream, bool current) {
|
||||
void StateProvider::writeResourceTree(Resources::Resource *resource, Common::WriteStream *stream, bool current) {
|
||||
// Explicit scope to control the lifespan of the memory stream
|
||||
{
|
||||
Common::MemoryWriteStreamDynamic resourceStream(DisposeAfterUse::YES);
|
||||
|
@ -195,7 +195,7 @@ void StateProvider::writeResourceTree(Resource *resource, Common::WriteStream *s
|
|||
}
|
||||
|
||||
// Serialize the resource children
|
||||
Common::Array<Resource *> children = resource->listChildren<Resource>();
|
||||
Common::Array<Resources::Resource *> children = resource->listChildren<Resources::Resource>();
|
||||
for (uint i = 0; i < children.size(); i++) {
|
||||
writeResourceTree(children[i], stream, current);
|
||||
}
|
||||
|
|
|
@ -31,9 +31,11 @@
|
|||
|
||||
namespace Stark {
|
||||
|
||||
namespace Resources {
|
||||
class Resource;
|
||||
class Level;
|
||||
class Location;
|
||||
}
|
||||
|
||||
class StateReadStream : public Common::SeekableSubReadStream {
|
||||
public:
|
||||
|
@ -52,7 +54,7 @@ public:
|
|||
};
|
||||
|
||||
/**
|
||||
* Resource state provider.
|
||||
* Resources::Resource state provider.
|
||||
*
|
||||
* Maintains a serialized version of the state of the resource trees.
|
||||
*/
|
||||
|
@ -60,17 +62,17 @@ class StateProvider {
|
|||
public:
|
||||
~StateProvider();
|
||||
|
||||
void restoreLevelState(Level *level);
|
||||
void restoreCurrentLevelState(Level *level);
|
||||
void restoreLocationState(Level *level, Location *location);
|
||||
void restoreCurrentLocationState(Level *level, Location *location);
|
||||
void restoreGlobalState(Level *level);
|
||||
void restoreLevelState(Resources::Level *level);
|
||||
void restoreCurrentLevelState(Resources::Level *level);
|
||||
void restoreLocationState(Resources::Level *level, Resources::Location *location);
|
||||
void restoreCurrentLocationState(Resources::Level *level, Resources::Location *location);
|
||||
void restoreGlobalState(Resources::Level *level);
|
||||
|
||||
void saveLevelState(Level *level);
|
||||
void saveCurrentLevelState(Level *level);
|
||||
void saveLocationState(Level *level, Location *location);
|
||||
void saveCurrentLocationState(Level *level, Location *location);
|
||||
void saveGlobalState(Level *level);
|
||||
void saveLevelState(Resources::Level *level);
|
||||
void saveCurrentLevelState(Resources::Level *level);
|
||||
void saveLocationState(Resources::Level *level, Resources::Location *location);
|
||||
void saveCurrentLocationState(Resources::Level *level, Resources::Location *location);
|
||||
void saveGlobalState(Resources::Level *level);
|
||||
|
||||
/** Replace the current states by those read from the stream */
|
||||
void readStateFromStream(StateReadStream*stream);
|
||||
|
@ -94,11 +96,11 @@ private:
|
|||
|
||||
typedef Common::HashMap<Common::String, ResourceTreeState *> ResourceTreeStateMap;
|
||||
|
||||
void restoreResourceTreeState(Common::String storeKey, Resource *root, bool current);
|
||||
void saveResourceTreeState(Common::String storeKey, Resource *root, bool current);
|
||||
void restoreResourceTreeState(Common::String storeKey, Resources::Resource *root, bool current);
|
||||
void saveResourceTreeState(Common::String storeKey, Resources::Resource *root, bool current);
|
||||
|
||||
void readResourceTree(Resource *resource, Common::SeekableReadStream *stream, bool current);
|
||||
void writeResourceTree(Resource *resource, Common::WriteStream *stream, bool current);
|
||||
void readResourceTree(Resources::Resource *resource, Common::SeekableReadStream *stream, bool current);
|
||||
void writeResourceTree(Resources::Resource *resource, Common::WriteStream *stream, bool current);
|
||||
|
||||
void clear();
|
||||
|
||||
|
|
|
@ -45,14 +45,14 @@ void UserInterface::skipCurrentSpeeches() {
|
|||
}
|
||||
|
||||
// Get all speeches
|
||||
Common::Array<Speech *> speeches;
|
||||
speeches.push_back(global->getLevel()->listChildrenRecursive<Speech>());
|
||||
speeches.push_back(current->getLevel()->listChildrenRecursive<Speech>());
|
||||
speeches.push_back(current->getLocation()->listChildrenRecursive<Speech>());
|
||||
Common::Array<Resources::Speech *> speeches;
|
||||
speeches.push_back(global->getLevel()->listChildrenRecursive<Resources::Speech>());
|
||||
speeches.push_back(current->getLevel()->listChildrenRecursive<Resources::Speech>());
|
||||
speeches.push_back(current->getLocation()->listChildrenRecursive<Resources::Speech>());
|
||||
|
||||
// Stop them
|
||||
for (uint i = 0; i < speeches.size(); i++) {
|
||||
Speech *speech = speeches[i];
|
||||
Resources::Speech *speech = speeches[i];
|
||||
if (speech->isPlaying()) {
|
||||
speech->stop();
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ void UserInterface::scrollLocation(int32 dX, int32 dY) {
|
|||
return; // No current location, nothing to do
|
||||
}
|
||||
|
||||
Location *location = current->getLocation();
|
||||
Resources::Location *location = current->getLocation();
|
||||
|
||||
Common::Point scroll = location->getScrollPosition();
|
||||
scroll.x += dX;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue