Exemple #1
0
        private void AddPaletteChange(uint paletteID, uint offset, uint length)
        {
            var cloSubPalette = new CloSubPalette();

            cloSubPalette.PaletteSet = paletteID;

            var cloSubPaletteRange = new CloSubPaletteRange();

            cloSubPaletteRange.Offset    = offset * 8;
            cloSubPaletteRange.NumColors = length * 8;

            cloSubPalette.Ranges.Add(cloSubPaletteRange);

            var cloSubPalettes = new List <CloSubPalette>()
            {
                cloSubPalette
            };

            if (PaletteChanges == null)
            {
                PaletteChanges = new PaletteChanges(cloSubPalettes);
            }
            else
            {
                PaletteChanges.Add(cloSubPalettes);
            }
        }
Exemple #2
0
        public void Add(uint clothingTableID, PaletteTemplate paletteTemplate = PaletteTemplate.Undef, float shade = 0.0f)
        {
            var clothingTable = DatManager.PortalDat.ReadFromDat <ClothingTable>(clothingTableID);

            if (!clothingTable.ClothingBaseEffects.TryGetValue(SetupId, out var baseEffect))
            {
                return;
            }

            // palette changes
            if (clothingTable.ClothingSubPalEffects.TryGetValue((uint)paletteTemplate, out var palEffect))
            {
                if (PaletteChanges == null)
                {
                    PaletteChanges = new PaletteChanges(palEffect.CloSubPalettes, shade);
                }
                else
                {
                    PaletteChanges.Add(palEffect.CloSubPalettes, shade);
                }
            }

            foreach (var objEffect in baseEffect.CloObjectEffects)
            {
                if (PartChanges == null)
                {
                    PartChanges = new Dictionary <uint, PartChange>();
                }

                // gfxobj change
                if (!PartChanges.TryGetValue(objEffect.Index, out var partChange))
                {
                    partChange = new PartChange(objEffect.ModelId);
                    PartChanges.Add(objEffect.Index, partChange);
                }
                else
                {
                    partChange.NewGfxObjId = objEffect.ModelId;
                }

                // texture changes
                foreach (var texEffect in objEffect.CloTextureEffects)
                {
                    if (partChange.TextureChanges == null)
                    {
                        partChange.TextureChanges = new Dictionary <uint, uint>();
                    }

                    partChange.TextureChanges[texEffect.OldTexture] = texEffect.NewTexture;
                }
            }
        }
Exemple #3
0
        public void LoadTextures(Dictionary <uint, uint> textureChanges = null, PaletteChanges paletteChanges = null, bool useCache = true)
        {
            Textures = new List <Texture2D>();
            Surfaces = new List <Surface>();

            foreach (var surfaceID in _gfxObj.Surfaces)
            {
                var surface = DatManager.PortalDat.ReadFromDat <Surface>(surfaceID);
                Surfaces.Add(surface);

                Textures.Add(TextureCache.Get(surfaceID, textureChanges, paletteChanges, useCache));
            }
        }