Ejemplo n.º 1
0
 private static string GetBumpTypeName(byte val)
 {
     if (BumpImageChunk.GetBumpTypeInfo(val) == null)
     {
         return(string.Format("{0:x} (Unknown)", val));
     }
     else
     {
         return(BumpImageChunk.GetBumpTypeInfo(val).Name);
     }
 }
Ejemplo n.º 2
0
        ///========================================================================
        /// Static Method : FindBumpData
        ///
        /// <summary>
        ///     Find a specific bump, by hunting through all the flats
        /// </summary>
        /// <param name="xiRootDir"></param>
        /// <param name="xiIndex"></param>
        /// <param name="xiSearchValueMin"></param>
        /// <param name="xiSearchValueMax"></param>
        /// <returns></returns>
        ///========================================================================
        private static int FindBumpData(DirectoryInfo xiRootDir, byte xiSearchValueMin, byte xiSearchValueMax)
        {
            Files lAllFiles = LoadAllFilesFromRootPath(xiRootDir);

            foreach (FileHolder lFile in lAllFiles.FileHolders)
            {
                bool lFound = false;

                for (int lBumpImageIdx = 0; lBumpImageIdx < lFile.Level.SHET.BumpImages.GetChildren().Length; lBumpImageIdx++)
                {
                    BumpImageChunk lBumpImage = (BumpImageChunk)lFile.Level.SHET.BumpImages.GetChildren()[lBumpImageIdx];

                    for (int ii = 0; ii < 8; ii++)
                    {
                        for (int jj = 0; jj < 8; jj++)
                        {
                            byte lBumpType = lBumpImage.GetPixelType(ii, jj);

                            if (lBumpType >= xiSearchValueMin && lBumpType <= xiSearchValueMax)
                            {
                                foreach (FlatChunk lFlat in lFile.Level.SHET.Flats)
                                {
                                    if (!lFlat.HasMetaData)
                                    {
                                        continue;
                                    }

                                    for (int kk = 0; kk < lFlat.Width; kk++)
                                    {
                                        for (int ll = 0; ll < lFlat.Height; ll++)
                                        {
                                            if (lFlat.TexMetaData[kk][ll][(int)eTexMetaDataEntries.Bumpmap] == lBumpImageIdx)
                                            {
                                                Console.Out.WriteLine(string.Format("{4}: Level {0} Flat {1} ({2}, {3})",
                                                                                    lFile.Level.Name,
                                                                                    lFlat.Name,
                                                                                    kk,
                                                                                    ll,
                                                                                    lBumpImage.GetPixelType(ii, jj)));

                                                if (xiSearchValueMin == xiSearchValueMax)
                                                {
                                                    lFound = true;
                                                    break;
                                                }
                                            }
                                        }
                                        if (lFound)
                                        {
                                            break;
                                        }
                                    }
                                    if (lFound)
                                    {
                                        break;
                                    }
                                }
                            }
                            if (lFound)
                            {
                                break;
                            }
                        }
                        if (lFound)
                        {
                            break;
                        }
                    }
                    if (lFound)
                    {
                        break;
                    }
                }
            }

            return(0);
        }