Esempio n. 1
0
        private void MPDSEditor_Load(object sender, EventArgs e)
        {
            byte[] numArray1 = Compression.LZ77Decompress(this.BoardData.Files[1].Data);
            byte[] numArray2 = Compression.LZ77Decompress(this.BoardData.Files[2].Data);
            byte[] numArray3 = Compression.LZ77Decompress(this.BoardData.Files[0].Data);
            byte[] array1    = ((IEnumerable <byte>)numArray1).ToList <byte>().GetRange(4, numArray1.Length - 4).ToArray();
            byte[] array2    = ((IEnumerable <byte>)numArray2).ToList <byte>().GetRange(4, numArray2.Length - 4).ToArray();
            byte[] array3    = ((IEnumerable <byte>)numArray3).ToList <byte>().GetRange(4, numArray3.Length - 4).ToArray();
            this.pictureBox1.Image = (Image)Graphic.ConvertData(array2, 0, 0, array1, array3, 256, 256, Graphic.GXTexFmt.GX_TEXFMT_PLTT16, Graphic.NNSG2dCharacterFmt.NNS_G2D_CHARACTER_FMT_CHAR);
            this.Layout            = new BoardLayout(Compression.LZ77Decompress(this.BoardData.Files[3].Data));
            int index1 = -1;
            int num    = 0;

            for (int index2 = 4; (long)index2 < (long)this.BoardData.NrFiles; ++index2)
            {
                int length = this.BoardData.Files[index2].Data.Length;
                if (length > num)
                {
                    num    = length;
                    index1 = index2;
                }
            }
            this.Model      = new HBDF(Compression.LZ77Decompress(this.BoardData.Files[index1].Data));
            this.Spaces     = new HBDF.TEXSBlock(Compression.LZ77Decompress(this.SystemData.Files[69].Data));
            this.Objects[0] = new HBDF(Compression.LZ77Decompress(this.SystemData.Files[32].Data));
            this.Objects[1] = new HBDF(Compression.LZ77Decompress(this.SystemData.Files[31].Data));
            this.Objects[2] = new HBDF(Compression.LZ77Decompress(this.SystemData.Files[33].Data));
            Gl.ReloadFunctions();
            Gl.glEnable(2896);
            Gl.glEnable(32826);
            Gl.glEnable(2903);
            Gl.glEnable(2929);
            Gl.glEnable(2977);
            Gl.glDisable(2884);
            Gl.glFrontFace(2305);
            Gl.glEnable(3553);
            Gl.glClearDepth(1.0);
            Gl.glEnable(3008);
            Gl.glEnable(3042);
            Gl.glBlendFunc(770, 771);
            Gl.glShadeModel(7425);
            Gl.glAlphaFunc(516, 0.0f);
            Gl.glClearColor(0.2f, 0.2f, 0.2f, 1f);
            GlNitro2.glNitroBindTextures(this.Model, 1);
            GlNitro2.glNitroBindTextures(this.Spaces, (int)this.Model.MDLFBlocks[0].NrTextures + 1);
            GlNitro2.glNitroBindTextures(this.Objects[0], (int)this.Model.MDLFBlocks[0].NrTextures + 1 + this.Spaces.TEXOBlocks.Length);
            GlNitro2.glNitroBindTextures(this.Objects[1], (int)this.Model.MDLFBlocks[0].NrTextures + 1 + this.Spaces.TEXOBlocks.Length + (int)this.Objects[0].MDLFBlocks[0].NrTextures);
            GlNitro2.glNitroBindTextures(this.Objects[2], (int)this.Model.MDLFBlocks[0].NrTextures + 1 + this.Spaces.TEXOBlocks.Length + (int)this.Objects[0].MDLFBlocks[0].NrTextures + (int)this.Objects[1].MDLFBlocks[0].NrTextures);
            this.Render();
        }
Esempio n. 2
0
        public static void glNitroBindTextures(HBDF.TEXSBlock b, int offset)
        {
            int num = 0;

            foreach (HBDF.TEXSBlock.TEXOBlock texoBlock in b.TEXOBlocks)
            {
                if (texoBlock.PalName != null)
                {
                    GlNitro.glNitroTexImage2D(b.GetIMGOByName(texoBlock.TexName.Name).ToBitmap(b.GetPLTOByName(texoBlock.PalName.Name)), num + offset, 10496, 9728);
                }
                else
                {
                    GlNitro.glNitroTexImage2D(b.GetIMGOByName(texoBlock.TexName.Name).ToBitmap((HBDF.TEXSBlock.PLTOBlock)null), num + offset, 10496, 9728);
                }
                ++num;
            }
        }