Example #1
0
        public MGLevel(Scene s, Detail detail)
        {
            List <VertexPositionColorTexture> monolist = new List <VertexPositionColorTexture>();
            List <CTRFramework.Vertex>        vts      = new List <Vertex>();

            switch (detail)
            {
            case Detail.Low:
            {
                Console.WriteLine("doin low");

                foreach (QuadBlock qb in s.quads)
                {
                    monolist.Clear();
                    vts = qb.GetVertexListq(s.verts, -1);

                    if (vts != null)
                    {
                        foreach (Vertex cv in vts)
                        {
                            monolist.Add(DataConverter.ToVptc(cv, cv.uv, 0.01f));
                        }

                        TextureLayout t = qb.texlow;

                        string texTag = t.Tag();

                        foreach (QuadFlags fl in (QuadFlags[])Enum.GetValues(typeof(QuadFlags)))
                        {
                            if (qb.quadFlags.HasFlag(fl))
                            {
                                Push(flagq, fl.ToString(), monolist, "flag");
                            }
                        }

                        if (qb.isWater)
                        {
                            Push(waterq, "water", monolist);
                            continue;
                        }

                        if (qb.quadFlags.HasFlag(QuadFlags.InvisibleTriggers))
                        {
                            Push(flagq, "invis", monolist);
                            continue;
                        }

                        if (Game1.alphalist.Contains(texTag))
                        {
                            Push(alphaq, texTag, monolist);
                        }
                        else
                        {
                            Push(normalq, texTag, monolist);
                        }
                    }
                }

                break;
            }

            case Detail.Med:
            {
                Console.WriteLine("doin med");

                foreach (QuadBlock qb in s.quads)
                {
                    for (int j = 0; j < 4; j++)
                    {
                        monolist.Clear();
                        vts = qb.GetVertexListq(s.verts, j);

                        if (vts != null)
                        {
                            foreach (Vertex cv in vts)
                            {
                                monolist.Add(DataConverter.ToVptc(cv, cv.uv, 0.01f));
                            }

                            bool   isAnimated = false;
                            string texTag     = "test";

                            if (qb.ptrTexMid[j] != 0)
                            {
                                isAnimated = qb.tex[j].isAnimated;
                                if (texTag != "00000000")
                                {
                                    texTag = qb.tex[j].midlods[2].Tag();
                                }
                            }

                            foreach (QuadFlags fl in (QuadFlags[])Enum.GetValues(typeof(QuadFlags)))
                            {
                                if (qb.quadFlags.HasFlag(fl))
                                {
                                    Push(flagq, fl.ToString(), monolist, "flag");
                                }
                            }

                            if (qb.isWater)
                            {
                                Push(waterq, "water", monolist);
                                continue;
                            }

                            if (qb.quadFlags.HasFlag(QuadFlags.InvisibleTriggers))
                            {
                                Push(flagq, "invis", monolist);
                                continue;
                            }

                            Push((isAnimated ? animatedq : (Game1.alphalist.Contains(texTag) ? alphaq : normalq)), texTag, monolist);

                            if (isAnimated)
                            {
                                animatedq[texTag].scrollingEnabled = true;
                            }
                        }
                    }
                }

                break;
            }
            }

            foreach (var ql in normalq)
            {
                ql.Value.Seal();
            }

            foreach (var ql in waterq)
            {
                ql.Value.Seal();
            }

            foreach (var ql in alphaq)
            {
                ql.Value.Seal();
            }

            foreach (var ql in animatedq)
            {
                ql.Value.Seal();
            }

            foreach (var ql in flagq)
            {
                ql.Value.Seal();
            }
        }