예제 #1
0
        public void SaveValue(EndianIO IO, int parentOffset)
        {
            //Go to the required offset
            IO.Out.BaseStream.Position = parentOffset + BitmaskData.Offset;
            //Determine type and write accordingly
            switch (BitmaskData.Attributes)
            {
            case mValue.ObjectAttributes.Bitmask8:
            {
                IO.Out.Write((byte)BitHelper.ConvertToWriteableInteger(ReturnCheckedList()));
                break;
            }

            case mValue.ObjectAttributes.Bitmask16:
            {
                IO.Out.Write((short)BitHelper.ConvertToWriteableInteger(ReturnCheckedList()));
                break;
            }

            case mValue.ObjectAttributes.Bitmask32:
            {
                IO.Out.Write(BitHelper.ConvertToWriteableInteger(ReturnCheckedList()));
                break;
            }
            }
        }
예제 #2
0
        public RTHData.RTHDataBlock ReturnRTHDataBlock(int parentMemoryOffset)
        {
            //Initialize our RTH Data Block
            RTHData.RTHDataBlock RTH_Data_Block = new RTHData.RTHDataBlock();
            //Set our memory offset
            RTH_Data_Block.Memory_Offset = (uint)(parentMemoryOffset + BitmaskData.Offset);
            //Determine type and assign accordingly
            switch (BitmaskData.Attributes)
            {
            case mValue.ObjectAttributes.Bitmask8:
            {
                RTH_Data_Block.Data_Block =
                    ExtraFunctions.ValueToBytes((byte)BitHelper.ConvertToWriteableInteger(ReturnCheckedList()));
                break;
            }

            case mValue.ObjectAttributes.Bitmask16:
            {
                RTH_Data_Block.Data_Block =
                    ExtraFunctions.ValueToBytes((short)BitHelper.ConvertToWriteableInteger(ReturnCheckedList()));
                break;
            }

            case mValue.ObjectAttributes.Bitmask32:
            {
                RTH_Data_Block.Data_Block =
                    ExtraFunctions.ValueToBytes(BitHelper.ConvertToWriteableInteger(ReturnCheckedList()));
                break;
            }
            }
            //Reverse our value
            //Array.Reverse(RTH_Data_Block.Data_Block);
            //Set our block size
            RTH_Data_Block.Block_Size = RTH_Data_Block.Data_Block.Length;
            //Return the RTH Data Block instance
            return(RTH_Data_Block);
        }
예제 #3
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);
                }
            }