31 #include <OgreException.h>
41 file.load(ds,
"\t:=",
true);
47 def->name =
file.getString(
"Name",
"General");
48 if (def->name.empty())
50 Str<500> msg; msg <<
"Error in file '" << ds->getName() <<
"': Terrain name is empty";
55 def->ogre_ter_conf_filename =
file.getString(
"GeometryConfig",
"General");
57 if (!def->ogre_ter_conf_filename.empty() && def->ogre_ter_conf_filename.find(
".otc") == String::npos)
59 Str<500> msg; msg <<
"Error in file '" << ds->getName() <<
"': Invalid geometry config file; only '.otc' is supported";
64 def->ambient_color =
file.getColourValue(
"AmbientColor",
"General", ColourValue::White);
65 def->category_id =
file.getInt (
"CategoryID",
"General", 129);
66 def->guid =
file.getString (
"GUID",
"General");
67 def->version =
file.getInt (
"Version",
"General", 1);
68 def->gravity =
file.getFloat (
"Gravity",
"General", -9.81);
69 def->caelum_config =
file.getString (
"CaelumConfigFile",
"General");
70 def->cubemap_config =
file.getString (
"SandStormCubeMap",
"General");
71 def->caelum_fog_start =
file.getInt (
"CaelumFogStart",
"General", -1);
72 def->caelum_fog_end =
file.getInt (
"CaelumFogEnd",
"General", -1);
73 def->has_water =
file.getBool (
"Water",
"General",
false);
74 def->hydrax_conf_file =
file.getString (
"HydraxConfigFile",
"General");
75 def->skyx_config =
file.getString (
"SkyXConfigFile",
"General");
76 def->traction_map_file =
file.getString (
"TractionMap",
"General");
77 def->water_height =
file.getFloat (
"WaterLine",
"General");
78 def->water_bottom_height =
file.getFloat (
"WaterBottomLine",
"General");
79 def->custom_material_name =
file.getString (
"CustomMaterial",
"General");
80 def->start_position =
file.getVector3 (
"StartPosition",
"General", Vector3(512.0f, 0.0f, 512.0f));
82 def->start_rotation_specified =
file.HasSetting(
"General",
"StartRotation");
83 def->start_rotation = Ogre::Degree(
file.getFloat(
"StartRotation",
"General"));
85 if (
file.HasSection(
"Authors"))
87 for (
auto& author:
file.getSettings(
"Authors"))
97 def->authors.push_back(author);
102 if (
file.HasSection(
"Objects"))
104 for (
auto& tobj:
file.getSettings(
"Objects"))
107 def->tobj_files.push_back(
TrimStr(tobj_filename));
111 if (
file.HasSection(
"Scripts"))
113 for (
auto& script:
file.getSettings(
"Scripts"))
116 def->as_files.push_back(
TrimStr(as_filename));
120 if (
file.HasSection(
"AssetPacks"))
122 for (
auto& assetpack:
file.getSettings(
"AssetPacks"))
125 def->assetpack_files.push_back(
TrimStr(assetpack_filename));
129 if (
file.HasSection(
"AI Presets"))
131 for (
auto& presets:
file.getSettings(
"AI Presets"))
134 def->ai_presets_files.push_back(
TrimStr(presets_filename));
138 this->ProcessTeleport(def, &
file);
145 def->teleport_map_image =
file->getString(
"NavigationMapImage",
"Teleport");
147 unsigned int telepoint_number = 1;
150 char key_position [50];
153 snprintf(key_position, 50,
"Telepoint%u/Position" , telepoint_number);
154 snprintf(key_name, 50,
"Telepoint%u/Name" , telepoint_number);
165 snprintf(msg_buf, 500,
166 "ERROR: Field '[Teleport]/%s' ('%s') is not valid XYZ position. Skipping telepoint %u.",
167 key_position, pos_str.c_str(), telepoint_number);
173 t_point.
name =
file->getString(key_name,
"Teleport");
174 def->telepoints.push_back(t_point);