本文整理汇总了C++中XmlTree::load方法的典型用法代码示例。如果您正苦于以下问题:C++ XmlTree::load方法的具体用法?C++ XmlTree::load怎么用?C++ XmlTree::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlTree
的用法示例。
在下文中一共展示了XmlTree::load方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
Checksum Scenario::load(const string &path) {
Checksum scenarioChecksum;
try {
scenarioChecksum.addFile(path);
checksumValue.addFile(path);
string name= cutLastExt(lastDir(path));
Logger::getInstance().add("Scenario: " + formatString(name), true);
//parse xml
XmlTree xmlTree;
xmlTree.load(path);
const XmlNode *scenarioNode= xmlTree.getRootNode();
const XmlNode *scriptsNode= scenarioNode->getChild("scripts");
for(int i= 0; i<scriptsNode->getChildCount(); ++i){
const XmlNode *scriptNode = scriptsNode->getChild(i);
scripts.push_back(Script(getFunctionName(scriptNode), scriptNode->getText()));
}
}
//Exception handling (conversions and so on);
catch(const exception &e) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Error: " + path + "\n" + e.what());
}
return scenarioChecksum;
}
示例2: load
void UnitParticleSystemType::load(const XmlNode *particleFileNode, const string &dir, const string &path,
RendererInterface *renderer, std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader, string techtreePath) {
try{
XmlTree xmlTree;
std::map<string,string> mapExtraTagReplacementValues;
mapExtraTagReplacementValues["$COMMONDATAPATH"] = techtreePath + "/commondata/";
xmlTree.load(path, Properties::getTagReplacementValues(&mapExtraTagReplacementValues));
loadedFileList[path].push_back(make_pair(parentLoader,parentLoader));
const XmlNode *particleSystemNode= xmlTree.getRootNode();
if(particleFileNode){
// immediate children in the particleFileNode will override the particleSystemNode
particleFileNode->setSuper(particleSystemNode);
particleSystemNode= particleFileNode;
}
UnitParticleSystemType::load(particleSystemNode, dir, renderer,
loadedFileList, parentLoader, techtreePath);
}
catch(const exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw megaglest_runtime_error("Error loading ParticleSystem: "+ path + "\n" +e.what());
}
}
示例3: load
void UnitParticleSystemType::load(const string &dir, const string &path, RendererInterface *renderer){
try{
XmlTree xmlTree;
xmlTree.load(path);
const XmlNode *particleSystemNode= xmlTree.getRootNode();
UnitParticleSystemType::load(particleSystemNode, dir, renderer);
}
catch(const exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
throw runtime_error("Error loading ParticleSystem: "+ path + "\n" +e.what());
}
}
示例4: load
void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetChecksum,
std::map<string,vector<pair<string, string> > > &loadedFileList) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
random.init(time(NULL));
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
string name= lastDir(dir);
tileset_name = name;
string currentPath = dir;
endPathWithSlash(currentPath);
string path= currentPath + name + ".xml";
string sourceXMLFile = path;
checksum->addFile(path);
tilesetChecksum->addFile(path);
checksumValue.addFile(path);
try {
char szBuf[8096]="";
snprintf(szBuf,8096,Lang::getInstance().get("LogScreenGameLoadingTileset","",true).c_str(),formatString(name).c_str());
Logger::getInstance().add(szBuf, true);
Renderer &renderer= Renderer::getInstance();
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
//printf("About to load tileset [%s]\n",path.c_str());
//parse xml
XmlTree xmlTree;
xmlTree.load(path,Properties::getTagReplacementValues());
loadedFileList[path].push_back(make_pair(currentPath,currentPath));
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
const XmlNode *tilesetNode= xmlTree.getRootNode();
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
//surfaces
const XmlNode *surfacesNode= tilesetNode->getChild("surfaces");
int partsize= 0;
for(int i=0; i < surfCount; ++i) {
const XmlNode *surfaceNode;
if(surfacesNode->hasChildAtIndex("surface",i)){
surfaceNode= surfacesNode->getChild("surface", i);
}
else {
// cliff texture does not exist, use texture 2 instead
surfaceNode= surfacesNode->getChild("surface", 2);
}
if(surfaceNode->hasAttribute("partsize")){
partsize=surfaceNode->getAttribute("partsize",true)->getIntValue();
}
else{
partsize=0;
}
if(partsize==0){
int childCount= surfaceNode->getChildCount();
surfPixmaps[i].resize(childCount);
surfProbs[i].resize(childCount);
for(int j = 0; j < childCount; ++j) {
surfPixmaps[i][j] = NULL;
}
for(int j = 0; j < childCount; ++j) {
const XmlNode *textureNode= surfaceNode->getChild("texture", j);
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
surfPixmaps[i][j] = new Pixmap2D();
surfPixmaps[i][j]->init(3);
surfPixmaps[i][j]->load(textureNode->getAttribute("path")->getRestrictedValue(currentPath));
}
loadedFileList[textureNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,textureNode->getAttribute("path")->getRestrictedValue()));
surfProbs[i][j]= textureNode->getAttribute("prob")->getFloatValue();
}
}
else {
// read single big texture and cut it into pieces
const XmlNode *textureNode= surfaceNode->getChild("texture", 0);
Pixmap2D *pixmap=new Pixmap2D();
pixmap->init(3);
pixmap->load(textureNode->getAttribute("path")->getRestrictedValue(currentPath));
loadedFileList[textureNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,textureNode->getAttribute("path")->getRestrictedValue()));
int width=pixmap->getW();
int heith=pixmap->getW();
assert(width==heith);
assert(width%64==0);
assert(width%partsize==0);
int parts=width/partsize;
int numberOfPieces=parts*parts;
partsArray[i]=parts;
surfPixmaps[i].resize(numberOfPieces);
surfProbs[i].resize(numberOfPieces);
int j=0;
//.........这里部分代码省略.........
示例5: rps
MenuBackground::MenuBackground() : rps(NULL) {
Renderer &renderer= Renderer::getInstance();
//load data
string data_path = getGameReadWritePath(GameConstants::path_data_CacheLookupKey);
XmlTree xmlTree;
xmlTree.load(getGameCustomCoreDataPath(data_path, "data/core/menu/menu.xml"),Properties::getTagReplacementValues());
const XmlNode *menuNode= xmlTree.getRootNode();
//water
const XmlNode *waterNode= menuNode->getChild("water");
water= waterNode->getAttribute("value")->getBoolValue();
if(water){
waterHeight= waterNode->getAttribute("height")->getFloatValue();
//water texture
waterTexture= renderer.newTexture2D(rsMenu);
if(waterTexture) {
waterTexture->getPixmap()->init(4);
waterTexture->getPixmap()->load(getGameCustomCoreDataPath(data_path, "data/core/menu/textures/water.tga"));
}
}
//fog
const XmlNode *fogNode= menuNode->getChild("fog");
fog= fogNode->getAttribute("value")->getBoolValue();
if(fog){
fogDensity= fogNode->getAttribute("density")->getFloatValue();
}
//rain
bool withRainEffect = Config::getInstance().getBool("RainEffectMenu","true");
if(withRainEffect == true) {
rain= menuNode->getChild("rain")->getAttribute("value")->getBoolValue();
if(rain) {
createRainParticleSystem();
}
}
else {
rain = false;
}
//camera
const XmlNode *cameraNode= menuNode->getChild("camera");
//position
const XmlNode *positionNode= cameraNode->getChild("start-position");
Vec3f startPosition;
startPosition.x= positionNode->getAttribute("x")->getFloatValue();
startPosition.y= positionNode->getAttribute("y")->getFloatValue();
startPosition.z= positionNode->getAttribute("z")->getFloatValue();
camera.setPosition(startPosition);
//rotation
const XmlNode *rotationNode= cameraNode->getChild("start-rotation");
Vec3f startRotation;
startRotation.x= rotationNode->getAttribute("x")->getFloatValue();
startRotation.y= rotationNode->getAttribute("y")->getFloatValue();
startRotation.z= rotationNode->getAttribute("z")->getFloatValue();
camera.setOrientation(Quaternion(EulerAngles(
degToRad(startRotation.x),
degToRad(startRotation.y),
degToRad(startRotation.z))));
//load main model
mainModel= renderer.newModel(rsMenu);
if(mainModel) {
string mainModelFile = "data/core/menu/main_model/menu_main.g3d";
if(menuNode->hasChild("menu-background-model") == true) {
//mainModel->load(data_path + "data/core/menu/main_model/menu_main.g3d");
const XmlNode *mainMenuModelNode= menuNode->getChild("menu-background-model");
mainModelFile = mainMenuModelNode->getAttribute("value")->getRestrictedValue();
}
mainModel->load(getGameCustomCoreDataPath(data_path, mainModelFile));
}
//models
for(int i=0; i<5; ++i){
characterModels[i]= renderer.newModel(rsMenu);
if(characterModels[i]) {
characterModels[i]->load(getGameCustomCoreDataPath(data_path, "data/core/menu/about_models/character"+intToStr(i)+".g3d"));
}
}
//about position
positionNode= cameraNode->getChild("about-position");
aboutPosition.x= positionNode->getAttribute("x")->getFloatValue();
aboutPosition.y= positionNode->getAttribute("y")->getFloatValue();
aboutPosition.z= positionNode->getAttribute("z")->getFloatValue();
rotationNode= cameraNode->getChild("about-rotation");
targetCamera= NULL;
t= 0.f;
fade= 0.f;
anim= 0.f;
}
示例6: RainParticleSystem
MenuBackground::MenuBackground(){
Renderer &renderer= Renderer::getInstance();
//load data
XmlTree xmlTree;
xmlTree.load("data/core/menu/menu.xml");
const XmlNode *menuNode= xmlTree.getRootNode();
//water
const XmlNode *waterNode= menuNode->getChild("water");
water= waterNode->getAttribute("value")->getBoolValue();
if(water){
waterHeight= waterNode->getAttribute("height")->getFloatValue();
//water texture
waterTexture= renderer.newTexture2D(ResourceScope::MENU);
waterTexture->getPixmap()->init(4);
waterTexture->getPixmap()->load("data/core/menu/textures/water.tga");
}
//fog
const XmlNode *fogNode= menuNode->getChild("fog");
fog= fogNode->getAttribute("value")->getBoolValue();
if(fog){
fogDensity= fogNode->getAttribute("density")->getFloatValue();
}
// rain
rain = menuNode->getChild("rain")->getAttribute("value")->getBoolValue();
if(rain){
RainParticleSystem *rps= new RainParticleSystem();
rps->setSpeed(12.f / WORLD_FPS);
rps->setEmissionRate(25.f);
rps->setWindSpeed2(-90.f, 4.f / WORLD_FPS);
rps->setPos(Vec3f(0.f, 25.f, 0.f));
rps->setColor(Vec4f(1.f, 1.f, 1.f, 0.2f));
rps->setRadius(30.f);
renderer.manageParticleSystem(rps, ResourceScope::MENU);
for(int i=0; i<raindropCount; ++i){
raindropStates[i]= random.randRange(0.f, 1.f);
raindropPos[i]= computeRaindropPos();
}
} else if (menuNode->getOptionalBoolValue("snow")) {
SnowParticleSystem *sps = new SnowParticleSystem(1200);
sps->setSpeed(1.5f / WORLD_FPS);
sps->setEmissionRate(2.f);
sps->setWindSpeed2(-90.f, 0.5f / WORLD_FPS);
sps->setPos(Vec3f(0.f, 25.f, 0.f));
sps->setRadius(30.f);
sps->setTexture(g_coreData.getSnowTexture());
renderer.manageParticleSystem(sps, ResourceScope::MENU);
}
//camera
const XmlNode *cameraNode= menuNode->getChild("camera");
//position
const XmlNode *positionNode= cameraNode->getChild("start-position");
Vec3f startPosition;
startPosition.x= positionNode->getAttribute("x")->getFloatValue();
startPosition.y= positionNode->getAttribute("y")->getFloatValue();
startPosition.z= positionNode->getAttribute("z")->getFloatValue();
camera.setPosition(startPosition);
//rotation
const XmlNode *rotationNode= cameraNode->getChild("start-rotation");
Vec3f startRotation;
startRotation.x= rotationNode->getAttribute("x")->getFloatValue();
startRotation.y= rotationNode->getAttribute("y")->getFloatValue();
startRotation.z= rotationNode->getAttribute("z")->getFloatValue();
camera.setOrientation(Quaternion(EulerAngles(
degToRad(startRotation.x),
degToRad(startRotation.y),
degToRad(startRotation.z))));
// load main model
mainModel= renderer.newModel(ResourceScope::MENU);
mainModel->load("data/core/menu/main_model/menu_main.g3d", 2, 2);
// models
for(int i=0; i<5; ++i){
characterModels[i]= renderer.newModel(ResourceScope::MENU);
try {
characterModels[i]->load("data/core/menu/about_models/character"+intToStr(i)+".g3d", 2, 2);
} catch (runtime_error &e) {
g_logger.logError(e.what());
}
}
// about position
positionNode= cameraNode->getChild("about-position");
aboutPosition.x= positionNode->getAttribute("x")->getFloatValue();
aboutPosition.y= positionNode->getAttribute("y")->getFloatValue();
aboutPosition.z= positionNode->getAttribute("z")->getFloatValue();
rotationNode= cameraNode->getChild("about-rotation");
targetCamera = 0;
//.........这里部分代码省略.........
示例7: load
void UnitType::load(int id,const string &dir, const TechTree *techTree, const FactionType *factionType, Checksum* checksum){
this->id= id;
string path;
try{
Logger::getInstance().add("Unit type: " + formatString(name), true);
//file load
path= dir+"/"+name+".xml";
checksum->addFile(path);
XmlTree xmlTree;
xmlTree.load(path);
const XmlNode *unitNode= xmlTree.getRootNode();
const XmlNode *parametersNode= unitNode->getChild("parameters");
//size
size= parametersNode->getChild("size")->getAttribute("value")->getIntValue();
//height
height= parametersNode->getChild("height")->getAttribute("value")->getIntValue();
//maxHp
maxHp= parametersNode->getChild("max-hp")->getAttribute("value")->getIntValue();
//hpRegeneration
hpRegeneration= parametersNode->getChild("max-hp")->getAttribute("regeneration")->getIntValue();
//maxEp
maxEp= parametersNode->getChild("max-ep")->getAttribute("value")->getIntValue();
if(maxEp!=0){
//wpRegeneration
epRegeneration= parametersNode->getChild("max-ep")->getAttribute("regeneration")->getIntValue();
}
//armor
armor= parametersNode->getChild("armor")->getAttribute("value")->getIntValue();
//armor type string
string armorTypeName= parametersNode->getChild("armor-type")->getAttribute("value")->getRestrictedValue();
armorType= techTree->getArmorType(armorTypeName);
//sight
sight= parametersNode->getChild("sight")->getAttribute("value")->getIntValue();
//prod time
productionTime= parametersNode->getChild("time")->getAttribute("value")->getIntValue();
//multi selection
multiSelect= parametersNode->getChild("multi-selection")->getAttribute("value")->getBoolValue();
//cellmap
const XmlNode *cellMapNode= parametersNode->getChild("cellmap");
bool hasCellMap= cellMapNode->getAttribute("value")->getBoolValue();
if(hasCellMap){
cellMap= new bool[size*size];
for(int i=0; i<size; ++i){
const XmlNode *rowNode= cellMapNode->getChild("row", i);
string row= rowNode->getAttribute("value")->getRestrictedValue();
if(row.size()!=size){
throw runtime_error("Cellmap row has not the same length as unit size");
}
for(int j=0; j<row.size(); ++j){
cellMap[i*size+j]= row[j]=='0'? false: true;
}
}
}
//levels
const XmlNode *levelsNode= parametersNode->getChild("levels");
levels.resize(levelsNode->getChildCount());
for(int i=0; i<levels.size(); ++i){
const XmlNode *levelNode= levelsNode->getChild("level", i);
levels[i].init(
levelNode->getAttribute("name")->getRestrictedValue(),
levelNode->getAttribute("kills")->getIntValue());
}
//fields
const XmlNode *fieldsNode= parametersNode->getChild("fields");
for(int i=0; i<fieldsNode->getChildCount(); ++i){
const XmlNode *fieldNode= fieldsNode->getChild("field", i);
string fieldName= fieldNode->getAttribute("value")->getRestrictedValue();
if(fieldName=="land"){
fields[fLand]= true;
}
else if(fieldName=="air"){
fields[fAir]= true;
}
else{
throw runtime_error("Not a valid field: "+fieldName+": "+ path);
}
}
//properties
//.........这里部分代码省略.........
示例8: load
bool Modification::load(const string &dir) {
g_logger.logProgramEvent("Modification: " + dir, true);
bool loadOk = true;
string path = dir + "/" + m_name + ".xml";
name = m_name;
XmlTree xmlTree;
try { xmlTree.load(path); }
catch (runtime_error e) {
g_logger.logXmlError(path, e.what());
g_logger.logError("Fatal Error: could not load " + path);
return false;
}
const XmlNode *modificationNode;
try { modificationNode = xmlTree.getRootNode(); }
catch (runtime_error e) {
g_logger.logXmlError(path, e.what());
return false;
}
const XmlNode *parametersNode;
try { parametersNode = modificationNode->getChild("parameters"); }
catch (runtime_error e) {
g_logger.logXmlError(path, e.what());
return false;
}
if (!RequirableType::load(parametersNode, dir)) {
loadOk = false;
}
try {
const XmlNode *serviceNode = parametersNode->getChild("service");
service = serviceNode->getAttribute("scope")->getRestrictedValue();
} catch (runtime_error e) {
g_logger.logXmlError(dir, e.what());
loadOk = false;
}
try {
const XmlNode *equipmentNode = parametersNode->getChild("equipment-types", 0, false);
if(equipmentNode) {
for(int i = 0; i < equipmentNode->getChildCount(); ++i) {
try {
const XmlNode *typeNode = equipmentNode->getChild("equipment-type", i);
string ename = typeNode->getAttribute("name")->getRestrictedValue();
equipment.push_back(ename);
} catch (runtime_error e) {
g_logger.logXmlError(dir, e.what());
loadOk = false;
}
}
}
} catch (runtime_error e) {
g_logger.logXmlError(dir, e.what());
loadOk = false;
}
try {
const XmlNode *resourceRequirementsNode = parametersNode->getChild("resource-requirements", 0, false);
if(resourceRequirementsNode) {
costs.resize(resourceRequirementsNode->getChildCount());
for(int i = 0; i < costs.size(); ++i) {
try {
const XmlNode *resourceNode = resourceRequirementsNode->getChild("resource", i);
string rname = resourceNode->getAttribute("name")->getRestrictedValue();
int amount = resourceNode->getAttribute("amount")->getIntValue();
int amount_plus = resourceNode->getAttribute("plus")->getIntValue();
fixed amount_multiply = resourceNode->getAttribute("multiply")->getFixedValue();
costs[i].init(g_world.getTechTree()->getResourceType(rname), amount, amount_plus, amount_multiply);
} catch (runtime_error e) {
g_logger.logXmlError(dir, e.what());
loadOk = false;
}
}
}
} catch (runtime_error e) {
g_logger.logXmlError(dir, e.what());
loadOk = false;
}
try {
const XmlNode *statisticsNode = parametersNode->getChild("statistics", 0, false);
if (statisticsNode) {
if (!statistics.load(statisticsNode, dir)) {
loadOk = false;
}
}
}
catch (runtime_error e) {
g_logger.logXmlError(dir, e.what());
loadOk = false;
}
const XmlNode *effectsNode = parametersNode->getChild("effects", 0, false);
if (effectsNode) {
effectTypes.resize(effectsNode->getChildCount());
for(int i=0; i < effectsNode->getChildCount(); ++i) {
const XmlNode *effectNode = effectsNode->getChild("effect", i);
EffectType *effectType = new EffectType();
effectType->load(effectNode, dir);
effectTypes[i] = effectType;
}
}
//.........这里部分代码省略.........
示例9: load
void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetChecksum) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
random.init(time(NULL));
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
string name= lastDir(dir);
string path= dir + "/" + name + ".xml";
checksum->addFile(path);
tilesetChecksum->addFile(path);
checksumValue.addFile(path);
try {
Logger::getInstance().add("Tileset: "+formatString(name), true);
Renderer &renderer= Renderer::getInstance();
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
//parse xml
XmlTree xmlTree;
xmlTree.load(path);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
const XmlNode *tilesetNode= xmlTree.getRootNode();
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
//surfaces
const XmlNode *surfacesNode= tilesetNode->getChild("surfaces");
for(int i=0; i<surfCount; ++i){
const XmlNode *surfaceNode= surfacesNode->getChild("surface", i);
int childCount= surfaceNode->getChildCount();
surfPixmaps[i].resize(childCount);
surfProbs[i].resize(childCount);
for(int j=0; j<childCount; ++j){
const XmlNode *textureNode= surfaceNode->getChild("texture", j);
surfPixmaps[i][j].init(3);
surfPixmaps[i][j].load(dir +"/"+textureNode->getAttribute("path")->getRestrictedValue());
surfProbs[i][j]= textureNode->getAttribute("prob")->getFloatValue();
}
}
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
//object models
const XmlNode *objectsNode= tilesetNode->getChild("objects");
for(int i=0; i<objCount; ++i){
const XmlNode *objectNode= objectsNode->getChild("object", i);
int childCount= objectNode->getChildCount();
int objectHeight = 0;
bool walkable = objectNode->getAttribute("walkable")->getBoolValue();
if(walkable == false) {
const XmlAttribute *heightAttribute = objectNode->getAttribute("height",false);
if(heightAttribute != NULL) {
objectHeight = heightAttribute->getIntValue();
}
}
objectTypes[i].init(childCount, i, walkable,objectHeight);
for(int j=0; j<childCount; ++j) {
const XmlNode *modelNode= objectNode->getChild("model", j);
const XmlAttribute *pathAttribute= modelNode->getAttribute("path");
objectTypes[i].loadModel(dir +"/"+ pathAttribute->getRestrictedValue());
}
}
// Now free up the pixmap memory
for(int i=0; i<objCount; ++i){
objectTypes[i].deletePixels();
}
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
//ambient sounds
ambientSounds.load(dir, tilesetNode->getChild("ambient-sounds"));
//parameters
const XmlNode *parametersNode= tilesetNode->getChild("parameters");
//water
const XmlNode *waterNode= parametersNode->getChild("water");
waterTex= renderer.newTexture3D(rsGame);
waterTex->setMipmap(false);
waterTex->setWrapMode(Texture::wmRepeat);
waterEffects= waterNode->getAttribute("effects")->getBoolValue();
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
int waterFrameCount= waterNode->getChildCount();
waterTex->getPixmap()->init(waterFrameCount, 4);
for(int i=0; i<waterFrameCount; ++i){
const XmlNode *waterFrameNode= waterNode->getChild("texture", i);
waterTex->getPixmap()->loadSlice(dir +"/"+ waterFrameNode->getAttribute("path")->getRestrictedValue(), i);
}
//.........这里部分代码省略.........