예제 #1
0
        /// <summary>
        /// The load weapons.
        /// </summary>
        /// <param name="WeaponsList">The weapons list.</param>
        /// <remarks></remarks>
        public void LoadWeapons(ref List <CollectionInfo> WeaponsList)
        {
            if (WeaponsList == null)
            {
                WeaponsList = new List <CollectionInfo>();
            }
            else
            {
                WeaponsList.Clear();
            }

            map.OpenMap(MapTypes.Internal);

            // Lists all weapons
            for (int i = 0; i < map.MetaInfo.TagType.Length; i++)
            {
                if ((map.MetaInfo.TagType[i] == "itmc") || (map.MetaInfo.TagType[i] == "vehc"))
                {
                    CollectionInfo Weapon = new CollectionInfo();
                    Meta           m      = new Meta(map);
                    m.ReadMetaFromMap(i, false);

                    Weapon.ItmcTagNumber = i;

                    // Base address of ITMC tag, offset of WEAP pointer (+20)
                    map.BR.BaseStream.Position = map.MetaInfo.Offset[Weapon.ItmcTagNumber] + 20;
                    Weapon.WeapTagNumber       = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32());
                    if (Weapon.WeapTagNumber == -1)
                    {
                        continue;
                    }

                    // Base address of WEAP tag, offset of HLMT pointer (+56)
                    map.BR.BaseStream.Position = map.MetaInfo.Offset[Weapon.WeapTagNumber] + 56;
                    Weapon.HlmtTagNumber       = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32());
                    if (Weapon.HlmtTagNumber != -1)
                    {
                        // Base address of HLMT tag, offset of MODE pointer (+4)
                        map.BR.BaseStream.Position = map.MetaInfo.Offset[Weapon.HlmtTagNumber] + 4;
                        Weapon.ModelTagNumber      = map.Functions.ForMeta.FindMetaByID(map.BR.ReadInt32());
                        m.ReadMetaFromMap(Weapon.ModelTagNumber, false);
                        Weapon.Model = new ParsedModel(ref m);
                        ParsedModel.DisplayedInfo.LoadDirectXTexturesAndBuffers(ref device, ref Weapon.Model);

                        // Store names into Weapon
                        Weapon.TagPath = map.FileNames.Name[i];
                        Weapon.TagType = map.MetaInfo.TagType[i];
                        int      xx        = map.Functions.ForMeta.FindByNameAndTagType(Weapon.TagType, Weapon.TagPath);
                        string[] NameSplit = map.FileNames.Name[xx].Split('\\');
                        Weapon.Name = NameSplit[NameSplit.Length - 1];
                        Weapon.Name = Weapon.Name.Replace('_', ' ');
                        WeaponsList.Add(Weapon);
                    }
                }
            }

            map.CloseMap();
        }
예제 #2
0
        /// <summary>
        /// The load weapons.
        /// </summary>
        /// <param name="WeaponsList">The weapons list.</param>
        /// <remarks></remarks>
        public void LoadWeapons(ref List <CollectionInfo> WeaponsList)
        {
            if (WeaponsList == null)
            {
                WeaponsList = new List <CollectionInfo>();
            }
            else
            {
                WeaponsList.Clear();
            }

            map.OpenMap(MapTypes.Internal);

            // Lists all weapons
            for (int i = 0; i < map.MetaInfo.TagType.Length; i++)
            {
                if ((map.MetaInfo.TagType[i] == "itmc") || (map.MetaInfo.TagType[i] == "vehc"))
                {
                    CollectionInfo Weapon = new CollectionInfo();
                    Meta           m      = new Meta(map);
                    m.ReadMetaFromMap(i, false);

                    Weapon.ModelTagNumber = map.Functions.FindModelByBaseClass(i);
                    if (Weapon.ModelTagNumber != -1)
                    {
                        m.ReadMetaFromMap(Weapon.ModelTagNumber, false);
                        Weapon.Model = new ParsedModel(ref m);
                        ParsedModel.DisplayedInfo.LoadDirectXTexturesAndBuffers(ref device, ref Weapon.Model);

                        // Store names into Weapon
                        Weapon.TagPath = map.FileNames.Name[i];
                        Weapon.TagType = map.MetaInfo.TagType[i];
                        int      xx        = map.Functions.ForMeta.FindByNameAndTagType(Weapon.TagType, Weapon.TagPath);
                        string[] NameSplit = map.FileNames.Name[xx].Split('\\');
                        Weapon.Name = NameSplit[NameSplit.Length - 1];
                        Weapon.Name = Weapon.Name.Replace('_', ' ');
                        WeaponsList.Add(Weapon);
                    }
                }
            }

            map.CloseMap();
        }