git-svn-id: svn://svn.icculus.org/netradiant/trunk@1 61c419a2-8eb2-4b30-bcec-8cead039b335
This commit is contained in:
rpolzer
2008-09-13 18:28:57 +00:00
commit 107765f0e4
1687 changed files with 438695 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
; mapxml.def : Declares the module parameters for the DLL.
LIBRARY "MAPXML"
EXPORTS
; Explicit exports can go here
Radiant_RegisterModules @1

View File

@@ -0,0 +1,295 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="mapxml"
ProjectGUID="{B43DBA9D-6EE0-421C-83D9-9776064B66B4}"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include;../../libs;&quot;../../../STLPort-4.6/stlport&quot;;&quot;../../../gtk2-2.10/include/glib-2.0&quot;;&quot;../../../gtk2-2.10/lib/glib-2.0/include&quot;;&quot;../../../gtk2-2.10/include&quot;;&quot;../../../libxml2-2.6/include&quot;"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;_USRDLL;MAPXML_EXPORTS"
StringPooling="true"
MinimalRebuild="true"
ExceptionHandling="0"
BasicRuntimeChecks="0"
RuntimeLibrary="3"
BufferSecurityCheck="false"
ForceConformanceInForLoopScope="true"
UsePrecompiledHeader="0"
BrowseInformation="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4610;4510;4512;4505;4100;4127"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libxml2.lib glib-2.0.lib"
OutputFile="$(OutDir)/mapxml.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="&quot;../../../libxml2-2.6/lib&quot;;&quot;../../../gtk2-2.10/lib&quot;"
IgnoreDefaultLibraryNames="msvcprtd.lib"
ModuleDefinitionFile="$(ProjectName).def"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(ProjectName).pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/mapxml.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)install\modules&quot;&#x0D;&#x0A;copy &quot;$(TargetDir)$(TargetName).pdb&quot; &quot;$(SolutionDir)install\modules&quot;&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="../../include;../../libs;&quot;../../../STLPort-4.6/stlport&quot;;&quot;../../../gtk2-2.10/include/glib-2.0&quot;;&quot;../../../gtk2-2.10/lib/glib-2.0/include&quot;;&quot;../../../gtk2-2.10/include&quot;;&quot;../../../libxml2-2.6/include&quot;"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;_USRDLL;MAPXML_EXPORTS"
StringPooling="true"
ExceptionHandling="0"
RuntimeLibrary="2"
BufferSecurityCheck="false"
ForceConformanceInForLoopScope="true"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4610;4510;4512;4505;4100;4127"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libxml2.lib glib-2.0.lib"
OutputFile="$(OutDir)/mapxml.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="&quot;../../../libxml2-2.6/lib&quot;;&quot;../../../gtk2-2.10/lib&quot;"
IgnoreDefaultLibraryNames="msvcprt.lib"
ModuleDefinitionFile="$(ProjectName).def"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/$(ProjectName).pdb"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/mapxml.lib"
TargetMachine="1"
FixedBaseAddress="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)install\modules&quot;&#x0D;&#x0A;copy &quot;$(TargetDir)$(TargetName).pdb&quot; &quot;$(SolutionDir)install\modules&quot;&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="src"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\plugin.cpp"
>
</File>
<File
RelativePath=".\plugin.h"
>
</File>
<Filter
Name="modules"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\xmlparse.cpp"
>
</File>
<File
RelativePath=".\xmlparse.h"
>
</File>
<File
RelativePath=".\xmlwrite.cpp"
>
</File>
<File
RelativePath=".\xmlwrite.h"
>
</File>
</Filter>
</Filter>
<File
RelativePath="..\..\debug.py"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="python &quot;$(SolutionDir)debug.py&quot;&#x0D;&#x0A;"
AdditionalDependencies="&quot;$(SolutionDir)install\modules\$(TargetName).pdb&quot;"
Outputs="&quot;$(TargetDir)$(TargetName).pdb&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="python &quot;$(SolutionDir)debug.py&quot;&#x0D;&#x0A;"
AdditionalDependencies="&quot;$(SolutionDir)install\modules\$(TargetName).pdb&quot;"
Outputs="&quot;$(TargetDir)$(TargetName).pdb&quot;"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\mapxml.def"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="python &quot;$(SolutionDir)touch.py&quot; &quot;$(TargetPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="&quot;$(SolutionDir)install\modules\$(TargetFileName)&quot;"
Outputs="&quot;$(TargetPath)&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="python &quot;$(SolutionDir)touch.py&quot; &quot;$(TargetPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="&quot;$(SolutionDir)install\modules\$(TargetFileName)&quot;"
Outputs="&quot;$(TargetPath)&quot;"
/>
</FileConfiguration>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

107
plugins/mapxml/plugin.cpp Normal file
View File

@@ -0,0 +1,107 @@
/*
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "plugin.h"
#include "ibrush.h"
#include "ipatch.h"
#include "ifiletypes.h"
#include "ieclass.h"
#include "qerplugin.h"
#include "modulesystem/singletonmodule.h"
#include "typesystem.h"
#include "xmlparse.h"
#include "xmlwrite.h"
class MapXMLDependencies :
public GlobalRadiantModuleRef,
public GlobalBrushModuleRef,
public GlobalFiletypesModuleRef,
public GlobalEntityClassManagerModuleRef,
public GlobalSceneGraphModuleRef
{
PatchModuleRef m_patchDef2Doom3Module;
PatchModuleRef m_patchDoom3Module;
public:
MapXMLDependencies() :
GlobalBrushModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("brushtypes")),
GlobalEntityClassManagerModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("entityclass")),
m_patchDef2Doom3Module("def2doom3"),
m_patchDoom3Module("doom3")
{
}
BrushCreator& getBrushDoom3()
{
return GlobalBrushModule::getTable();
}
PatchCreator& getPatchDoom3()
{
return *m_patchDoom3Module.getTable();
}
PatchCreator& getPatchDef2Doom3()
{
return *m_patchDef2Doom3Module.getTable();
}
};
class MapXMLAPI : public TypeSystemRef, public MapFormat
{
public:
typedef MapFormat Type;
STRING_CONSTANT(Name, "xmldoom3");
MapXMLAPI()
{
GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("xml doom3 maps", "*.xmap"));
}
MapFormat* getTable()
{
return this;
}
void readGraph(scene::Node& root, TextInputStream& inputStream, EntityCreator& entityTable) const
{
Map_Read(root, inputStream, entityTable);
}
void writeGraph(scene::Node& root, GraphTraversalFunc traverse, TextOutputStream& outputStream) const
{
Map_Write(root, traverse, outputStream);
}
};
typedef SingletonModule<MapXMLAPI, MapXMLDependencies> MapXMLModule;
MapXMLModule g_MapXMLModule;
extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer& server)
{
GlobalErrorStream::instance().setOutputStream(server.getErrorStream());
GlobalOutputStream::instance().setOutputStream(server.getOutputStream());
GlobalDebugMessageHandler::instance().setHandler(server.getDebugMessageHandler());
GlobalModuleServer::instance().set(server);
g_MapXMLModule.selfRegister();
}

25
plugins/mapxml/plugin.h Normal file
View File

@@ -0,0 +1,25 @@
/*
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if !defined(INCLUDED_PLUGIN_H)
#define INCLUDED_PLUGIN_H
#endif

277
plugins/mapxml/xmlparse.cpp Normal file
View File

@@ -0,0 +1,277 @@
/*
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
//
// parses xml tree format into internal objects
//
#include "xmlparse.h"
#include <vector>
#include "ientity.h"
#include "ibrush.h"
#include "ipatch.h"
#include "ieclass.h"
#include "eclasslib.h"
#include "xml/xmlparser.h"
#include "scenelib.h"
#include "generic/reference.h"
#include "generic/object.h"
#define PARSE_ERROR "XML PARSE ERROR"
inline XMLImporter* Node_getXMLImporter(scene::Node& node)
{
return NodeTypeCast<XMLImporter>::cast(node);
}
scene::Node& createPrimitive(const char* name)
{
if(string_equal(name, "brush"))
{
return GlobalBrushCreator().createBrush();
}
else if(string_equal(name, "patch"))
{
return GlobalPatchCreator().createPatch();
}
ASSERT_MESSAGE(0, PARSE_ERROR << ": primitive type not supported: \"" << name << "\"\n");
scene::Node* node = 0;
return *node;
}
class TreeXMLImporter : public XMLImporter
{
public:
virtual TreeXMLImporter& child() = 0;
};
class SubPrimitiveImporter : public TreeXMLImporter
{
XMLImporter* m_importer;
public:
SubPrimitiveImporter(XMLImporter* importer) : m_importer(importer)
{
}
void pushElement(const XMLElement& element)
{
m_importer->pushElement(element);
}
void popElement(const char* name)
{
m_importer->popElement(name);
}
std::size_t write(const char* buffer, std::size_t length)
{
return m_importer->write(buffer, length);
}
SubPrimitiveImporter& child()
{
return *this;
}
};
class PrimitiveImporter : public TreeXMLImporter
{
scene::Node& m_parent;
XMLImporter* m_importer;
char m_child[sizeof(SubPrimitiveImporter)];
SubPrimitiveImporter& subprimitive()
{
return *reinterpret_cast<SubPrimitiveImporter*>(m_child);
}
public:
PrimitiveImporter(scene::Node& parent) : m_parent(parent), m_importer(0)
{
}
void pushElement(const XMLElement& element)
{
if(string_equal(element.name(), "epair"))
{
ASSERT_MESSAGE(string_equal(element.name(), "epair"), PARSE_ERROR);
Node_getEntity(m_parent)->setKeyValue(element.attribute("key"), element.attribute("value"));
}
else
{
NodeSmartReference node(createPrimitive(element.name()));
m_importer = Node_getXMLImporter(node);
constructor(subprimitive(), m_importer);
m_importer->pushElement(element);
Node_getTraversable(m_parent)->insert(node);
}
}
void popElement(const char* name)
{
if(string_equal(name, "epair"))
{
}
else
{
m_importer->popElement(name);
destructor(subprimitive());
m_importer = 0;
}
}
std::size_t write(const char* buffer, std::size_t length)
{
return m_importer->write(buffer, length);
}
TreeXMLImporter& child()
{
return subprimitive();
}
};
class EntityImporter : public TreeXMLImporter
{
scene::Node& m_parent;
char m_node[sizeof(NodeSmartReference)];
char m_child[sizeof(PrimitiveImporter)];
EntityCreator& m_entityTable;
NodeSmartReference& node()
{
return *reinterpret_cast<NodeSmartReference*>(m_node);
}
PrimitiveImporter& primitive()
{
return *reinterpret_cast<PrimitiveImporter*>(m_child);
}
public:
EntityImporter(scene::Node& parent, EntityCreator& entityTable) : m_parent(parent), m_entityTable(entityTable)
{
}
void pushElement(const XMLElement& element)
{
ASSERT_MESSAGE(string_equal(element.name(), "entity"), PARSE_ERROR);
constructor(node(), NodeSmartReference(m_entityTable.createEntity(GlobalEntityClassManager().findOrInsert("", true))));
constructor(primitive(), makeReference(node().get()));
}
void popElement(const char* name)
{
ASSERT_MESSAGE(string_equal(name, "entity"), PARSE_ERROR);
NodeSmartReference entity(m_entityTable.createEntity(GlobalEntityClassManager().findOrInsert(Node_getEntity(node())->getKeyValue("classname"), node_is_group(node()))));
{
EntityCopyingVisitor visitor(*Node_getEntity(entity));
Node_getEntity(node())->forEachKeyValue(visitor);
}
if(Node_getTraversable(entity) != 0 && !Node_getEntity(entity)->getEntityClass().fixedsize)
{
parentBrushes(node(), entity);
}
Node_getTraversable(m_parent)->insert(entity);
destructor(primitive());
destructor(node());
}
std::size_t write(const char* buffer, std::size_t length)
{
return length;
}
TreeXMLImporter& child()
{
return primitive();
}
};
class MapDoom3Importer : public TreeXMLImporter
{
scene::Node& m_root;
char m_child[sizeof(EntityImporter)];
EntityCreator& m_entityTable;
EntityImporter& getEntity()
{
return *reinterpret_cast<EntityImporter*>(m_child);
}
public:
MapDoom3Importer(scene::Node& root, EntityCreator& entityTable) : m_root(root), m_entityTable(entityTable)
{
}
void pushElement(const XMLElement& element)
{
ASSERT_MESSAGE(string_equal(element.name(), "mapdoom3"), PARSE_ERROR);
constructor(getEntity(), makeReference(m_root), makeReference(m_entityTable));
}
void popElement(const char* name)
{
ASSERT_MESSAGE(string_equal(name, "mapdoom3"), PARSE_ERROR);
destructor(getEntity());
}
std::size_t write(const char* data, std::size_t length)
{
return length;
}
TreeXMLImporter& child()
{
return getEntity();
}
};
class TreeXMLImporterStack : public XMLImporter
{
std::vector< Reference<TreeXMLImporter> > m_importers;
public:
TreeXMLImporterStack(TreeXMLImporter& importer)
{
m_importers.push_back(makeReference(importer));
}
void pushElement(const XMLElement& element)
{
m_importers.back().get().pushElement(element);
m_importers.push_back(makeReference(m_importers.back().get().child()));
}
void popElement(const char* name)
{
m_importers.pop_back();
m_importers.back().get().popElement(name);
}
std::size_t write(const char* buffer, std::size_t length)
{
return (*(m_importers.end() - 2)).get().write(buffer, length);
}
};
void Map_Read(scene::Node& root, TextInputStream& in, EntityCreator& entityTable)
{
XMLStreamParser parser(in);
MapDoom3Importer importer(root, entityTable);
TreeXMLImporterStack stack(importer);
parser.exportXML(stack);
}

29
plugins/mapxml/xmlparse.h Normal file
View File

@@ -0,0 +1,29 @@
/*
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if !defined(INCLUDED_XMLPARSE_H)
#define INCLUDED_XMLPARSE_H
#include "imap.h"
void Map_Read(scene::Node& root, TextInputStream& in, EntityCreator& entityTable);
#endif

View File

@@ -0,0 +1,91 @@
/*
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
//
// writes xml tree format from internal objects
//
#include "xmlwrite.h"
#include "xml/xmlwriter.h"
#include "scenelib.h"
#include "entityxml.h"
inline XMLExporter* Node_getXMLExporter(scene::Node& node)
{
return NodeTypeCast<XMLExporter>::cast(node);
}
class write_all : public scene::Traversable::Walker
{
XMLImporter& m_importer;
public:
write_all(XMLImporter& importer) : m_importer(importer)
{
}
bool pre(scene::Node& node) const
{
Entity* entity = Node_getEntity(node);
if(entity != 0)
{
m_importer.write("\n", 1);
StaticElement element("entity");
m_importer.pushElement(element);
entity_export exporter(*entity);
exporter.exportXML(m_importer);
}
else
{
XMLExporter* exporter = Node_getXMLExporter(node);
if(exporter != 0)
{
m_importer.write("\n", 1);
exporter->exportXML(m_importer);
m_importer.write("\n", 1);
}
}
return true;
}
void post(scene::Node& node) const
{
if(Node_getEntity(node) != 0)
{
m_importer.write("\n", 1);
m_importer.popElement("entity");
}
}
};
void Map_Write(scene::Node& root, GraphTraversalFunc traverse, TextOutputStream& out)
{
XMLStreamWriter writer(out);
writer.write("\n", 1);
{
StaticElement element("mapdoom3");
writer.pushElement(element);
traverse(root, write_all(writer));
writer.write("\n", 1);
writer.popElement(element.name());
}
}

29
plugins/mapxml/xmlwrite.h Normal file
View File

@@ -0,0 +1,29 @@
/*
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if !defined(INCLUDED_XMLWRITE_H)
#define INCLUDED_XMLWRITE_H
#include "imap.h"
void Map_Write(scene::Node& root, GraphTraversalFunc traverse, TextOutputStream& out);
#endif