Example #1
0
 public void SaveMapVariantInformation(HaloUserMap User_Map)
 {
     //Go to the Map Variant Information Offset
     User_Map.IO.Out.BaseStream.Position = User_Map.SandboxOffset + 0x238;
     //Write our unknown values.
     User_Map.IO.Out.Write(unknown);
     User_Map.IO.Out.Write(unknown_2);
     User_Map.IO.Out.Write(unknown_4);
     //Read the spawned object count
     User_Map.IO.Out.Write(Spawned_Object_Count);
     //Read our unknown value.
     User_Map.IO.Out.Write(unknown_6);
     //Read the map ID
     User_Map.IO.Out.Write(Map_ID);
     //Read our world bounds values
     User_Map.IO.Out.Write(World_Bounds_X_Min);
     User_Map.IO.Out.Write(World_Bounds_X_Max);
     User_Map.IO.Out.Write(World_Bounds_Y_Min);
     User_Map.IO.Out.Write(World_Bounds_Y_Max);
     User_Map.IO.Out.Write(World_Bounds_Z_Min);
     User_Map.IO.Out.Write(World_Bounds_Z_Max);
     //Read our unknown value.
     User_Map.IO.Out.Write(unknown_36);
     //Read the maximum budget
     User_Map.IO.Out.Write(Maximum_Budget);
     //Read the current budget
     User_Map.IO.Out.Write(Current_Budget);
     //Read our unknown values.
     User_Map.IO.Out.Write(unknown_48);
     User_Map.IO.Out.Write(unknown_52);
 }
Example #2
0
 public PalletteBlocks(HaloUserMap User_Map)
 {
     //Loop for each chunk.
     for (int i = 0; i < 256; i++)
     {
         //Initialize our pallete block instance
         PalletteBlock pallete_Block = new PalletteBlock();
         //Go to our pallete block offset
         User_Map.IO.In.BaseStream.Position = User_Map.SandboxOffset + 0xD494 + (i * 12);
         //Set its offset in the usermap
         pallete_Block.Index_Offset = (int)User_Map.IO.In.BaseStream.Position - User_Map.SandboxOffset;
         //Read the tag Ident
         pallete_Block.Tag_Ident = User_Map.IO.In.ReadInt32();
         //Read the runtimes.
         pallete_Block.Run_Time_Minimum = User_Map.IO.In.ReadByte();
         pallete_Block.Run_Time_Maximum = User_Map.IO.In.ReadByte();
         //Read the number on the map
         pallete_Block.Number_On_Map = User_Map.IO.In.ReadByte();
         //Read the design time maximum
         pallete_Block.Design_Time_Maximum = User_Map.IO.In.ReadByte();
         //Read the total cost
         pallete_Block.Total_Cost = User_Map.IO.In.ReadSingle();
         //Set our block's index
         pallete_Block.Index = i;
         //Add it to the list
         Add(pallete_Block);
     }
 }
Example #3
0
 public MapVariantInformation(HaloUserMap User_Map)
 {
     //Go to the Map Variant Information Offset
     User_Map.IO.In.BaseStream.Position = User_Map.SandboxOffset + 0x238;
     //Read our unknown values.
     unknown   = User_Map.IO.In.ReadInt16();
     unknown_2 = User_Map.IO.In.ReadInt16();
     unknown_4 = User_Map.IO.In.ReadByte();
     //Read the spawned object count
     Spawned_Object_Count = User_Map.IO.In.ReadByte();
     //Read our unknown value.
     unknown_6 = User_Map.IO.In.ReadInt16();
     //Read the map ID
     Map_ID = User_Map.IO.In.ReadInt32();
     //Read our world bounds values
     World_Bounds_X_Min = User_Map.IO.In.ReadSingle();
     World_Bounds_X_Max = User_Map.IO.In.ReadSingle();
     World_Bounds_Y_Min = User_Map.IO.In.ReadSingle();
     World_Bounds_Y_Max = User_Map.IO.In.ReadSingle();
     World_Bounds_Z_Min = User_Map.IO.In.ReadSingle();
     World_Bounds_Z_Max = User_Map.IO.In.ReadSingle();
     //Read our unknown value.
     unknown_36 = User_Map.IO.In.ReadInt32();
     //Read the maximum budget
     Maximum_Budget = User_Map.IO.In.ReadSingle();
     //Read the current budget
     Current_Budget = User_Map.IO.In.ReadSingle();
     //Read our unknown values.
     unknown_48 = User_Map.IO.In.ReadInt32();
     unknown_52 = User_Map.IO.In.ReadInt32();
 }
Example #4
0
 public UserMapForm(HaloUserMap usermap, HaloMap map)
 {
     InitializeComponent();
     //Set our instance of the usermap
     Usermap = usermap;
     //Set our instance of the HaloMap class
     Map = map;
     //Load our variant information
     LoadVariantInformation();
     //Load the tag tree
     LoadTagTree();
     //Load classes
     LoadClasses();
     //Set the forms text
     Text = Usermap.FileName;
 }
Example #5
0
 public void SavePalleteBlocks(HaloUserMap User_Map)
 {
     //Loop for each chunk.
     for (int i = 0; i < Count; i++)
     {
         //Go to our pallete block offset
         User_Map.IO.Out.BaseStream.Position = User_Map.SandboxOffset + this[i].Index_Offset;
         //Write the tag Ident
         User_Map.IO.Out.Write(this[i].Tag_Ident);
         //Write the runtimes.
         User_Map.IO.Out.Write(this[i].Run_Time_Minimum);
         User_Map.IO.Out.Write(this[i].Run_Time_Maximum);
         //Write the number on the map
         User_Map.IO.Out.Write(this[i].Number_On_Map);
         //Write the design time maximum
         User_Map.IO.Out.Write(this[i].Design_Time_Maximum);
         //Write the total cost
         User_Map.IO.Out.Write(this[i].Total_Cost);
     }
 }
Example #6
0
 public void SaveMapVariantHeader(HaloUserMap User_Map)
 {
     //Go to our sandbox offset
     User_Map.IO.Out.BaseStream.Position = User_Map.SandboxOffset + 0x138;
     //Write our mapV string
     User_Map.IO.Out.WriteAsciiString(MapVString, 4);
     //Write our sandbox size
     User_Map.IO.Out.Write(Size);
     //Write our unknowns
     User_Map.IO.Out.Write(unknown_8);
     User_Map.IO.Out.Write(unknown_10);
     //Skip unused data
     User_Map.IO.Out.BaseStream.Position += 0xC;
     //Write our variant data
     User_Map.IO.Out.WriteUnicodeString(Variant_Name, 0x10);
     User_Map.IO.Out.WriteAsciiString(Variant_Description, 0x80);
     User_Map.IO.Out.WriteAsciiString(Variant_Author, 0x10);
     //Write more unknowns
     User_Map.IO.Out.Write(unknown_200);
     User_Map.IO.Out.Write(unknown_204);
     User_Map.IO.Out.Write(unknown_208);
     User_Map.IO.Out.Write(unknown_212);
     User_Map.IO.Out.Write(unknown_216);
     //Read our entry size
     User_Map.IO.Out.Write(Entry_Size);
     //Read our CON File Name int's
     User_Map.IO.Out.Write(CON_File_Name_1);
     User_Map.IO.Out.Write(CON_File_Name_2);
     //Write our unknown and null
     User_Map.IO.Out.Write(unknown_232);
     User_Map.IO.Out.Write(null1);
     //Write our map id
     User_Map.IO.Out.Write(Map_ID);
     //Write our unknowns and nulls remaining
     User_Map.IO.Out.Write(unknown_244);
     User_Map.IO.Out.Write(null2);
     User_Map.IO.Out.Write(null3);
     User_Map.IO.Out.Write(unknown_254);
 }
Example #7
0
 public MapVariantHeader(HaloUserMap User_Map)
 {
     //Go to our sandbox offset
     User_Map.IO.In.BaseStream.Position = User_Map.SandboxOffset + 0x138;
     //Read our mapV string
     MapVString = User_Map.IO.In.ReadAsciiString(4);
     //Read our sandbox size
     Size = User_Map.IO.In.ReadInt32();
     //Read our unknowns
     unknown_8  = User_Map.IO.In.ReadInt16();
     unknown_10 = User_Map.IO.In.ReadInt16();
     //Skip unused data
     User_Map.IO.In.BaseStream.Position += 0xC;
     //Read our variant data
     Variant_Name        = User_Map.IO.In.ReadUnicodeString(0x10);
     Variant_Description = User_Map.IO.In.ReadAsciiString(0x80);
     Variant_Author      = User_Map.IO.In.ReadAsciiString(0x10);
     //Read more unknowns
     unknown_200 = User_Map.IO.In.ReadInt32();
     unknown_204 = User_Map.IO.In.ReadInt32();
     unknown_208 = User_Map.IO.In.ReadInt32();
     unknown_212 = User_Map.IO.In.ReadInt32();
     unknown_216 = User_Map.IO.In.ReadInt32();
     //Read our entry size
     Entry_Size = User_Map.IO.In.ReadInt32();
     //Read our CON File Name int's
     CON_File_Name_1 = User_Map.IO.In.ReadInt32();
     CON_File_Name_2 = User_Map.IO.In.ReadInt32();
     unknown_232     = User_Map.IO.In.ReadInt32();
     null1           = User_Map.IO.In.ReadInt32();
     //Read our map id
     Map_ID = User_Map.IO.In.ReadInt32();
     //Read our unknowns and nulls remaining
     unknown_244 = User_Map.IO.In.ReadInt32();
     null2       = User_Map.IO.In.ReadInt32();
     null3       = User_Map.IO.In.ReadInt32();
     unknown_254 = User_Map.IO.In.ReadInt32();
 }
Example #8
0
        private void btnOpenMapFile_Click(object sender, EventArgs e)
        {
            //If the usermap was not selected...
            if (txtOpenUsermap.Text == "")
            {
                //Tell them to select it first
                MessageBox.Show("You must open a sandbox.map or a usermap Container file before opening the Map File.");
                //Stop processing code.
                return;
            }

            //Load our usermap
            HaloUserMap usermap = new HaloUserMap(txtOpenUsermap.Text);
            //Get our filter
            string filter = "Halo 3 Map File|*.map";

            //Get our map ID
            MapIdentifier.MapID mapID = (MapIdentifier.MapID)usermap.Map_Variant_Header.Map_ID;
            //if the map ID isn't "other"
            if (mapID != MapIdentifier.MapID.Other)
            {
                //Set our filter for this usermap.
                filter = mapID.ToString().ToLower() + ".map|*" + mapID.ToString().ToLower() + ".map";
            }

            //Initialize a new OpenFileDialog
            OpenFileDialog ofd = new OpenFileDialog();

            //Set the filter
            ofd.Filter = filter;
            //If the result of us showing the dialog is the user clicking OK(meaning he/she selected a file..)
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                //Set the text for the textBox
                txtOpenMapFile.Text = ofd.FileName;
            }
        }
Example #9
0
            public void SavePlacementBlocks(HaloUserMap User_Map)
            {
                //Loop through all the placement blocks.
                for (int i = 0; i < Count; i++)
                {
                    //Go to that placement block's offset.
                    User_Map.IO.Out.BaseStream.Position = this[i].Index_Offset + User_Map.SandboxOffset;
                    //Write our blockType
                    User_Map.IO.Out.Write((int)this[i].Block_Type);
                    //Write our unused
                    User_Map.IO.Out.Write(this[i].unused_4);

                    //Write the tags index which is the index of the pallete to use.
                    User_Map.IO.Out.Write(this[i].Tags_Index);

                    //Write our X Coordinate
                    User_Map.IO.Out.Write(this[i].X);
                    //Write our Y Coordinate
                    User_Map.IO.Out.Write(this[i].Y);
                    //Write our Z Coordinate
                    User_Map.IO.Out.Write(this[i].Z);
                    //Write our Yaw Rotation Coordinate
                    User_Map.IO.Out.Write(this[i].Yaw);
                    //Write our Pitch Rotation Coordinate
                    User_Map.IO.Out.Write(this[i].Pitch);
                    //Write our Roll Rotation Coordinate
                    User_Map.IO.Out.Write(this[i].Roll);

                    //Write the three unknown rotation values.
                    User_Map.IO.Out.Write(this[i].unknown_Rot_1);
                    User_Map.IO.Out.Write(this[i].unknown_Rot_2);
                    User_Map.IO.Out.Write(this[i].unknown_Rot_3);

                    //Write our 16 bytes of unused
                    User_Map.IO.Out.Write(this[i].unused_52);

                    //Write two unknowns.
                    User_Map.IO.Out.Write(this[i].unknown_60);
                    User_Map.IO.Out.Write(this[i].unknown_61);

                    //Initialize our flags list
                    List <bool> flags = new List <bool>();
                    //Set the unknown flag as the first bit
                    flags.Add(this[i].Flag_Unknown);
                    //Set the place at start as the second bit
                    flags.Add(this[i].Flag_Place_At_Start);
                    //Set the asymmetrical flag as the third bit
                    flags.Add(this[i].Flag_Asymmetrical);
                    //Set the symmetrical flag as the fourth bit.
                    flags.Add(this[i].Flag_Symmetrical);
                    //Add the 0 bits at the end
                    flags.Add(false);
                    flags.Add(false);
                    flags.Add(false);
                    flags.Add(false);

                    //Convert it to a byte and write it
                    User_Map.IO.Out.Write(byte.Parse(BitHelper.ConvertToWriteableInteger(flags).ToString()));

                    //Write our team index
                    User_Map.IO.Out.Write(this[i].Team);
                    //Write our spare clips
                    User_Map.IO.Out.Write(this[i].Spare_Clips);
                    //Write our respawn time.
                    User_Map.IO.Out.Write(this[i].Respawn_Time);

                    //Write our unused.
                    User_Map.IO.Out.Write(this[i].unused_68);
                }
            }
Example #10
0
            public PlacementBlocks(HaloUserMap User_Map)
            {
                //Loop through all the placement blocks.
                for (int i = 0; i < 640; i++)
                {
                    //Initialize our placement block
                    PlacementBlock placement_block = new PlacementBlock();
                    //Go to that placement block's offset.
                    User_Map.IO.In.BaseStream.Position = User_Map.SandboxOffset + 0x278 + (i * 0x54);
                    //Set our index offset which is the offset of the placement block within the sandbox
                    placement_block.Index_Offset = (int)User_Map.IO.In.BaseStream.Position - User_Map.SandboxOffset;
                    //Read our blockType
                    placement_block.Block_Type = (PlacementBlock.BlockType)User_Map.IO.In.ReadInt32();
                    //Read our unused
                    placement_block.unused_4 = User_Map.IO.In.ReadBytes(8);

                    //Read the tags index which is the index of the pallete to use.
                    placement_block.Tags_Index = User_Map.IO.In.ReadInt32();

                    //Read our X Coordinate
                    placement_block.X = User_Map.IO.In.ReadSingle();
                    //Read our Y Coordinate
                    placement_block.Y = User_Map.IO.In.ReadSingle();
                    //Read our Z Coordinate
                    placement_block.Z = User_Map.IO.In.ReadSingle();
                    //Read our Yaw Rotation Coordinate
                    placement_block.Yaw = User_Map.IO.In.ReadSingle();
                    //Read our Pitch Rotation Coordinate
                    placement_block.Pitch = User_Map.IO.In.ReadSingle();
                    //Read our Roll Rotation Coordinate
                    placement_block.Roll = User_Map.IO.In.ReadSingle();

                    //Read the three unknown rotation values.
                    placement_block.unknown_Rot_1 = User_Map.IO.In.ReadSingle();
                    placement_block.unknown_Rot_2 = User_Map.IO.In.ReadSingle();
                    placement_block.unknown_Rot_3 = User_Map.IO.In.ReadSingle();

                    //Read our 16 bytes of unused
                    placement_block.unused_52 = User_Map.IO.In.ReadBytes(16);
                    //Read two unknowns.
                    placement_block.unknown_60 = User_Map.IO.In.ReadByte();
                    placement_block.unknown_61 = User_Map.IO.In.ReadByte();

                    //Load our byte value for our flags
                    List <bool> flags = BitHelper.LoadValue(int.Parse(User_Map.IO.In.ReadByte().ToString()), 8);
                    //Set the unknown flag as the first bit
                    placement_block.Flag_Unknown = flags[0];
                    //Set the place at start as the second bit
                    placement_block.Flag_Place_At_Start = flags[1];
                    //Set the asymmetrical flag as the third bit
                    placement_block.Flag_Asymmetrical = flags[2];
                    //Set the symmetrical flag as the fourth bit.
                    placement_block.Flag_Symmetrical = flags[3];

                    //Read our team index
                    placement_block.Team = User_Map.IO.In.ReadByte();
                    //Read our spare clips
                    placement_block.Spare_Clips = User_Map.IO.In.ReadByte();
                    //Read our respawn time.
                    placement_block.Respawn_Time = User_Map.IO.In.ReadByte();

                    //Read our unused.
                    placement_block.unused_68 = User_Map.IO.In.ReadBytes(16);

                    //Add the placement block to the list.
                    Add(placement_block);
                    //If our placement block's pallete index isn't null
                    if (placement_block.Tags_Index != -1)
                    {
                        //Add the placement block to the parent pallete block's list
                        User_Map.Pallette_Blocks[placement_block.Tags_Index].Placement_Blocks.Add(placement_block);
                    }
                }
            }