Esempio n. 1
0
        public static void SaveConfig()
        {
            XmlDocument doc = new XmlDocument();

            string     comment = @"
Config ENUMS

floor style
-Normal
-Solid
-Textured

for setting floor texture 
<texture>(texture location)</texture>

render type
-Texture
-Normals
-NormalsBnW
-VertColor

for changing default texure
<default_texture>(texture location)</default_texture>
";
            XmlComment com     = doc.CreateComment(comment);

            XmlNode mainNode = doc.CreateElement("FORGECONFIG");

            doc.AppendChild(mainNode);
            mainNode.AppendChild(com);

            XmlNode viewportNode = doc.CreateElement("VIEWPORT");

            mainNode.AppendChild(viewportNode);
            {
                XmlNode node = doc.CreateElement("floor");
                viewportNode.AppendChild(node);
                node.AppendChild(createNode(doc, "enabled", renderFloor.ToString()));
                node.AppendChild(createNode(doc, "style", floorStyle.ToString()));
                node.AppendChild(createNode(doc, "color", ColorTranslator.ToHtml(floorColor)));
                node.AppendChild(createNode(doc, "size", floorSize.ToString()));
            }
            viewportNode.AppendChild(createNode(doc, "zoom_speed", zoomspeed.ToString()));
            viewportNode.AppendChild(createNode(doc, "fov", fov.ToString()));
            viewportNode.AppendChild(createNode(doc, "render_depth", renderDepth.ToString()));
            viewportNode.AppendChild(createNode(doc, "render_background", renderBackGround.ToString()));
            viewportNode.AppendChild(createNode(doc, "back_gradient_top", ColorTranslator.ToHtml(back1)));
            viewportNode.AppendChild(createNode(doc, "back_gradient_bottom", ColorTranslator.ToHtml(back2)));

            XmlNode renderNode = doc.CreateElement("RENDERSETTINGS");

            mainNode.AppendChild(renderNode);
            renderNode.AppendChild(createNode(doc, "type", renderType.ToString()));
            renderNode.AppendChild(createNode(doc, "render_vertex_color", renderVertColor.ToString()));
            renderNode.AppendChild(createNode(doc, "render_normals", renderNormals.ToString()));
            renderNode.AppendChild(createNode(doc, "camera_light", CameraLight.ToString()));
            renderNode.AppendChild(createNode(doc, "use_normal_map", useNormalMap.ToString()));

            {
                XmlNode node = doc.CreateElement("lighting");
                renderNode.AppendChild(node);
                node.AppendChild(createNode(doc, "enabled", renderLighting.ToString()));
                node.AppendChild(createNode(doc, "render_diffuse", renderDiffuse.ToString()));
                node.AppendChild(createNode(doc, "render_specular", renderSpecular.ToString()));
                node.AppendChild(createNode(doc, "render_fresnel", renderFresnel.ToString()));
                node.AppendChild(createNode(doc, "render_reflection", renderReflection.ToString()));
            }
            {
                XmlNode node = doc.CreateElement("diffuse");
                renderNode.AppendChild(node);
                node.AppendChild(createNode(doc, "enabled", renderDiffuse.ToString()));
                node.AppendChild(createNode(doc, "intensity", dif_inten.ToString()));
            }
            {
                XmlNode node = doc.CreateElement("specular");
                renderNode.AppendChild(node);
                node.AppendChild(createNode(doc, "enabled", renderSpecular.ToString()));
                node.AppendChild(createNode(doc, "intensity", spc_inten.ToString()));
            }
            {
                XmlNode node = doc.CreateElement("fresnel");
                renderNode.AppendChild(node);
                node.AppendChild(createNode(doc, "enabled", renderFresnel.ToString()));
                node.AppendChild(createNode(doc, "intensity", frs_inten.ToString()));
            }
            {
                XmlNode node = doc.CreateElement("reflection");
                renderNode.AppendChild(node);
                node.AppendChild(createNode(doc, "enabled", renderReflection.ToString()));
                node.AppendChild(createNode(doc, "intensity", ref_inten.ToString()));
            }
            {
                XmlNode node = doc.CreateElement("ambient");
                renderNode.AppendChild(node);
                node.AppendChild(createNode(doc, "intensity", amb_inten.ToString()));
            }

            {
                XmlNode node = doc.CreateElement("render_model");
                renderNode.AppendChild(node);
                node.AppendChild(createNode(doc, "enabled", renderModel.ToString()));
                node.AppendChild(createNode(doc, "render_selection", renderModelSelection.ToString()));
                node.AppendChild(createNode(doc, "render_wireframe", renderModelWireframe.ToString()));
                node.AppendChild(createNode(doc, "render_bones", renderBones.ToString()));
                node.AppendChild(createNode(doc, "render_bounding_boxes", renderBoundingBox.ToString()));
            }

            renderNode.AppendChild(createNode(doc, "render_hurtboxes", renderHurtboxes.ToString()));
            renderNode.AppendChild(createNode(doc, "render_hurtboxes_zone", renderHurtboxesZone.ToString()));
            renderNode.AppendChild(createNode(doc, "render_hitboxes", renderHitboxes.ToString()));
            renderNode.AppendChild(createNode(doc, "render_interpolated_hitboxes", renderInterpolatedHitboxes.ToString()));
            renderNode.AppendChild(createNode(doc, "render_ECB", renderECB.ToString()));
            renderNode.AppendChild(createNode(doc, "render_path", renderPath.ToString()));
            {
                XmlNode node = doc.CreateElement("render_LVD");
                renderNode.AppendChild(node);
                node.AppendChild(createNode(doc, "enabled", renderLVD.ToString()));
                node.AppendChild(createNode(doc, "render_collisions", renderCollisions.ToString()));
                node.AppendChild(createNode(doc, "render_collision_normals", renderCollisionNormals.ToString()));

                node.AppendChild(createNode(doc, "render_respawns", renderRespawns.ToString()));
                node.AppendChild(createNode(doc, "render_spawns", renderSpawns.ToString()));
                node.AppendChild(createNode(doc, "render_item_spawners", renderItemSpawners.ToString()));
                node.AppendChild(createNode(doc, "render_general_points", renderGeneralPoints.ToString()));
                node.AppendChild(createNode(doc, "render_otherLVDEntries", renderOtherLVDEntries.ToString()));
                node.AppendChild(createNode(doc, "render_swag", renderSwag.ToString()));
            }

            doc.Save("config.xml");
        }
Esempio n. 2
0
        public static void SaveConfig()
        {
            EnsureHitboxColors();

            XmlDocument doc = new XmlDocument();

            string comment = @"
                Config ENUMS

                floor style
                -Normal
                -Solid
                -Textured

                for setting floor texture 
                <texture>(texture location)</texture>

                render type
                -Texture
                -Normals
                -NormalsBnW
                -VertColor

                for changing default texure
                <default_texture>(texture location)</default_texture>";

            XmlComment com = doc.CreateComment(comment);

            XmlNode mainNode = doc.CreateElement("FORGECONFIG");

            doc.AppendChild(mainNode);
            mainNode.AppendChild(com);

            XmlNode viewportNode = doc.CreateElement("VIEWPORT");

            mainNode.AppendChild(viewportNode);
            {
                XmlNode node = doc.CreateElement("floor");
                viewportNode.AppendChild(node);
                node.AppendChild(createNode(doc, "enabled", renderFloor.ToString()));
                node.AppendChild(createNode(doc, "style", floorStyle.ToString()));
                node.AppendChild(createNode(doc, "color", ColorTranslator.ToHtml(floorColor)));
                node.AppendChild(createNode(doc, "size", floorSize.ToString()));
                if (floorStyle == FloorStyle.UserTexture)
                {
                    node.AppendChild(createNode(doc, "texture", FloorURL));
                }
            }

            viewportNode.AppendChild(createNode(doc, "zoom_speed", zoomspeed.ToString()));
            viewportNode.AppendChild(createNode(doc, "zoom_modifier_multiplier", zoomModifierScale.ToString()));
            viewportNode.AppendChild(createNode(doc, "fov", fov.ToString()));
            viewportNode.AppendChild(createNode(doc, "render_depth", renderDepth.ToString()));
            viewportNode.AppendChild(createNode(doc, "render_background", renderBackGround.ToString()));
            viewportNode.AppendChild(createNode(doc, "back_gradient_top", ColorTranslator.ToHtml(back1)));
            viewportNode.AppendChild(createNode(doc, "back_gradient_bottom", ColorTranslator.ToHtml(back2)));

            XmlNode renderNode = doc.CreateElement("RENDERSETTINGS");

            mainNode.AppendChild(renderNode);
            renderNode.AppendChild(createNode(doc, "type", renderType.ToString()));
            renderNode.AppendChild(createNode(doc, "render_vertex_color", renderVertColor.ToString()));
            renderNode.AppendChild(createNode(doc, "render_alpha", renderAlpha.ToString()));
            renderNode.AppendChild(createNode(doc, "camera_light", cameraLight.ToString()));
            renderNode.AppendChild(createNode(doc, "OpenGL_2.10", useLegacyShaders.ToString()));
            renderNode.AppendChild(createNode(doc, "use_normal_map", renderNormalMap.ToString()));

            {
                XmlNode node = doc.CreateElement("lighting");
                renderNode.AppendChild(node);
                node.AppendChild(createNode(doc, "enabled", renderMaterialLighting.ToString()));
                node.AppendChild(createNode(doc, "render_diffuse", renderDiffuse.ToString()));
                node.AppendChild(createNode(doc, "render_specular", renderSpecular.ToString()));
                node.AppendChild(createNode(doc, "render_fresnel", renderFresnel.ToString()));
                node.AppendChild(createNode(doc, "render_reflection", renderReflection.ToString()));
            }
            {
                XmlNode node = doc.CreateElement("diffuse");
                renderNode.AppendChild(node);
                node.AppendChild(createNode(doc, "enabled", renderDiffuse.ToString()));
                node.AppendChild(createNode(doc, "intensity", dif_inten.ToString()));
            }
            {
                XmlNode node = doc.CreateElement("specular");
                renderNode.AppendChild(node);
                node.AppendChild(createNode(doc, "enabled", renderSpecular.ToString()));
                node.AppendChild(createNode(doc, "intensity", spc_inten.ToString()));
            }
            {
                XmlNode node = doc.CreateElement("fresnel");
                renderNode.AppendChild(node);
                node.AppendChild(createNode(doc, "enabled", renderFresnel.ToString()));
                node.AppendChild(createNode(doc, "intensity", frs_inten.ToString()));
            }
            {
                XmlNode node = doc.CreateElement("reflection");
                renderNode.AppendChild(node);
                node.AppendChild(createNode(doc, "enabled", renderReflection.ToString()));
                node.AppendChild(createNode(doc, "intensity", ref_inten.ToString()));
            }
            {
                XmlNode node = doc.CreateElement("ambient");
                renderNode.AppendChild(node);
                node.AppendChild(createNode(doc, "intensity", amb_inten.ToString()));
            }

            {
                XmlNode node = doc.CreateElement("render_model");
                renderNode.AppendChild(node);
                node.AppendChild(createNode(doc, "enabled", renderModel.ToString()));
                node.AppendChild(createNode(doc, "render_selection", renderModelSelection.ToString()));
                node.AppendChild(createNode(doc, "render_wireframe", renderModelWireframe.ToString()));
                node.AppendChild(createNode(doc, "render_bones", renderBones.ToString()));
                node.AppendChild(createNode(doc, "render_bounding_boxes", renderBoundingBox.ToString()));
            }

            renderNode.AppendChild(createNode(doc, "render_ECB", renderECB.ToString()));
            renderNode.AppendChild(createNode(doc, "render_hurtboxes", renderHurtboxes.ToString()));
            renderNode.AppendChild(createNode(doc, "render_hurtboxes_zone", renderHurtboxesZone.ToString()));
            renderNode.AppendChild(createNode(doc, "render_hitboxes", renderHitboxes.ToString()));
            renderNode.AppendChild(createNode(doc, "render_interpolated_hitboxes", renderInterpolatedHitboxes.ToString()));
            renderNode.AppendChild(createNode(doc, "render_hitboxes_no_overlap", renderHitboxesNoOverlap.ToString()));
            renderNode.AppendChild(createNode(doc, "render_hitboxes_mode", hitboxRenderMode.ToString()));
            renderNode.AppendChild(createNode(doc, "render_hitbox_angles", renderHitboxAngles.ToString()));
            renderNode.AppendChild(createNode(doc, "render_special_bubbles", renderSpecialBubbles.ToString()));
            renderNode.AppendChild(createNode(doc, "render_ledge_grabboxes", renderLedgeGrabboxes.ToString()));
            renderNode.AppendChild(createNode(doc, "render_reverse_ledge_grabboxes", renderReverseLedgeGrabboxes.ToString()));
            renderNode.AppendChild(createNode(doc, "render_tether_ledge_grabboxes", renderTetherLedgeGrabboxes.ToString()));
            renderNode.AppendChild(createNode(doc, "hitbox_alpha", hitboxAlpha.ToString()));
            renderNode.AppendChild(createNode(doc, "hurtbox_alpha", hurtboxAlpha.ToString()));
            renderNode.AppendChild(createNode(doc, "hurtbox_color", System.Drawing.ColorTranslator.ToHtml(hurtboxColor)));
            renderNode.AppendChild(createNode(doc, "hurtbox_color_hi", System.Drawing.ColorTranslator.ToHtml(hurtboxColorHi)));
            renderNode.AppendChild(createNode(doc, "hurtbox_color_med", System.Drawing.ColorTranslator.ToHtml(hurtboxColorMed)));
            renderNode.AppendChild(createNode(doc, "hurtbox_color_low", System.Drawing.ColorTranslator.ToHtml(hurtboxColorLow)));
            renderNode.AppendChild(createNode(doc, "hurtbox_color_selected", System.Drawing.ColorTranslator.ToHtml(hurtboxColorSelected)));
            renderNode.AppendChild(createNode(doc, "hitbox_angles_color", System.Drawing.ColorTranslator.ToHtml(hitboxAnglesColor)));
            renderNode.AppendChild(createNode(doc, "windbox_color", System.Drawing.ColorTranslator.ToHtml(windboxColor)));
            renderNode.AppendChild(createNode(doc, "grabbox_color", System.Drawing.ColorTranslator.ToHtml(grabboxColor)));
            renderNode.AppendChild(createNode(doc, "searchbox_color", System.Drawing.ColorTranslator.ToHtml(searchboxColor)));
            renderNode.AppendChild(createNode(doc, "counterBubble_color", System.Drawing.ColorTranslator.ToHtml(counterBubbleColor)));
            renderNode.AppendChild(createNode(doc, "reflectBubble_color", System.Drawing.ColorTranslator.ToHtml(reflectBubbleColor)));
            renderNode.AppendChild(createNode(doc, "shieldBubble_color", System.Drawing.ColorTranslator.ToHtml(shieldBubbleColor)));
            renderNode.AppendChild(createNode(doc, "absorbBubble_color", System.Drawing.ColorTranslator.ToHtml(absorbBubbleColor)));
            renderNode.AppendChild(createNode(doc, "wtSlowdownBubble_color", System.Drawing.ColorTranslator.ToHtml(wtSlowdownBubbleColor)));
            {
                XmlNode node = doc.CreateElement("hitbox_kb_colors");
                renderNode.AppendChild(node);
                foreach (Color c in Runtime.hitboxKnockbackColors)
                {
                    node.AppendChild(createNode(doc, "color", System.Drawing.ColorTranslator.ToHtml(c)));
                }
            }
            {
                XmlNode node = doc.CreateElement("hitbox_id_colors");
                renderNode.AppendChild(node);
                foreach (Color c in Runtime.hitboxIdColors)
                {
                    node.AppendChild(createNode(doc, "color", System.Drawing.ColorTranslator.ToHtml(c)));
                }
            }

            renderNode.AppendChild(createNode(doc, "render_path", renderPath.ToString()));
            renderNode.AppendChild(createNode(doc, "render_indicators", renderIndicators.ToString()));
            {
                XmlNode node = doc.CreateElement("render_LVD");
                renderNode.AppendChild(node);
                node.AppendChild(createNode(doc, "enabled", renderLVD.ToString()));
                node.AppendChild(createNode(doc, "render_collisions", renderCollisions.ToString()));
                node.AppendChild(createNode(doc, "render_collision_normals", renderCollisionNormals.ToString()));

                node.AppendChild(createNode(doc, "render_respawns", renderRespawns.ToString()));
                node.AppendChild(createNode(doc, "render_spawns", renderSpawns.ToString()));
                node.AppendChild(createNode(doc, "render_item_spawners", renderItemSpawners.ToString()));
                node.AppendChild(createNode(doc, "render_general_points", renderGeneralPoints.ToString()));
                node.AppendChild(createNode(doc, "render_otherLVDEntries", renderOtherLVDEntries.ToString()));
                node.AppendChild(createNode(doc, "render_swag", renderSwag.ToString()));
            }
            {
                XmlNode etcNode = doc.CreateElement("ETC");
                mainNode.AppendChild(etcNode);
                etcNode.AppendChild(createNode(doc, "param_dir", paramDir));
            }

            doc.Save(MainForm.executableDir + "\\config.xml");
        }