From 5bd5790e5714403682bd254625c7b1dd9813b65d Mon Sep 17 00:00:00 2001
From: Paul Gilbert
Date: Mon, 23 Aug 2010 00:32:45 +0000
Subject: SWORD25: Converted AnimationResource to use SCUMMVM XMLParser.
Removed tinyxml library
svn-id: r53281
---
engines/sword25/gfx/animationresource.h | 38 +++++++++++++++++++++++----------
1 file changed, 27 insertions(+), 11 deletions(-)
(limited to 'engines/sword25/gfx/animationresource.h')
diff --git a/engines/sword25/gfx/animationresource.h b/engines/sword25/gfx/animationresource.h
index 2bc052c39c..ca0fd9ca23 100644
--- a/engines/sword25/gfx/animationresource.h
+++ b/engines/sword25/gfx/animationresource.h
@@ -39,13 +39,12 @@
// Includes
// -----------------------------------------------------------------------------
+#include "common/xmlparser.h"
#include "sword25/kernel/common.h"
#include "sword25/kernel/resource.h"
#include "sword25/gfx/animationdescription.h"
#include "sword25/gfx/animation.h"
-class TiXmlElement;
-
namespace Sword25 {
// -----------------------------------------------------------------------------
@@ -59,9 +58,9 @@ class PackageManager;
// Class Definition
// -----------------------------------------------------------------------------
-class AnimationResource : public Resource, public AnimationDescription {
+class AnimationResource : public Resource, public AnimationDescription, public Common::XMLParser {
public:
- AnimationResource(const Common::String &FileName);
+ AnimationResource(const Common::String &filename);
virtual ~AnimationResource();
virtual const Frame &GetFrame(unsigned int Index) const {
@@ -100,18 +99,35 @@ public:
private:
bool m_Valid;
- Common::Array m_Frames;
-
- //@{
- /** @name Dokument-Parser Methoden */
+ Common::Array m_Frames;
- bool ParseAnimationTag(TiXmlElement &AnimationTag, int &FPS, Animation::ANIMATION_TYPES &AnimationType);
- bool ParseFrameTag(TiXmlElement &FrameTag, Frame &Frame, PackageManager &PackageManager);
+ PackageManager * _pPackage;
- //@}
bool ComputeFeatures();
bool PrecacheAllFrames() const;
+
+ // Parser
+ CUSTOM_XML_PARSER(AnimationResource) {
+ XML_KEY(animation)
+ XML_PROP(fps, true)
+ XML_PROP(type, true)
+
+ XML_KEY(frame)
+ XML_PROP(file, true)
+ XML_PROP(hotspotx, true)
+ XML_PROP(hotspoty, true)
+ XML_PROP(fliph, false)
+ XML_PROP(flipv, false)
+ KEY_END()
+ KEY_END()
+ } PARSER_END()
+
+ bool parseBooleanKey(Common::String s, bool &result);
+
+ // Parser callback methods
+ bool parserCallback_animation(ParserNode *node);
+ bool parserCallback_frame(ParserNode *node);
};
} // End of namespace Sword25
--
cgit v1.2.3