예제 #1
0
        /// <summary>
        /// Tracks a pnames/textureX entry. Does nothing if it is not one of
        /// the vanilla entries.
        /// </summary>
        /// <param name="entry">The entry to track.</param>
        public void Track(IEntry entry)
        {
            switch (entry.Name.String)
            {
            case "PNAMES":
                Optional <PNames> pnames = PNames.From(entry.Data);
                if (pnames)
                {
                    lastPnames = pnames.Value;
                }
                else
                {
                    Log.Error($"Error reading pnames at: {entry.Path}");
                }
                break;

            case "TEXTURE1":
            case "TEXTURE2":
                Optional <TextureX> textureX = TextureX.From(entry);
                if (textureX)
                {
                    if (textureX.Value.TextureXNumber == 1)
                    {
                        lastTexture1 = textureX.Value;
                    }
                    else
                    {
                        lastTexture2 = textureX.Value;
                    }
                }
                else
                {
                    Log.Error($"Error reading pnames at: {entry.Path}");
                }
                break;

            default:
                Debug.Assert(false, $"Should not be processing entry {entry.Path} in the vanilla texture definitions tracker");
                break;
            }
        }
예제 #2
0
        private static void ParseAndAddDefinitions(PNames pnames, TextureX textureX, List <TextureDefinition> definitions)
        {
            if (pnames == null || textureX == null)
            {
                return;
            }

            foreach (TextureXImage image in textureX)
            {
                TextureDefinition definition = new TextureDefinition(image.Name, image.Dimension, ResourceNamespace.Textures);

                foreach (TextureXPatch patch in image.Patches)
                {
                    UpperString            name     = pnames[patch.PatchIndex];
                    TextureDefinitionPatch defPatch = new TextureDefinitionPatch(name, patch.Offset, ResourceNamespace.Textures);
                    definition.Patches.Add(defPatch);
                }

                definitions.Add(definition);
            }
        }