Example #1
0
 protected override void InitTextures(ArchiveWorker aw = null)
 {
     Textures = new List <TextureHandler>();
     for (int t = 0; t < Props.Count; t++)
     {
         TEX tex;
         tex = new TEX(ArchiveWorker.GetBinaryFile(ArchiveString,
                                                   aw.GetListOfFiles().First(x => x.IndexOf(Props[t].Filename, StringComparison.OrdinalIgnoreCase) >= 0)));
         if (Props[t].Colors == null || Props[t].Colors.Length == 0)
         {
             for (ushort i = 0; i < tex.GetClutCount; i++)
             {
                 if (FORCE_ORIGINAL == false && Props[t].Big != null && Props[t].Big.Count > 0)
                 {
                     Textures.Add(TextureHandler.Create(Props[t].Big[0].Filename, tex, 2, Props[t].Big[0].Split / 2, i));
                 }
                 else
                 {
                     Textures.Add(TextureHandler.Create(Props[t].Filename, tex, 1, 1, i));
                 }
             }
         }
         else
         {
             if (FORCE_ORIGINAL == false && Props[t].Big != null && Props[t].Big.Count > 0)
             {
                 Textures.Add(TextureHandler.Create(Props[t].Big[0].Filename, tex, 2, Props[t].Big[0].Split / 2, (ushort)Textures.Count, colors: Props[t].Big[0].Colors ?? Props[t].Colors));
             }
             else
             {
                 Textures.Add(TextureHandler.Create(Props[t].Filename, tex, 1, 1, (ushort)Textures.Count, colors: Props[t].Colors));
             }
         }
     }
 }
Example #2
0
        public void LoadFonts()
        {
            ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_MENU);
            string        sysfntTdwFilepath = aw.GetListOfFiles().First(x => x.ToLower().Contains("sysfnt.tdw"));
            string        sysfntFilepath    = aw.GetListOfFiles().First(x => x.ToLower().Contains("sysfnt.tex"));
            TEX           tex = new TEX(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfntFilepath));

            sysfnt    = tex.GetTexture((int)ColorID.White);
            sysfntbig = new TextureHandler("sysfld{0:00}.tex", tex, 2, 1, (int)ColorID.White);

            ReadTdw(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfntTdwFilepath));
        }
Example #3
0
 public TextureHandler(string filename, uint cols, uint rows)
 {
     if (cols == 1 && rows == 1)
     {
         ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_MENU);
         filename = aw.GetListOfFiles().First(x => x.IndexOf(filename, StringComparison.OrdinalIgnoreCase) >= 0);
         TEX tex = new TEX(aw.GetBinaryFile(filename));
         Init(filename, tex, cols, rows);
     }
     else
     {
         Init(filename, null, cols, rows);
     }
 }
Example #4
0
        public void LoadFonts()
        {
            ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_MENU);
            string        sysfntTdwFilepath = aw.GetListOfFiles().First(x => x.ToLower().Contains("sysfnt.tdw"));
            string        sysfntFilepath    = aw.GetListOfFiles().First(x => x.ToLower().Contains("sysfnt.tex"));
            TEX           tex = new TEX(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfntFilepath));

            sysfnt    = tex.GetTexture((int)ColorID.White);
            sysfntbig = TextureHandler.Create("sysfld{0:00}.tex", tex, 2, 1, (int)ColorID.White);

            TDW tim = new TDW(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfntTdwFilepath), 0);

            charWidths = tim.CharWidths;
            menuFont   = tim.GetTexture((ushort)ColorID.White);
        }
Example #5
0
        public void LoadFonts()
        {
            Memory.Log.WriteLine($"{nameof(Font)} :: {nameof(LoadFonts)} ");
            var aw        = ArchiveWorker.Load(Memory.Archives.A_MENU);
            var bufferTex = aw.GetBinaryFile("sysfnt.tex");
            var tex       = new TEX(bufferTex);

            sysfnt    = tex.GetTexture((int)ColorID.White);
            sysfntbig = TextureHandler.Create("sysfld{0:00}.tex", tex, 2, 1, (int)ColorID.White);

            var bufferTDW = aw.GetBinaryFile("sysfnt.tdw");
            var tim       = new TDW(bufferTDW);

            charWidths = tim.CharWidths;
            menuFont   = tim.GetTexture((ushort)ColorID.White);
        }
Example #6
0
        public void LoadFonts()
        {
            Memory.Log.WriteLine($"{nameof(Font)} :: {nameof(LoadFonts)} ");
            ArchiveWorker aw = new ArchiveWorker(Memory.Archives.A_MENU);

            string[] filelist = aw.GetListOfFiles();
            if (filelist != null)
            {
                string sysfntTdwFilepath = filelist.First(x => x.ToLower().Contains("sysfnt.tdw"));
                string sysfntFilepath    = filelist.First(x => x.ToLower().Contains("sysfnt.tex"));
                TEX    tex = new TEX(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfntFilepath));
                sysfnt    = tex.GetTexture((int)ColorID.White);
                sysfntbig = TextureHandler.Create("sysfld{0:00}.tex", tex, 2, 1, (int)ColorID.White);

                TDW tim = new TDW(ArchiveWorker.GetBinaryFile(Memory.Archives.A_MENU, sysfntTdwFilepath), 0);
                charWidths = tim.CharWidths;
                menuFont   = tim.GetTexture((ushort)ColorID.White);
            }
        }
Example #7
0
        protected virtual void InitTextures(ArchiveWorker aw = null)
        {
            int count = (int)Props.Sum(x => x.Count);

            if (Textures == null)
            {
                Textures = new List <TextureHandler>(count);
            }
            if (Textures.Count <= 0)
            {
                if (aw == null)
                {
                    aw = new ArchiveWorker(ArchiveString);
                }
                TEX tex;
                Scale = new Dictionary <uint, Vector2>(count);
                int b = 0;
                for (int j = 0; j < Props.Count; j++)
                {
                    for (uint i = 0; i < Props[j].Count; i++)
                    {
                        string path = aw.GetListOfFiles().First(x => x.ToLower().Contains(string.Format(Props[j].Filename, i + TextureStartOffset)));
                        tex = new TEX(aw.GetBinaryFile(path));
                        if (Props[j].Big != null && FORCE_ORIGINAL == false && b < Props[j].Big.Count)
                        {
                            TextureHandler th = new TextureHandler(Props[j].Big[b].Filename, tex, 2, Props[j].Big[b++].Split / 2);

                            Textures.Add(th);
                            Scale[i] = Vector2.One;
                        }
                        else
                        {
                            TextureHandler th = new TextureHandler(path, tex);
                            Textures.Add(th);
                            Scale[i] = th.GetScale(); //scale might not be used outside of texturehandler.
                        }
                    }
                }
            }
        }
Example #8
0
 public TextureHandler(string filename, TEX classic, int palette = -1, Color[] colors = null) => Init(filename, classic, 1, 1, palette : palette, colors : colors);