From c406bd4b62efd59fd99ff75167c92290cabc728e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20F=C3=BCndgens?= Date: Fri, 12 Dec 2014 17:18:31 +0100 Subject: [PATCH] Converter now adds a Dummy-Trigger to the xml. Copy and customize it in the Levelx.xml to create actual triggers. --- Levels/ObjectSetups/Level0.xml | 13 +++++++++++++ converter/converter.cc | 35 ++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/Levels/ObjectSetups/Level0.xml b/Levels/ObjectSetups/Level0.xml index a93a3fa..5aaea86 100644 --- a/Levels/ObjectSetups/Level0.xml +++ b/Levels/ObjectSetups/Level0.xml @@ -150,3 +150,16 @@ skydome.png + + + - + 0.0 + 0.0 + 0.0 + 1.0 + false + 0 + 0 + 1 + - + diff --git a/converter/converter.cc b/converter/converter.cc index 0394a73..725f2d4 100644 --- a/converter/converter.cc +++ b/converter/converter.cc @@ -39,6 +39,7 @@ Converter::Converter(std::string level){ doc->LoadFile(charXmlFile); if (doc->ErrorID()!=0){ printf("Could not open xml, creating new xml.\n"); + //Create all global Elements with Dummy-Values std::vector lightAttributes; lightAttributes.push_back(doc->NewElement("xOffset")); lightAttributes.push_back(doc->NewElement("yOffset")); @@ -94,6 +95,40 @@ Converter::Converter(std::string level){ doc->InsertEndChild(fogColour); doc->InsertEndChild(directionalLight); doc->InsertEndChild(skydome); + + //Create a Dummy-trigger + XMLElement* trigger = doc->NewElement("trigger"); + doc->InsertEndChild(trigger); + XMLElement* name = doc->NewElement("name"); + XMLElement* xPosition = doc->NewElement("xPosition"); + XMLElement* yPosition = doc->NewElement("yPosition"); + XMLElement* zPosition = doc->NewElement("zPosition"); + XMLElement* distance = doc->NewElement("distance"); + XMLElement* isBiggerThan = doc->NewElement("isBiggerThan"); + XMLElement* idGreen = doc->NewElement("idGreen"); + XMLElement* idBlue = doc->NewElement("idBlue"); + XMLElement* objectNum = doc->NewElement("objectNum"); + XMLElement* functionPointer = doc->NewElement("functionPointer"); + name->SetText("-"); + xPosition->SetText("0.0"); + yPosition->SetText("0.0"); + zPosition->SetText("0.0"); + distance->SetText("1.0"); + isBiggerThan->SetText("false"); + idGreen->SetText("0"); + idBlue->SetText("0"); + objectNum->SetText("1"); + functionPointer->SetText("-"); + trigger->InsertEndChild(name); + trigger->InsertEndChild(xPosition); + trigger->InsertEndChild(yPosition); + trigger->InsertEndChild(zPosition); + trigger->InsertEndChild(distance); + trigger->InsertEndChild(isBiggerThan); + trigger->InsertEndChild(idGreen); + trigger->InsertEndChild(idBlue); + trigger->InsertEndChild(objectNum); + trigger->InsertEndChild(functionPointer); }else{ XMLElement* thisComposition = doc->FirstChildElement("composition"); int idGreen, idBlue;