Пример #1
0
        public void GetJoints()
        {
            string[] joints = new string[]
            {
                "HeadBone:0",
                "NeckBone:0",
                "LeftHandBone: 0",
                "LeftLeg: -1:0,0,0:0",
                "LeftKnee: -1:0,0,0:0",
                "LeftFoot: -1:0,0,0:0",
                "RightLeg: -1:0,0,0:0",
                "RightKnee: -1:0,0,0:0",
                "RightFoot: -1:0,0,0:0",
                "CliffPosition: 0,0,0",
                "ZeroPosition: 0,0,0",
                "ZeroPositionFight: 0,0,0",
                "WalkSpeed: 120",
                "RunSpeed: 240",
                "Epaisseur: 0"
            };
            if (File.Exists(Path.GetDirectoryName(this.FileName) + @"\Joints.txt"))
            {
                string[] text = File.ReadAllLines(Path.GetDirectoryName(this.FileName) + @"\Joints.txt");
                if (text.Length <= joints.Length)
                {
                    Array.Copy(text, joints, text.Length);
                }
            }
            this.Skeleton.HeadBone     = int.Parse(joints[0].Split(':')[1]);
            this.Skeleton.NeckBone     = int.Parse(joints[1].Split(':')[1]);
            this.Skeleton.LeftHandBone = int.Parse(joints[2].Split(':')[1]);

            this.Skeleton.LeftLeg  = int.Parse(joints[3].Split(':')[1]);
            this.Skeleton.LeftKnee = int.Parse(joints[4].Split(':')[1]);
            this.Skeleton.LeftFoot = int.Parse(joints[5].Split(':')[1]);

            this.Skeleton.RightLeg  = int.Parse(joints[6].Split(':')[1]);
            this.Skeleton.RightKnee = int.Parse(joints[7].Split(':')[1]);
            this.Skeleton.RightFoot = int.Parse(joints[8].Split(':')[1]);

            this.CliffPosition.X = MainGame.SingleParse(joints[9].Split(':')[1].Split(',')[0]);
            this.CliffPosition.Y = MainGame.SingleParse(joints[9].Split(':')[1].Split(',')[1]);
            this.CliffPosition.Z = MainGame.SingleParse(joints[9].Split(':')[1].Split(',')[2]);

            this.Skeleton.ZeroPosition.X = MainGame.SingleParse(joints[10].Split(':')[1].Split(',')[0]);
            this.Skeleton.ZeroPosition.Y = MainGame.SingleParse(joints[10].Split(':')[1].Split(',')[1]);
            this.Skeleton.ZeroPosition.Z = MainGame.SingleParse(joints[10].Split(':')[1].Split(',')[2]);

            this.Skeleton.ZeroPositionFight.X = MainGame.SingleParse(joints[11].Split(':')[1].Split(',')[0]);
            this.Skeleton.ZeroPositionFight.Y = MainGame.SingleParse(joints[11].Split(':')[1].Split(',')[1]);
            this.Skeleton.ZeroPositionFight.Z = MainGame.SingleParse(joints[11].Split(':')[1].Split(',')[2]);

            this.WalkSpeed        = MainGame.SingleParse(joints[12].Split(':')[1]);
            this.RunSpeed         = MainGame.SingleParse(joints[13].Split(':')[1]);
            this.InitialWalkSpeed = this.WalkSpeed;
            this.InitialRunSpeed  = this.RunSpeed;
            this.Epaisseur        = MainGame.SingleParse(joints[14].Split(':')[1]);
        }
Пример #2
0
        public void Parse()
        {
            this.ResourceIndex = Array.IndexOf(Resource.ResourceIndices, this.FileName.Split('.')[0] + ".");
            this.IsSky         = this.Name.Contains("SKY");


            FileStream   fs     = new FileStream(this.FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
            BinaryReader reader = new BinaryReader(fs);

            this.ModelType = (MDType)reader.ReadSByte();
            this.NoCull    = reader.ReadSByte() < 0;
            this.ZIndex    = (int)reader.ReadSByte();
            reader.ReadSByte();
            int textureCount = reader.ReadInt32();

            if (this.ModelType == MDType.Map)
            {
                for (int i = 0; i < 10; i++)
                {
                    if (File.Exists(Path.GetDirectoryName(this.FileName) + @"\SKY\" + this.Name + "-SKY" + i + ".dae"))
                    {
                        string fname = Path.GetDirectoryName(this.FileName) + @"\SKY\" + this.Name + "-SKY" + i + ".dae";

                        Model model = new DAE(Path.GetDirectoryName(this.FileName) + @"\SKY\" + this.Name + "-SKY" + i + ".dae");
                        model.Parse();

                        BinaryMoveset bm = null;
                        if (Directory.Exists(Path.GetDirectoryName(fname) + "\\" + Path.GetFileNameWithoutExtension(fname)))
                        {
                            bm = new BinaryMoveset(Path.GetDirectoryName(fname) + "\\" + Path.GetFileNameWithoutExtension(fname));
                            bm.Links.Add(model);
                            bm.Parse();
                            bm.PlayingIndex = 0;
                            bm.Render       = true;
                            model.Links.Add(bm);
                        }
                        this.SuppMsets.Add(bm);
                        this.Supp.Add(model);
                    }
                }
            }
            if (Directory.Exists(Path.GetDirectoryName(this.FileName) + @"\OBJECTS"))
            {
                string[] files = Directory.GetFiles(Path.GetDirectoryName(this.FileName) + @"\OBJECTS", "*.dae");

                for (int i = 0; i < files.Length; i++)
                {
                    Model dae = new DAE(files[i])
                    {
                        Render    = true,
                        ModelType = files[i].Contains("-sp") ? MDType.Specular : MDType.Sky
                    };
                    dae.Parse();
                    //(dae as DAE).ExportBin();

                    BinaryMoveset bm = null;

                    if (Directory.Exists(Path.GetDirectoryName(files[i]) + "\\" + Path.GetFileNameWithoutExtension(files[i])))
                    {
                        bm = new BinaryMoveset(Path.GetDirectoryName(files[i]) + "\\" + Path.GetFileNameWithoutExtension(files[i]));
                        bm.Links.Add(dae);
                        bm.Parse();
                        bm.PlayingIndex     = 0;
                        bm.ObjectMsetRender = bm.Name.Contains("-mdl-");
                        bm.Render           = true;
                        dae.Links.Add(bm);
                    }

                    this.SuppMsets.Add(bm);
                    this.Supp.Add(dae);
                }
            }
            this.FogStart = reader.ReadInt16() * 10f;
            this.FogEnd   = reader.ReadInt16() * 10f;
            this.FogColor = (new Microsoft.Xna.Framework.Color(reader.ReadByte(), reader.ReadByte(), reader.ReadByte(), reader.ReadByte())).ToVector3();

            reader.Close();
            fs.Close();

            if (sunbeamList == null)
            {
                sunbeamList = File.ReadAllLines("Content\\Effects\\Visual\\Sun\\sunpositions.txt");
            }
            for (int i = 0; i < sunbeamList.Length; i++)
            {
                string[] spli = sunbeamList[i].Split('|');
                if (spli[0] == this.Name)
                {
                    spli         = spli[1].Split(';');
                    this.sunbeam = new SunBeam
                    {
                        From = new Vector3(MainGame.SingleParse(spli[0]), MainGame.SingleParse(spli[1]), MainGame.SingleParse(spli[2]))
                    };
                    this.sunbeam.coll = new Collision("Content\\Effects\\Visual\\Sun\\" + this.Name + ".obj");
                }
            }


            for (int i = 0; i < this.Supp.Count; i++)
            {
                for (int j = i + 1; j < this.Supp.Count; j++)
                {
                    if (this.Supp[j].ZIndex < this.Supp[i].ZIndex)
                    {
                        var curr = this.Supp[j];
                        this.Supp.RemoveAt(j);
                        this.Supp.Insert(0, curr);
                        var currM = this.SuppMsets[j];
                        this.SuppMsets.RemoveAt(j);
                        this.SuppMsets.Insert(0, currM);
                    }
                }
            }


            base.Parse();
        }
Пример #3
0
        public static void Init()
        {
            string[]       input    = File.ReadAllLines(@"Content\Effects\Visual\LoadingScreen\heart.obj");
            List <Vector3> pos      = new List <Vector3>(0);
            List <Vector3> normal   = new List <Vector3>(0);
            List <Vector2> texcoord = new List <Vector2>(0);
            List <VertexPositionNormalTexture> output = new List <VertexPositionNormalTexture>(0);

            string[] spli, spli2;
            for (int i = 0; i < input.Length; i++)
            {
                spli = input[i].Split(' ');
                if (spli[0] == "v")
                {
                    pos.Add(new Vector3(
                                MainGame.SingleParse(spli[1]),
                                MainGame.SingleParse(spli[2]),
                                MainGame.SingleParse(spli[3])
                                ));
                }
                if (spli[0] == "vt")
                {
                    texcoord.Add(new Vector2(
                                     MainGame.SingleParse(spli[1]),
                                     MainGame.SingleParse(spli[2])
                                     ));
                }
                if (spli[0] == "vn")
                {
                    normal.Add(new Vector3(
                                   MainGame.SingleParse(spli[1]),
                                   MainGame.SingleParse(spli[2]),
                                   MainGame.SingleParse(spli[3])
                                   ));
                }
                if (spli[0] == "f")
                {
                    spli2 = spli[1].Split('/');
                    int iv  = int.Parse(spli2[0]);
                    int ivt = int.Parse(spli2[1]);
                    int ivn = int.Parse(spli2[2]);
                    VertexPositionNormalTexture vpn1 = new VertexPositionNormalTexture();
                    vpn1.Position          = pos[iv - 1];
                    vpn1.TextureCoordinate = texcoord[ivt - 1];
                    vpn1.Normal            = normal[ivn - 1];

                    spli2 = spli[2].Split('/');
                    iv    = int.Parse(spli2[0]);
                    ivt   = int.Parse(spli2[1]);
                    ivn   = int.Parse(spli2[2]);
                    VertexPositionNormalTexture vpn2 = new VertexPositionNormalTexture();
                    vpn2.Position          = pos[iv - 1];
                    vpn2.TextureCoordinate = texcoord[ivt - 1];
                    vpn2.Normal            = normal[ivn - 1];

                    spli2 = spli[3].Split('/');
                    iv    = int.Parse(spli2[0]);
                    ivt   = int.Parse(spli2[1]);
                    ivn   = int.Parse(spli2[2]);
                    VertexPositionNormalTexture vpn3 = new VertexPositionNormalTexture();
                    vpn3.Position          = pos[iv - 1];
                    vpn3.TextureCoordinate = texcoord[ivt - 1];
                    vpn3.Normal            = normal[ivn - 1];

                    output.Add(vpn3);
                    output.Add(vpn2);
                    output.Add(vpn1);
                }
            }
            vpnt = output.ToArray();
            output.Clear();
            output = null;
            pos.Clear();
            pos = null;
            normal.Clear();
            normal = null;
            texcoord.Clear();
            texcoord = null;

            texture = ResourceLoader.GetT2D(@"Content\Effects\Visual\LoadingScreen\texture.png");
            for (int i = 0; i < vpnt.Length; i++)
            {
                vpnt[i].Position = Vector3.Transform(vpnt[i].Position, Matrix.CreateScale(5f));
            }

            dnewV        = new Viewport();
            dnewV.Bounds = Program.game.graphics.GraphicsDevice.Viewport.Bounds;
            dnewV.X      = 100;
        }
Пример #4
0
        public Area(string filename)
        {
            this.Set     = 0x584976;
            this.verts   = new List <Vector3>(0);
            this.Names   = new List <string>(0);
            this.Bases   = new List <Vector3[]>(0);
            this.Heights = new List <Vector3>(0);
            this.Links   = new List <Resource>(0);

            this.Type     = Resource.ResourceType.Collision;
            this.Name     = Path.GetFileNameWithoutExtension(filename);
            this.FileName = filename;

            string[]  obj    = File.ReadAllLines(filename);
            string[]  spli   = new string[0];
            Vector3[] plane1 = new Vector3[4];
            Vector3[] plane2 = new Vector3[4];
            plane1[0].X = Single.NaN;
            plane2[0].X = Single.NaN;

            for (int i = 0; i < obj.Length; i++)
            {
                spli = obj[i].Split(' ');
                if (spli[0] == "v")
                {
                    this.verts.Add(new Vector3(MainGame.SingleParse(spli[1]), MainGame.SingleParse(spli[2]), MainGame.SingleParse(spli[3])));
                }

                if (spli[0] == "g")
                {
                    this.Names.Add(spli[1]);
                }
                if (spli[0] == "f")
                {
                    Vector3 v1 = this.verts[int.Parse(spli[1]) - 1];
                    Vector3 v2 = this.verts[int.Parse(spli[2]) - 1];
                    Vector3 v3 = this.verts[int.Parse(spli[3]) - 1];
                    Vector3 v4 = this.verts[int.Parse(spli[4]) - 1];

                    if (Math.Abs(((v1.Y + v2.Y + v3.Y + v4.Y) / 4f) - v1.Y) < 1)
                    {
                        if (Single.IsNaN(plane1[0].X))
                        {
                            plane1[0] = v1;
                            plane1[1] = v2;
                            plane1[2] = v3;
                            plane1[3] = v4;
                        }
                        else if (Single.IsNaN(plane2[0].X))
                        {
                            plane2[0] = v1;
                            plane2[1] = v2;
                            plane2[2] = v3;
                            plane2[3] = v4;

                            if (plane2[0].Y > plane1[0].Y)
                            {
                                this.Bases.Add(plane1);
                                this.Heights.Add(new Vector3(0, plane2[0].Y - plane1[0].Y, 0));
                            }
                            else
                            {
                                this.Bases.Add(plane2);
                                this.Heights.Add(new Vector3(0, plane1[0].Y - plane2[0].Y, 0));
                            }
                            plane1      = new Vector3[4];
                            plane2      = new Vector3[4];
                            plane1[0].X = Single.NaN;
                            plane2[0].X = Single.NaN;
                        }
                    }
                }
            }
        }
Пример #5
0
        public Scene(string fname)
        {
            this.Commands     = new List <SceneCommand>(0);
            this.Instructions = new List <object>(0);
            this.StartFrames  = new List <int>(0);

            string[] content = File.ReadAllLines(@"Content\Scenes\" + fname + ".txt");
            string[] spli1, spli2;
            for (int i = 0; i < content.Length; i++)
            {
                spli1 = content[i].Split('|');
                spli2 = spli1[2].Split(';');
                int startFrame = int.Parse(spli1[0]);

                switch (spli1[1])
                {
                case "Goto":
                    if (startFrame > this.MaxFrame)
                    {
                        this.MaxFrame = startFrame;
                    }

                    Model mdl_ = null;
                    for (int r = 0; r < MainGame.ResourceFiles.Count; r++)
                    {
                        if (MainGame.ResourceFiles[r].Name == spli2[0])
                        {
                            mdl_ = MainGame.ResourceFiles[r] as Model;
                            break;
                        }
                    }
                    Vector3 dest = new Vector3(MainGame.SingleParse(spli2[1]), MainGame.SingleParse(spli2[2]), MainGame.SingleParse(spli2[3]));

                    this.Instructions.Add(new GotoDest(mdl_, dest));
                    this.Commands.Add(SceneCommand.Goto);
                    break;

                case "SetBGMVolume":
                    if (startFrame > this.MaxFrame)
                    {
                        this.MaxFrame = startFrame;
                    }

                    this.Instructions.Add(new int[] { int.Parse(spli1[2]), int.Parse(spli1[3]) });
                    this.Commands.Add(SceneCommand.SetBGMVolume);
                    break;

                case "ContactCollison":
                    if (startFrame > this.MaxFrame)
                    {
                        this.MaxFrame = startFrame;
                    }

                    this.Instructions.Add(Boolean.Parse(spli2[0]));
                    this.Commands.Add(SceneCommand.ContactCollison);
                    break;

                case "SetCamera":
                    if (startFrame > this.MaxFrame)
                    {
                        this.MaxFrame = startFrame;
                    }
                    Vector3[] insts = new Vector3[spli2.Length / 3];
                    for (int n = 0; n < spli2.Length; n++)
                    {
                        float val = Single.NaN;
                        Single.TryParse(spli2[n], out val);

                        if (n % 3 == 0)
                        {
                            insts[n / 3].X = val;
                        }
                        if (n % 3 == 1)
                        {
                            insts[n / 3].Y = val;
                        }
                        if (n % 3 == 2)
                        {
                            insts[n / 3].Z = val;
                        }
                    }
                    this.Instructions.Add(insts);
                    this.Commands.Add(SceneCommand.SetCamera);
                    break;

                case "Gameplay":
                    if (startFrame > this.MaxFrame)
                    {
                        this.MaxFrame = startFrame;
                    }
                    this.Instructions.Add(null);
                    this.Commands.Add(SceneCommand.Gameplay);
                    break;

                case "PlayAnim":
                    Animation anm = new Animation();

                    for (int n = 0; n < spli2.Length; n += 6)
                    {
                        spli2[n + 0] = spli2[n + 0].Replace("player", Program.game.Player.Name);
                        spli2[n + 1] = spli2[n + 1].Replace("player", Program.game.Player.Name);
                        Model         mdl  = null;
                        BinaryMoveset mset = null;
                        for (int r = 0; r < MainGame.ResourceFiles.Count; r++)
                        {
                            if (MainGame.ResourceFiles[r].Name == spli2[n + 0])
                            {
                                mdl = MainGame.ResourceFiles[r] as Model;
                                break;
                            }
                        }
                        if (mdl == null)
                        {
                            for (int r = 0; r < Program.game.Map.Supp.Count; r++)
                            {
                                if (Program.game.Map.Supp[r].Name == spli2[n + 0])
                                {
                                    mdl = Program.game.Map.Supp[r] as Model;
                                    break;
                                }
                            }
                        }
                        if (mdl == null)
                        {
                            mdl = new DAE(@"Content\Models\" + spli2[n + 0] + @"\" + spli2[n + 0] + ".dae");
                            mdl.Parse();
                            MainGame.ResourceFiles.Add(mdl);
                            mdl.Render = false;
                        }

                        mdl.Cutscene = true;
                        int index = -1;
                        if (mdl.Links.Count > 0)
                        {
                            (mdl.Links[0] as BinaryMoveset).PlayingIndex = -1;
                        }

                        if (int.TryParse(spli2[n + 1], out index))
                        {
                            if (mdl.Links.Count == 0)
                            {
                                mset = new BinaryMoveset(mdl.FileName.Replace(mdl.Name + ".dae", @"\MSET"));
                                mset.Links.Add(mdl);
                                mset.Parse();
                                MainGame.ResourceFiles.Add(mset);
                                mdl.Links.Add(mset);
                            }
                            else
                            {
                                mset = (mdl.Links[0] as BinaryMoveset);
                            }
                        }
                        else
                        {
                            string name = Path.GetFileNameWithoutExtension(@"Content\Scenes\ANB\" + spli2[n + 1]);

                            for (int r = 0; r < MainGame.ResourceFiles.Count; r++)
                            {
                                if (MainGame.ResourceFiles[r].Name == name)
                                {
                                    mset = MainGame.ResourceFiles[r] as BinaryMoveset;
                                }
                            }
                            if (mset == null)
                            {
                                mset = new BinaryMoveset(@"Content\Scenes\ANB\" + spli2[n + 1]);
                                MainGame.ResourceFiles.Add(mset);
                            }
                            index = 0;
                        }
                        mset.Render = true;


                        if (mset.Links.Count == 0)
                        {
                            mset.Links.Add(mdl);
                        }

                        mset.Skeleton = mdl.Skeleton;
                        if (mdl.Links.Count > 0)
                        {
                            mset.Voices = (mdl.Links[0] as Moveset).Voices;
                        }

                        //mset.Parse();

                        Vector3 startPos = Vector3.Zero;
                        startPos.X = MainGame.SingleParse(spli2[n + 2]);
                        startPos.Y = MainGame.SingleParse(spli2[n + 3]);
                        startPos.Z = MainGame.SingleParse(spli2[n + 4]);
                        float rot = MainGame.SingleParse(spli2[n + 5]);
                        anm.Append(mdl, mset, index, startPos, rot);

                        if (startFrame + mset.MaxTick > this.MaxFrame)
                        {
                            this.MaxFrame = startFrame + mset.MaxTick;
                        }
                    }
                    this.Instructions.Add(anm);
                    this.Commands.Add(SceneCommand.PlayAnim);
                    break;
                }
                this.StartFrames.Add(startFrame);
            }
        }
Пример #6
0
        public Collision(string filename)
		{
			this.Type = ResourceType.Collision;
            this.Name = Path.GetFileNameWithoutExtension(filename);
            this.FileName = filename;
            this.cols = new List<Vector3>(0);
            this.norms = new List<Vector3>(0);
            this.indices = new List<int[][]>(0);
            this.StartEnds = new int[1000][];
            this.PolyCount = 0;

            string[] obj = File.ReadAllLines(filename);
            string[] spli = obj[0].Split('#');
            if (spli.Length == 3)
            {
                Program.game.backgroundColor.R = byte.Parse(spli[0]);
                Program.game.backgroundColor.G = byte.Parse(spli[1]);
                Program.game.backgroundColor.B = byte.Parse(spli[2]);
            }

            int lastIndex = -1;

            for (int i=0;i<obj.Length;i++)
            {
                spli = obj[i].Split(' ');
                if (spli[0] == "v")
                {
                    Vector3 v = new Vector3(MainGame.SingleParse(spli[1]), MainGame.SingleParse(spli[2]), MainGame.SingleParse(spli[3]));
                    if (v.X < MinX) MinX = v.X;
                    if (v.Y < MinY) MinY = v.Y;
                    if (v.Z < MinZ) MinZ = v.Z;
                    if (v.X > MaxX) MaxX = v.X;
                    if (v.Y > MaxY) MaxY = v.Y;
                    if (v.Z > MaxZ) MaxZ = v.Z;

                    cols.Add(v);
                }
                if (spli[0] == "vn")
                {
                    norms.Add(new Vector3(MainGame.SingleParse(spli[1]), MainGame.SingleParse(spli[2]), MainGame.SingleParse(spli[3])));
                }
                if (spli[0] == "g")
                {
                    if (spli[1].Contains("poly"))
                    {
                        int index = int.Parse(spli[1].Substring(4, spli[1].Length-4));

                        if (lastIndex>-1)
                        {
                            StartEnds[lastIndex][1] = indices.Count;
                        }
                        StartEnds[index] = new int[] { indices.Count, 0 };
                        this.PolyCount++;
                        lastIndex = index;
                    }
                    if (spli[1].Contains("perimetre"))
                    {
                        int index = 500+int.Parse(spli[1].Substring(9, spli[1].Length - 9));

                        if (lastIndex > -1)
                        {
                            StartEnds[lastIndex][1] = indices.Count;
                        }
                        StartEnds[index] = new int[] { indices.Count ,0};
                        lastIndex = index;
                    }
                }
                if (spli[0] == "f")
                {
                    int[][] vals = new int[][] { new int[2] , new int[2] , new int[2] };

                    string[] spli_ = spli[1].Split('/');
                    vals[0][0] = int.Parse(spli_[0]) - 1;
                    vals[0][1] = int.Parse(spli_[2]) - 1;

                    spli_ = spli[2].Split('/');
                    vals[1][0] = int.Parse(spli_[0]) - 1;
                    vals[1][1] = int.Parse(spli_[2]) - 1;

                    spli_ = spli[3].Split('/');
                    vals[2][0] = int.Parse(spli_[0]) - 1;
                    vals[2][1] = int.Parse(spli_[2]) - 1;

                    

                    this.indices.Add(vals);
                }
            }
            if (PolyCount == 0)
            {
                this.PolyCount = 1;
                StartEnds[0] = new int[] { 0, this.indices.Count };
            }
            if (lastIndex>-1)
            {
                if (lastIndex >= 500)
                {
                    lastIndex -= 500;
                }
				if (StartEnds[lastIndex + 500] == null)
				{
					StartEnds[lastIndex][1] = this.indices.Count;
				}
				else
				{
					StartEnds[lastIndex][1] = StartEnds[lastIndex + 500][0];
					StartEnds[lastIndex + 500][1] = indices.Count;
				}
			}
		}
Пример #7
0
        public static void Load(string filename)
        {
            for (int i = 0; i < MainGame.ResourceFiles.Count; i++)
            {
                if (!(MainGame.ResourceFiles[i] is MAP))
                {
                    MainGame.ResourceFiles[i].Render = false;
                }
            }
            string[] contenu = File.ReadAllLines(filename);
            string[] spli;

            if (Program.game.MapSet && File.Exists(@"Content\Scenes\Behaviours\" + contenu[0]))
            {
                string[] text = File.ReadAllLines(@"Content\Scenes\Behaviours\" + contenu[0]);
                for (int i = 0; i < text.Length; i++)
                {
                    spli = text[i].Split('|');

                    if (spli[0].Length > 1 && spli[0][0] == 'I' && spli[0][1] == 'F')
                    {
                        Action action = new Action();
                        action.parent = Program.game.Map;
                        action.AddCondition(text[i]);
                        while (spli[0] != "ENDIF")
                        {
                            i++;
                            spli = text[i].Split('|');
                            if (spli[0] == "ELSE" || spli[0] == "AND" || spli[0] == "OR")
                            {
                                action.AddCondition(text[i]);
                            }
                            else
                            {
                                action.AddComand(text[i]);
                            }
                        }
                        Program.game.Map.Behaviours[Program.game.Map.BehavioursCount] = action;
                        Program.game.Map.BehavioursCount++;
                    }
                }
            }

            spli = contenu[0 + 2].Split(',');
            LoadCharacter(spli[0], spli[1], ref Program.game.Player);
            spli = contenu[1 + 2].Split(',');
            LoadKeyblade(spli[0], spli[1], ref Program.game.Player);

            if (Program.game.Player != null)
            {
                spli = contenu[2 + 2].Split(',');
                Program.game.Player.Location        = new Vector3(MainGame.SingleParse(spli[0]), MainGame.SingleParse(spli[1]), MainGame.SingleParse(spli[2]));
                Program.game.Player.SpawnedLocation = Program.game.Player.Location;
                Program.game.Player.LowestFloor     = Program.game.Player.Location.Y;
                Program.game.Player.DestRotate      = MainGame.SingleParse(contenu[3 + 2]);
                Program.game.Player.Rotate          = Program.game.Player.DestRotate;
            }

            spli = contenu[5 + 2].Split(',');
            LoadCharacter(spli[0], spli[1], ref Program.game.Partner1);
            spli = contenu[6 + 2].Split(',');
            LoadKeyblade(spli[0], spli[1], ref Program.game.Partner1);

            if (Program.game.Partner1 != null)
            {
                spli = contenu[7 + 2].Split(',');
                Program.game.Partner1.Location        = new Vector3(MainGame.SingleParse(spli[0]), MainGame.SingleParse(spli[1]), MainGame.SingleParse(spli[2]));
                Program.game.Partner1.SpawnedLocation = Program.game.Partner1.Location;
                Program.game.Partner1.LowestFloor     = Program.game.Partner1.Location.Y;
                Program.game.Partner1.DestRotate      = MainGame.SingleParse(contenu[8 + 2]);
                Program.game.Partner1.Rotate          = Program.game.Partner1.DestRotate;
            }

            spli = contenu[10 + 2].Split(',');
            LoadCharacter(spli[0], spli[1], ref Program.game.Partner2);
            spli = contenu[11 + 2].Split(',');
            LoadKeyblade(spli[0], spli[1], ref Program.game.Partner2);

            if (Program.game.Partner2 != null)
            {
                spli = contenu[12 + 2].Split(',');
                Program.game.Partner2.Location        = new Vector3(MainGame.SingleParse(spli[0]), MainGame.SingleParse(spli[1]), MainGame.SingleParse(spli[2]));
                Program.game.Partner2.SpawnedLocation = Program.game.Partner2.Location;
                Program.game.Partner2.LowestFloor     = Program.game.Partner2.Location.Y;
                Program.game.Partner2.DestRotate      = MainGame.SingleParse(contenu[13 + 2]);
                Program.game.Partner2.Rotate          = Program.game.Partner2.DestRotate;
            }


            for (int i = 17; i < contenu.Length; i += 5)
            {
                spli = contenu[i].Split(',');
                LoadCharacter(spli[0], spli[1], ref Program.game.LastLoadedNotParty);
                if (spli[2] == "NPC")
                {
                    Program.game.LastLoadedNotParty.NPC = true;
                }
                spli = contenu[i + 1].Split(',');
                LoadKeyblade(spli[0], spli[1], ref Program.game.LastLoadedNotParty);

                if (Program.game.LastLoadedNotParty != null)
                {
                    spli = contenu[i + 2].Split(',');
                    Program.game.LastLoadedNotParty.Location        = new Vector3(MainGame.SingleParse(spli[0]), MainGame.SingleParse(spli[1]), MainGame.SingleParse(spli[2]));
                    Program.game.LastLoadedNotParty.SpawnedLocation = Program.game.LastLoadedNotParty.Location;
                    Program.game.LastLoadedNotParty.LowestFloor     = Program.game.LastLoadedNotParty.Location.Y;
                    Program.game.LastLoadedNotParty.DestRotate      = MainGame.SingleParse(contenu[i + 3]);
                    Program.game.LastLoadedNotParty.Rotate          = Program.game.LastLoadedNotParty.DestRotate;
                }
            }


            //LoadCharacter(@"P_EX020\P_EX020.dae", @"P_EX020", ref this.Partner1);
            //LoadKeyblade(@"W_EX020\W_EX020.dae", @"W_EX020", ref this.Partner1);

            Program.game.Sora   = Program.game.Player;
            Program.game.Donald = Program.game.Partner1;
            //Program.game.Player.Patches[0].GetPatch(2);

            Program.game.mainCamera.Target = Program.game.Player;
            Model target = Program.game.mainCamera.Target;

            if (target != null)
            {
                Program.game.mainCamera.DestLookAt = target.Location + target.HeadHeight;
                Program.game.mainCamera.LookAt     = Program.game.mainCamera.DestLookAt;
                Program.game.mainCamera.DestYaw    = Program.game.Player.DestRotate - MainGame.PI;
                Program.game.mainCamera.Yaw        = Program.game.mainCamera.DestYaw;
            }
            else
            {
                Program.game.mainCamera.DestLookAt = new Vector3(0, 250, 0);
                Program.game.mainCamera.LookAt     = Program.game.mainCamera.DestLookAt;
                Program.game.mainCamera.DestYaw    = 0f;
                Program.game.mainCamera.Yaw        = Program.game.mainCamera.DestYaw;
            }
        }