Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9a668ed7d7 | |||
| 7624c6ee0a | |||
| 3ef15dcb81 | |||
| 5923d2d7a7 | |||
| 069583e09f | |||
| 44b4a597d4 | |||
| 618e96da90 | |||
| fb9914d08a | |||
| 0c0f2d7e50 | |||
| 26d6546d79 | |||
| 62c8196ad4 | |||
| 76117cb3ce | |||
| e6b3bbeb54 | |||
| 01def459a1 | |||
| 3094dd301b | |||
| 76ab746a22 | |||
| e56f203f7c | |||
| 267c007291 | |||
| 7d15313209 | |||
| 53c520123a | |||
| 92d5ec70ba | |||
| 233a1d0990 | |||
| 4ef76f6c45 | |||
| a5c086e389 | |||
| 91dbbb9c11 | |||
| dc10661e6b | |||
| 95078b6a4b | |||
| 1217b25d02 | |||
| 06d60f9884 | |||
| 629ebb871f | |||
| 5a8261453e | |||
| a9762f44ca | |||
| 3d4427dd20 | |||
| 5c6a652316 |
@@ -1,164 +1,21 @@
|
|||||||
#ifndef EntityFile_h__
|
#ifndef EntityFile_h__
|
||||||
#define EntityFile_h__
|
#define EntityFile_h__
|
||||||
|
|
||||||
#include <stack>
|
#include "World.h"
|
||||||
#include <boost/lexical_cast.hpp>
|
#include "EntityXMLFile.h"
|
||||||
#include <xercesc/util/XercesDefs.hpp>
|
#include "EntityXMLFilePreprocessor.h"
|
||||||
#include <xercesc/util/PlatformUtils.hpp>
|
#include "EntityXMLFileParser.h"
|
||||||
#include <xercesc/sax2/SAX2XMLReader.hpp>
|
#include "EntityWrapper.h"
|
||||||
#include <xercesc/sax2/XMLReaderFactory.hpp>
|
|
||||||
#include <xercesc/sax2/DefaultHandler.hpp>
|
|
||||||
#include <xercesc/sax2/Attributes.hpp>
|
|
||||||
#include <xercesc/util/XMLString.hpp>
|
|
||||||
#include <xercesc/util/XMLChar.hpp>
|
|
||||||
#include <xercesc/sax2/DefaultHandler.hpp>
|
|
||||||
#include <xercesc/framework/XMLDocumentHandler.hpp>
|
|
||||||
#include <xercesc/framework/psvi/XSElementDeclaration.hpp>
|
|
||||||
#include <xercesc/framework/psvi/XSComplexTypeDefinition.hpp>
|
|
||||||
#include <xercesc/framework/psvi/XSParticle.hpp>
|
|
||||||
#include <xercesc/framework/psvi/XSModelGroup.hpp>
|
|
||||||
#include <xercesc/framework/psvi/XSAnnotation.hpp>
|
|
||||||
#include <xercesc/framework/psvi/XSValue.hpp>
|
|
||||||
#include <xercesc/framework/XMLGrammarPoolImpl.hpp>
|
|
||||||
#include <xercesc/dom/DOM.hpp>
|
|
||||||
#include <xercesc/dom/DOMLSInput.hpp>
|
|
||||||
#include <xercesc/dom/DOMElement.hpp>
|
|
||||||
|
|
||||||
#include "../GLM.h"
|
class EntityFile : private World, public Resource
|
||||||
#include "Util/XercesString.h"
|
|
||||||
#include "ResourceManager.h"
|
|
||||||
#include "Entity.h"
|
|
||||||
#include "ComponentInfo.h"
|
|
||||||
|
|
||||||
class EntityFileHandler
|
|
||||||
{
|
|
||||||
friend class EntityFileSAXHandler;
|
|
||||||
public:
|
|
||||||
// @param EntityID The entity found
|
|
||||||
// @param EntityID The parent of the entity
|
|
||||||
typedef std::function<void(EntityID, EntityID, const std::string&)> OnStartEntityCallback;
|
|
||||||
void SetStartEntityCallback(OnStartEntityCallback c) { m_OnStartEntityCallback = c; }
|
|
||||||
// @param EntityID The entity the component corresponds to
|
|
||||||
// @param std::string Type name of the component
|
|
||||||
typedef std::function<void(EntityID, const std::string&)> OnStartComponentCallback;
|
|
||||||
void SetStartComponentCallback(OnStartComponentCallback c) { m_OnStartComponentCallback = c; }
|
|
||||||
// @param EntityID Entity
|
|
||||||
// @param std::string Component name
|
|
||||||
// @param std::string Field name
|
|
||||||
// @param std::map<std::string, std::string> Field attribute names and values
|
|
||||||
typedef std::function<void(EntityID, const std::string&, const std::string&, const std::map<std::string, std::string>&)> OnStartFieldCallback;
|
|
||||||
void SetStartFieldCallback(OnStartFieldCallback c) { m_OnStartFieldCallback = c; }
|
|
||||||
// @param EntityID Entity
|
|
||||||
// @param std::string Component name
|
|
||||||
// @param std::string Field name
|
|
||||||
// @param char* Field data
|
|
||||||
typedef std::function<void(EntityID, const std::string&, const std::string&, const char*)> OnStartFieldDataCallback;
|
|
||||||
void SetStartFieldDataCallback(OnStartFieldDataCallback c) { m_OnStartFieldDataCallback = c; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
OnStartEntityCallback m_OnStartEntityCallback = nullptr;
|
|
||||||
OnStartComponentCallback m_OnStartComponentCallback = nullptr;
|
|
||||||
OnStartFieldCallback m_OnStartFieldCallback = nullptr;
|
|
||||||
OnStartFieldDataCallback m_OnStartFieldDataCallback = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
class EntityFileSAXHandler : public xercesc::DefaultHandler
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum class State
|
EntityFile(std::string path);
|
||||||
{
|
|
||||||
Unknown,
|
|
||||||
Entity,
|
|
||||||
Component,
|
|
||||||
ComponentField
|
|
||||||
};
|
|
||||||
|
|
||||||
EntityFileSAXHandler(const EntityFileHandler* handler, xercesc::SAX2XMLReader* reader);
|
EntityWrapper MergeInto(World* other);
|
||||||
|
|
||||||
void startElement(const XMLCh* const _uri, const XMLCh* const _localName, const XMLCh* const _qname, const xercesc::Attributes& attrs) override;
|
|
||||||
void characters(const XMLCh* const chars, const XMLSize_t length) override;
|
|
||||||
void endElement(const XMLCh* const _uri, const XMLCh* const _localName, const XMLCh* const _qname) override;
|
|
||||||
|
|
||||||
void warning(const xercesc::SAXParseException& e);
|
|
||||||
void error(const xercesc::SAXParseException& e);
|
|
||||||
void fatalError(const xercesc::SAXParseException& e);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const EntityFileHandler* m_Handler;
|
EntityID m_RootEntity = EntityID_Invalid;
|
||||||
xercesc::XMLGrammarPool* m_GrammarPool;
|
|
||||||
xercesc::SAX2XMLReader* m_Reader;
|
|
||||||
//State m_CurrentScope = State::Unknown;
|
|
||||||
std::stack<State> m_StateStack;
|
|
||||||
unsigned int m_NextEntityID = 0;
|
|
||||||
std::stack<EntityID> m_EntityStack;
|
|
||||||
std::string m_CurrentComponent;
|
|
||||||
std::string m_CurrentField;
|
|
||||||
std::map<std::string, std::string> m_CurrentAttributes;
|
|
||||||
|
|
||||||
void onStartEntity(const xercesc::Attributes& attrs);
|
|
||||||
void onEndEntity();
|
|
||||||
void onStartEntityRef(const xercesc::Attributes& attrs);
|
|
||||||
void onStartComponent(const std::string& name);
|
|
||||||
void onEndComponent(const std::string& name);
|
|
||||||
void onStartComponentField(const std::string& field, const xercesc::Attributes& attrs);
|
|
||||||
void onEndComponentField(const std::string& field);
|
|
||||||
void onFieldData(char* data);
|
|
||||||
};
|
|
||||||
|
|
||||||
class EntityFileXMLErrorHandler : public xercesc::ErrorHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void warning(const xercesc::SAXParseException& e) override
|
|
||||||
{
|
|
||||||
reportParseException("Warning", e);
|
|
||||||
}
|
|
||||||
void error(const xercesc::SAXParseException& e) override
|
|
||||||
{
|
|
||||||
reportParseException("Error", e);
|
|
||||||
}
|
|
||||||
void fatalError(const xercesc::SAXParseException& e) override
|
|
||||||
{
|
|
||||||
reportParseException("FATAL ERROR", e);
|
|
||||||
}
|
|
||||||
void resetErrors() override { }
|
|
||||||
|
|
||||||
private:
|
|
||||||
void reportParseException(std::string type, const xercesc::SAXParseException& e)
|
|
||||||
{
|
|
||||||
char* message = xercesc::XMLString::transcode(e.getMessage());
|
|
||||||
char* systemID = xercesc::XMLString::transcode(e.getSystemId());
|
|
||||||
std::cerr << systemID << ":" << e.getLineNumber() << ":" << e.getColumnNumber() << std::endl;
|
|
||||||
std::cerr << type << ": " << message << std::endl;
|
|
||||||
xercesc::XMLString::release(&systemID);
|
|
||||||
xercesc::XMLString::release(&message);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class EntityFile : public Resource
|
|
||||||
{
|
|
||||||
friend class ResourceManager;
|
|
||||||
friend class EntityFileSAXHandler;
|
|
||||||
private:
|
|
||||||
EntityFile(boost::filesystem::path path);
|
|
||||||
~EntityFile();
|
|
||||||
|
|
||||||
public:
|
|
||||||
static unsigned int GetTypeStride(std::string typeName);
|
|
||||||
static void WriteAttributeData(char* outData, const ComponentInfo::Field_t& field, const std::map<std::string, std::string>& attributes);
|
|
||||||
static void WriteValueData(char* outData, const ComponentInfo::Field_t& field, const char* valueData);
|
|
||||||
|
|
||||||
xercesc::XMLGrammarPool* GrammarPool() const { return m_GrammarPool; }
|
|
||||||
|
|
||||||
void Parse(const EntityFileHandler* handler) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
boost::filesystem::path m_FilePath;
|
|
||||||
xercesc::XMLGrammarPool* m_GrammarPool;
|
|
||||||
xercesc::SAX2XMLReader* m_SAX2XMLReader;
|
|
||||||
//std::map<std::string, ::ComponentInfo> m_ComponentInfo;
|
|
||||||
//std::vector<std::string> m_EntityReferences;
|
|
||||||
|
|
||||||
static void setReaderFeatures(xercesc::SAX2XMLReader* reader);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -0,0 +1,164 @@
|
|||||||
|
#ifndef EntityXMLFile_h__
|
||||||
|
#define EntityXMLFile_h__
|
||||||
|
|
||||||
|
#include <stack>
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
#include <xercesc/util/XercesDefs.hpp>
|
||||||
|
#include <xercesc/util/PlatformUtils.hpp>
|
||||||
|
#include <xercesc/sax2/SAX2XMLReader.hpp>
|
||||||
|
#include <xercesc/sax2/XMLReaderFactory.hpp>
|
||||||
|
#include <xercesc/sax2/DefaultHandler.hpp>
|
||||||
|
#include <xercesc/sax2/Attributes.hpp>
|
||||||
|
#include <xercesc/util/XMLString.hpp>
|
||||||
|
#include <xercesc/util/XMLChar.hpp>
|
||||||
|
#include <xercesc/sax2/DefaultHandler.hpp>
|
||||||
|
#include <xercesc/framework/XMLDocumentHandler.hpp>
|
||||||
|
#include <xercesc/framework/psvi/XSElementDeclaration.hpp>
|
||||||
|
#include <xercesc/framework/psvi/XSComplexTypeDefinition.hpp>
|
||||||
|
#include <xercesc/framework/psvi/XSParticle.hpp>
|
||||||
|
#include <xercesc/framework/psvi/XSModelGroup.hpp>
|
||||||
|
#include <xercesc/framework/psvi/XSAnnotation.hpp>
|
||||||
|
#include <xercesc/framework/psvi/XSValue.hpp>
|
||||||
|
#include <xercesc/framework/XMLGrammarPoolImpl.hpp>
|
||||||
|
#include <xercesc/dom/DOM.hpp>
|
||||||
|
#include <xercesc/dom/DOMLSInput.hpp>
|
||||||
|
#include <xercesc/dom/DOMElement.hpp>
|
||||||
|
|
||||||
|
#include "../GLM.h"
|
||||||
|
#include "Util/XercesString.h"
|
||||||
|
#include "ResourceManager.h"
|
||||||
|
#include "Entity.h"
|
||||||
|
#include "ComponentInfo.h"
|
||||||
|
|
||||||
|
class EntityFileHandler
|
||||||
|
{
|
||||||
|
friend class EntityFileSAXHandler;
|
||||||
|
public:
|
||||||
|
// @param EntityID The entity found
|
||||||
|
// @param EntityID The parent of the entity
|
||||||
|
typedef std::function<void(EntityID, EntityID, const std::string&)> OnStartEntityCallback;
|
||||||
|
void SetStartEntityCallback(OnStartEntityCallback c) { m_OnStartEntityCallback = c; }
|
||||||
|
// @param EntityID The entity the component corresponds to
|
||||||
|
// @param std::string Type name of the component
|
||||||
|
typedef std::function<void(EntityID, const std::string&)> OnStartComponentCallback;
|
||||||
|
void SetStartComponentCallback(OnStartComponentCallback c) { m_OnStartComponentCallback = c; }
|
||||||
|
// @param EntityID Entity
|
||||||
|
// @param std::string Component name
|
||||||
|
// @param std::string Field name
|
||||||
|
// @param std::map<std::string, std::string> Field attribute names and values
|
||||||
|
typedef std::function<void(EntityID, const std::string&, const std::string&, const std::map<std::string, std::string>&)> OnStartFieldCallback;
|
||||||
|
void SetStartFieldCallback(OnStartFieldCallback c) { m_OnStartFieldCallback = c; }
|
||||||
|
// @param EntityID Entity
|
||||||
|
// @param std::string Component name
|
||||||
|
// @param std::string Field name
|
||||||
|
// @param char* Field data
|
||||||
|
typedef std::function<void(EntityID, const std::string&, const std::string&, const char*)> OnStartFieldDataCallback;
|
||||||
|
void SetStartFieldDataCallback(OnStartFieldDataCallback c) { m_OnStartFieldDataCallback = c; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
OnStartEntityCallback m_OnStartEntityCallback = nullptr;
|
||||||
|
OnStartComponentCallback m_OnStartComponentCallback = nullptr;
|
||||||
|
OnStartFieldCallback m_OnStartFieldCallback = nullptr;
|
||||||
|
OnStartFieldDataCallback m_OnStartFieldDataCallback = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
class EntityFileSAXHandler : public xercesc::DefaultHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum class State
|
||||||
|
{
|
||||||
|
Unknown,
|
||||||
|
Entity,
|
||||||
|
Component,
|
||||||
|
ComponentField
|
||||||
|
};
|
||||||
|
|
||||||
|
EntityFileSAXHandler(const EntityFileHandler* handler, xercesc::SAX2XMLReader* reader);
|
||||||
|
|
||||||
|
void startElement(const XMLCh* const _uri, const XMLCh* const _localName, const XMLCh* const _qname, const xercesc::Attributes& attrs) override;
|
||||||
|
void characters(const XMLCh* const chars, const XMLSize_t length) override;
|
||||||
|
void endElement(const XMLCh* const _uri, const XMLCh* const _localName, const XMLCh* const _qname) override;
|
||||||
|
|
||||||
|
void warning(const xercesc::SAXParseException& e);
|
||||||
|
void error(const xercesc::SAXParseException& e);
|
||||||
|
void fatalError(const xercesc::SAXParseException& e);
|
||||||
|
|
||||||
|
private:
|
||||||
|
const EntityFileHandler* m_Handler;
|
||||||
|
xercesc::XMLGrammarPool* m_GrammarPool;
|
||||||
|
xercesc::SAX2XMLReader* m_Reader;
|
||||||
|
//State m_CurrentScope = State::Unknown;
|
||||||
|
std::stack<State> m_StateStack;
|
||||||
|
unsigned int m_NextEntityID = 0;
|
||||||
|
std::stack<EntityID> m_EntityStack;
|
||||||
|
std::string m_CurrentComponent;
|
||||||
|
std::string m_CurrentField;
|
||||||
|
std::map<std::string, std::string> m_CurrentAttributes;
|
||||||
|
|
||||||
|
void onStartEntity(const xercesc::Attributes& attrs);
|
||||||
|
void onEndEntity();
|
||||||
|
void onStartEntityRef(const xercesc::Attributes& attrs);
|
||||||
|
void onStartComponent(const std::string& name);
|
||||||
|
void onEndComponent(const std::string& name);
|
||||||
|
void onStartComponentField(const std::string& field, const xercesc::Attributes& attrs);
|
||||||
|
void onEndComponentField(const std::string& field);
|
||||||
|
void onFieldData(char* data);
|
||||||
|
};
|
||||||
|
|
||||||
|
class EntityFileXMLErrorHandler : public xercesc::ErrorHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void warning(const xercesc::SAXParseException& e) override
|
||||||
|
{
|
||||||
|
reportParseException("Warning", e);
|
||||||
|
}
|
||||||
|
void error(const xercesc::SAXParseException& e) override
|
||||||
|
{
|
||||||
|
reportParseException("Error", e);
|
||||||
|
}
|
||||||
|
void fatalError(const xercesc::SAXParseException& e) override
|
||||||
|
{
|
||||||
|
reportParseException("FATAL ERROR", e);
|
||||||
|
}
|
||||||
|
void resetErrors() override { }
|
||||||
|
|
||||||
|
private:
|
||||||
|
void reportParseException(std::string type, const xercesc::SAXParseException& e)
|
||||||
|
{
|
||||||
|
char* message = xercesc::XMLString::transcode(e.getMessage());
|
||||||
|
char* systemID = xercesc::XMLString::transcode(e.getSystemId());
|
||||||
|
std::cerr << systemID << ":" << e.getLineNumber() << ":" << e.getColumnNumber() << std::endl;
|
||||||
|
std::cerr << type << ": " << message << std::endl;
|
||||||
|
xercesc::XMLString::release(&systemID);
|
||||||
|
xercesc::XMLString::release(&message);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class EntityXMLFile : public Resource
|
||||||
|
{
|
||||||
|
friend class ResourceManager;
|
||||||
|
friend class EntityFileSAXHandler;
|
||||||
|
private:
|
||||||
|
EntityXMLFile(boost::filesystem::path path);
|
||||||
|
~EntityXMLFile();
|
||||||
|
|
||||||
|
public:
|
||||||
|
static unsigned int GetTypeStride(std::string typeName);
|
||||||
|
static void WriteAttributeData(char* outData, const ComponentInfo::Field_t& field, const std::map<std::string, std::string>& attributes);
|
||||||
|
static void WriteValueData(char* outData, const ComponentInfo::Field_t& field, const char* valueData);
|
||||||
|
|
||||||
|
xercesc::XMLGrammarPool* GrammarPool() const { return m_GrammarPool; }
|
||||||
|
|
||||||
|
void Parse(const EntityFileHandler* handler) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
boost::filesystem::path m_FilePath;
|
||||||
|
xercesc::XMLGrammarPool* m_GrammarPool;
|
||||||
|
xercesc::SAX2XMLReader* m_SAX2XMLReader;
|
||||||
|
//std::map<std::string, ::ComponentInfo> m_ComponentInfo;
|
||||||
|
//std::vector<std::string> m_EntityReferences;
|
||||||
|
|
||||||
|
static void setReaderFeatures(xercesc::SAX2XMLReader* reader);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,18 +1,19 @@
|
|||||||
#ifndef EntityFileParser_h__
|
#ifndef EntityXMLFileParser_h__
|
||||||
#define EntityFileParser_h__
|
#define EntityXMLFileParser_h__
|
||||||
|
|
||||||
#include "EntityFile.h"
|
#include "EntityXMLFile.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
class EntityFileParser
|
class EntityXMLFileParser
|
||||||
{
|
{
|
||||||
|
friend class EntityFile;
|
||||||
public:
|
public:
|
||||||
EntityFileParser(const EntityFile* entityFile);
|
EntityXMLFileParser(const EntityXMLFile* entityFile);
|
||||||
|
|
||||||
EntityID MergeEntities(World* world, EntityID baseParent = EntityID_Invalid);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const EntityFile* m_EntityFile;
|
EntityID MergeEntities(World* world, EntityID baseParent = EntityID_Invalid);
|
||||||
|
|
||||||
|
const EntityXMLFile* m_EntityFile;
|
||||||
EntityFileHandler m_Handler;
|
EntityFileHandler m_Handler;
|
||||||
World* m_World = nullptr;
|
World* m_World = nullptr;
|
||||||
EntityID m_FirstEntity = EntityID_Invalid;
|
EntityID m_FirstEntity = EntityID_Invalid;
|
||||||
+9
-8
@@ -1,5 +1,5 @@
|
|||||||
#ifndef EntityFilePreprocessor_h__
|
#ifndef EntityXMLFilePreprocessor_h__
|
||||||
#define EntityFilePreprocessor_h__
|
#define EntityXMLFilePreprocessor_h__
|
||||||
|
|
||||||
#include <xercesc/framework/psvi/XSElementDeclaration.hpp>
|
#include <xercesc/framework/psvi/XSElementDeclaration.hpp>
|
||||||
#include <xercesc/framework/psvi/XSComplexTypeDefinition.hpp>
|
#include <xercesc/framework/psvi/XSComplexTypeDefinition.hpp>
|
||||||
@@ -17,17 +17,18 @@
|
|||||||
#include "Util/XercesString.h"
|
#include "Util/XercesString.h"
|
||||||
#include "ResourceManager.h"
|
#include "ResourceManager.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "EntityFile.h"
|
#include "EntityXMLFile.h"
|
||||||
|
|
||||||
class EntityFilePreprocessor
|
class EntityXMLFilePreprocessor
|
||||||
{
|
{
|
||||||
|
friend class EntityFile;
|
||||||
public:
|
public:
|
||||||
EntityFilePreprocessor(const EntityFile* entityFile);
|
EntityXMLFilePreprocessor(const EntityXMLFile* entityFile);
|
||||||
|
|
||||||
void RegisterComponents(World* world);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const EntityFile* m_EntityFile;
|
void RegisterComponents(World* world);
|
||||||
|
|
||||||
|
const EntityXMLFile* m_EntityFile;
|
||||||
std::map<std::string, unsigned int> m_ComponentCounts;
|
std::map<std::string, unsigned int> m_ComponentCounts;
|
||||||
std::map<std::string, ComponentInfo> m_ComponentInfo;
|
std::map<std::string, ComponentInfo> m_ComponentInfo;
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef EntityFileWriter_h__
|
#ifndef EntityXMLFileWriter_h__
|
||||||
#define EntityFileWriter_h__
|
#define EntityXMLFileWriter_h__
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <xercesc/dom/DOM.hpp>
|
#include <xercesc/dom/DOM.hpp>
|
||||||
@@ -8,13 +8,13 @@
|
|||||||
#include <xercesc/framework/LocalFileFormatTarget.hpp>
|
#include <xercesc/framework/LocalFileFormatTarget.hpp>
|
||||||
|
|
||||||
#include "Util/XercesString.h"
|
#include "Util/XercesString.h"
|
||||||
#include "EntityFile.h"
|
#include "EntityXMLFile.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
class EntityFileWriter
|
class EntityXMLFileWriter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EntityFileWriter(boost::filesystem::path file)
|
EntityXMLFileWriter(boost::filesystem::path file)
|
||||||
: m_FilePath(file)
|
: m_FilePath(file)
|
||||||
{
|
{
|
||||||
using namespace xercesc;
|
using namespace xercesc;
|
||||||
@@ -118,9 +118,6 @@ public:
|
|||||||
else {
|
else {
|
||||||
m_ExtraMemory.push_back((char*)malloc(m_Stride));
|
m_ExtraMemory.push_back((char*)malloc(m_Stride));
|
||||||
//We should preferably not enter here to avoid performance issues. Set more numMaxElements in constructor instead.
|
//We should preferably not enter here to avoid performance issues. Set more numMaxElements in constructor instead.
|
||||||
if (!DisableMemoryPool::Value) {
|
|
||||||
LOG_DEBUG("Allocated slots exceed Pool size, extra memory allocated dynamically. Pool size: %u, dynamic size: %u.", m_NumSlots, m_ExtraMemory.size());
|
|
||||||
}
|
|
||||||
return m_ExtraMemory.back();
|
return m_ExtraMemory.back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "ObjectPool.h"
|
#include "ObjectPool.h"
|
||||||
#include "ComponentPool.h"
|
#include "ComponentPool.h"
|
||||||
#include "EventBroker.h"
|
#include "EventBroker.h"
|
||||||
|
struct EntityWrapper;
|
||||||
|
|
||||||
class World
|
class World
|
||||||
{
|
{
|
||||||
@@ -18,13 +19,13 @@ public:
|
|||||||
World(const World& other);
|
World(const World& other);
|
||||||
|
|
||||||
// Create empty entity
|
// Create empty entity
|
||||||
EntityID CreateEntity(EntityID parent = 0);
|
EntityID CreateEntity(EntityID parent = EntityID_Invalid);
|
||||||
// Delete entity and all components within
|
// Delete entity and all components within
|
||||||
void DeleteEntity(EntityID entity);
|
void DeleteEntity(EntityID entity);
|
||||||
// Check if an entity exists
|
// Check if an entity exists
|
||||||
bool ValidEntity(EntityID entity) const;
|
bool ValidEntity(EntityID entity) const;
|
||||||
// Register a component type and allocate space for it
|
// Register a component type and allocate space for it
|
||||||
void RegisterComponent(ComponentInfo& ci);
|
void RegisterComponent(const ComponentInfo& ci);
|
||||||
// Attach a component to an entity and fill it with default values
|
// Attach a component to an entity and fill it with default values
|
||||||
ComponentWrapper AttachComponent(EntityID entity, const std::string& componentType);
|
ComponentWrapper AttachComponent(EntityID entity, const std::string& componentType);
|
||||||
// Check if an entity has a component
|
// Check if an entity has a component
|
||||||
@@ -49,6 +50,12 @@ public:
|
|||||||
void SetName(EntityID entity, const std::string& name);
|
void SetName(EntityID entity, const std::string& name);
|
||||||
// Get the textual name of an entity
|
// Get the textual name of an entity
|
||||||
std::string GetName(EntityID entity) const;
|
std::string GetName(EntityID entity) const;
|
||||||
|
// Get the first entity in the world with the name.
|
||||||
|
EntityWrapper GetFirstEntityByName(const std::string& name);
|
||||||
|
|
||||||
|
// Merge another world into this one
|
||||||
|
// Returns a map that maps entities from the other world to their copies in this one
|
||||||
|
std::unordered_map<EntityID, EntityID> Merge(const World* other);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EventBroker* m_EventBroker = nullptr;
|
EventBroker* m_EventBroker = nullptr;
|
||||||
|
|||||||
@@ -5,9 +5,8 @@
|
|||||||
#include "../Core/World.h"
|
#include "../Core/World.h"
|
||||||
#include "../Core/SystemPipeline.h"
|
#include "../Core/SystemPipeline.h"
|
||||||
#include "../Core/ResourceManager.h"
|
#include "../Core/ResourceManager.h"
|
||||||
#include "../Core/EntityFilePreprocessor.h"
|
#include "../Core/EntityFile.h"
|
||||||
#include "../Core/EntityFileParser.h"
|
#include "../Core/EntityXMLFileWriter.h"
|
||||||
#include "../Core/EntityFileWriter.h"
|
|
||||||
#include "../Core/EMousePress.h"
|
#include "../Core/EMousePress.h"
|
||||||
#include "../Input/EInputCommand.h"
|
#include "../Input/EInputCommand.h"
|
||||||
#include "EditorGUI.h"
|
#include "EditorGUI.h"
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public:
|
|||||||
virtual bool OnCommand(const Events::InputCommand& e) override;
|
virtual bool OnCommand(const Events::InputCommand& e) override;
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
|
|
||||||
void AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer, double& assaultDashCoolDownTimer);
|
void AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer, double& assaultDashCoolDownTimer, EntityID playerID);
|
||||||
virtual bool AssaultDashDoubleTapped() const { return m_AssaultDashDoubleTapped; }
|
virtual bool AssaultDashDoubleTapped() const { return m_AssaultDashDoubleTapped; }
|
||||||
virtual bool PlayerIsDashing() const { return m_PlayerIsDashing; }
|
virtual bool PlayerIsDashing() const { return m_PlayerIsDashing; }
|
||||||
|
|
||||||
@@ -41,6 +41,7 @@ protected:
|
|||||||
bool m_Crouching = false;
|
bool m_Crouching = false;
|
||||||
//assault dash membervariables - needed to calculate the doubletap- and dashlogic
|
//assault dash membervariables - needed to calculate the doubletap- and dashlogic
|
||||||
double m_AssaultDashDoubleTapDeltaTime = 0.0;
|
double m_AssaultDashDoubleTapDeltaTime = 0.0;
|
||||||
|
double m_DashEffectResetTimer = 0.0;
|
||||||
//i will let m_AssaultDashDoubleTapSensitivityTimer stay hardcoded, its not really a gamevariable (more an inputvariable),
|
//i will let m_AssaultDashDoubleTapSensitivityTimer stay hardcoded, its not really a gamevariable (more an inputvariable),
|
||||||
//and its very unlikely that someone wants to change that value
|
//and its very unlikely that someone wants to change that value
|
||||||
const float m_AssaultDashDoubleTapSensitivityTimer = 0.25f;
|
const float m_AssaultDashDoubleTapSensitivityTimer = 0.25f;
|
||||||
@@ -51,7 +52,7 @@ protected:
|
|||||||
bool m_ShiftDashing = false;
|
bool m_ShiftDashing = false;
|
||||||
bool m_ValidDoubleTap = false;
|
bool m_ValidDoubleTap = false;
|
||||||
|
|
||||||
//specialabilitys
|
//specialabilities
|
||||||
bool m_MovementKeyDown = false;
|
bool m_MovementKeyDown = false;
|
||||||
bool m_SpecialAbilityKeyDown = false;
|
bool m_SpecialAbilityKeyDown = false;
|
||||||
int m_NumberOfMovementKeysDown = 0;
|
int m_NumberOfMovementKeysDown = 0;
|
||||||
@@ -190,12 +191,19 @@ bool FirstPersonInputController<EventContext>::OnLockMouse(const Events::LockMou
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename EventContext>
|
template <typename EventContext>
|
||||||
void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer, double& assaultDashCoolDownTimer) {
|
void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer, double& assaultDashCoolDownTimer, EntityID playerID) {
|
||||||
m_AssaultDashDoubleTapDeltaTime += dt;
|
m_AssaultDashDoubleTapDeltaTime += dt;
|
||||||
|
m_DashEffectResetTimer += dt;
|
||||||
assaultDashCoolDownTimer -= dt;
|
assaultDashCoolDownTimer -= dt;
|
||||||
//cooldown = assaultDashCoolDownMaxTimer sec, pretend the dash lasts 0.25 sec (for friction to do its work)
|
//cooldown = assaultDashCoolDownMaxTimer sec, pretend the dash lasts 0.25 sec (for friction to do its work)
|
||||||
if (assaultDashCoolDownTimer > (assaultDashCoolDownMaxTimer - 0.25f)) {
|
if (assaultDashCoolDownTimer > (assaultDashCoolDownMaxTimer - 0.25f)) {
|
||||||
m_PlayerIsDashing = true;
|
m_PlayerIsDashing = true;
|
||||||
|
if (m_DashEffectResetTimer > 0.05) {
|
||||||
|
Events::DashAbility e;
|
||||||
|
e.Player = playerID;
|
||||||
|
m_EventBroker->Publish(e);
|
||||||
|
m_DashEffectResetTimer = 0.0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
m_PlayerIsDashing = false;
|
m_PlayerIsDashing = false;
|
||||||
}
|
}
|
||||||
@@ -207,6 +215,9 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
|
|||||||
assaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
assaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
||||||
m_AssaultDashDoubleTapped = true;
|
m_AssaultDashDoubleTapped = true;
|
||||||
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
||||||
|
Events::DashAbility e;
|
||||||
|
e.Player = playerID;
|
||||||
|
m_EventBroker->Publish(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,6 +248,7 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
|
|||||||
assaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
assaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
||||||
|
|
||||||
Events::DashAbility e;
|
Events::DashAbility e;
|
||||||
|
e.Player = playerID;
|
||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include "Core/EPlayerSpawned.h"
|
#include "Core/EPlayerSpawned.h"
|
||||||
#include "Core/EAmmoPickup.h"
|
#include "Core/EAmmoPickup.h"
|
||||||
#include "Network/ESearchForServers.h"
|
#include "Network/ESearchForServers.h"
|
||||||
|
#include "../Game/Events/EDashAbility.h"
|
||||||
|
|
||||||
struct ServerInfo
|
struct ServerInfo
|
||||||
{
|
{
|
||||||
@@ -107,6 +108,7 @@ private:
|
|||||||
void parsePlayerDamage(Packet& packet);
|
void parsePlayerDamage(Packet& packet);
|
||||||
void parseComponentDeletion(Packet& packet);
|
void parseComponentDeletion(Packet& packet);
|
||||||
void parseDoubleJump(Packet& packet);
|
void parseDoubleJump(Packet& packet);
|
||||||
|
void parseDashEffect(Packet& packet);
|
||||||
void parseAmmoPickup(Packet& packet);
|
void parseAmmoPickup(Packet& packet);
|
||||||
void InterpolateFields(Packet& packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType);
|
void InterpolateFields(Packet& packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType);
|
||||||
void parseSnapshot(Packet& packet);
|
void parseSnapshot(Packet& packet);
|
||||||
@@ -135,6 +137,9 @@ private:
|
|||||||
EventRelay< Client, Events::SearchForServers> m_ESearchForServers;
|
EventRelay< Client, Events::SearchForServers> m_ESearchForServers;
|
||||||
EventRelay<Client, Events::DoubleJump> m_EDoubleJump;
|
EventRelay<Client, Events::DoubleJump> m_EDoubleJump;
|
||||||
bool OnDoubleJump(Events::DoubleJump & e);
|
bool OnDoubleJump(Events::DoubleJump & e);
|
||||||
|
EventRelay<Client, Events::DashAbility> m_EDashAbility;
|
||||||
|
bool OnDashAbility(const Events::DashAbility& e);
|
||||||
|
|
||||||
bool OnSearchForServers(const Events::SearchForServers& e);
|
bool OnSearchForServers(const Events::SearchForServers& e);
|
||||||
UDPClient m_ServerlistRequest;
|
UDPClient m_ServerlistRequest;
|
||||||
std::vector<ServerInfo> m_Serverlist;
|
std::vector<ServerInfo> m_Serverlist;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ enum class MessageType
|
|||||||
ComponentDeleted,
|
ComponentDeleted,
|
||||||
PlayerTransform,
|
PlayerTransform,
|
||||||
OnDoubleJump,
|
OnDoubleJump,
|
||||||
|
OnDashEffect,
|
||||||
ServerlistRequest,
|
ServerlistRequest,
|
||||||
AmmoPickup,
|
AmmoPickup,
|
||||||
Invalid
|
Invalid
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ private:
|
|||||||
void parseClientPing();
|
void parseClientPing();
|
||||||
void parsePing();
|
void parsePing();
|
||||||
bool parseDoubleJump(Packet& packet);
|
bool parseDoubleJump(Packet& packet);
|
||||||
|
void parseDashEffect(Packet& packet);
|
||||||
void parseUDPConnect(Packet& packet);
|
void parseUDPConnect(Packet& packet);
|
||||||
void parseTCPConnect(Packet& packet);
|
void parseTCPConnect(Packet& packet);
|
||||||
void parseDisconnect();
|
void parseDisconnect();
|
||||||
|
|||||||
@@ -2,11 +2,15 @@
|
|||||||
#define Events_DashAbility_h__
|
#define Events_DashAbility_h__
|
||||||
|
|
||||||
#include "Core/Event.h"
|
#include "Core/Event.h"
|
||||||
|
#include "Core/EntityWrapper.h"
|
||||||
|
|
||||||
namespace Events
|
namespace Events
|
||||||
{
|
{
|
||||||
|
|
||||||
struct DashAbility : public Event { };
|
struct DashAbility : public Event
|
||||||
|
{
|
||||||
|
EntityID Player;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -13,13 +13,13 @@
|
|||||||
#include "Input/KeyboardInputHandler.h"
|
#include "Input/KeyboardInputHandler.h"
|
||||||
#include "Input/MouseInputHandler.h"
|
#include "Input/MouseInputHandler.h"
|
||||||
#include "Core/EKeyDown.h"
|
#include "Core/EKeyDown.h"
|
||||||
#include "Core/EntityFilePreprocessor.h"
|
#include "Core/EntityXMLFilePreprocessor.h"
|
||||||
#include "Core/SystemPipeline.h"
|
#include "Core/SystemPipeline.h"
|
||||||
#include "Systems/ExplosionEffectSystem.h"
|
#include "Systems/ExplosionEffectSystem.h"
|
||||||
#include "Editor/EditorSystem.h"
|
#include "Editor/EditorSystem.h"
|
||||||
#include "Core/EntityFile.h"
|
#include "Core/EntityXMLFile.h"
|
||||||
#include "Rendering/RenderSystem.h"
|
#include "Rendering/RenderSystem.h"
|
||||||
#include "Core/EntityFileParser.h"
|
#include "Core/EntityXMLFileParser.h"
|
||||||
#include "Core/Octree.h"
|
#include "Core/Octree.h"
|
||||||
#include "Rendering/Font.h"
|
#include "Rendering/Font.h"
|
||||||
#include "Systems/InterpolationSystem.h"
|
#include "Systems/InterpolationSystem.h"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
#include "Core/Transform.h"
|
#include "Core/Transform.h"
|
||||||
#include "Core/ResourceManager.h"
|
#include "Core/ResourceManager.h"
|
||||||
#include "Core/EntityFileParser.h"
|
#include "Core/EntityFile.h"
|
||||||
#include "Core/EPickupSpawned.h"
|
#include "Core/EPickupSpawned.h"
|
||||||
#include "Core/EAmmoPickup.h"
|
#include "Core/EAmmoPickup.h"
|
||||||
#include "Engine/Collision/ETrigger.h"
|
#include "Engine/Collision/ETrigger.h"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
#include "Core/ResourceManager.h"
|
#include "Core/ResourceManager.h"
|
||||||
#include "Core/EntityFileParser.h"
|
#include "Core/EntityFile.h"
|
||||||
#include "Core/EPlayerDamage.h"
|
#include "Core/EPlayerDamage.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
#include "Core/Transform.h"
|
#include "Core/Transform.h"
|
||||||
#include "Core/ResourceManager.h"
|
#include "Core/ResourceManager.h"
|
||||||
#include "Core/EntityFileParser.h"
|
#include "Core/EntityFile.h"
|
||||||
#include "Core/EPlayerDamage.h"
|
#include "Core/EPlayerDamage.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#include "Common.h"
|
||||||
|
#include "Core/System.h"
|
||||||
|
|
||||||
|
class FloatingEffectSystem : public PureSystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FloatingEffectSystem(SystemParams params)
|
||||||
|
: System(params)
|
||||||
|
, PureSystem("FloatingEffect")
|
||||||
|
{ }
|
||||||
|
|
||||||
|
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt) override
|
||||||
|
{
|
||||||
|
ComponentWrapper& transform = m_World->GetComponent(component.EntityID, "Transform");
|
||||||
|
(double&)component["Time"] += dt;
|
||||||
|
(glm::vec3&)transform["Position"] = (float)(double)component["Amplitude"] * glm::sin((glm::two_pi<float>() / (float)(double)component["Period"]) * (float)(double)component["Time"]) * (glm::vec3)component["Axis"];
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
#include "Core/Transform.h"
|
#include "Core/Transform.h"
|
||||||
#include "Core/ResourceManager.h"
|
#include "Core/ResourceManager.h"
|
||||||
#include "Core/EntityFileParser.h"
|
#include "Core/EntityFile.h"
|
||||||
#include "Core/EPickupSpawned.h"
|
#include "Core/EPickupSpawned.h"
|
||||||
#include "Core/EPlayerHealthPickup.h"
|
#include "Core/EPlayerHealthPickup.h"
|
||||||
#include "Engine/Collision/ETrigger.h"
|
#include "Engine/Collision/ETrigger.h"
|
||||||
|
|||||||
@@ -6,11 +6,9 @@
|
|||||||
#include "GLM.h"
|
#include "GLM.h"
|
||||||
#include "Rendering/ESetCamera.h"
|
#include "Rendering/ESetCamera.h"
|
||||||
#include "Core/ConfigFile.h"
|
#include "Core/ConfigFile.h"
|
||||||
|
|
||||||
#include "Core/EntityFile.h"
|
#include "Core/EntityFile.h"
|
||||||
#include "Core/EntityFileParser.h"
|
|
||||||
|
|
||||||
#include "Core/EPlayerDeath.h"
|
#include "Core/EPlayerDeath.h"
|
||||||
|
#include "Core/EEntityDeleted.h"
|
||||||
|
|
||||||
class PlayerDeathSystem : public ImpureSystem
|
class PlayerDeathSystem : public ImpureSystem
|
||||||
{
|
{
|
||||||
@@ -20,8 +18,12 @@ public:
|
|||||||
virtual void Update(double dt) override;
|
virtual void Update(double dt) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
EntityWrapper m_LocalPlayerDeathEffect;
|
||||||
|
|
||||||
EventRelay<PlayerDeathSystem, Events::PlayerDeath> m_OnPlayerDeath;
|
EventRelay<PlayerDeathSystem, Events::PlayerDeath> m_OnPlayerDeath;
|
||||||
bool OnPlayerDeath(Events::PlayerDeath& e);
|
bool OnPlayerDeath(Events::PlayerDeath& e);
|
||||||
|
EventRelay<PlayerDeathSystem, Events::EntityDeleted> m_EEntityDeleted;
|
||||||
|
bool OnEntityDeleted(Events::EntityDeleted& e);
|
||||||
|
|
||||||
void createDeathEffect(EntityWrapper player);
|
void createDeathEffect(EntityWrapper player);
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,7 @@
|
|||||||
#include <imgui/imgui.h>
|
#include <imgui/imgui.h>
|
||||||
#include "Events/EDoubleJump.h"
|
#include "Events/EDoubleJump.h"
|
||||||
#include "../Engine/Sound/EPlaySoundOnEntity.h"
|
#include "../Engine/Sound/EPlaySoundOnEntity.h"
|
||||||
|
|
||||||
#include "Core/EntityFile.h"
|
#include "Core/EntityFile.h"
|
||||||
#include "Core/EntityFileParser.h"
|
|
||||||
|
|
||||||
class PlayerMovementSystem : public ImpureSystem
|
class PlayerMovementSystem : public ImpureSystem
|
||||||
{
|
{
|
||||||
@@ -41,6 +39,8 @@ private:
|
|||||||
bool OnPlayerSpawned(Events::PlayerSpawned& e);
|
bool OnPlayerSpawned(Events::PlayerSpawned& e);
|
||||||
EventRelay<PlayerMovementSystem, Events::DoubleJump> m_EDoubleJump;
|
EventRelay<PlayerMovementSystem, Events::DoubleJump> m_EDoubleJump;
|
||||||
bool PlayerMovementSystem::OnDoubleJump(Events::DoubleJump & e);
|
bool PlayerMovementSystem::OnDoubleJump(Events::DoubleJump & e);
|
||||||
|
EventRelay<PlayerMovementSystem, Events::DashAbility> m_EDashAbility;
|
||||||
|
bool PlayerMovementSystem::OnDashAbility(Events::DashAbility & e);
|
||||||
|
|
||||||
void updateMovementControllers(double dt);
|
void updateMovementControllers(double dt);
|
||||||
void updateVelocity(EntityWrapper player, double dt);
|
void updateVelocity(EntityWrapper player, double dt);
|
||||||
|
|||||||
@@ -7,8 +7,7 @@
|
|||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
#include "Events/ESpawnerSpawn.h"
|
#include "Events/ESpawnerSpawn.h"
|
||||||
#include "Core/Transform.h"
|
#include "Core/Transform.h"
|
||||||
#include "Core/ResourceManager.h"
|
#include "Core/EntityFile.h"
|
||||||
#include "Core/EntityFileParser.h"
|
|
||||||
|
|
||||||
class SpawnerSystem : public System
|
class SpawnerSystem : public System
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
#include "Core/EShoot.h"
|
#include "Core/EShoot.h"
|
||||||
#include "Core/EPlayerSpawned.h"
|
#include "Core/EPlayerSpawned.h"
|
||||||
#include "Input/EInputCommand.h"
|
#include "Input/EInputCommand.h"
|
||||||
#include "Core/EntityFile.h"
|
#include "Core/EntityXMLFile.h"
|
||||||
#include "Core/EntityFileParser.h"
|
#include "Core/EntityXMLFileParser.h"
|
||||||
#include "Core/Octree.h"
|
#include "Core/Octree.h"
|
||||||
#include "Collision/EntityAABB.h"
|
#include "Collision/EntityAABB.h"
|
||||||
#include "Systems/SpawnerSystem.h"
|
#include "Systems/SpawnerSystem.h"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ LoadMap=
|
|||||||
; if true -> Pool allocation is not used when calling Allocate/Free, just use regular dynamic allocation.
|
; if true -> Pool allocation is not used when calling Allocate/Free, just use regular dynamic allocation.
|
||||||
; if false -> Use pool allocation.
|
; if false -> Use pool allocation.
|
||||||
DisableMemoryPool=false
|
DisableMemoryPool=false
|
||||||
RespawnTime = 8.0
|
RespawnTime = -1.0
|
||||||
EditorEnabled=false
|
EditorEnabled=false
|
||||||
OutOfBodyExperience=false
|
OutOfBodyExperience=false
|
||||||
|
|
||||||
|
|||||||
@@ -56,4 +56,5 @@
|
|||||||
<xs:include schemaLocation="Components/DefenderWeapon.xsd"/>
|
<xs:include schemaLocation="Components/DefenderWeapon.xsd"/>
|
||||||
<xs:include schemaLocation="Components/CapturePointGameMode.xsd"/>
|
<xs:include schemaLocation="Components/CapturePointGameMode.xsd"/>
|
||||||
<xs:include schemaLocation="Components/CapturePointArrowHUD.xsd"/>
|
<xs:include schemaLocation="Components/CapturePointArrowHUD.xsd"/>
|
||||||
|
<xs:include schemaLocation="Components/FloatingEffect.xsd"/>
|
||||||
</xs:schema>
|
</xs:schema>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<FloatingEffect xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FloatingEffect.xsd">
|
||||||
|
<Period>1</Period>
|
||||||
|
<Amplitude>1</Amplitude>
|
||||||
|
<Time>0</Time>
|
||||||
|
<Axis X="0" Y="0" Z="0"/>
|
||||||
|
<Position X="0" Y="0" Z="0"/>
|
||||||
|
</FloatingEffect>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
|
||||||
|
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
|
||||||
|
|
||||||
|
<xs:element name="FloatingEffect">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:all>
|
||||||
|
<xs:element name="Period" type="t:double" minOccurs="0"/>
|
||||||
|
<xs:element name="Amplitude" type="t:double" minOccurs="0"/>
|
||||||
|
<xs:element name="Time" type="t:double" minOccurs="0"/>
|
||||||
|
<xs:element name="Axis" type="t:Vector" minOccurs="0"/>
|
||||||
|
<xs:element name="Position" type="t:Vector" minOccurs="0"/>
|
||||||
|
</xs:all>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity name="DashEffect" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:Animation/>
|
||||||
|
<c:Lifetime>
|
||||||
|
<Lifetime>0.5</Lifetime>
|
||||||
|
</c:Lifetime>
|
||||||
|
<c:ExplosionEffect>
|
||||||
|
<Velocity X="0" Y="0" Z="0"/>
|
||||||
|
<TimeSinceDeath>0</TimeSinceDeath>
|
||||||
|
<ExplosionDuration>0.5</ExplosionDuration>
|
||||||
|
<EndColor A="0" B="0" G="0" R="0"/>
|
||||||
|
</c:ExplosionEffect>
|
||||||
|
<c:Model/>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
</Entity>
|
||||||
@@ -804,11 +804,11 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:FloatingEffect>
|
<c:FloatingEffect>
|
||||||
<Axis X="0" Y="0.200000003" Z="0"/>
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
<Time>3002.0048499272534</Time>
|
<Time>3297.0538973857279</Time>
|
||||||
<Period>2</Period>
|
<Period>2</Period>
|
||||||
</c:FloatingEffect>
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0.00320033543" Z="0"/>
|
<Position X="-0" Y="-0.0338360146" Z="-0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -825,7 +825,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36784196" Z="0"/>
|
<Position X="0" Y="2.36784196" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="23665.3672" Z="0"/>
|
<Orientation X="0" Y="23901.0449" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -851,11 +851,11 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:FloatingEffect>
|
<c:FloatingEffect>
|
||||||
<Axis X="0" Y="0.200000003" Z="0"/>
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
<Time>2981.7884295114754</Time>
|
<Time>3276.8374769699499</Time>
|
||||||
<Period>2</Period>
|
<Period>2</Period>
|
||||||
</c:FloatingEffect>
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0" Y="-0.123386621" Z="-0"/>
|
<Position X="0" Y="0.0977828354" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -872,7 +872,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36784196" Z="0"/>
|
<Position X="0" Y="2.36784196" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="23644.3164" Z="0"/>
|
<Orientation X="0" Y="23879.9941" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -898,11 +898,11 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:FloatingEffect>
|
<c:FloatingEffect>
|
||||||
<Axis X="0" Y="0.200000003" Z="0"/>
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
<Time>2965.4934667508096</Time>
|
<Time>3260.542514209284</Time>
|
||||||
<Period>2</Period>
|
<Period>2</Period>
|
||||||
</c:FloatingEffect>
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0" Y="-0.199960142" Z="-0"/>
|
<Position X="0" Y="0.19820635" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -919,7 +919,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36784196" Z="0"/>
|
<Position X="0" Y="2.36784196" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="23585.6074" Z="0"/>
|
<Orientation X="0" Y="23821.2852" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -945,11 +945,11 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:FloatingEffect>
|
<c:FloatingEffect>
|
||||||
<Axis X="0" Y="0.200000003" Z="0"/>
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
<Time>2922.0307477781698</Time>
|
<Time>3217.0797952366443</Time>
|
||||||
<Period>2</Period>
|
<Period>2</Period>
|
||||||
</c:FloatingEffect>
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0.0194334686" Z="0"/>
|
<Position X="-0" Y="-0.0497358106" Z="-0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -966,7 +966,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36800003" Z="0"/>
|
<Position X="0" Y="2.36800003" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="5331.15967" Z="0"/>
|
<Orientation X="0" Y="5567.29199" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -992,11 +992,11 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:FloatingEffect>
|
<c:FloatingEffect>
|
||||||
<Axis X="0" Y="0.200000003" Z="0"/>
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
<Time>2871.33224525081</Time>
|
<Time>3166.3812927092845</Time>
|
||||||
<Period>2</Period>
|
<Period>2</Period>
|
||||||
</c:FloatingEffect>
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0" Y="-0.172897741" Z="-0"/>
|
<Position X="0" Y="0.186271787" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -1013,7 +1013,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36800003" Z="0"/>
|
<Position X="0" Y="2.36800003" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="5241.63037" Z="0"/>
|
<Orientation X="0" Y="5477.7627" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -1039,11 +1039,11 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:FloatingEffect>
|
<c:FloatingEffect>
|
||||||
<Axis X="0" Y="0.200000003" Z="0"/>
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
<Time>2854.2794756870871</Time>
|
<Time>3149.3285231455616</Time>
|
||||||
<Period>2</Period>
|
<Period>2</Period>
|
||||||
</c:FloatingEffect>
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0.154012829" Z="0"/>
|
<Position X="-0" Y="-0.171761468" Z="-0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -1060,7 +1060,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36784196" Z="0"/>
|
<Position X="0" Y="2.36784196" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="14694.2959" Z="0"/>
|
<Orientation X="0" Y="14930.6826" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -1086,11 +1086,11 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:FloatingEffect>
|
<c:FloatingEffect>
|
||||||
<Axis X="0" Y="0.200000003" Z="0"/>
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
<Time>2839.2647225755118</Time>
|
<Time>3134.3137700339862</Time>
|
||||||
<Period>2</Period>
|
<Period>2</Period>
|
||||||
</c:FloatingEffect>
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0" Y="-0.147846922" Z="-0"/>
|
<Position X="0" Y="0.166757002" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -1107,7 +1107,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36784196" Z="0"/>
|
<Position X="0" Y="2.36784196" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="12585.2275" Z="0"/>
|
<Orientation X="0" Y="12821.6143" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -2242,7 +2242,7 @@
|
|||||||
<Resource>Models/Props/Stones/AssaultHolder.mesh</Resource>
|
<Resource>Models/Props/Stones/AssaultHolder.mesh</Resource>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-3.47628784" Y="0.507368565" Z="0.99732101"/>
|
<Position X="-3.30188537" Y="0.507368565" Z="1.6052227"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -2355,11 +2355,11 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:FloatingEffect>
|
<c:FloatingEffect>
|
||||||
<Axis X="0" Y="0.200000003" Z="0"/>
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
<Time>2746.6837512442808</Time>
|
<Time>3041.7327987027552</Time>
|
||||||
<Period>2</Period>
|
<Period>2</Period>
|
||||||
</c:FloatingEffect>
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0.16754517" Z="0"/>
|
<Position X="-0" Y="-0.148809776" Z="-0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -2376,7 +2376,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36784196" Z="0"/>
|
<Position X="0" Y="2.36784196" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="16210.457" Z="0"/>
|
<Orientation X="0" Y="16446.9434" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -2402,11 +2402,11 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:FloatingEffect>
|
<c:FloatingEffect>
|
||||||
<Axis X="0" Y="0.200000003" Z="0"/>
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
<Time>2732.8386366079758</Time>
|
<Time>3027.8876840664502</Time>
|
||||||
<Period>2</Period>
|
<Period>2</Period>
|
||||||
</c:FloatingEffect>
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0.0970942229" Z="0"/>
|
<Position X="-0" Y="-0.0691253543" Z="-0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -2423,7 +2423,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36800003" Z="0"/>
|
<Position X="0" Y="2.36800003" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="5167.40771" Z="0"/>
|
<Orientation X="0" Y="5403.54004" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -2904,11 +2904,11 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:FloatingEffect>
|
<c:FloatingEffect>
|
||||||
<Axis X="0" Y="0.200000003" Z="0"/>
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
<Time>2969.073541383088</Time>
|
<Time>3264.1225888415624</Time>
|
||||||
<Period>2</Period>
|
<Period>2</Period>
|
||||||
</c:FloatingEffect>
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0" Y="-0.0458931364" Z="-0"/>
|
<Position X="0" Y="0.0752089471" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -2925,7 +2925,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36784196" Z="0"/>
|
<Position X="0" Y="2.36784196" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="23639.0527" Z="0"/>
|
<Orientation X="0" Y="23874.7305" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -2951,11 +2951,11 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:FloatingEffect>
|
<c:FloatingEffect>
|
||||||
<Axis X="0" Y="0.200000003" Z="0"/>
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
<Time>2948.85712096731</Time>
|
<Time>3243.9061684257845</Time>
|
||||||
<Period>2</Period>
|
<Period>2</Period>
|
||||||
</c:FloatingEffect>
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0.0866934955" Z="0"/>
|
<Position X="-0" Y="-0.0580219813" Z="-0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -2972,7 +2972,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36784196" Z="0"/>
|
<Position X="0" Y="2.36784196" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="23618.002" Z="0"/>
|
<Orientation X="0" Y="23853.6797" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -2998,11 +2998,11 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:FloatingEffect>
|
<c:FloatingEffect>
|
||||||
<Axis X="0" Y="0.200000003" Z="0"/>
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
<Time>2932.5621582066442</Time>
|
<Time>3227.6112056651186</Time>
|
||||||
<Period>2</Period>
|
<Period>2</Period>
|
||||||
</c:FloatingEffect>
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0.196187839" Z="0"/>
|
<Position X="-0" Y="-0.187905088" Z="-0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -3019,7 +3019,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36784196" Z="0"/>
|
<Position X="0" Y="2.36784196" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="23559.293" Z="0"/>
|
<Orientation X="0" Y="23794.9707" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -3045,11 +3045,11 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:FloatingEffect>
|
<c:FloatingEffect>
|
||||||
<Axis X="0" Y="0.200000003" Z="0"/>
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
<Time>2889.0994392340044</Time>
|
<Time>3184.1484866924789</Time>
|
||||||
<Period>2</Period>
|
<Period>2</Period>
|
||||||
</c:FloatingEffect>
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0" Y="-0.0615537763" Z="-0"/>
|
<Position X="0" Y="0.0900137872" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -3066,7 +3066,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36800003" Z="0"/>
|
<Position X="0" Y="2.36800003" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="5304.81885" Z="0"/>
|
<Orientation X="0" Y="5540.95117" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -3092,11 +3092,11 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:FloatingEffect>
|
<c:FloatingEffect>
|
||||||
<Axis X="0" Y="0.200000003" Z="0"/>
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
<Time>2838.4009367066446</Time>
|
<Time>3133.4499841651191</Time>
|
||||||
<Period>2</Period>
|
<Period>2</Period>
|
||||||
</c:FloatingEffect>
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0.190397173" Z="0"/>
|
<Position X="-0" Y="-0.197535709" Z="-0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -3113,7 +3113,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36800003" Z="0"/>
|
<Position X="0" Y="2.36800003" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="5215.28955" Z="0"/>
|
<Orientation X="0" Y="5451.42188" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -3139,11 +3139,11 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:FloatingEffect>
|
<c:FloatingEffect>
|
||||||
<Axis X="0" Y="0.200000003" Z="0"/>
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
<Time>2821.3481671429217</Time>
|
<Time>3116.3972146013962</Time>
|
||||||
<Period>2</Period>
|
<Period>2</Period>
|
||||||
</c:FloatingEffect>
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0" Y="-0.177647248" Z="-0"/>
|
<Position X="0" Y="0.189699799" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -3160,7 +3160,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36784196" Z="0"/>
|
<Position X="0" Y="2.36784196" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="14667.9326" Z="0"/>
|
<Orientation X="0" Y="14904.3193" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
@@ -3186,11 +3186,11 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:FloatingEffect>
|
<c:FloatingEffect>
|
||||||
<Axis X="0" Y="0.200000003" Z="0"/>
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
<Time>2806.3334140313464</Time>
|
<Time>3101.3824614898208</Time>
|
||||||
<Period>2</Period>
|
<Period>2</Period>
|
||||||
</c:FloatingEffect>
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0.173328787" Z="0"/>
|
<Position X="-0" Y="-0.186583459" Z="-0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -3207,7 +3207,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36784196" Z="0"/>
|
<Position X="0" Y="2.36784196" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="12558.8643" Z="0"/>
|
<Orientation X="0" Y="12795.251" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
</Components>
|
</Components>
|
||||||
|
|||||||
@@ -802,8 +802,13 @@
|
|||||||
<Children>
|
<Children>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
|
<Time>309.46063484238653</Time>
|
||||||
|
<Period>2</Period>
|
||||||
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0.181836113" Z="0"/>
|
<Position X="-0" Y="-0.198473096" Z="-0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -821,7 +826,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36784196" Z="0"/>
|
<Position X="0" Y="2.36784196" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="24080.8184" Z="0"/>
|
<Orientation X="0" Y="24396.9355" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -844,8 +849,13 @@
|
|||||||
<Children>
|
<Children>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
|
<Time>277.77588852554459</Time>
|
||||||
|
<Period>2</Period>
|
||||||
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0" Y="-0.185762629" Z="-0"/>
|
<Position X="-0" Y="-0.129464492" Z="-0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -863,7 +873,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36784196" Z="0"/>
|
<Position X="0" Y="2.36784196" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="24059.7676" Z="0"/>
|
<Orientation X="0" Y="24375.8848" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -886,8 +896,13 @@
|
|||||||
<Children>
|
<Children>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
|
<Time>265.69306053010564</Time>
|
||||||
|
<Period>2</Period>
|
||||||
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0.167244121" Z="0"/>
|
<Position X="-0" Y="-0.164330602" Z="-0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -905,7 +920,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36784196" Z="0"/>
|
<Position X="0" Y="2.36784196" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="24001.0586" Z="0"/>
|
<Orientation X="0" Y="24317.1758" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -928,8 +943,13 @@
|
|||||||
<Children>
|
<Children>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
|
<Time>254.01948784300018</Time>
|
||||||
|
<Period>2</Period>
|
||||||
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0.0644967183" Z="0"/>
|
<Position X="0" Y="0.0122369174" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -947,7 +967,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36800003" Z="0"/>
|
<Position X="0" Y="2.36800003" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="5746.52246" Z="0"/>
|
<Orientation X="0" Y="6061.90527" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -970,8 +990,13 @@
|
|||||||
<Children>
|
<Children>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
|
<Time>244.21618709850597</Time>
|
||||||
|
<Period>2</Period>
|
||||||
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0" Y="-0.0994067639" Z="-0"/>
|
<Position X="0" Y="0.125630379" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -989,7 +1014,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36800003" Z="0"/>
|
<Position X="0" Y="2.36800003" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="5656.99316" Z="0"/>
|
<Orientation X="0" Y="5972.37598" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -1012,8 +1037,13 @@
|
|||||||
<Children>
|
<Children>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
|
<Time>231.37430087102678</Time>
|
||||||
|
<Period>2</Period>
|
||||||
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0" Y="-0.19803375" Z="-0"/>
|
<Position X="-0" Y="-0.184606224" Z="-0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -1031,7 +1061,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36784196" Z="0"/>
|
<Position X="0" Y="2.36784196" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="15110.7119" Z="0"/>
|
<Orientation X="0" Y="15425.6113" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -1054,8 +1084,13 @@
|
|||||||
<Children>
|
<Children>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
|
<Time>219.21100328618962</Time>
|
||||||
|
<Period>2</Period>
|
||||||
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0" Y="-0.11493478" Z="-0"/>
|
<Position X="-0" Y="-0.12308117" Z="-0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -1073,7 +1108,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36784196" Z="0"/>
|
<Position X="0" Y="2.36784196" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="13001.6436" Z="0"/>
|
<Orientation X="0" Y="13316.543" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -2318,8 +2353,13 @@
|
|||||||
<Children>
|
<Children>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
|
<Time>192.42971043059836</Time>
|
||||||
|
<Period>2</Period>
|
||||||
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0.143913418" Z="0"/>
|
<Position X="0" Y="0.195146352" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -2337,7 +2377,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36784196" Z="0"/>
|
<Position X="0" Y="2.36784196" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="16626.7168" Z="0"/>
|
<Orientation X="0" Y="16942.834" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -2360,8 +2400,13 @@
|
|||||||
<Children>
|
<Children>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
|
<Time>180.12130596231671</Time>
|
||||||
|
<Period>2</Period>
|
||||||
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0.151800558" Z="0"/>
|
<Position X="0" Y="0.0743921027" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -2379,7 +2424,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36800003" Z="0"/>
|
<Position X="0" Y="2.36800003" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="5582.77051" Z="0"/>
|
<Orientation X="0" Y="5898.15332" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -2857,8 +2902,13 @@
|
|||||||
<Children>
|
<Children>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
|
<Time>154.99927956894089</Time>
|
||||||
|
<Period>2</Period>
|
||||||
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0" Y="-0.199556321" Z="-0"/>
|
<Position X="0" Y="0.000450141786" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -2876,7 +2926,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36784196" Z="0"/>
|
<Position X="0" Y="2.36784196" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="24054.5039" Z="0"/>
|
<Orientation X="0" Y="24370.6191" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -2899,8 +2949,13 @@
|
|||||||
<Children>
|
<Children>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
|
<Time>144.56072209865593</Time>
|
||||||
|
<Period>2</Period>
|
||||||
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0" Y="-0.0983726978" Z="-0"/>
|
<Position X="0" Y="0.196372822" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -2918,7 +2973,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36784196" Z="0"/>
|
<Position X="0" Y="2.36784196" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="24033.4531" Z="0"/>
|
<Orientation X="0" Y="24349.5703" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -2941,8 +2996,13 @@
|
|||||||
<Children>
|
<Children>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
|
<Time>113.54515932497441</Time>
|
||||||
|
<Period>2</Period>
|
||||||
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0.199529812" Z="0"/>
|
<Position X="-0" Y="-0.197990373" Z="-0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -2960,7 +3020,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36784196" Z="0"/>
|
<Position X="0" Y="2.36784196" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="23974.7441" Z="0"/>
|
<Orientation X="0" Y="24290.8613" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -2983,8 +3043,13 @@
|
|||||||
<Children>
|
<Children>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
|
<Time>101.62883282122999</Time>
|
||||||
|
<Period>2</Period>
|
||||||
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0" Y="-0.129332498" Z="-0"/>
|
<Position X="-0" Y="-0.183840692" Z="-0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -3002,7 +3067,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36800003" Z="0"/>
|
<Position X="0" Y="2.36800003" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="5720.18164" Z="0"/>
|
<Orientation X="0" Y="6035.56445" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -3025,8 +3090,13 @@
|
|||||||
<Children>
|
<Children>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
|
<Time>90.764091375525993</Time>
|
||||||
|
<Period>2</Period>
|
||||||
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0" Y="-0.199750423" Z="-0"/>
|
<Position X="0" Y="0.135024786" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -3044,7 +3114,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36800003" Z="0"/>
|
<Position X="0" Y="2.36800003" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="5630.65234" Z="0"/>
|
<Orientation X="0" Y="5946.03516" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -3067,8 +3137,13 @@
|
|||||||
<Children>
|
<Children>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
|
<Time>70.667870676407972</Time>
|
||||||
|
<Period>2</Period>
|
||||||
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0" Y="-0.164693162" Z="-0"/>
|
<Position X="0" Y="0.172826052" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -3086,7 +3161,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36784196" Z="0"/>
|
<Position X="0" Y="2.36784196" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="15084.3486" Z="0"/>
|
<Orientation X="0" Y="15399.248" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -3109,8 +3184,13 @@
|
|||||||
<Children>
|
<Children>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Axis X="0" Y="0.200000003" Z="0"/>
|
||||||
|
<Time>54.385750605052408</Time>
|
||||||
|
<Period>2</Period>
|
||||||
|
</c:FloatingEffect>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0" Y="-0.0709934905" Z="-0"/>
|
<Position X="0" Y="0.187255353" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
@@ -3128,7 +3208,7 @@
|
|||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.36784196" Z="0"/>
|
<Position X="0" Y="2.36784196" Z="0"/>
|
||||||
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
|
||||||
<Orientation X="0" Y="12975.2803" Z="0"/>
|
<Orientation X="0" Y="13290.1797" Z="0"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
@@ -4222,7 +4302,7 @@
|
|||||||
<HomePointForTeam>
|
<HomePointForTeam>
|
||||||
<Blue/>
|
<Blue/>
|
||||||
</HomePointForTeam>
|
</HomePointForTeam>
|
||||||
<CapturePointMaxTimer>-15</CapturePointMaxTimer>
|
<CaptureTimer>-15</CaptureTimer>
|
||||||
<CapturePointNumber>4</CapturePointNumber>
|
<CapturePointNumber>4</CapturePointNumber>
|
||||||
</c:CapturePoint>
|
</c:CapturePoint>
|
||||||
<c:Trigger/>
|
<c:Trigger/>
|
||||||
@@ -4444,7 +4524,7 @@
|
|||||||
<Entity name="Directional">
|
<Entity name="Directional">
|
||||||
<Components>
|
<Components>
|
||||||
<c:DirectionalLight>
|
<c:DirectionalLight>
|
||||||
<Intensity>1</Intensity>
|
<Intensity>0.40000000596046448</Intensity>
|
||||||
</c:DirectionalLight>
|
</c:DirectionalLight>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Orientation X="0" Y="1.16600001" Z="2.08000016"/>
|
<Orientation X="0" Y="1.16600001" Z="2.08000016"/>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,219 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity name="SpectatorCamera" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:Camera/>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children>
|
||||||
|
<Entity name="SpectatorHUD">
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="-0.5"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="RespawnTimer">
|
||||||
|
<Components>
|
||||||
|
<c:Text>
|
||||||
|
<Content>Time to respawn: 0</Content>
|
||||||
|
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||||
|
<Color A="1" B="0" G="1" R="0.784313738"/>
|
||||||
|
<Alignment>
|
||||||
|
<Left/>
|
||||||
|
</Alignment>
|
||||||
|
</c:Text>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.115000000" Y="0.15304254" Z="0"/>
|
||||||
|
<Scale X="0.0250000004" Y="0.0250000004" Z="1"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="CapturePointHUD">
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.190541431" Z="0"/>
|
||||||
|
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="BackgroundHexagon">
|
||||||
|
<Components>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.919596612" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="ProgressionHexagon">
|
||||||
|
<Components>
|
||||||
|
<c:CapturePointHUD>
|
||||||
|
<CapturePointNumber>2</CapturePointNumber>
|
||||||
|
</c:CapturePointHUD>
|
||||||
|
<c:Fill>
|
||||||
|
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||||
|
</c:Fill>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||||
|
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
|
||||||
|
<Orientation X="0" Y="0" Z="1.57079637"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="BackgroundHexagon">
|
||||||
|
<Components>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.811270177" Y="0.440691769" Z="-0.100000001"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="ProgressionHexagon">
|
||||||
|
<Components>
|
||||||
|
<c:CapturePointHUD>
|
||||||
|
<CapturePointNumber>3</CapturePointNumber>
|
||||||
|
</c:CapturePointHUD>
|
||||||
|
<c:Fill>
|
||||||
|
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||||
|
</c:Fill>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||||
|
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
|
||||||
|
<Orientation X="0" Y="0" Z="1.57079637"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="BackgroundHexagon">
|
||||||
|
<Components>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="1.62788737" Y="0.919596612" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="ProgressionHexagon">
|
||||||
|
<Components>
|
||||||
|
<c:CapturePointHUD>
|
||||||
|
<CapturePointNumber>4</CapturePointNumber>
|
||||||
|
</c:CapturePointHUD>
|
||||||
|
<c:Fill>
|
||||||
|
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||||
|
</c:Fill>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||||
|
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
|
||||||
|
<Orientation X="0" Y="0" Z="1.57079637"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="BackgroundHexagon">
|
||||||
|
<Components>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<Color A="0.300000012" B="1" G="1" R="1"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.820431828" Y="0.441878349" Z="-0.100000001"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="ProgressionHexagon">
|
||||||
|
<Components>
|
||||||
|
<c:CapturePointHUD>
|
||||||
|
<CapturePointNumber>1</CapturePointNumber>
|
||||||
|
</c:CapturePointHUD>
|
||||||
|
<c:Fill>
|
||||||
|
<Percentage>0.59265931447347009</Percentage>
|
||||||
|
<Color A="0.699999988" B="0" G="0" R="1"/>
|
||||||
|
</c:Fill>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||||
|
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
|
||||||
|
<Orientation X="0" Y="0" Z="4.71238899"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="BackgroundHexagon">
|
||||||
|
<Components>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
<Color A="0.699999988" B="0" G="0" R="1"/>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-1.58304751" Y="0.919596612" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="ProgressionHexagon">
|
||||||
|
<Components>
|
||||||
|
<c:CapturePointHUD/>
|
||||||
|
<c:Fill>
|
||||||
|
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
|
||||||
|
</c:Fill>
|
||||||
|
<c:Sprite>
|
||||||
|
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
|
||||||
|
<GlowMap></GlowMap>
|
||||||
|
</c:Sprite>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0" Z="0.00999999978"/>
|
||||||
|
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
|
||||||
|
<Orientation X="0" Y="0" Z="1.57079637"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -53,6 +53,13 @@
|
|||||||
<xs:element ref="c:WeaponAttachment" minOccurs="0"/>
|
<xs:element ref="c:WeaponAttachment" minOccurs="0"/>
|
||||||
<xs:element ref="c:DefenderWeapon" minOccurs="0"/>
|
<xs:element ref="c:DefenderWeapon" minOccurs="0"/>
|
||||||
<xs:element ref="c:CapturePointArrowHUD" minOccurs="0"/>
|
<xs:element ref="c:CapturePointArrowHUD" minOccurs="0"/>
|
||||||
|
<xs:element ref="c:FloatingEffect" minOccurs="0"/>
|
||||||
|
<xs:element ref="c:AmmoPickup" minOccurs="0"/>
|
||||||
|
<xs:element ref="c:HealthPickup" minOccurs="0"/>
|
||||||
|
<xs:element ref="c:CapturePointGameMode" minOccurs="0"/>
|
||||||
|
<xs:element ref="c:DoubleJump" minOccurs="0"/>
|
||||||
|
<xs:element ref="c:HealthHUD" minOccurs="0"/>
|
||||||
|
<xs:element ref="c:SpriteIndicator" minOccurs="0"/>
|
||||||
</xs:all>
|
</xs:all>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ layout (binding = 10) uniform sampler2D SpecularMapTexture3;
|
|||||||
layout (binding = 11) uniform sampler2D GlowMapTexture1;
|
layout (binding = 11) uniform sampler2D GlowMapTexture1;
|
||||||
layout (binding = 12) uniform sampler2D GlowMapTexture2;
|
layout (binding = 12) uniform sampler2D GlowMapTexture2;
|
||||||
layout (binding = 13) uniform sampler2D GlowMapTexture3;
|
layout (binding = 13) uniform sampler2D GlowMapTexture3;
|
||||||
layout (binding = 13) uniform sampler2D GlowMapTexture3;
|
|
||||||
layout (binding = 31) uniform samplerCube ShieldBuffer;
|
layout (binding = 31) uniform samplerCube ShieldBuffer;
|
||||||
|
|
||||||
#define TILE_SIZE 16
|
#define TILE_SIZE 16
|
||||||
|
|||||||
+14
-280
@@ -1,291 +1,25 @@
|
|||||||
#include "Core/EntityFile.h"
|
#include "Core/EntityFile.h"
|
||||||
|
|
||||||
EntityFile::EntityFile(boost::filesystem::path path)
|
EntityFile::EntityFile(std::string path)
|
||||||
: m_FilePath(path)
|
|
||||||
{
|
{
|
||||||
using namespace xercesc;
|
EntityXMLFile* xml = ResourceManager::Load<EntityXMLFile>(path);
|
||||||
XMLPlatformUtils::Initialize();
|
|
||||||
m_GrammarPool = new XMLGrammarPoolImpl();
|
|
||||||
m_SAX2XMLReader = XMLReaderFactory::createXMLReader(XMLPlatformUtils::fgMemoryManager, m_GrammarPool);
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityFile::~EntityFile()
|
EntityXMLFilePreprocessor preprocessor(xml);
|
||||||
{
|
preprocessor.RegisterComponents(this);
|
||||||
delete m_SAX2XMLReader;
|
|
||||||
delete m_GrammarPool;
|
|
||||||
xercesc::XMLPlatformUtils::Terminate();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityFile::Parse(const EntityFileHandler* handler) const
|
EntityXMLFileParser parser(xml);
|
||||||
{
|
m_RootEntity = parser.MergeEntities(this);
|
||||||
using namespace xercesc;
|
|
||||||
|
|
||||||
EntityFileSAXHandler saxHandler(handler, m_SAX2XMLReader);
|
if (m_RootEntity == EntityID_Invalid) {
|
||||||
setReaderFeatures(m_SAX2XMLReader);
|
ResourceManager::Release("EntityXMLFile", path);
|
||||||
m_SAX2XMLReader->setContentHandler(&saxHandler);
|
throw Resource::FailedLoadingException("Failed to merge entities; root entity is invalid");
|
||||||
m_SAX2XMLReader->setErrorHandler(&saxHandler);
|
|
||||||
m_SAX2XMLReader->setDeclarationHandler(&saxHandler);
|
|
||||||
m_SAX2XMLReader->parse(m_FilePath.string().c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityFile::setReaderFeatures(xercesc::SAX2XMLReader* reader)
|
|
||||||
{
|
|
||||||
using namespace xercesc;
|
|
||||||
reader->setFeature(XMLUni::fgXercesCacheGrammarFromParse, true);
|
|
||||||
reader->setFeature(XMLUni::fgXercesUseCachedGrammarInParse, true);
|
|
||||||
reader->setFeature(XMLUni::fgSAX2CoreValidation, true);
|
|
||||||
reader->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
|
|
||||||
reader->setFeature(XMLUni::fgXercesSchema, true);
|
|
||||||
reader->setFeature(XMLUni::fgXercesSchemaFullChecking, true);
|
|
||||||
reader->setFeature(XMLUni::fgXercesCalculateSrcOfs, true);
|
|
||||||
reader->setFeature(XMLUni::fgXercesIdentityConstraintChecking, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int EntityFile::GetTypeStride(std::string typeName)
|
|
||||||
{
|
|
||||||
std::map<std::string, unsigned int> typeStrides{
|
|
||||||
{ "bool", sizeof(bool) },
|
|
||||||
{ "int", sizeof(int) },
|
|
||||||
{ "float", sizeof(float) },
|
|
||||||
{ "double", sizeof(double) },
|
|
||||||
{ "string", sizeof(std::string) },
|
|
||||||
{ "enum", sizeof(ComponentInfo::EnumType) },
|
|
||||||
{ "Vector", sizeof(glm::vec3) },
|
|
||||||
{ "Quaternion", sizeof(glm::quat) },
|
|
||||||
{ "Color", sizeof(glm::vec4) }
|
|
||||||
};
|
|
||||||
|
|
||||||
auto it = typeStrides.find(typeName);
|
|
||||||
return (it != typeStrides.end()) ? it->second : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityFile::WriteAttributeData(char* outData, const ComponentInfo::Field_t& field, const std::map<std::string, std::string>& attributes)
|
|
||||||
{
|
|
||||||
if (field.Type == "Vector") {
|
|
||||||
glm::vec3 vec;
|
|
||||||
vec.x = boost::lexical_cast<float>(attributes.at("X"));
|
|
||||||
vec.y = boost::lexical_cast<float>(attributes.at("Y"));
|
|
||||||
vec.z = boost::lexical_cast<float>(attributes.at("Z"));
|
|
||||||
memcpy(outData, reinterpret_cast<char*>(&vec), field.Stride);
|
|
||||||
} else if (field.Type == "Color") {
|
|
||||||
glm::vec4 vec;
|
|
||||||
vec.r = boost::lexical_cast<float>(attributes.at("R"));
|
|
||||||
vec.g = boost::lexical_cast<float>(attributes.at("G"));
|
|
||||||
vec.b = boost::lexical_cast<float>(attributes.at("B"));
|
|
||||||
vec.a = boost::lexical_cast<float>(attributes.at("A"));
|
|
||||||
memcpy(outData, reinterpret_cast<char*>(&vec), field.Stride);
|
|
||||||
} else if (field.Type == "Quaternion") {
|
|
||||||
glm::quat q;
|
|
||||||
q.x = boost::lexical_cast<float>(attributes.at("X"));
|
|
||||||
q.y = boost::lexical_cast<float>(attributes.at("Y"));
|
|
||||||
q.z = boost::lexical_cast<float>(attributes.at("Z"));
|
|
||||||
q.w = boost::lexical_cast<float>(attributes.at("W"));
|
|
||||||
memcpy(outData, reinterpret_cast<char*>(&q), field.Stride);
|
|
||||||
} else if (!attributes.empty()) {
|
|
||||||
LOG_WARNING("%i attributes not handled by any type conversion!", attributes.size());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityFile::WriteValueData(char* outData, const ComponentInfo::Field_t& field, const char* valueData)
|
|
||||||
{
|
|
||||||
// Catch and ignore casting errors so whitespace around string enums won't mess anything up
|
|
||||||
try {
|
|
||||||
if (field.Type == "int") {
|
|
||||||
int value = boost::lexical_cast<int>(valueData);
|
|
||||||
memcpy(outData, reinterpret_cast<char*>(&value), field.Stride);
|
|
||||||
} else if (field.Type == "enum") {
|
|
||||||
ComponentInfo::EnumType value = boost::lexical_cast<ComponentInfo::EnumType>(valueData);
|
|
||||||
memcpy(outData, reinterpret_cast<char*>(&value), field.Stride);
|
|
||||||
} else if (field.Type == "float") {
|
|
||||||
float value = boost::lexical_cast<float>(valueData);
|
|
||||||
memcpy(outData, reinterpret_cast<char*>(&value), field.Stride);
|
|
||||||
} else if (field.Type == "double") {
|
|
||||||
double value = boost::lexical_cast<double>(valueData);
|
|
||||||
memcpy(outData, reinterpret_cast<char*>(&value), field.Stride);
|
|
||||||
} else if (field.Type == "bool") {
|
|
||||||
bool value = (valueData[0] == 't'); // Lazy bool evaluation
|
|
||||||
memcpy(outData, reinterpret_cast<char*>(&value), field.Stride);
|
|
||||||
} else if (field.Type == "string") {
|
|
||||||
new (outData) std::string(valueData);
|
|
||||||
} else {
|
|
||||||
LOG_WARNING("Unknown value data type: %s", field.Type.c_str());
|
|
||||||
}
|
|
||||||
} catch (const boost::bad_lexical_cast&) { }
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityFileSAXHandler::EntityFileSAXHandler(const EntityFileHandler* handler, xercesc::SAX2XMLReader* reader)
|
|
||||||
: m_Handler(handler)
|
|
||||||
, m_Reader(reader)
|
|
||||||
{
|
|
||||||
// 0 is imaginary base parent
|
|
||||||
m_EntityStack.push(0);
|
|
||||||
m_StateStack.push(State::Unknown);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityFileSAXHandler::startElement(const XMLCh* const _uri, const XMLCh* const _localName, const XMLCh* const _qname, const xercesc::Attributes& attrs)
|
|
||||||
{
|
|
||||||
std::string name = XS::ToString(_localName);
|
|
||||||
|
|
||||||
if (m_StateStack.top() == State::Unknown || m_StateStack.top() == State::Entity) {
|
|
||||||
if (name == "Entity") {
|
|
||||||
m_StateStack.push(State::Entity);
|
|
||||||
onStartEntity(attrs);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (name == "EntityRef") {
|
|
||||||
onStartEntityRef(attrs);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string uri = XS::ToString(_uri);
|
ResourceManager::Release("EntityXMLFile", path);
|
||||||
if (m_StateStack.top() == State::Entity) {
|
|
||||||
if (uri == "components") {
|
|
||||||
m_StateStack.push(State::Component);
|
|
||||||
onStartComponent(name);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_StateStack.top() == State::Component) {
|
|
||||||
m_StateStack.push(State::ComponentField);
|
|
||||||
onStartComponentField(name, attrs);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityFileSAXHandler::endElement(const XMLCh* const _uri, const XMLCh* const _localName, const XMLCh* const _qname)
|
EntityWrapper EntityFile::MergeInto(World* other)
|
||||||
{
|
{
|
||||||
std::string name = XS::ToString(_localName);
|
auto mapping = other->Merge(this);
|
||||||
if (m_StateStack.top() == State::Entity) {
|
return EntityWrapper(other, mapping.at(m_RootEntity));
|
||||||
if (name == "Entity") {
|
}
|
||||||
m_StateStack.pop();
|
|
||||||
onEndEntity();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string uri = XS::ToString(_uri);
|
|
||||||
if (m_StateStack.top() == State::Component) {
|
|
||||||
//if (uri == "components") {
|
|
||||||
m_StateStack.pop();
|
|
||||||
onEndComponent(name);
|
|
||||||
return;
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_StateStack.top() == State::ComponentField && name == m_CurrentField) {
|
|
||||||
m_StateStack.pop();
|
|
||||||
onEndComponentField(name);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityFileSAXHandler::characters(const XMLCh* const chars, const XMLSize_t length)
|
|
||||||
{
|
|
||||||
if (m_StateStack.top() == State::ComponentField) {
|
|
||||||
char* transcoded = xercesc::XMLString::transcode(chars);
|
|
||||||
onFieldData(transcoded);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityFileSAXHandler::fatalError(const xercesc::SAXParseException& e)
|
|
||||||
{
|
|
||||||
std::string message = XS::ToString(e.getMessage());
|
|
||||||
std::string systemId = XS::ToString(e.getSystemId());
|
|
||||||
XMLFileLoc line = e.getLineNumber();
|
|
||||||
XMLFileLoc column = e.getColumnNumber();
|
|
||||||
LOG_ERROR("SAXParseException\n\tLocation: %s:%i:%i\n\tFatal Error: %s", systemId.c_str(), line, column, message.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityFileSAXHandler::error(const xercesc::SAXParseException& e)
|
|
||||||
{
|
|
||||||
std::string message = XS::ToString(e.getMessage());
|
|
||||||
std::string systemId = XS::ToString(e.getSystemId());
|
|
||||||
XMLFileLoc line = e.getLineNumber();
|
|
||||||
XMLFileLoc column = e.getColumnNumber();
|
|
||||||
LOG_ERROR("SAXParseException\n\tLocation: %s:%i:%i\n\tError: %s", systemId.c_str(), line, column, message.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityFileSAXHandler::warning(const xercesc::SAXParseException& e)
|
|
||||||
{
|
|
||||||
std::string message = XS::ToString(e.getMessage());
|
|
||||||
std::string systemId = XS::ToString(e.getSystemId());
|
|
||||||
XMLFileLoc line = e.getLineNumber();
|
|
||||||
XMLFileLoc column = e.getColumnNumber();
|
|
||||||
LOG_ERROR("SAXParseException\n\tLocation: %s:%i:%i\n\tWarning: %s", systemId.c_str(), line, column, message.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityFileSAXHandler::onStartEntity(const xercesc::Attributes& attrs)
|
|
||||||
{
|
|
||||||
EntityID parent = m_EntityStack.top();
|
|
||||||
|
|
||||||
if (m_Handler->m_OnStartEntityCallback) {
|
|
||||||
std::string name;
|
|
||||||
auto xName = attrs.getValue(XS::ToXMLCh("name"));
|
|
||||||
if (xName != nullptr) {
|
|
||||||
name = XS::ToString(xName);
|
|
||||||
}
|
|
||||||
m_Handler->m_OnStartEntityCallback(m_NextEntityID, parent, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_EntityStack.push(m_NextEntityID);
|
|
||||||
m_NextEntityID++;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityFileSAXHandler::onEndEntity()
|
|
||||||
{
|
|
||||||
m_EntityStack.pop();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityFileSAXHandler::onStartEntityRef(const xercesc::Attributes& attrs)
|
|
||||||
{
|
|
||||||
std::string path = XS::ToString(attrs.getValue(XS::ToXMLCh("file")));
|
|
||||||
|
|
||||||
xercesc::SAX2XMLReader* reader = xercesc::XMLReaderFactory::createXMLReader();
|
|
||||||
EntityFile::setReaderFeatures(reader);
|
|
||||||
reader->setContentHandler(this);
|
|
||||||
reader->setErrorHandler(this);
|
|
||||||
reader->parse(path.c_str());
|
|
||||||
delete reader;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityFileSAXHandler::onStartComponentField(const std::string& field, const xercesc::Attributes& attrs)
|
|
||||||
{
|
|
||||||
//LOG_DEBUG(" Field: %s", field.c_str());
|
|
||||||
m_CurrentField = field;
|
|
||||||
m_CurrentAttributes.clear();
|
|
||||||
for (int i = 0; i < attrs.getLength(); i++) {
|
|
||||||
auto name = attrs.getQName(i);
|
|
||||||
auto value = attrs.getValue(name);
|
|
||||||
//LOG_DEBUG(" %s = %s", (char*)XS::ToString(name), (char*)XS::ToString(value));
|
|
||||||
m_CurrentAttributes[XS::ToString(name).operator std::string()] = XS::ToString(value).operator std::string();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_Handler->m_OnStartFieldCallback) {
|
|
||||||
m_Handler->m_OnStartFieldCallback(m_EntityStack.top(), m_CurrentComponent, field, m_CurrentAttributes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityFileSAXHandler::onEndComponent(const std::string& name) { }
|
|
||||||
|
|
||||||
void EntityFileSAXHandler::onStartComponent(const std::string& name)
|
|
||||||
{
|
|
||||||
//LOG_DEBUG(" Component: %s", name.c_str());
|
|
||||||
m_CurrentComponent = name;
|
|
||||||
if (m_Handler->m_OnStartComponentCallback) {
|
|
||||||
m_Handler->m_OnStartComponentCallback(m_EntityStack.top(), name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityFileSAXHandler::onEndComponentField(const std::string& field) { }
|
|
||||||
|
|
||||||
void EntityFileSAXHandler::onFieldData(char* data)
|
|
||||||
{
|
|
||||||
//LOG_DEBUG(" Data: %s", data);
|
|
||||||
if (m_Handler->m_OnStartFieldDataCallback) {
|
|
||||||
m_Handler->m_OnStartFieldDataCallback(m_EntityStack.top(), m_CurrentComponent, m_CurrentField, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
xercesc::XMLString::release(&data);
|
|
||||||
}
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
#include "Core/EntityFileParser.h"
|
|
||||||
|
|
||||||
EntityFileParser::EntityFileParser(const EntityFile* entityFile)
|
|
||||||
: m_EntityFile(entityFile)
|
|
||||||
{
|
|
||||||
m_Handler.SetStartEntityCallback(std::bind(&EntityFileParser::onStartEntity, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
|
||||||
m_Handler.SetStartComponentCallback(std::bind(&EntityFileParser::onStartComponent, this, std::placeholders::_1, std::placeholders::_2));
|
|
||||||
m_Handler.SetStartFieldCallback(std::bind(&EntityFileParser::onStartComponentField, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4));
|
|
||||||
m_Handler.SetStartFieldDataCallback(std::bind(&EntityFileParser::onFieldData, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4));
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityID EntityFileParser::MergeEntities(World* world, EntityID baseParent /*= EntityID_Invalid */)
|
|
||||||
{
|
|
||||||
m_World = world;
|
|
||||||
m_EntityIDMapper[0] = baseParent;
|
|
||||||
m_EntityFile->Parse(&m_Handler);
|
|
||||||
return m_FirstEntity;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityFileParser::onStartEntity(EntityID entity, EntityID parent, const std::string& name)
|
|
||||||
{
|
|
||||||
EntityID realParent = m_EntityIDMapper.at(parent);
|
|
||||||
EntityID realEntity = m_World->CreateEntity(realParent);
|
|
||||||
if (m_FirstEntity == EntityID_Invalid) {
|
|
||||||
m_FirstEntity = realEntity;
|
|
||||||
}
|
|
||||||
if (!name.empty()) {
|
|
||||||
m_World->SetName(realEntity, name);
|
|
||||||
}
|
|
||||||
m_EntityIDMapper[entity] = realEntity;
|
|
||||||
//LOG_DEBUG("Created entity #%i (%i) with parent %i (%i)", entity, realEntity, parent, realParent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityFileParser::onStartComponent(EntityID entity, const std::string& component)
|
|
||||||
{
|
|
||||||
EntityID realEntity = m_EntityIDMapper.at(entity);
|
|
||||||
m_World->AttachComponent(realEntity, component);
|
|
||||||
//LOG_DEBUG("Attached component of type \"%s\" to entity #%i (%i)", component.c_str(), entity, realEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityFileParser::onStartComponentField(EntityID entity, const std::string& componentType, const std::string& fieldName, const std::map<std::string, std::string>& attributes)
|
|
||||||
{
|
|
||||||
EntityID realEntity = m_EntityIDMapper.at(entity);
|
|
||||||
ComponentWrapper component = m_World->GetComponent(realEntity, componentType);
|
|
||||||
auto fieldIt = component.Info.Fields.find(fieldName);
|
|
||||||
if (fieldIt == component.Info.Fields.end()) {
|
|
||||||
LOG_ERROR("Tried to set unknown field \"%s\" of component type \"%s\"! Ignoring.", fieldName.c_str(), componentType.c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
auto& field = fieldIt->second;
|
|
||||||
|
|
||||||
//LOG_DEBUG("Field \"%s\" type \"%s\"", fieldName.c_str(), field.Type.c_str());
|
|
||||||
//LOG_DEBUG("Attributes:");
|
|
||||||
//for (auto& kv : attributes) {
|
|
||||||
// LOG_DEBUG("\t%s = %s", kv.first.c_str(), kv.second.c_str());
|
|
||||||
//}
|
|
||||||
|
|
||||||
char* data = component.Data + field.Offset;
|
|
||||||
EntityFile::WriteAttributeData(data, field, attributes);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityFileParser::onFieldData(EntityID entity, const std::string& componentType, const std::string& fieldName, const char* fieldData)
|
|
||||||
{
|
|
||||||
EntityID realEntity = m_EntityIDMapper.at(entity);
|
|
||||||
ComponentWrapper component = m_World->GetComponent(realEntity, componentType);
|
|
||||||
auto fieldIt = component.Info.Fields.find(fieldName);
|
|
||||||
if (fieldIt == component.Info.Fields.end()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
auto& field = fieldIt->second;
|
|
||||||
|
|
||||||
char* data = component.Data + field.Offset;
|
|
||||||
EntityFile::WriteValueData(data, field, fieldData);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,291 @@
|
|||||||
|
#include "Core/EntityXMLFile.h"
|
||||||
|
|
||||||
|
EntityXMLFile::EntityXMLFile(boost::filesystem::path path)
|
||||||
|
: m_FilePath(path)
|
||||||
|
{
|
||||||
|
using namespace xercesc;
|
||||||
|
XMLPlatformUtils::Initialize();
|
||||||
|
m_GrammarPool = new XMLGrammarPoolImpl();
|
||||||
|
m_SAX2XMLReader = XMLReaderFactory::createXMLReader(XMLPlatformUtils::fgMemoryManager, m_GrammarPool);
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityXMLFile::~EntityXMLFile()
|
||||||
|
{
|
||||||
|
delete m_SAX2XMLReader;
|
||||||
|
delete m_GrammarPool;
|
||||||
|
xercesc::XMLPlatformUtils::Terminate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityXMLFile::Parse(const EntityFileHandler* handler) const
|
||||||
|
{
|
||||||
|
using namespace xercesc;
|
||||||
|
|
||||||
|
EntityFileSAXHandler saxHandler(handler, m_SAX2XMLReader);
|
||||||
|
setReaderFeatures(m_SAX2XMLReader);
|
||||||
|
m_SAX2XMLReader->setContentHandler(&saxHandler);
|
||||||
|
m_SAX2XMLReader->setErrorHandler(&saxHandler);
|
||||||
|
m_SAX2XMLReader->setDeclarationHandler(&saxHandler);
|
||||||
|
m_SAX2XMLReader->parse(m_FilePath.string().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityXMLFile::setReaderFeatures(xercesc::SAX2XMLReader* reader)
|
||||||
|
{
|
||||||
|
using namespace xercesc;
|
||||||
|
reader->setFeature(XMLUni::fgXercesCacheGrammarFromParse, true);
|
||||||
|
reader->setFeature(XMLUni::fgXercesUseCachedGrammarInParse, true);
|
||||||
|
reader->setFeature(XMLUni::fgSAX2CoreValidation, true);
|
||||||
|
reader->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
|
||||||
|
reader->setFeature(XMLUni::fgXercesSchema, true);
|
||||||
|
reader->setFeature(XMLUni::fgXercesSchemaFullChecking, true);
|
||||||
|
reader->setFeature(XMLUni::fgXercesCalculateSrcOfs, true);
|
||||||
|
reader->setFeature(XMLUni::fgXercesIdentityConstraintChecking, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int EntityXMLFile::GetTypeStride(std::string typeName)
|
||||||
|
{
|
||||||
|
std::map<std::string, unsigned int> typeStrides{
|
||||||
|
{ "bool", sizeof(bool) },
|
||||||
|
{ "int", sizeof(int) },
|
||||||
|
{ "float", sizeof(float) },
|
||||||
|
{ "double", sizeof(double) },
|
||||||
|
{ "string", sizeof(std::string) },
|
||||||
|
{ "enum", sizeof(ComponentInfo::EnumType) },
|
||||||
|
{ "Vector", sizeof(glm::vec3) },
|
||||||
|
{ "Quaternion", sizeof(glm::quat) },
|
||||||
|
{ "Color", sizeof(glm::vec4) }
|
||||||
|
};
|
||||||
|
|
||||||
|
auto it = typeStrides.find(typeName);
|
||||||
|
return (it != typeStrides.end()) ? it->second : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityXMLFile::WriteAttributeData(char* outData, const ComponentInfo::Field_t& field, const std::map<std::string, std::string>& attributes)
|
||||||
|
{
|
||||||
|
if (field.Type == "Vector") {
|
||||||
|
glm::vec3 vec;
|
||||||
|
vec.x = boost::lexical_cast<float>(attributes.at("X"));
|
||||||
|
vec.y = boost::lexical_cast<float>(attributes.at("Y"));
|
||||||
|
vec.z = boost::lexical_cast<float>(attributes.at("Z"));
|
||||||
|
memcpy(outData, reinterpret_cast<char*>(&vec), field.Stride);
|
||||||
|
} else if (field.Type == "Color") {
|
||||||
|
glm::vec4 vec;
|
||||||
|
vec.r = boost::lexical_cast<float>(attributes.at("R"));
|
||||||
|
vec.g = boost::lexical_cast<float>(attributes.at("G"));
|
||||||
|
vec.b = boost::lexical_cast<float>(attributes.at("B"));
|
||||||
|
vec.a = boost::lexical_cast<float>(attributes.at("A"));
|
||||||
|
memcpy(outData, reinterpret_cast<char*>(&vec), field.Stride);
|
||||||
|
} else if (field.Type == "Quaternion") {
|
||||||
|
glm::quat q;
|
||||||
|
q.x = boost::lexical_cast<float>(attributes.at("X"));
|
||||||
|
q.y = boost::lexical_cast<float>(attributes.at("Y"));
|
||||||
|
q.z = boost::lexical_cast<float>(attributes.at("Z"));
|
||||||
|
q.w = boost::lexical_cast<float>(attributes.at("W"));
|
||||||
|
memcpy(outData, reinterpret_cast<char*>(&q), field.Stride);
|
||||||
|
} else if (!attributes.empty()) {
|
||||||
|
LOG_WARNING("%i attributes not handled by any type conversion!", attributes.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityXMLFile::WriteValueData(char* outData, const ComponentInfo::Field_t& field, const char* valueData)
|
||||||
|
{
|
||||||
|
// Catch and ignore casting errors so whitespace around string enums won't mess anything up
|
||||||
|
try {
|
||||||
|
if (field.Type == "int") {
|
||||||
|
int value = boost::lexical_cast<int>(valueData);
|
||||||
|
memcpy(outData, reinterpret_cast<char*>(&value), field.Stride);
|
||||||
|
} else if (field.Type == "enum") {
|
||||||
|
ComponentInfo::EnumType value = boost::lexical_cast<ComponentInfo::EnumType>(valueData);
|
||||||
|
memcpy(outData, reinterpret_cast<char*>(&value), field.Stride);
|
||||||
|
} else if (field.Type == "float") {
|
||||||
|
float value = boost::lexical_cast<float>(valueData);
|
||||||
|
memcpy(outData, reinterpret_cast<char*>(&value), field.Stride);
|
||||||
|
} else if (field.Type == "double") {
|
||||||
|
double value = boost::lexical_cast<double>(valueData);
|
||||||
|
memcpy(outData, reinterpret_cast<char*>(&value), field.Stride);
|
||||||
|
} else if (field.Type == "bool") {
|
||||||
|
bool value = (valueData[0] == 't'); // Lazy bool evaluation
|
||||||
|
memcpy(outData, reinterpret_cast<char*>(&value), field.Stride);
|
||||||
|
} else if (field.Type == "string") {
|
||||||
|
new (outData) std::string(valueData);
|
||||||
|
} else {
|
||||||
|
LOG_WARNING("Unknown value data type: %s", field.Type.c_str());
|
||||||
|
}
|
||||||
|
} catch (const boost::bad_lexical_cast&) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityFileSAXHandler::EntityFileSAXHandler(const EntityFileHandler* handler, xercesc::SAX2XMLReader* reader)
|
||||||
|
: m_Handler(handler)
|
||||||
|
, m_Reader(reader)
|
||||||
|
{
|
||||||
|
// 0 is imaginary base parent
|
||||||
|
m_EntityStack.push(0);
|
||||||
|
m_StateStack.push(State::Unknown);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityFileSAXHandler::startElement(const XMLCh* const _uri, const XMLCh* const _localName, const XMLCh* const _qname, const xercesc::Attributes& attrs)
|
||||||
|
{
|
||||||
|
std::string name = XS::ToString(_localName);
|
||||||
|
|
||||||
|
if (m_StateStack.top() == State::Unknown || m_StateStack.top() == State::Entity) {
|
||||||
|
if (name == "Entity") {
|
||||||
|
m_StateStack.push(State::Entity);
|
||||||
|
onStartEntity(attrs);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (name == "EntityRef") {
|
||||||
|
onStartEntityRef(attrs);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string uri = XS::ToString(_uri);
|
||||||
|
if (m_StateStack.top() == State::Entity) {
|
||||||
|
if (uri == "components") {
|
||||||
|
m_StateStack.push(State::Component);
|
||||||
|
onStartComponent(name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_StateStack.top() == State::Component) {
|
||||||
|
m_StateStack.push(State::ComponentField);
|
||||||
|
onStartComponentField(name, attrs);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityFileSAXHandler::endElement(const XMLCh* const _uri, const XMLCh* const _localName, const XMLCh* const _qname)
|
||||||
|
{
|
||||||
|
std::string name = XS::ToString(_localName);
|
||||||
|
if (m_StateStack.top() == State::Entity) {
|
||||||
|
if (name == "Entity") {
|
||||||
|
m_StateStack.pop();
|
||||||
|
onEndEntity();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string uri = XS::ToString(_uri);
|
||||||
|
if (m_StateStack.top() == State::Component) {
|
||||||
|
//if (uri == "components") {
|
||||||
|
m_StateStack.pop();
|
||||||
|
onEndComponent(name);
|
||||||
|
return;
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_StateStack.top() == State::ComponentField && name == m_CurrentField) {
|
||||||
|
m_StateStack.pop();
|
||||||
|
onEndComponentField(name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityFileSAXHandler::characters(const XMLCh* const chars, const XMLSize_t length)
|
||||||
|
{
|
||||||
|
if (m_StateStack.top() == State::ComponentField) {
|
||||||
|
char* transcoded = xercesc::XMLString::transcode(chars);
|
||||||
|
onFieldData(transcoded);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityFileSAXHandler::fatalError(const xercesc::SAXParseException& e)
|
||||||
|
{
|
||||||
|
std::string message = XS::ToString(e.getMessage());
|
||||||
|
std::string systemId = XS::ToString(e.getSystemId());
|
||||||
|
XMLFileLoc line = e.getLineNumber();
|
||||||
|
XMLFileLoc column = e.getColumnNumber();
|
||||||
|
LOG_ERROR("SAXParseException\n\tLocation: %s:%i:%i\n\tFatal Error: %s", systemId.c_str(), line, column, message.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityFileSAXHandler::error(const xercesc::SAXParseException& e)
|
||||||
|
{
|
||||||
|
std::string message = XS::ToString(e.getMessage());
|
||||||
|
std::string systemId = XS::ToString(e.getSystemId());
|
||||||
|
XMLFileLoc line = e.getLineNumber();
|
||||||
|
XMLFileLoc column = e.getColumnNumber();
|
||||||
|
LOG_ERROR("SAXParseException\n\tLocation: %s:%i:%i\n\tError: %s", systemId.c_str(), line, column, message.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityFileSAXHandler::warning(const xercesc::SAXParseException& e)
|
||||||
|
{
|
||||||
|
std::string message = XS::ToString(e.getMessage());
|
||||||
|
std::string systemId = XS::ToString(e.getSystemId());
|
||||||
|
XMLFileLoc line = e.getLineNumber();
|
||||||
|
XMLFileLoc column = e.getColumnNumber();
|
||||||
|
LOG_ERROR("SAXParseException\n\tLocation: %s:%i:%i\n\tWarning: %s", systemId.c_str(), line, column, message.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityFileSAXHandler::onStartEntity(const xercesc::Attributes& attrs)
|
||||||
|
{
|
||||||
|
EntityID parent = m_EntityStack.top();
|
||||||
|
|
||||||
|
if (m_Handler->m_OnStartEntityCallback) {
|
||||||
|
std::string name;
|
||||||
|
auto xName = attrs.getValue(XS::ToXMLCh("name"));
|
||||||
|
if (xName != nullptr) {
|
||||||
|
name = XS::ToString(xName);
|
||||||
|
}
|
||||||
|
m_Handler->m_OnStartEntityCallback(m_NextEntityID, parent, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_EntityStack.push(m_NextEntityID);
|
||||||
|
m_NextEntityID++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityFileSAXHandler::onEndEntity()
|
||||||
|
{
|
||||||
|
m_EntityStack.pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityFileSAXHandler::onStartEntityRef(const xercesc::Attributes& attrs)
|
||||||
|
{
|
||||||
|
std::string path = XS::ToString(attrs.getValue(XS::ToXMLCh("file")));
|
||||||
|
|
||||||
|
xercesc::SAX2XMLReader* reader = xercesc::XMLReaderFactory::createXMLReader();
|
||||||
|
EntityXMLFile::setReaderFeatures(reader);
|
||||||
|
reader->setContentHandler(this);
|
||||||
|
reader->setErrorHandler(this);
|
||||||
|
reader->parse(path.c_str());
|
||||||
|
delete reader;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityFileSAXHandler::onStartComponentField(const std::string& field, const xercesc::Attributes& attrs)
|
||||||
|
{
|
||||||
|
//LOG_DEBUG(" Field: %s", field.c_str());
|
||||||
|
m_CurrentField = field;
|
||||||
|
m_CurrentAttributes.clear();
|
||||||
|
for (int i = 0; i < attrs.getLength(); i++) {
|
||||||
|
auto name = attrs.getQName(i);
|
||||||
|
auto value = attrs.getValue(name);
|
||||||
|
//LOG_DEBUG(" %s = %s", (char*)XS::ToString(name), (char*)XS::ToString(value));
|
||||||
|
m_CurrentAttributes[XS::ToString(name).operator std::string()] = XS::ToString(value).operator std::string();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_Handler->m_OnStartFieldCallback) {
|
||||||
|
m_Handler->m_OnStartFieldCallback(m_EntityStack.top(), m_CurrentComponent, field, m_CurrentAttributes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityFileSAXHandler::onEndComponent(const std::string& name) { }
|
||||||
|
|
||||||
|
void EntityFileSAXHandler::onStartComponent(const std::string& name)
|
||||||
|
{
|
||||||
|
//LOG_DEBUG(" Component: %s", name.c_str());
|
||||||
|
m_CurrentComponent = name;
|
||||||
|
if (m_Handler->m_OnStartComponentCallback) {
|
||||||
|
m_Handler->m_OnStartComponentCallback(m_EntityStack.top(), name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityFileSAXHandler::onEndComponentField(const std::string& field) { }
|
||||||
|
|
||||||
|
void EntityFileSAXHandler::onFieldData(char* data)
|
||||||
|
{
|
||||||
|
//LOG_DEBUG(" Data: %s", data);
|
||||||
|
if (m_Handler->m_OnStartFieldDataCallback) {
|
||||||
|
m_Handler->m_OnStartFieldDataCallback(m_EntityStack.top(), m_CurrentComponent, m_CurrentField, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
xercesc::XMLString::release(&data);
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
#include "Core/EntityXMLFileParser.h"
|
||||||
|
|
||||||
|
EntityXMLFileParser::EntityXMLFileParser(const EntityXMLFile* entityFile)
|
||||||
|
: m_EntityFile(entityFile)
|
||||||
|
{
|
||||||
|
m_Handler.SetStartEntityCallback(std::bind(&EntityXMLFileParser::onStartEntity, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||||
|
m_Handler.SetStartComponentCallback(std::bind(&EntityXMLFileParser::onStartComponent, this, std::placeholders::_1, std::placeholders::_2));
|
||||||
|
m_Handler.SetStartFieldCallback(std::bind(&EntityXMLFileParser::onStartComponentField, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4));
|
||||||
|
m_Handler.SetStartFieldDataCallback(std::bind(&EntityXMLFileParser::onFieldData, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4));
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityID EntityXMLFileParser::MergeEntities(World* world, EntityID baseParent /*= EntityID_Invalid */)
|
||||||
|
{
|
||||||
|
m_World = world;
|
||||||
|
m_EntityIDMapper[0] = baseParent;
|
||||||
|
m_EntityFile->Parse(&m_Handler);
|
||||||
|
return m_FirstEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityXMLFileParser::onStartEntity(EntityID entity, EntityID parent, const std::string& name)
|
||||||
|
{
|
||||||
|
EntityID realParent = m_EntityIDMapper.at(parent);
|
||||||
|
EntityID realEntity = m_World->CreateEntity(realParent);
|
||||||
|
if (m_FirstEntity == EntityID_Invalid) {
|
||||||
|
m_FirstEntity = realEntity;
|
||||||
|
}
|
||||||
|
if (!name.empty()) {
|
||||||
|
m_World->SetName(realEntity, name);
|
||||||
|
}
|
||||||
|
m_EntityIDMapper[entity] = realEntity;
|
||||||
|
//LOG_DEBUG("Created entity #%i (%i) with parent %i (%i)", entity, realEntity, parent, realParent);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityXMLFileParser::onStartComponent(EntityID entity, const std::string& component)
|
||||||
|
{
|
||||||
|
if (m_World->GetComponentPools().count(component) != 0) {
|
||||||
|
EntityID realEntity = m_EntityIDMapper.at(entity);
|
||||||
|
m_World->AttachComponent(realEntity, component);
|
||||||
|
} else {
|
||||||
|
LOG_ERROR("Tried to attach unregistered component \"%s\"! to entity #%i. Ignoring.", component.c_str(), entity);
|
||||||
|
}
|
||||||
|
//LOG_DEBUG("Attached component of type \"%s\" to entity #%i (%i)", component.c_str(), entity, realEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityXMLFileParser::onStartComponentField(EntityID entity, const std::string& componentType, const std::string& fieldName, const std::map<std::string, std::string>& attributes)
|
||||||
|
{
|
||||||
|
if (m_World->GetComponentPools().count(componentType) == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
EntityID realEntity = m_EntityIDMapper.at(entity);
|
||||||
|
ComponentWrapper component = m_World->GetComponent(realEntity, componentType);
|
||||||
|
auto fieldIt = component.Info.Fields.find(fieldName);
|
||||||
|
if (fieldIt == component.Info.Fields.end()) {
|
||||||
|
LOG_ERROR("Tried to set unknown field \"%s\" of component type \"%s\"! Ignoring.", fieldName.c_str(), componentType.c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto& field = fieldIt->second;
|
||||||
|
|
||||||
|
//LOG_DEBUG("Field \"%s\" type \"%s\"", fieldName.c_str(), field.Type.c_str());
|
||||||
|
//LOG_DEBUG("Attributes:");
|
||||||
|
//for (auto& kv : attributes) {
|
||||||
|
// LOG_DEBUG("\t%s = %s", kv.first.c_str(), kv.second.c_str());
|
||||||
|
//}
|
||||||
|
|
||||||
|
char* data = component.Data + field.Offset;
|
||||||
|
EntityXMLFile::WriteAttributeData(data, field, attributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityXMLFileParser::onFieldData(EntityID entity, const std::string& componentType, const std::string& fieldName, const char* fieldData)
|
||||||
|
{
|
||||||
|
if (m_World->GetComponentPools().count(componentType) == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
EntityID realEntity = m_EntityIDMapper.at(entity);
|
||||||
|
ComponentWrapper component = m_World->GetComponent(realEntity, componentType);
|
||||||
|
auto fieldIt = component.Info.Fields.find(fieldName);
|
||||||
|
if (fieldIt == component.Info.Fields.end()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto& field = fieldIt->second;
|
||||||
|
|
||||||
|
char* data = component.Data + field.Offset;
|
||||||
|
EntityXMLFile::WriteValueData(data, field, fieldData);
|
||||||
|
}
|
||||||
+12
-12
@@ -1,10 +1,10 @@
|
|||||||
#include "Core/EntityFilePreprocessor.h"
|
#include "Core/EntityXMLFilePreprocessor.h"
|
||||||
|
|
||||||
EntityFilePreprocessor::EntityFilePreprocessor(const EntityFile* entityFile)
|
EntityXMLFilePreprocessor::EntityXMLFilePreprocessor(const EntityXMLFile* entityFile)
|
||||||
: m_EntityFile(entityFile)
|
: m_EntityFile(entityFile)
|
||||||
{
|
{
|
||||||
EntityFileHandler handler;
|
EntityFileHandler handler;
|
||||||
handler.SetStartComponentCallback(std::bind(&EntityFilePreprocessor::onStartComponent, this, std::placeholders::_1, std::placeholders::_2));
|
handler.SetStartComponentCallback(std::bind(&EntityXMLFilePreprocessor::onStartComponent, this, std::placeholders::_1, std::placeholders::_2));
|
||||||
m_EntityFile->Parse(&handler);
|
m_EntityFile->Parse(&handler);
|
||||||
|
|
||||||
//LOG_DEBUG("___ COMPONENT DEFINITIONS ___");
|
//LOG_DEBUG("___ COMPONENT DEFINITIONS ___");
|
||||||
@@ -28,20 +28,20 @@ EntityFilePreprocessor::EntityFilePreprocessor(const EntityFile* entityFile)
|
|||||||
parseDefaults();
|
parseDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityFilePreprocessor::RegisterComponents(World* world)
|
void EntityXMLFilePreprocessor::RegisterComponents(World* world)
|
||||||
{
|
{
|
||||||
for (auto& kv : m_ComponentInfo) {
|
for (auto& kv : m_ComponentInfo) {
|
||||||
world->RegisterComponent(kv.second);
|
world->RegisterComponent(kv.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityFilePreprocessor::onStartComponent(EntityID entity, std::string type)
|
void EntityXMLFilePreprocessor::onStartComponent(EntityID entity, std::string type)
|
||||||
{
|
{
|
||||||
//LOG_DEBUG("Component: %s", type.c_str());
|
//LOG_DEBUG("Component: %s", type.c_str());
|
||||||
m_ComponentCounts[type]++;
|
m_ComponentCounts[type]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityFilePreprocessor::parseComponentInfo()
|
void EntityXMLFilePreprocessor::parseComponentInfo()
|
||||||
{
|
{
|
||||||
using namespace xercesc;
|
using namespace xercesc;
|
||||||
EntityFileXMLErrorHandler errorHandler;
|
EntityFileXMLErrorHandler errorHandler;
|
||||||
@@ -141,9 +141,9 @@ void EntityFilePreprocessor::parseComponentInfo()
|
|||||||
std::string baseType = XS::ToString(elementDeclaration->getTypeDefinition()->getBaseType()->getName());
|
std::string baseType = XS::ToString(elementDeclaration->getTypeDefinition()->getBaseType()->getName());
|
||||||
|
|
||||||
std::string effectiveType = type;
|
std::string effectiveType = type;
|
||||||
unsigned int stride = EntityFile::GetTypeStride(type);
|
unsigned int stride = EntityXMLFile::GetTypeStride(type);
|
||||||
if (stride == 0) {
|
if (stride == 0) {
|
||||||
stride = EntityFile::GetTypeStride(baseType);
|
stride = EntityXMLFile::GetTypeStride(baseType);
|
||||||
if (stride == 0) {
|
if (stride == 0) {
|
||||||
LOG_WARNING("Field \"%s\" in component \"%s\" uses unexpected field type \"%s\" with base type \"%s\". Skipping.", name.c_str(), compInfo.Name.c_str(), type.c_str(), baseType.c_str());
|
LOG_WARNING("Field \"%s\" in component \"%s\" uses unexpected field type \"%s\" with base type \"%s\". Skipping.", name.c_str(), compInfo.Name.c_str(), type.c_str(), baseType.c_str());
|
||||||
continue;
|
continue;
|
||||||
@@ -196,7 +196,7 @@ void EntityFilePreprocessor::parseComponentInfo()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityFilePreprocessor::parseDefaults()
|
void EntityXMLFilePreprocessor::parseDefaults()
|
||||||
{
|
{
|
||||||
using namespace xercesc;
|
using namespace xercesc;
|
||||||
|
|
||||||
@@ -261,7 +261,7 @@ void EntityFilePreprocessor::parseDefaults()
|
|||||||
auto attribItem = attributeMap->item(i);
|
auto attribItem = attributeMap->item(i);
|
||||||
attributes[XS::ToString(attribItem->getNodeName())] = XS::ToString(attribItem->getNodeValue());
|
attributes[XS::ToString(attribItem->getNodeName())] = XS::ToString(attribItem->getNodeValue());
|
||||||
}
|
}
|
||||||
EntityFile::WriteAttributeData(data, field, attributes);
|
EntityXMLFile::WriteAttributeData(data, field, attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto childNode = fieldElement->getFirstChild();
|
auto childNode = fieldElement->getFirstChild();
|
||||||
@@ -278,14 +278,14 @@ void EntityFilePreprocessor::parseDefaults()
|
|||||||
// Handle potential field values
|
// Handle potential field values
|
||||||
if (childNode->getNodeType() == DOMNode::TEXT_NODE) {
|
if (childNode->getNodeType() == DOMNode::TEXT_NODE) {
|
||||||
char* cstrValue = XMLString::transcode(childNode->getNodeValue());
|
char* cstrValue = XMLString::transcode(childNode->getNodeValue());
|
||||||
EntityFile::WriteValueData(data, field, cstrValue);
|
EntityXMLFile::WriteValueData(data, field, cstrValue);
|
||||||
XMLString::release(&cstrValue);
|
XMLString::release(&cstrValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string EntityFilePreprocessor::parseAnnotationXML(const XMLCh* xml)
|
std::string EntityXMLFilePreprocessor::parseAnnotationXML(const XMLCh* xml)
|
||||||
{
|
{
|
||||||
using namespace xercesc;
|
using namespace xercesc;
|
||||||
|
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
#include "Core/EntityFileWriter.h"
|
#include "Core/EntityXMLFileWriter.h"
|
||||||
|
|
||||||
#define X(str) XS::ToXMLCh(str)
|
#define X(str) XS::ToXMLCh(str)
|
||||||
|
|
||||||
void EntityFileWriter::WriteWorld(World* world)
|
void EntityXMLFileWriter::WriteWorld(World* world)
|
||||||
{
|
{
|
||||||
WriteEntity(world, 0);
|
WriteEntity(world, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityFileWriter::WriteEntity(World* world, EntityID entity)
|
void EntityXMLFileWriter::WriteEntity(World* world, EntityID entity)
|
||||||
{
|
{
|
||||||
using namespace xercesc;
|
using namespace xercesc;
|
||||||
DOMDocument* doc = m_DOMImplementation->createDocument(nullptr, X("Entity"), nullptr);
|
DOMDocument* doc = m_DOMImplementation->createDocument(nullptr, X("Entity"), nullptr);
|
||||||
@@ -41,7 +41,7 @@ void EntityFileWriter::WriteEntity(World* world, EntityID entity)
|
|||||||
doc->release();
|
doc->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityFileWriter::appendEntityChildren(xercesc::DOMElement* parentElement, const World* world, EntityID entity)
|
void EntityXMLFileWriter::appendEntityChildren(xercesc::DOMElement* parentElement, const World* world, EntityID entity)
|
||||||
{
|
{
|
||||||
using namespace xercesc;
|
using namespace xercesc;
|
||||||
DOMDocument* doc = parentElement->getOwnerDocument();
|
DOMDocument* doc = parentElement->getOwnerDocument();
|
||||||
@@ -67,7 +67,7 @@ void EntityFileWriter::appendEntityChildren(xercesc::DOMElement* parentElement,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityFileWriter::appentEntityComponents(xercesc::DOMElement* parentElement, const World* world, EntityID entity)
|
void EntityXMLFileWriter::appentEntityComponents(xercesc::DOMElement* parentElement, const World* world, EntityID entity)
|
||||||
{
|
{
|
||||||
using namespace xercesc;
|
using namespace xercesc;
|
||||||
DOMDocument* doc = parentElement->getOwnerDocument();
|
DOMDocument* doc = parentElement->getOwnerDocument();
|
||||||
@@ -33,8 +33,8 @@ void _LOG(_LOG_LEVEL logLevel, const char* file, const char* func, unsigned int
|
|||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
if (logLevel == LOG_LEVEL_ERROR) {
|
if (logLevel == LOG_LEVEL_ERROR) {
|
||||||
//std::cerr << file << ":" << line << " " << func << std::endl;
|
std::cerr << file << ":" << line << " " << func << std::endl;
|
||||||
//std::cerr << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;
|
std::cerr << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;
|
||||||
} else {
|
} else {
|
||||||
std::cout << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;
|
std::cout << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "Core/World.h"
|
#include "Core/World.h"
|
||||||
#include "Core/EEntityDeleted.h"
|
#include "Core/EEntityDeleted.h"
|
||||||
#include "Core/EComponentDeleted.h"
|
#include "Core/EComponentDeleted.h"
|
||||||
|
#include "Core/EntityWrapper.h"
|
||||||
|
|
||||||
World::~World()
|
World::~World()
|
||||||
{
|
{
|
||||||
@@ -44,7 +45,7 @@ bool World::ValidEntity(EntityID entity) const
|
|||||||
return m_EntityParents.find(entity) != m_EntityParents.end();
|
return m_EntityParents.find(entity) != m_EntityParents.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::RegisterComponent(ComponentInfo& ci)
|
void World::RegisterComponent(const ComponentInfo& ci)
|
||||||
{
|
{
|
||||||
if (m_ComponentPools.find(ci.Name) == m_ComponentPools.end()) {
|
if (m_ComponentPools.find(ci.Name) == m_ComponentPools.end()) {
|
||||||
m_ComponentPools[ci.Name] = new ComponentPool(ci);
|
m_ComponentPools[ci.Name] = new ComponentPool(ci);
|
||||||
@@ -151,6 +152,62 @@ std::string World::GetName(EntityID entity) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EntityWrapper World::GetFirstEntityByName(const std::string& name)
|
||||||
|
{
|
||||||
|
auto itPair = GetDirectChildren(EntityID_Invalid);
|
||||||
|
for (auto it = itPair.first; it != itPair.second; it++) {
|
||||||
|
EntityID childEntityID = it->second;
|
||||||
|
EntityWrapper childEntity(this, childEntityID);
|
||||||
|
if (!childEntity.Valid()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
EntityWrapper entityWithName = childEntity.Name() == name ? childEntity : childEntity.FirstChildByName(name);
|
||||||
|
if (entityWithName.Valid()) {
|
||||||
|
return entityWithName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return EntityWrapper::Invalid;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unordered_map<EntityID, EntityID> World::Merge(const World* other)
|
||||||
|
{
|
||||||
|
std::unordered_map<EntityID, EntityID> oldToNew;
|
||||||
|
|
||||||
|
// Create new entities
|
||||||
|
for (auto& kv : other->m_EntityParents) {
|
||||||
|
EntityID entity = kv.first;
|
||||||
|
|
||||||
|
EntityID newEntity = CreateEntity();
|
||||||
|
SetName(newEntity, other->GetName(entity));
|
||||||
|
oldToNew[entity] = newEntity;
|
||||||
|
}
|
||||||
|
// Fix relationships
|
||||||
|
for (auto& kv : other->m_EntityParents) {
|
||||||
|
EntityID entity = kv.first;
|
||||||
|
EntityID parent = kv.second;
|
||||||
|
if (parent != EntityID_Invalid) {
|
||||||
|
SetParent(oldToNew.at(entity), oldToNew.at(parent));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Transfer components
|
||||||
|
for (auto& kv : other->m_ComponentPools) {
|
||||||
|
auto& componentType = kv.first;
|
||||||
|
ComponentPool* pool = kv.second;
|
||||||
|
// Register pool if it's not present in world
|
||||||
|
if (m_ComponentPools.count(componentType) == 0) {
|
||||||
|
RegisterComponent(pool->ComponentInfo());
|
||||||
|
}
|
||||||
|
// Copy components
|
||||||
|
for (auto component : *pool) {
|
||||||
|
ComponentWrapper newComponent = AttachComponent(oldToNew.at(component.EntityID), componentType);
|
||||||
|
component.Copy(newComponent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return oldToNew;
|
||||||
|
}
|
||||||
|
|
||||||
EntityID World::generateEntityID()
|
EntityID World::generateEntityID()
|
||||||
{
|
{
|
||||||
// TODO: Make EntityID generation smarter
|
// TODO: Make EntityID generation smarter
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "Core/UniformScaleSystem.h"
|
#include "Core/UniformScaleSystem.h"
|
||||||
#include "Editor/EditorRenderSystem.h"
|
#include "Editor/EditorRenderSystem.h"
|
||||||
#include "Editor/EditorWidgetSystem.h"
|
#include "Editor/EditorWidgetSystem.h"
|
||||||
|
#include "Core/EntityFile.h"
|
||||||
|
|
||||||
EditorSystem::EditorSystem(SystemParams params, IRenderer* renderer, RenderFrame* renderFrame)
|
EditorSystem::EditorSystem(SystemParams params, IRenderer* renderer, RenderFrame* renderFrame)
|
||||||
: System(params)
|
: System(params)
|
||||||
@@ -129,7 +130,7 @@ void EditorSystem::OnEntitySelected(EntityWrapper entity)
|
|||||||
|
|
||||||
void EditorSystem::OnEntitySave(EntityWrapper entity, boost::filesystem::path filePath)
|
void EditorSystem::OnEntitySave(EntityWrapper entity, boost::filesystem::path filePath)
|
||||||
{
|
{
|
||||||
EntityFileWriter writer(filePath);
|
EntityXMLFileWriter writer(filePath);
|
||||||
writer.WriteEntity(entity.World, entity.ID);
|
writer.WriteEntity(entity.World, entity.ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,12 +261,11 @@ EntityWrapper EditorSystem::importEntity(EntityWrapper parent, boost::filesystem
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
auto entityFile = ResourceManager::Load<EntityFile>(filePath.string());
|
auto entityFile = ResourceManager::Load<EntityFile>(filePath.string());
|
||||||
EntityFilePreprocessor fpp(entityFile);
|
EntityWrapper newEntity = entityFile->MergeInto(parent.World);
|
||||||
fpp.RegisterComponents(parent.World);
|
parent.World->SetParent(newEntity.ID, parent.ID);
|
||||||
EntityFileParser fp(entityFile);
|
return newEntity;
|
||||||
EntityID newEntity = fp.MergeEntities(parent.World, parent.ID);
|
} catch (const std::exception& e) {
|
||||||
return EntityWrapper(parent.World, newEntity);
|
LOG_ERROR("Failed to import entity \"%s\": \"%s\"", filePath.string().c_str(), e.what());
|
||||||
} catch (const std::exception&) {
|
|
||||||
return EntityWrapper::Invalid;
|
return EntityWrapper::Invalid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ void Client::Connect(std::string address, int port)
|
|||||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &Client::OnPlayerDamage);
|
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &Client::OnPlayerDamage);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &Client::OnPlayerSpawned);
|
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &Client::OnPlayerSpawned);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EDoubleJump, &Client::OnDoubleJump);
|
EVENT_SUBSCRIBE_MEMBER(m_EDoubleJump, &Client::OnDoubleJump);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EDashAbility, &Client::OnDashAbility);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_ESearchForServers, &Client::OnSearchForServers);
|
EVENT_SUBSCRIBE_MEMBER(m_ESearchForServers, &Client::OnSearchForServers);
|
||||||
auto config = ResourceManager::Load<ConfigFile>("Config.ini");
|
auto config = ResourceManager::Load<ConfigFile>("Config.ini");
|
||||||
m_Address = address;
|
m_Address = address;
|
||||||
@@ -143,6 +144,9 @@ void Client::parseMessageType(Packet& packet)
|
|||||||
case MessageType::OnDoubleJump:
|
case MessageType::OnDoubleJump:
|
||||||
parseDoubleJump(packet);
|
parseDoubleJump(packet);
|
||||||
break;
|
break;
|
||||||
|
case MessageType::OnDashEffect:
|
||||||
|
parseDashEffect(packet);
|
||||||
|
break;
|
||||||
case MessageType::AmmoPickup:
|
case MessageType::AmmoPickup:
|
||||||
parseAmmoPickup(packet);
|
parseAmmoPickup(packet);
|
||||||
break;
|
break;
|
||||||
@@ -262,7 +266,7 @@ void Client::parseEntityDeletion(Packet & packet)
|
|||||||
if (m_ServerIDToClientID.find(entityToDelete) != m_ServerIDToClientID.end()) {
|
if (m_ServerIDToClientID.find(entityToDelete) != m_ServerIDToClientID.end()) {
|
||||||
EntityID localEntity = m_ServerIDToClientID.at(entityToDelete);
|
EntityID localEntity = m_ServerIDToClientID.at(entityToDelete);
|
||||||
if (m_World->ValidEntity(localEntity)) {
|
if (m_World->ValidEntity(localEntity)) {
|
||||||
if (m_World->HasComponent(localEntity,"Player")) {
|
if (m_World->HasComponent(localEntity, "Player")) {
|
||||||
Events::PlayerDeath e;
|
Events::PlayerDeath e;
|
||||||
e.Player = EntityWrapper(m_World, localEntity);
|
e.Player = EntityWrapper(m_World, localEntity);
|
||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
@@ -297,8 +301,22 @@ void Client::parseDoubleJump(Packet & packet)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Client::parseDashEffect(Packet& packet)
|
||||||
|
{
|
||||||
|
EntityID serverID = packet.ReadPrimitive<EntityID>();
|
||||||
|
if (!serverClientMapsHasEntity(serverID)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Events::DashAbility e;
|
||||||
|
e.Player = m_ServerIDToClientID.at(serverID);
|
||||||
|
if (e.Player != m_LocalPlayer.ID) {
|
||||||
|
m_EventBroker->Publish(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Client::parseAmmoPickup(Packet & packet)
|
void Client::parseAmmoPickup(Packet & packet)
|
||||||
{
|
{
|
||||||
Events::AmmoPickup e;
|
Events::AmmoPickup e;
|
||||||
e.AmmoGain = packet.ReadPrimitive<int>();
|
e.AmmoGain = packet.ReadPrimitive<int>();
|
||||||
e.Player = m_LocalPlayer;
|
e.Player = m_LocalPlayer;
|
||||||
@@ -388,7 +406,7 @@ void Client::parseSnapshot(Packet& packet)
|
|||||||
if (m_SnapshotFilter != nullptr) {
|
if (m_SnapshotFilter != nullptr) {
|
||||||
shouldApply = m_SnapshotFilter->FilterComponent(localEntity, newComponent);
|
shouldApply = m_SnapshotFilter->FilterComponent(localEntity, newComponent);
|
||||||
}
|
}
|
||||||
if (shouldApply) {
|
if (shouldApply) {
|
||||||
ComponentWrapper currentComponent = m_World->GetComponent(localEntityID, componentType);
|
ComponentWrapper currentComponent = m_World->GetComponent(localEntityID, componentType);
|
||||||
memcpy(currentComponent.Data, newComponent.Data, componentInfo.Stride);
|
memcpy(currentComponent.Data, newComponent.Data, componentInfo.Stride);
|
||||||
}
|
}
|
||||||
@@ -518,6 +536,18 @@ bool Client::OnPlayerSpawned(const Events::PlayerSpawned& e)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Client::OnDashAbility(const Events::DashAbility& e)
|
||||||
|
{
|
||||||
|
if (!clientServerMapsHasEntity(e.Player) || e.Player != m_LocalPlayer.ID) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Packet packet(MessageType::OnDashEffect);
|
||||||
|
packet.WritePrimitive(m_ClientIDToServerID.at(e.Player));
|
||||||
|
m_Reliable.Send(packet);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool Client::OnSearchForServers(const Events::SearchForServers& e)
|
bool Client::OnSearchForServers(const Events::SearchForServers& e)
|
||||||
{
|
{
|
||||||
m_SearchingForServers = true;
|
m_SearchingForServers = true;
|
||||||
|
|||||||
@@ -141,6 +141,9 @@ void Server::parseMessageType(Packet& packet)
|
|||||||
case MessageType::OnDoubleJump:
|
case MessageType::OnDoubleJump:
|
||||||
parseDoubleJump(packet);
|
parseDoubleJump(packet);
|
||||||
break;
|
break;
|
||||||
|
case MessageType::OnDashEffect:
|
||||||
|
parseDashEffect(packet);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -555,6 +558,11 @@ bool Server::parseDoubleJump(Packet & packet)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Server::parseDashEffect(Packet& packet)
|
||||||
|
{
|
||||||
|
reliableBroadcast(packet);
|
||||||
|
}
|
||||||
|
|
||||||
void Server::parseOnInputCommand(Packet& packet)
|
void Server::parseOnInputCommand(Packet& packet)
|
||||||
{
|
{
|
||||||
PlayerID player = -1;
|
PlayerID player = -1;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ void FrameBuffer::Generate()
|
|||||||
}
|
}
|
||||||
GLERROR("3");
|
GLERROR("3");
|
||||||
|
|
||||||
GLenum* bufferTextures = &attachments[0];
|
GLenum* bufferTextures = attachments.data();
|
||||||
glDrawBuffers(attachments.size(), bufferTextures);
|
glDrawBuffers(attachments.size(), bufferTextures);
|
||||||
if (GLERROR("GLBufferAttachement error")) {
|
if (GLERROR("GLBufferAttachement error")) {
|
||||||
printf(": AttachmentSize %i", attachments.size());
|
printf(": AttachmentSize %i", attachments.size());
|
||||||
|
|||||||
+6
-5
@@ -10,7 +10,9 @@
|
|||||||
#include "Systems/SpawnerSystem.h"
|
#include "Systems/SpawnerSystem.h"
|
||||||
#include "Systems/PlayerSpawnSystem.h"
|
#include "Systems/PlayerSpawnSystem.h"
|
||||||
#include "Systems/PlayerDeathSystem.h"
|
#include "Systems/PlayerDeathSystem.h"
|
||||||
#include "Core/EntityFileWriter.h"
|
#include "Systems/FloatingEffectSystem.h"
|
||||||
|
#include "Core/EntityFile.h"
|
||||||
|
#include "Core/EntityXMLFileWriter.h"
|
||||||
#include "Game/Systems/CapturePointSystem.h"
|
#include "Game/Systems/CapturePointSystem.h"
|
||||||
#include "Game/Systems/CapturePointHUDSystem.h"
|
#include "Game/Systems/CapturePointHUDSystem.h"
|
||||||
#include "Game/Systems/PickupSpawnSystem.h"
|
#include "Game/Systems/PickupSpawnSystem.h"
|
||||||
@@ -44,6 +46,7 @@ Game::Game(int argc, char* argv[])
|
|||||||
ResourceManager::RegisterType<PNG>("Png");
|
ResourceManager::RegisterType<PNG>("Png");
|
||||||
ResourceManager::RegisterType<ShaderProgram>("ShaderProgram");
|
ResourceManager::RegisterType<ShaderProgram>("ShaderProgram");
|
||||||
ResourceManager::RegisterType<EntityFile>("EntityFile");
|
ResourceManager::RegisterType<EntityFile>("EntityFile");
|
||||||
|
ResourceManager::RegisterType<EntityXMLFile>("EntityXMLFile");
|
||||||
ResourceManager::RegisterType<Font>("FontFile");
|
ResourceManager::RegisterType<Font>("FontFile");
|
||||||
|
|
||||||
m_Config = ResourceManager::Load<ConfigFile>("Config.ini");
|
m_Config = ResourceManager::Load<ConfigFile>("Config.ini");
|
||||||
@@ -80,10 +83,7 @@ Game::Game(int argc, char* argv[])
|
|||||||
std::string mapToLoad = m_Config->Get<std::string>("Debug.LoadMap", "");
|
std::string mapToLoad = m_Config->Get<std::string>("Debug.LoadMap", "");
|
||||||
if (!mapToLoad.empty()) {
|
if (!mapToLoad.empty()) {
|
||||||
auto file = ResourceManager::Load<EntityFile>(mapToLoad);
|
auto file = ResourceManager::Load<EntityFile>(mapToLoad);
|
||||||
EntityFilePreprocessor fpp(file);
|
file->MergeInto(m_World);
|
||||||
fpp.RegisterComponents(m_World);
|
|
||||||
EntityFileParser fp(file);
|
|
||||||
fp.MergeEntities(m_World);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the sound manager
|
// Create the sound manager
|
||||||
@@ -120,6 +120,7 @@ Game::Game(int argc, char* argv[])
|
|||||||
++updateOrderLevel;
|
++updateOrderLevel;
|
||||||
m_SystemPipeline->AddSystem<SoundSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<SoundSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<RaptorCopterSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<RaptorCopterSystem>(updateOrderLevel);
|
||||||
|
m_SystemPipeline->AddSystem<FloatingEffectSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<ExplosionEffectSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<ExplosionEffectSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<HealthSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<HealthSystem>(updateOrderLevel);
|
||||||
m_SystemPipeline->AddSystem<PlayerMovementSystem>(updateOrderLevel);
|
m_SystemPipeline->AddSystem<PlayerMovementSystem>(updateOrderLevel);
|
||||||
|
|||||||
@@ -21,16 +21,15 @@ void AmmoPickupSystem::Update(double dt)
|
|||||||
somePickup.DecreaseThisRespawnTimer -= dt;
|
somePickup.DecreaseThisRespawnTimer -= dt;
|
||||||
if (somePickup.DecreaseThisRespawnTimer < 0.0) {
|
if (somePickup.DecreaseThisRespawnTimer < 0.0) {
|
||||||
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/AmmoPickup.xml");
|
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/AmmoPickup.xml");
|
||||||
EntityFileParser parser(entityFile);
|
EntityWrapper ammoPickup = entityFile->MergeInto(m_World);
|
||||||
EntityID ammoPickupID = parser.MergeEntities(m_World);
|
|
||||||
|
|
||||||
//let the world know a pickup has spawned
|
//let the world know a pickup has spawned
|
||||||
Events::PickupSpawned ePickupSpawned;
|
Events::PickupSpawned ePickupSpawned;
|
||||||
ePickupSpawned.Pickup = EntityWrapper(m_World, ammoPickupID);
|
ePickupSpawned.Pickup = ammoPickup;
|
||||||
m_EventBroker->Publish(ePickupSpawned);
|
m_EventBroker->Publish(ePickupSpawned);
|
||||||
|
|
||||||
//copy values from the old entity to the new entity
|
//copy values from the old entity to the new entity
|
||||||
auto& newAmmoPickupEntity = EntityWrapper(m_World, ammoPickupID);
|
auto& newAmmoPickupEntity = ammoPickup;
|
||||||
newAmmoPickupEntity["Transform"]["Position"] = somePickup.Pos;
|
newAmmoPickupEntity["Transform"]["Position"] = somePickup.Pos;
|
||||||
newAmmoPickupEntity["AmmoPickup"]["AmmoGain"] = somePickup.AmmoGain;
|
newAmmoPickupEntity["AmmoPickup"]["AmmoGain"] = somePickup.AmmoGain;
|
||||||
newAmmoPickupEntity["AmmoPickup"]["RespawnTimer"] = somePickup.RespawnTimer;
|
newAmmoPickupEntity["AmmoPickup"]["RespawnTimer"] = somePickup.RespawnTimer;
|
||||||
|
|||||||
@@ -39,10 +39,9 @@ bool BoostSystem::OnPlayerDamage(Events::PlayerDamage& e)
|
|||||||
}
|
}
|
||||||
//load boost XML file, set it entity parented with the victim player
|
//load boost XML file, set it entity parented with the victim player
|
||||||
auto entityFile = ResourceManager::Load<EntityFile>(classXML);
|
auto entityFile = ResourceManager::Load<EntityFile>(classXML);
|
||||||
EntityFileParser parser(entityFile);
|
EntityWrapper boostAssaultEntity = entityFile->MergeInto(m_World);
|
||||||
EntityID boostAssaultEntity = parser.MergeEntities(m_World);
|
m_World->SetName(boostAssaultEntity.ID, className);
|
||||||
m_World->SetName(boostAssaultEntity, className);
|
m_World->SetParent(boostAssaultEntity.ID, e.Victim.ID);
|
||||||
m_World->SetParent(boostAssaultEntity, e.Victim.ID);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ DamageIndicatorSystem::DamageIndicatorSystem(SystemParams params)
|
|||||||
|
|
||||||
//load texture to cache
|
//load texture to cache
|
||||||
auto texture = CommonFunctions::LoadTexture("Textures/DamageIndicator.png", false);
|
auto texture = CommonFunctions::LoadTexture("Textures/DamageIndicator.png", false);
|
||||||
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/DamageIndicator.xml");
|
auto entityFile = ResourceManager::Load<EntityXMLFile>("Schema/Entities/DamageIndicator.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DamageIndicatorSystem::Update(double dt) {
|
void DamageIndicatorSystem::Update(double dt) {
|
||||||
@@ -50,15 +50,13 @@ bool DamageIndicatorSystem::OnPlayerDamage(Events::PlayerDamage& e)
|
|||||||
|
|
||||||
//load & set the "2d" sprite
|
//load & set the "2d" sprite
|
||||||
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/DamageIndicator.xml");
|
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/DamageIndicator.xml");
|
||||||
EntityFileParser parser(entityFile);
|
EntityWrapper sprite = entityFile->MergeInto(m_World);
|
||||||
EntityID spriteID = parser.MergeEntities(m_World);
|
m_World->SetParent(sprite.ID, m_CurrentCamera);
|
||||||
m_World->SetParent(spriteID, m_CurrentCamera);
|
|
||||||
auto spriteWrapper = EntityWrapper(m_World, spriteID);
|
|
||||||
//simply set the rotation z-wise to the angleBetweenVectors
|
//simply set the rotation z-wise to the angleBetweenVectors
|
||||||
spriteWrapper["Transform"]["Orientation"] = glm::vec3(0, 0, angleBetweenVectors);
|
sprite["Transform"]["Orientation"] = glm::vec3(0, 0, angleBetweenVectors);
|
||||||
|
|
||||||
if (!IsServer) {
|
if (!IsServer) {
|
||||||
updateDamageIndicatorVector.emplace_back(spriteWrapper, inflictorPos);
|
updateDamageIndicatorVector.emplace_back(sprite, inflictorPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -127,8 +125,8 @@ glm::vec3 DamageIndicatorSystem::DamageIndicatorTest(EntityWrapper player) {
|
|||||||
auto inflictorPos = glm::vec3(currentPos.x + testVar*6.0f, currentPos.y, currentPos.z + testVar2*6.0f);
|
auto inflictorPos = glm::vec3(currentPos.x + testVar*6.0f, currentPos.y, currentPos.z + testVar2*6.0f);
|
||||||
|
|
||||||
//load the explosioneffect XML
|
//load the explosioneffect XML
|
||||||
auto deathEffect = ResourceManager::Load<EntityFile>("Schema/Entities/PlayerDeathExplosionWithCamera.xml");
|
auto deathEffect = ResourceManager::Load<EntityXMLFile>("Schema/Entities/PlayerDeathExplosionWithCamera.xml");
|
||||||
EntityFileParser parser(deathEffect);
|
EntityXMLFileParser parser(deathEffect);
|
||||||
EntityID deathEffectID = parser.MergeEntities(m_World);
|
EntityID deathEffectID = parser.MergeEntities(m_World);
|
||||||
EntityWrapper deathEffectEW = EntityWrapper(m_World, deathEffectID);
|
EntityWrapper deathEffectEW = EntityWrapper(m_World, deathEffectID);
|
||||||
|
|
||||||
|
|||||||
@@ -19,16 +19,15 @@ void PickupSpawnSystem::Update(double dt)
|
|||||||
if (somePickup.DecreaseThisRespawnTimer < 0.0) {
|
if (somePickup.DecreaseThisRespawnTimer < 0.0) {
|
||||||
//spawn the new healthPickup
|
//spawn the new healthPickup
|
||||||
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/HealthPickup.xml");
|
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/HealthPickup.xml");
|
||||||
EntityFileParser parser(entityFile);
|
EntityWrapper healthPickup = entityFile->MergeInto(m_World);
|
||||||
EntityID healthPickupID = parser.MergeEntities(m_World);
|
|
||||||
|
|
||||||
//let the world know a pickup has spawned (graphics effects, etc)
|
//let the world know a pickup has spawned (graphics effects, etc)
|
||||||
Events::PickupSpawned ePickupSpawned;
|
Events::PickupSpawned ePickupSpawned;
|
||||||
ePickupSpawned.Pickup = EntityWrapper(m_World, healthPickupID);
|
ePickupSpawned.Pickup = healthPickup;
|
||||||
m_EventBroker->Publish(ePickupSpawned);
|
m_EventBroker->Publish(ePickupSpawned);
|
||||||
|
|
||||||
//copy values from the old entity to the new entity
|
//copy values from the old entity to the new entity
|
||||||
auto& newHealthPickupEntity = EntityWrapper(m_World, healthPickupID);
|
auto& newHealthPickupEntity = healthPickup;
|
||||||
newHealthPickupEntity["Transform"]["Position"] = somePickup.Pos;
|
newHealthPickupEntity["Transform"]["Position"] = somePickup.Pos;
|
||||||
newHealthPickupEntity["HealthPickup"]["HealthGain"] = somePickup.HealthGain;
|
newHealthPickupEntity["HealthPickup"]["HealthGain"] = somePickup.HealthGain;
|
||||||
newHealthPickupEntity["HealthPickup"]["RespawnTimer"] = somePickup.RespawnTimer;
|
newHealthPickupEntity["HealthPickup"]["RespawnTimer"] = somePickup.RespawnTimer;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ PlayerDeathSystem::PlayerDeathSystem(SystemParams params)
|
|||||||
: System(params)
|
: System(params)
|
||||||
{
|
{
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_OnPlayerDeath, &PlayerDeathSystem::OnPlayerDeath);
|
EVENT_SUBSCRIBE_MEMBER(m_OnPlayerDeath, &PlayerDeathSystem::OnPlayerDeath);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EEntityDeleted, &PlayerDeathSystem::OnEntityDeleted);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerDeathSystem::Update(double dt)
|
void PlayerDeathSystem::Update(double dt)
|
||||||
@@ -27,10 +28,8 @@ bool PlayerDeathSystem::OnPlayerDeath(Events::PlayerDeath& e)
|
|||||||
void PlayerDeathSystem::createDeathEffect(EntityWrapper player)
|
void PlayerDeathSystem::createDeathEffect(EntityWrapper player)
|
||||||
{
|
{
|
||||||
//load the explosioneffect XML
|
//load the explosioneffect XML
|
||||||
auto deathEffect = ResourceManager::Load<EntityFile>("Schema/Entities/PlayerDeathExplosionWithCamera.xml");
|
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/PlayerDeathExplosionWithCamera.xml");
|
||||||
EntityFileParser parser(deathEffect);
|
EntityWrapper deathEffectEW = entityFile->MergeInto(m_World);
|
||||||
EntityID deathEffectID = parser.MergeEntities(m_World);
|
|
||||||
EntityWrapper deathEffectEW = EntityWrapper(m_World, deathEffectID);
|
|
||||||
|
|
||||||
//components that we need from player
|
//components that we need from player
|
||||||
auto playerModel = player.FirstChildByName("PlayerModel");
|
auto playerModel = player.FirstChildByName("PlayerModel");
|
||||||
@@ -59,9 +58,28 @@ void PlayerDeathSystem::createDeathEffect(EntityWrapper player)
|
|||||||
|
|
||||||
//camera (with lifetime) behind the player
|
//camera (with lifetime) behind the player
|
||||||
if (player == LocalPlayer) {
|
if (player == LocalPlayer) {
|
||||||
|
m_LocalPlayerDeathEffect = deathEffectEW;
|
||||||
auto cam = deathEffectEW.FirstChildByName("Camera");
|
auto cam = deathEffectEW.FirstChildByName("Camera");
|
||||||
Events::SetCamera eSetCamera;
|
Events::SetCamera eSetCamera;
|
||||||
eSetCamera.CameraEntity = cam;
|
eSetCamera.CameraEntity = cam;
|
||||||
m_EventBroker->Publish(eSetCamera);
|
m_EventBroker->Publish(eSetCamera);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PlayerDeathSystem::OnEntityDeleted(Events::EntityDeleted& e)
|
||||||
|
{
|
||||||
|
// We only care about when the local players death effect is removed.
|
||||||
|
if (m_LocalPlayerDeathEffect.ID != e.DeletedEntity) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Look for the spectator camera entity in the level.
|
||||||
|
EntityWrapper spectatorCam = m_World->GetFirstEntityByName("SpectatorCamera");
|
||||||
|
if (!spectatorCam.Valid() || !spectatorCam.HasComponent("Camera") || LocalPlayer.Valid()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Events::SetCamera eSetCamera;
|
||||||
|
eSetCamera.CameraEntity = spectatorCam;
|
||||||
|
m_EventBroker->Publish(eSetCamera);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ PlayerMovementSystem::PlayerMovementSystem(SystemParams params)
|
|||||||
{
|
{
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &PlayerMovementSystem::OnPlayerSpawned);
|
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &PlayerMovementSystem::OnPlayerSpawned);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EDoubleJump, &PlayerMovementSystem::OnDoubleJump);
|
EVENT_SUBSCRIBE_MEMBER(m_EDoubleJump, &PlayerMovementSystem::OnDoubleJump);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EDashAbility, &PlayerMovementSystem::OnDashAbility);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerMovementSystem::~PlayerMovementSystem()
|
PlayerMovementSystem::~PlayerMovementSystem()
|
||||||
@@ -72,7 +73,7 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
|
|||||||
ComponentWrapper cPhysics = player["Physics"];
|
ComponentWrapper cPhysics = player["Physics"];
|
||||||
//Assault Dash Check
|
//Assault Dash Check
|
||||||
if (player.HasComponent("DashAbility")) {
|
if (player.HasComponent("DashAbility")) {
|
||||||
controller->AssaultDashCheck(dt, ((glm::vec3)cPhysics["Velocity"]).y != 0.0f, player["DashAbility"]["CoolDownMaxTimer"], player["DashAbility"]["CoolDownTimer"]);
|
controller->AssaultDashCheck(dt, ((glm::vec3)cPhysics["Velocity"]).y != 0.0f, player["DashAbility"]["CoolDownMaxTimer"], player["DashAbility"]["CoolDownTimer"], player.ID);
|
||||||
}
|
}
|
||||||
wishDirection = controller->Movement() * glm::inverse(glm::quat(ori));
|
wishDirection = controller->Movement() * glm::inverse(glm::quat(ori));
|
||||||
//this makes sure you can only dash in the 4 directions: forw,backw,left,right
|
//this makes sure you can only dash in the 4 directions: forw,backw,left,right
|
||||||
@@ -313,11 +314,11 @@ bool PlayerMovementSystem::OnPlayerSpawned(Events::PlayerSpawned& e)
|
|||||||
bool PlayerMovementSystem::OnDoubleJump(Events::DoubleJump & e)
|
bool PlayerMovementSystem::OnDoubleJump(Events::DoubleJump & e)
|
||||||
{
|
{
|
||||||
// If entity does not exist, exit
|
// If entity does not exist, exit
|
||||||
if (!EntityWrapper(m_World, e.entityID).Valid()) {
|
if (!EntityWrapper(m_World, e.entityID).Valid()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// If entity IsLocalPlayer, exit
|
// If entity IsLocalPlayer, exit
|
||||||
if (e.entityID == m_LocalPlayer.ID) {
|
if (e.entityID == m_LocalPlayer.ID) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
spawnHexagon(EntityWrapper(m_World, e.entityID));
|
spawnHexagon(EntityWrapper(m_World, e.entityID));
|
||||||
@@ -325,11 +326,33 @@ bool PlayerMovementSystem::OnDoubleJump(Events::DoubleJump & e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PlayerMovementSystem::spawnHexagon(EntityWrapper target)
|
void PlayerMovementSystem::spawnHexagon(EntityWrapper target)
|
||||||
{
|
{
|
||||||
//put a hexagon at the entitys... feet?
|
//put a hexagon at the entitys... feet?
|
||||||
auto hexagonEffect = ResourceManager::Load<EntityFile>("Schema/Entities/DoubleJumpHexagon.xml");
|
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/DoubleJumpHexagon.xml");
|
||||||
EntityFileParser parser(hexagonEffect);
|
EntityWrapper hexagonEW = entityFile->MergeInto(m_World);
|
||||||
EntityID hexagonEffectID = parser.MergeEntities(m_World);
|
|
||||||
EntityWrapper hexagonEW = EntityWrapper(m_World, hexagonEffectID);
|
|
||||||
hexagonEW["Transform"]["Position"] = (glm::vec3)target["Transform"]["Position"];
|
hexagonEW["Transform"]["Position"] = (glm::vec3)target["Transform"]["Position"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PlayerMovementSystem::OnDashAbility(Events::DashAbility & e)
|
||||||
|
{
|
||||||
|
EntityWrapper player(m_World, e.Player);
|
||||||
|
if (!player.Valid() || !IsClient || player.ID == LocalPlayer.ID) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/DashEffect.xml");
|
||||||
|
EntityWrapper dashEffect = entityFile->MergeInto(m_World);
|
||||||
|
auto playerModel = player.FirstChildByName("PlayerModel");
|
||||||
|
auto playerEntityModel = playerModel["Model"];
|
||||||
|
auto playerEntityAnimation = playerModel["Animation"];
|
||||||
|
playerEntityModel.Copy(dashEffect["Model"]);
|
||||||
|
playerEntityAnimation.Copy(dashEffect["Animation"]);
|
||||||
|
dashEffect["ExplosionEffect"]["EndColor"] = (glm::vec4)playerEntityModel["Color"];
|
||||||
|
((glm::vec4&)dashEffect["ExplosionEffect"]["EndColor"]).w = 0.f;
|
||||||
|
dashEffect["Animation"]["Speed1"] = 0.0;
|
||||||
|
dashEffect["Animation"]["Speed2"] = 0.0;
|
||||||
|
dashEffect["Animation"]["Speed3"] = 0.0;
|
||||||
|
dashEffect["Transform"]["Position"] = (glm::vec3)player["Transform"]["Position"];
|
||||||
|
dashEffect["Transform"]["Orientation"] = (glm::vec3)player["Transform"]["Orientation"];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ PlayerSpawnSystem::PlayerSpawnSystem(SystemParams params)
|
|||||||
ConfigFile* config = ResourceManager::Load<ConfigFile>("Config.ini");
|
ConfigFile* config = ResourceManager::Load<ConfigFile>("Config.ini");
|
||||||
m_NetworkEnabled = config->Get("Networking.StartNetwork", false);
|
m_NetworkEnabled = config->Get("Networking.StartNetwork", false);
|
||||||
m_ForcedRespawnTime = config->Get("Debug.RespawnTime", -1.0f);
|
m_ForcedRespawnTime = config->Get("Debug.RespawnTime", -1.0f);
|
||||||
m_DbgConfigForceRespawn = m_ForcedRespawnTime > 0;
|
m_DbgConfigForceRespawn = m_ForcedRespawnTime > 0 && IsServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerSpawnSystem::Update(double dt)
|
void PlayerSpawnSystem::Update(double dt)
|
||||||
@@ -26,7 +26,21 @@ void PlayerSpawnSystem::Update(double dt)
|
|||||||
// Increase timer.
|
// Increase timer.
|
||||||
double& timer = (double&)modeComponent["RespawnTime"];
|
double& timer = (double&)modeComponent["RespawnTime"];
|
||||||
timer += dt;
|
timer += dt;
|
||||||
double maxRespawnTime = m_DbgConfigForceRespawn ? m_ForcedRespawnTime : (double)modeComponent["MaxRespawnTime"];
|
if (m_DbgConfigForceRespawn) {
|
||||||
|
(double&)modeComponent["MaxRespawnTime"] = m_ForcedRespawnTime;
|
||||||
|
}
|
||||||
|
double maxRespawnTime = (double)modeComponent["MaxRespawnTime"];
|
||||||
|
EntityWrapper spectatorCam = m_World->GetFirstEntityByName("SpectatorCamera");
|
||||||
|
if (spectatorCam.Valid()) {
|
||||||
|
EntityWrapper HUD = spectatorCam.FirstChildByName("SpectatorHUD");
|
||||||
|
if (HUD.Valid()) {
|
||||||
|
EntityWrapper respawnTimer = spectatorCam.FirstChildByName("RespawnTimer");
|
||||||
|
if (respawnTimer.Valid()) {
|
||||||
|
//Update respawn time in the HUD element.
|
||||||
|
respawnTimer["Text"]["Content"] = std::to_string(1 + (int)(maxRespawnTime - timer));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (timer < maxRespawnTime) {
|
if (timer < maxRespawnTime) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -54,7 +68,14 @@ void PlayerSpawnSystem::Update(double dt)
|
|||||||
|
|
||||||
// If the spawner has a team affiliation, check it
|
// If the spawner has a team affiliation, check it
|
||||||
if (spawner.HasComponent("Team")) {
|
if (spawner.HasComponent("Team")) {
|
||||||
if ((int)spawner["Team"]["Team"] != req.Team) {
|
auto cSpawnerTeam = spawner["Team"];
|
||||||
|
if ((int)cSpawnerTeam["Team"] != req.Team) {
|
||||||
|
// Increase num spawned players if someone picks spectator, since it is valid to pick spectator
|
||||||
|
// but don't spawn anything, goto next spawnrequest.
|
||||||
|
if (req.Team == (int)cSpawnerTeam["Team"].Enum("Spectator")) {
|
||||||
|
++numSpawnedPlayers;
|
||||||
|
break;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,9 +96,9 @@ void PlayerSpawnSystem::Update(double dt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (numSpawnedPlayers != (int)m_SpawnRequests.size()) {
|
if (numSpawnedPlayers != (int)m_SpawnRequests.size()) {
|
||||||
LOG_DEBUG("%i players were supposed to be spawned, but %i was spawned.", (int)m_SpawnRequests.size(), numSpawnedPlayers);
|
LOG_DEBUG("%i players were supposed to be spawned or set as spectator, but only %i was handled.", (int)m_SpawnRequests.size(), numSpawnedPlayers);
|
||||||
} else {
|
} else {
|
||||||
LOG_DEBUG("%i players were spawned.", numSpawnedPlayers);
|
LOG_DEBUG("%i players were spawned or set as spectator.", numSpawnedPlayers);
|
||||||
}
|
}
|
||||||
m_SpawnRequests.clear();
|
m_SpawnRequests.clear();
|
||||||
}
|
}
|
||||||
@@ -88,24 +109,29 @@ bool PlayerSpawnSystem::OnInputCommand(Events::InputCommand& e)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e.Value == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A dead client should be able to swap to the spectator camera.
|
||||||
|
if (IsClient && !LocalPlayer.Valid()) {
|
||||||
|
// Set the spectator camera as active, if it exists.
|
||||||
|
// Find the camera.
|
||||||
|
EntityWrapper spectatorCam = m_World->GetFirstEntityByName("SpectatorCamera");
|
||||||
|
if (spectatorCam.Valid() && spectatorCam.HasComponent("Camera")) {
|
||||||
|
Events::SetCamera eSetCamera;
|
||||||
|
eSetCamera.CameraEntity = spectatorCam;
|
||||||
|
m_EventBroker->Publish(eSetCamera);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Team picks should be processed ONLY server-side!
|
// Team picks should be processed ONLY server-side!
|
||||||
// Don't make a spawn request if we're the client.
|
// Don't make a spawn request if we're the client.
|
||||||
if (!IsServer && m_NetworkEnabled) {
|
if (!IsServer && m_NetworkEnabled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.Value == 0) {
|
// Check if the player already requested spawn.
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: Spectating?
|
|
||||||
//Right now, return if someone picks spectator.
|
|
||||||
//1 signifies spectator here, could not get Playerteam component since it may be invalid or without team comp.
|
|
||||||
if ((ComponentInfo::EnumType)e.Value == 1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Check if the player already requested spawn.
|
|
||||||
auto iter = m_SpawnRequests.begin();
|
auto iter = m_SpawnRequests.begin();
|
||||||
for (; iter != m_SpawnRequests.end(); ++iter) {
|
for (; iter != m_SpawnRequests.end(); ++iter) {
|
||||||
if (iter->PlayerID == e.PlayerID) {
|
if (iter->PlayerID == e.PlayerID) {
|
||||||
@@ -114,11 +140,11 @@ bool PlayerSpawnSystem::OnInputCommand(Events::InputCommand& e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (iter != m_SpawnRequests.end()) {
|
if (iter != m_SpawnRequests.end()) {
|
||||||
//If player is in queue to spawn, then change their team affiliation in the request.
|
// If player is in queue to spawn, then change their team affiliation in the request.
|
||||||
iter->Team = (ComponentInfo::EnumType)e.Value;
|
iter->Team = (ComponentInfo::EnumType)e.Value;
|
||||||
} else if (m_PlayerEntities.count(e.PlayerID) == 0 || !m_PlayerEntities[e.PlayerID].Valid()) {
|
} else if (m_PlayerEntities.count(e.PlayerID) == 0 || !m_PlayerEntities[e.PlayerID].Valid()) {
|
||||||
//If player is not in queue to spawn, then create a spawn request,
|
// If player is not in queue to spawn, then create a spawn request,
|
||||||
//but only if they are spectating and/or just connected.
|
// but only if they are spectating and/or just connected.
|
||||||
SpawnRequest req;
|
SpawnRequest req;
|
||||||
req.PlayerID = e.PlayerID;
|
req.PlayerID = e.PlayerID;
|
||||||
req.Team = (ComponentInfo::EnumType)e.Value;
|
req.Team = (ComponentInfo::EnumType)e.Value;
|
||||||
|
|||||||
@@ -17,15 +17,17 @@ EntityWrapper SpawnerSystem::Spawn(EntityWrapper spawner, EntityWrapper parent /
|
|||||||
|
|
||||||
// Load the entity file and parse it
|
// Load the entity file and parse it
|
||||||
const std::string& entityFilePath = spawner["Spawner"]["EntityFile"];
|
const std::string& entityFilePath = spawner["Spawner"]["EntityFile"];
|
||||||
auto entityFile = ResourceManager::Load<EntityFile>(entityFilePath);
|
EntityWrapper spawnedEntity;
|
||||||
if (entityFile == nullptr) {
|
try {
|
||||||
|
auto entityFile = ResourceManager::Load<EntityFile>(entityFilePath);
|
||||||
|
spawnedEntity = entityFile->MergeInto(world);
|
||||||
|
world->SetParent(spawnedEntity.ID, parent.ID);
|
||||||
|
} catch (const Resource::FailedLoadingException& e) {
|
||||||
return EntityWrapper::Invalid;
|
return EntityWrapper::Invalid;
|
||||||
}
|
}
|
||||||
EntityFileParser parser(entityFile);
|
|
||||||
EntityWrapper spawnedEntity(world, parser.MergeEntities(world, parent.ID));
|
|
||||||
|
|
||||||
//If the spawned entity is collideable, then we must not spawn it where it collides with something that
|
// If the spawned entity is collidable, then we must not spawn it where it collides with something that
|
||||||
//has a dontCollideComponent attached.
|
// has a dontCollideComponent attached.
|
||||||
bool spawnOnCollidable = dontCollideComponent.empty() || !spawnedEntity.HasComponent("Collidable");
|
bool spawnOnCollidable = dontCollideComponent.empty() || !spawnedEntity.HasComponent("Collidable");
|
||||||
if (!spawnOnCollidable) {
|
if (!spawnOnCollidable) {
|
||||||
boost::optional<EntityAABB> optBox = Collision::EntityAbsoluteAABB(spawnedEntity);
|
boost::optional<EntityAABB> optBox = Collision::EntityAbsoluteAABB(spawnedEntity);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ using boost::unit_test_framework::test_case;
|
|||||||
|
|
||||||
#include "Collision/TriggerSystem.h"
|
#include "Collision/TriggerSystem.h"
|
||||||
#include "Collision/CollisionSystem.h"
|
#include "Collision/CollisionSystem.h"
|
||||||
#include "Core/EntityFileWriter.h"
|
#include "Core/EntityXMLFileWriter.h"
|
||||||
#include "Game/Systems/CapturePointSystem.h"
|
#include "Game/Systems/CapturePointSystem.h"
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE(CapturePointTestSuite)
|
BOOST_AUTO_TEST_SUITE(CapturePointTestSuite)
|
||||||
@@ -82,7 +82,7 @@ bool CapturePointTest::CapturePoint_Game_Loop_OneHundredTimes() {
|
|||||||
CapturePointTest::CapturePointTest(int runTestNumber)
|
CapturePointTest::CapturePointTest(int runTestNumber)
|
||||||
{
|
{
|
||||||
ResourceManager::RegisterType<ConfigFile>("ConfigFile");
|
ResourceManager::RegisterType<ConfigFile>("ConfigFile");
|
||||||
ResourceManager::RegisterType<EntityFile>("EntityFile");
|
ResourceManager::RegisterType<EntityXMLFile>("EntityFile");
|
||||||
|
|
||||||
m_Config = ResourceManager::Load<ConfigFile>("Config.ini");
|
m_Config = ResourceManager::Load<ConfigFile>("Config.ini");
|
||||||
LOG_LEVEL = static_cast<_LOG_LEVEL>(m_Config->Get<int>("Debug.LogLevel", 1));
|
LOG_LEVEL = static_cast<_LOG_LEVEL>(m_Config->Get<int>("Debug.LogLevel", 1));
|
||||||
@@ -99,10 +99,10 @@ CapturePointTest::CapturePointTest(int runTestNumber)
|
|||||||
m_SystemPipeline->AddSystem<CapturePointSystem>(1);
|
m_SystemPipeline->AddSystem<CapturePointSystem>(1);
|
||||||
|
|
||||||
//must register components (Components.xsd), else you cant create entities. Easiest done by loading a test xsd file
|
//must register components (Components.xsd), else you cant create entities. Easiest done by loading a test xsd file
|
||||||
auto file = ResourceManager::Load<EntityFile>("Schema/Entities/TeamTest.xml");
|
auto file = ResourceManager::Load<EntityXMLFile>("Schema/Entities/TeamTest.xml");
|
||||||
EntityFilePreprocessor fpp(file);
|
EntityXMLFilePreprocessor fpp(file);
|
||||||
fpp.RegisterComponents(m_World);
|
fpp.RegisterComponents(m_World);
|
||||||
EntityFileParser fp(file);
|
EntityXMLFileParser fp(file);
|
||||||
fp.MergeEntities(m_World);
|
fp.MergeEntities(m_World);
|
||||||
|
|
||||||
EntityID playerID = m_World->CreateEntity();
|
EntityID playerID = m_World->CreateEntity();
|
||||||
|
|||||||
@@ -9,12 +9,12 @@
|
|||||||
#include "Input/KeyboardInputHandler.h"
|
#include "Input/KeyboardInputHandler.h"
|
||||||
#include "Input/MouseInputHandler.h"
|
#include "Input/MouseInputHandler.h"
|
||||||
#include "Core/EKeyDown.h"
|
#include "Core/EKeyDown.h"
|
||||||
#include "Core/EntityFile.h"
|
#include "Core/EntityXMLFile.h"
|
||||||
#include "Core/SystemPipeline.h"
|
#include "Core/SystemPipeline.h"
|
||||||
|
|
||||||
#include "Core/EntityFilePreprocessor.h"
|
#include "Core/EntityXMLFilePreprocessor.h"
|
||||||
#include "Core/EntityFileParser.h"
|
#include "Core/EntityXMLFileParser.h"
|
||||||
#include "Core/EntityFileWriter.h"
|
#include "Core/EntityXMLFileWriter.h"
|
||||||
|
|
||||||
#include "Engine/Collision/ETrigger.h"
|
#include "Engine/Collision/ETrigger.h"
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ BOOST_AUTO_TEST_SUITE_END()
|
|||||||
GameHealthSystemTest::GameHealthSystemTest()
|
GameHealthSystemTest::GameHealthSystemTest()
|
||||||
{
|
{
|
||||||
ResourceManager::RegisterType<ConfigFile>("ConfigFile");
|
ResourceManager::RegisterType<ConfigFile>("ConfigFile");
|
||||||
ResourceManager::RegisterType<EntityFile>("EntityFile");
|
ResourceManager::RegisterType<EntityXMLFile>("EntityFile");
|
||||||
|
|
||||||
m_Config = ResourceManager::Load<ConfigFile>("Config.ini");
|
m_Config = ResourceManager::Load<ConfigFile>("Config.ini");
|
||||||
LOG_LEVEL = static_cast<_LOG_LEVEL>(m_Config->Get<int>("Debug.LogLevel", 1));
|
LOG_LEVEL = static_cast<_LOG_LEVEL>(m_Config->Get<int>("Debug.LogLevel", 1));
|
||||||
@@ -41,10 +41,10 @@ GameHealthSystemTest::GameHealthSystemTest()
|
|||||||
// Create a world
|
// Create a world
|
||||||
m_World = new World();
|
m_World = new World();
|
||||||
|
|
||||||
auto file = ResourceManager::Load<EntityFile>("Schema/Entities/TeamTest.xml");
|
auto file = ResourceManager::Load<EntityXMLFile>("Schema/Entities/TeamTest.xml");
|
||||||
EntityFilePreprocessor fpp(file);
|
EntityXMLFilePreprocessor fpp(file);
|
||||||
fpp.RegisterComponents(m_World);
|
fpp.RegisterComponents(m_World);
|
||||||
EntityFileParser fp(file);
|
EntityXMLFileParser fp(file);
|
||||||
fp.MergeEntities(m_World);
|
fp.MergeEntities(m_World);
|
||||||
|
|
||||||
// Create system pipeline
|
// Create system pipeline
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include "Input/KeyboardInputHandler.h"
|
#include "Input/KeyboardInputHandler.h"
|
||||||
#include "Input/MouseInputHandler.h"
|
#include "Input/MouseInputHandler.h"
|
||||||
#include "Core/EKeyDown.h"
|
#include "Core/EKeyDown.h"
|
||||||
#include "Core/EntityFile.h"
|
#include "Core/EntityXMLFile.h"
|
||||||
#include "Core/SystemPipeline.h"
|
#include "Core/SystemPipeline.h"
|
||||||
#include "Editor/EditorSystem.h"
|
#include "Editor/EditorSystem.h"
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ BOOST_AUTO_TEST_SUITE_END()
|
|||||||
PickupSpawnTest::PickupSpawnTest(int runTestNumber)
|
PickupSpawnTest::PickupSpawnTest(int runTestNumber)
|
||||||
{
|
{
|
||||||
ResourceManager::RegisterType<ConfigFile>("ConfigFile");
|
ResourceManager::RegisterType<ConfigFile>("ConfigFile");
|
||||||
ResourceManager::RegisterType<EntityFile>("EntityFile");
|
ResourceManager::RegisterType<EntityXMLFile>("EntityFile");
|
||||||
|
|
||||||
m_Config = ResourceManager::Load<ConfigFile>("Config.ini");
|
m_Config = ResourceManager::Load<ConfigFile>("Config.ini");
|
||||||
LOG_LEVEL = static_cast<_LOG_LEVEL>(m_Config->Get<int>("Debug.LogLevel", 1));
|
LOG_LEVEL = static_cast<_LOG_LEVEL>(m_Config->Get<int>("Debug.LogLevel", 1));
|
||||||
@@ -44,10 +44,10 @@ PickupSpawnTest::PickupSpawnTest(int runTestNumber)
|
|||||||
m_SystemPipeline->AddSystem<PickupSpawnSystem>(1);
|
m_SystemPipeline->AddSystem<PickupSpawnSystem>(1);
|
||||||
|
|
||||||
//must register components (Components.xsd), else you cant create entities. Easiest done by loading a test xsd file
|
//must register components (Components.xsd), else you cant create entities. Easiest done by loading a test xsd file
|
||||||
auto file = ResourceManager::Load<EntityFile>("Schema/Entities/HealthPickup.xml");
|
auto file = ResourceManager::Load<EntityXMLFile>("Schema/Entities/HealthPickup.xml");
|
||||||
EntityFilePreprocessor fpp(file);
|
EntityXMLFilePreprocessor fpp(file);
|
||||||
fpp.RegisterComponents(m_World);
|
fpp.RegisterComponents(m_World);
|
||||||
EntityFileParser fp(file);
|
EntityXMLFileParser fp(file);
|
||||||
//connect the healthpickup to the world
|
//connect the healthpickup to the world
|
||||||
m_HealthPickupID = fp.MergeEntities(m_World);
|
m_HealthPickupID = fp.MergeEntities(m_World);
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,12 @@
|
|||||||
#include "Input/KeyboardInputHandler.h"
|
#include "Input/KeyboardInputHandler.h"
|
||||||
#include "Input/MouseInputHandler.h"
|
#include "Input/MouseInputHandler.h"
|
||||||
#include "Core/EKeyDown.h"
|
#include "Core/EKeyDown.h"
|
||||||
#include "Core/EntityFile.h"
|
#include "Core/EntityXMLFile.h"
|
||||||
#include "Core/SystemPipeline.h"
|
#include "Core/SystemPipeline.h"
|
||||||
|
|
||||||
#include "Core/EntityFilePreprocessor.h"
|
#include "Core/EntityXMLFilePreprocessor.h"
|
||||||
#include "Core/EntityFileParser.h"
|
#include "Core/EntityXMLFileParser.h"
|
||||||
#include "Core/EntityFileWriter.h"
|
#include "Core/EntityXMLFileWriter.h"
|
||||||
|
|
||||||
#include "Engine/Collision/ETrigger.h"
|
#include "Engine/Collision/ETrigger.h"
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
//#include <tuple>
|
//#include <tuple>
|
||||||
#include "Collision/TriggerSystem.h"
|
#include "Collision/TriggerSystem.h"
|
||||||
#include "Collision/CollisionSystem.h"
|
#include "Collision/CollisionSystem.h"
|
||||||
#include "Core/EntityFileWriter.h"
|
#include "Core/EntityXMLFileWriter.h"
|
||||||
#include "Game/Systems/HealthSystem.h"
|
#include "Game/Systems/HealthSystem.h"
|
||||||
#include "Game/Systems/PickupSpawnSystem.h"
|
#include "Game/Systems/PickupSpawnSystem.h"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user