Moved C++ tools out
This commit is contained in:
50
archive/dawntools/vnscenetool/VNSceneParser.cpp
Normal file
50
archive/dawntools/vnscenetool/VNSceneParser.cpp
Normal file
@ -0,0 +1,50 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "VNSceneParser.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
std::vector<std::string> VNSceneParser::getRequiredAttributes() {
|
||||
return { };
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> VNSceneParser::getOptionalAttributes() {
|
||||
return { };
|
||||
}
|
||||
|
||||
int32_t VNSceneParser::onParse(
|
||||
Xml *node,
|
||||
std::map<std::string, std::string> values,
|
||||
struct VNScene *out,
|
||||
std::string *error
|
||||
) {
|
||||
//
|
||||
int32_t ret;
|
||||
|
||||
// First, pass as a standard scene
|
||||
ret = (SceneParser()).parse(node, &out->scene, error);
|
||||
if(ret != 0) return ret;
|
||||
|
||||
// Now pass the VN Events
|
||||
auto itChildren = node->childNodes.begin();
|
||||
while(itChildren != node->childNodes.end()) {
|
||||
if(itChildren->nodeType != XML_NODE_TYPE_ELEMENT) {
|
||||
++itChildren;
|
||||
continue;
|
||||
}
|
||||
|
||||
Xml *child = itChildren->child;
|
||||
if(child->node != "events") {
|
||||
++itChildren;
|
||||
continue;
|
||||
}
|
||||
ret = (VNSceneEventsParser()).parse(child, &out->events, error);
|
||||
if(ret != 0) return ret;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user