예제 #1
0
        public static bool ClassicInit()
        {
            if (ClassicData != null)
            {
                return(true);
            }
            string dir = Environment.GetEnvironmentVariable("OLMODDIR");
            string hogFile = Path.Combine(dir, "descent.hog"), pigFile = Path.Combine(dir, "descent.pig");

            if (!File.Exists(hogFile) || !File.Exists(pigFile))
            {
                return(false);
            }
            Hog hog = new Hog(hogFile);

            byte[] vgapal = hog.ItemData("palette.256");
            pal = ClassicLoader.VgaPalConv(vgapal);

            pal32 = new Color32[256];
            for (int i = 0; i < 256; i++)
            {
                pal32[i] = new Color32(pal[i * 3], pal[i * 3 + 1], pal[i * 3 + 2], 255);
            }

            palu = new uint[256];
            for (int i = 0; i < 256; i++)
            {
                palu[i] = ((uint)pal[i * 3] << 0) | ((uint)pal[i * 3 + 1] << 8) | ((uint)pal[i * 3 + 2] << 16) | (255u << 24);
            }

            pig = new Pig(pigFile);

            pig.ReadTableData(out ClassicData);

            shader = Shader.Find("Standard");
            //shader = Shader.Find("Diffuse");
            return(true);
        }