Plugins

Post here about scripting and programming for HaloPC (audio, network, ai, etc.)
Post Reply
User avatar
grimdoomer




System Engineer

Posts: 1440
Joined: Mon Oct 09, 2006 4:36 pm

Plugins

Post by grimdoomer »

Well I have every nodetype done except enums, bitmasks, and structs. The only problem im having is getting my xmltextreader to read the contense, ex options etc. Can any one help me?
Image
AI Zones in MP | Ambiance | Gravemind Beta v1.1
Aumaan Anubis wrote:Grimdoomer. The first person ever to mod Halo 2 Vista.
Supermodder911




Connoisseur Coroner

Posts: 1262
Joined: Sun Sep 03, 2006 10:43 pm
Location: Michigan

Post by Supermodder911 »

Maybe you can show us your reading code?
Image
C Wizzle
User avatar
grimdoomer




System Engineer

Posts: 1440
Joined: Mon Oct 09, 2006 4:36 pm

Post by grimdoomer »

Ok, I wrote it my self, Ill only put the enum part, because bitmasks are similar and so are structs.

Code: Select all

case "enum8":
                                    {
                                        ItemTag += 1;
                                        string Name = XR.GetAttribute("name");
                                        int Offset = System.Convert.ToInt32(XR.GetAttribute("offset"));
                                        bool Visible = bool.Parse(XR.GetAttribute("visible"));
                                        List<string> Temp = new List<string>(0);
                                        while (XR.Read())
                                        {
                                            switch (XR.NodeType)
                                            {
                                                case XmlNodeType.Element:
                                                    {
                                                        do
                                                        {
                                                            Temp.Capacity += 1;
                                                            Temp.Add(XR.GetAttribute("name"));
                                                        }
                                                        while (XR.Name.ToLower() == "option");
                                                        break;
                                                    }
                                                case XmlNodeType.EndElement:
                                                    {
                                                        break;
                                                    }
                                                default:
                                                    {
                                                        break;
                                                    }
                                            }
                                        }
                                        string[] Options = Temp.ToArray();
                                        Map.BR.BaseStream.Position = Offset;
                                        int Value = Map.BR.ReadByte();
                                        Plugin.Add(new ENTEnum(Map, Name, Offset, Visible, (int)Value, Options, typeof(byte), ItemTag));
                                        break;
                                    }
                                case "enum16":
                                    {
                                        ItemTag += 1;
                                        string Name = XR.GetAttribute("name");
                                        int Offset = System.Convert.ToInt32(XR.GetAttribute("offset"));
                                        bool Visible = bool.Parse(XR.GetAttribute("visible"));
                                        List<string> Temp = new List<string>();
                                        while (XR.Name.ToLower() == "option")
                                        {
                                            Temp.Add(XR.GetAttribute("name"));
                                        }
                                        string[] Options = Temp.ToArray();
                                        Map.BR.BaseStream.Position = Offset;
                                        int Value = Map.BR.ReadInt16();
                                        Plugin.Add(new ENTEnum(Map, Name, Offset, Visible, (int)Value, Options, typeof(short), ItemTag));
                                        break;
                                    }
                                case "enum32":
                                    {
                                        ItemTag += 1;
                                        string Name = XR.GetAttribute("name");
                                        int Offset = System.Convert.ToInt32(XR.GetAttribute("offset"));
                                        bool Visible = bool.Parse(XR.GetAttribute("visible"));
                                        List<string> Temp = new List<string>();
                                        while (XR.Name.ToLower() == "option")
                                        {
                                            Temp.Add(XR.GetAttribute("name"));
                                        }
                                        string[] Options = Temp.ToArray();
                                        Map.BR.BaseStream.Position = Offset;
                                        int Value = Map.BR.ReadInt32();
                                        Plugin.Add(new ENTEnum(Map, Name, Offset, Visible, Value, Options, typeof(int), ItemTag));
                                        break;
                                    }
I tryed many things the code in the enum8 was my last attempt. And sorry about the spacing.
Image
AI Zones in MP | Ambiance | Gravemind Beta v1.1
Aumaan Anubis wrote:Grimdoomer. The first person ever to mod Halo 2 Vista.
User avatar
LuxuriousMeat





Posts: 824
Joined: Thu Nov 03, 2005 6:43 pm
Location: zzzzzzzzzzzzzzzz
Contact:

Post by LuxuriousMeat »

The method 'XmlTextReader.ReadSubtree' returns a new XmlReader that just has the child elements of the current element, you can try to use that or you can download entity's source and look how they did it.
Image
User avatar
grimdoomer




System Engineer

Posts: 1440
Joined: Mon Oct 09, 2006 4:36 pm

Post by grimdoomer »

Ill try that, I did look at entitys source and when I tried it it didn't work the way I wanted it to.
Image
AI Zones in MP | Ambiance | Gravemind Beta v1.1
Aumaan Anubis wrote:Grimdoomer. The first person ever to mod Halo 2 Vista.
Post Reply