Converter now adds a Dummy-Trigger to the xml. Copy and customize it in the Levelx.xml to create actual triggers.

This commit is contained in:
Steffen Fündgens 2014-12-12 17:18:31 +01:00
parent 8a7f7da0a8
commit b4e9218e95
2 changed files with 48 additions and 0 deletions

View File

@ -150,3 +150,16 @@
<skydome>
<texture>skydome.png</texture>
</skydome>
<trigger>
<name>-</name>
<xPosition>0.0</xPosition>
<yPosition>0.0</yPosition>
<zPosition>0.0</zPosition>
<distance>1.0</distance>
<isBiggerThan>false</isBiggerThan>
<idGreen>0</idGreen>
<idBlue>0</idBlue>
<objectNum>1</objectNum>
<functionPointer>-</functionPointer>
</trigger>

View File

@ -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<XMLElement*> 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;