Exemplo n.º 1
0
        public void OpenModMenu()
        {
            /*
             * basePath = ModLoaderGlobals.ToolsPath;
             * RCF_Manager.Extract(basePath + @"frontend.rcf", basePath + @"temp\");
             *
             * RCF_Manager.Pack(basePath + @"exfrontend.rcf", basePath + @"temp\");
             */



            Pure3D.File CrashOnfootAnim1 = new Pure3D.File();
            CrashOnfootAnim1.Load(ModLoaderGlobals.ToolsPath + "file.p3d");
            PrintHierarchy(CrashOnfootAnim1.RootChunk, 0);

            Shader[] shaders = CrashOnfootAnim1.RootChunk.GetChildren <Shader>();
            ModelExporter.AddSkinnedModelWithAnimations(ref CrashOnfootAnim1.RootChunk.GetChildren <Skin>()[0], ref CrashOnfootAnim1.RootChunk.GetChildren <SkeletonCTTR>()[0], ref shaders);
            ModelExporter.ExportModel(ModLoaderGlobals.ToolsPath + "out.dae");

            /*
             * Console.WriteLine("\nNow saving...\n");
             * CrashOnfootAnim1.Save(ModLoaderGlobals.ToolsPath + "file1.p3d");
             */
        }
Exemplo n.º 2
0
        public static void TestMod_Text(string path_extr, string file_name)
        {
            Pure3D.File targetFile = new Pure3D.File();
            if (System.IO.File.Exists(path_extr + file_name))
            {
                targetFile.Load(path_extr + file_name);
            }
            else
            {
                return;
            }

            int chunkPos;

            if (targetFile.RootChunk.GetChildByName <FrontendTextBible>("loading") != null)
            {
                chunkPos = targetFile.RootChunk.GetChildIndexByName <FrontendLanguage>("loading");
                FrontendLanguage lang = (FrontendLanguage)targetFile.RootChunk.GetChildByName <FrontendTextBible>("loading").Children[0];
                lang.TextStrings[1] = "Really long loading text for testing!";
                lang.TextStrings[2] = "Really long loading text for testing!!";
                lang.TextStrings[3] = "Really long loading text for testing!!!";
                lang.TextStrings[4] = "Really long loading text for testing!!!!";
                if (targetFile.RootChunk.GetChildByName <FrontendTextBible>("loading").Children.Count > 1)
                {
                    FrontendLanguage lang1 = (FrontendLanguage)targetFile.RootChunk.GetChildByName <FrontendTextBible>("loading").Children[1];
                    lang1.TextStrings[1] = "Really long loading text for testing!";
                    lang1.TextStrings[2] = "Really long loading text for testing!!";
                    lang1.TextStrings[3] = "Really long loading text for testing!!!";
                    lang1.TextStrings[4] = "Really long loading text for testing!!!!";
                    FrontendLanguage lang2 = (FrontendLanguage)targetFile.RootChunk.GetChildByName <FrontendTextBible>("loading").Children[2];
                    lang2.TextStrings[1] = "Really long loading text for testing!";
                    lang2.TextStrings[2] = "Really long loading text for testing!!";
                    lang2.TextStrings[3] = "Really long loading text for testing!!!";
                    lang2.TextStrings[4] = "Really long loading text for testing!!!!";
                    FrontendLanguage lang3 = (FrontendLanguage)targetFile.RootChunk.GetChildByName <FrontendTextBible>("loading").Children[3];
                    lang3.TextStrings[1] = "Really long loading text for testing!";
                    lang3.TextStrings[2] = "Really long loading text for testing!!";
                    lang3.TextStrings[3] = "Really long loading text for testing!!!";
                    lang3.TextStrings[4] = "Really long loading text for testing!!!!";
                    FrontendLanguage lang4 = (FrontendLanguage)targetFile.RootChunk.GetChildByName <FrontendTextBible>("loading").Children[4];
                    lang4.TextStrings[1] = "Really long loading text for testing!";
                    lang4.TextStrings[2] = "Really long loading text for testing!!";
                    lang4.TextStrings[3] = "Really long loading text for testing!!!";
                    lang4.TextStrings[4] = "Really long loading text for testing!!!!";
                    FrontendLanguage lang5 = (FrontendLanguage)targetFile.RootChunk.GetChildByName <FrontendTextBible>("loading").Children[5];
                    lang5.TextStrings[1] = "Really long loading text for testing!";
                    lang5.TextStrings[2] = "Really long loading text for testing!!";
                    lang5.TextStrings[3] = "Really long loading text for testing!!!";
                    lang5.TextStrings[4] = "Really long loading text for testing!!!!";
                }
            }

            if (targetFile.RootChunk.GetChildByName <FrontendTextBible>("frontend") != null)
            {
                chunkPos = targetFile.RootChunk.GetChildIndexByName <FrontendLanguage>("frontend");
                FrontendLanguage lang6 = (FrontendLanguage)targetFile.RootChunk.GetChildByName <FrontendTextBible>("frontend").Children[0];
                lang6.TextStrings[171] = "Really long loading text for testing!";
                if (targetFile.RootChunk.GetChildByName <FrontendTextBible>("frontend").Children.Count > 1)
                {
                    FrontendLanguage lang7 = (FrontendLanguage)targetFile.RootChunk.GetChildByName <FrontendTextBible>("frontend").Children[1];
                    lang7.TextStrings[171] = "Really long loading text for testing!";
                    FrontendLanguage lang8 = (FrontendLanguage)targetFile.RootChunk.GetChildByName <FrontendTextBible>("frontend").Children[2];
                    lang8.TextStrings[171] = "Really long loading text for testing!";
                    FrontendLanguage lang9 = (FrontendLanguage)targetFile.RootChunk.GetChildByName <FrontendTextBible>("frontend").Children[3];
                    lang9.TextStrings[171] = "Really long loading text for testing!";
                    FrontendLanguage lang11 = (FrontendLanguage)targetFile.RootChunk.GetChildByName <FrontendTextBible>("frontend").Children[4];
                    lang11.TextStrings[171] = "Really long loading text for testing!";
                    FrontendLanguage lang12 = (FrontendLanguage)targetFile.RootChunk.GetChildByName <FrontendTextBible>("frontend").Children[5];
                    lang12.TextStrings[171] = "Really long loading text for testing!";
                }
            }

            targetFile.Save(path_extr + file_name + "1");
            System.IO.File.Delete(path_extr + file_name);
            System.IO.File.Move(path_extr + file_name + "1", path_extr + file_name);
        }
Exemplo n.º 3
0
        public static void Randomize_Characters(string path_extr, List <int> randChars)
        {
            /* TODO later, because it requires mission logic to unlock Crash/Cortex
             * if (System.IO.File.Exists(path_extr + @"design\permanent\genericobjectives.god"))
             * {
             *  string[] startup_lines = System.IO.File.ReadAllLines(path_extr + @"design\permanent\genericobjectives.god");
             *  List<string> LineList = new List<string>();
             *  for (int i = 0; i < startup_lines.Length; i++)
             *  {
             *      LineList.Add(startup_lines[i]);
             *  }
             *
             *  int characterList_Start = 0;
             *  int characterList_End = 0;
             *  List<string> DefaultUnlocks = new List<string>();
             *  if (CTTR_Data.LUA_LoadObject(LineList, "Objective", "UnlockDefaults", ref characterList_Start, ref characterList_End, DefaultUnlocks))
             *  {
             *      DefaultUnlocks.Clear();
             *      DefaultUnlocks.Add("this.SetName(\"UnlockDefaults\")");
             *      for (int i = 0; i < randChars.Count; i++)
             *      {
             *          DefaultUnlocks.Add("this.AddAction_UnlockCar(\"" + CTTR_Data.DriverNames[randChars[i]] + "\",1)");
             *      }
             *  }
             *  CTTR_Data.LUA_SaveObject(LineList, "Objective", "UnlockDefaults", DefaultUnlocks);
             *
             *  startup_lines = new string[LineList.Count];
             *  for (int i = 0; i < LineList.Count; i++)
             *  {
             *      startup_lines[i] = LineList[i];
             *  }
             *
             *  System.IO.File.WriteAllLines(path_extr + @"design\permanent\genericobjectives.god", startup_lines);
             *
             * }
             */
            if (randChars[0] != (int)CTTR_Data.DriverID.Crash && System.IO.File.Exists(path_extr + @"design\permanent\skins.god"))
            {
                string[]      skins_lines = System.IO.File.ReadAllLines(path_extr + @"design\permanent\skins.god");
                List <string> LineList    = new List <string>();
                for (int i = 0; i < skins_lines.Length; i++)
                {
                    LineList.Add(skins_lines[i]);
                }

                int           skin_Start = 0;
                int           skin_End   = 0;
                List <string> SkinObj    = new List <string>();
                if (CTTR_Data.LUA_LoadObject(LineList, "Skin", "CrashDefault", ref skin_Start, ref skin_End, SkinObj))
                {
                    for (int i = 0; i < SkinObj.Count; i++)
                    {
                        if (SkinObj[i] == "this.SetOnfootSkinFilename(\"crash_onfoot_model\")")
                        {
                            SkinObj[i] = "this.SetOnfootSkinFilename(\"" + CTTR_Data.DriverNames[randChars[0]] + "_onfoot_model\")";
                        }
                        else if (SkinObj[i] == "this.SetSpinSkinFilename(\"crash_spin_model\")")
                        {
                            SkinObj[i] = "this.SetSpinSkinFilename(\"" + CTTR_Data.DriverNames[randChars[0]] + "_onfoot_model\")";
                        }
                    }
                }
                CTTR_Data.LUA_SaveObject(LineList, "Skin", "CrashDefault", SkinObj);

                skins_lines = new string[LineList.Count];
                for (int i = 0; i < LineList.Count; i++)
                {
                    skins_lines[i] = LineList[i];
                }

                System.IO.File.WriteAllLines(path_extr + @"design\permanent\skins.god", skins_lines);
            }

            // Swapping idle animation for platforming character
            if (randChars[0] != (int)CTTR_Data.DriverID.Crash)
            {
                if (targetCharAnim == null || targetIdleAnim == null)
                {
                    targetCharAnim = new Pure3D.File();
                    if (System.IO.File.Exists(path_extr + @"art\animation\" + CTTR_Data.DriverNames[randChars[0]] + "_onfoot_animations.p3d"))
                    {
                        targetCharAnim.Load(path_extr + @"art\animation\\" + CTTR_Data.DriverNames[randChars[0]] + "_onfoot_animations.p3d");
                    }
                    else if (System.IO.File.Exists(path_extr + @"art\animation\" + CTTR_Data.DriverNames[randChars[0]] + "_onfoot_midway_animations.p3d"))
                    {
                        targetCharAnim.Load(path_extr + @"art\animation\\" + CTTR_Data.DriverNames[randChars[0]] + "_onfoot_midway_animations.p3d");
                    }
                    else
                    {
                        return;
                    }

                    if (targetCharAnim.RootChunk.GetChildByName <Animation>("onfoot_idle") != null)
                    {
                        targetIdleAnim = targetCharAnim.RootChunk.GetChildByName <Animation>("onfoot_idle");
                    }
                    else if (targetCharAnim.RootChunk.GetChildByName <Animation>("onfoot_talk_bored") != null) // Nina doesn't have an idle animation
                    {
                        Animation targetIdleAnimAnim;
                        targetIdleAnimAnim      = targetCharAnim.RootChunk.GetChildByName <Animation>("onfoot_talk_bored");
                        targetIdleAnimAnim.Name = "onfoot_idle";
                        targetIdleAnim          = (Pure3D.Chunk)targetIdleAnimAnim;
                    }
                    else
                    {
                        return;
                    }
                }

                if (targetCharAnim != null && targetIdleAnim != null)
                {
                    if (System.IO.File.Exists(path_extr + @"art\animation\crash_onfoot_animations.p3d"))
                    {
                        Pure3D.File CrashOnfootAnim = new Pure3D.File();
                        CrashOnfootAnim.Load(path_extr + @"art\animation\crash_onfoot_animations.p3d");

                        if (CrashOnfootAnim.RootChunk.GetChildByName <Animation>("onfoot_idle") != null)
                        {
                            int animIndex = CrashOnfootAnim.RootChunk.GetChildByName <Animation>("onfoot_idle").Parent.GetChildIndexByName <Animation>("onfoot_idle");
                            CrashOnfootAnim.RootChunk.GetChildByName <Animation>("onfoot_idle").Parent.Children[animIndex] = targetIdleAnim;
                        }

                        CrashOnfootAnim.Save(path_extr + @"art\animation\crash_onfoot_animations1.p3d");
                        System.IO.File.Delete(path_extr + @"art\animation\crash_onfoot_animations.p3d");
                        System.IO.File.Move(path_extr + @"art\animation\crash_onfoot_animations1.p3d", path_extr + @"art\animation\crash_onfoot_animations.p3d");
                    }
                    if (System.IO.File.Exists(path_extr + @"art\animation\crash_onfoot_midway_animations.p3d"))
                    {
                        Pure3D.File CrashOnfootMidwayAnim = new Pure3D.File();
                        CrashOnfootMidwayAnim.Load(path_extr + @"art\animation\crash_onfoot_midway_animations.p3d");

                        if (CrashOnfootMidwayAnim.RootChunk.GetChildByName <Animation>("onfoot_idle") != null)
                        {
                            int animIndex = CrashOnfootMidwayAnim.RootChunk.GetChildByName <Animation>("onfoot_idle").Parent.GetChildIndexByName <Animation>("onfoot_idle");
                            CrashOnfootMidwayAnim.RootChunk.GetChildByName <Animation>("onfoot_idle").Parent.Children[animIndex] = targetIdleAnim;
                        }

                        CrashOnfootMidwayAnim.Save(path_extr + @"art\animation\crash_onfoot_midway_animations1.p3d");
                        System.IO.File.Delete(path_extr + @"art\animation\crash_onfoot_midway_animations.p3d");
                        System.IO.File.Move(path_extr + @"art\animation\crash_onfoot_midway_animations1.p3d", path_extr + @"art\animation\crash_onfoot_midway_animations.p3d");
                    }
                }
            }
        }