コード例 #1
0
ファイル: SimpleTriggers.cs プロジェクト: cuellius/decomp
        public static void Decompile()
        {
            var fTriggers = new Text(Path.Combine(Common.InputPath, "simple_triggers.txt"));
            var fSource   = new Win32FileWriter(Path.Combine(Common.OutputPath, "module_simple_triggers.py"));

            fSource.WriteLine(Header.Standard);
            fSource.WriteLine(Header.SimpleTriggers);
            fTriggers.GetString();
            int iSimpleTriggers = fTriggers.GetInt();

            for (int t = 0; t < iSimpleTriggers; t++)
            {
                fSource.Write("  ({0},\r\n  [", Common.GetTriggerParam(fTriggers.GetDouble()));
                int iRecords = fTriggers.GetInt();
                if (iRecords != 0)
                {
                    fSource.WriteLine();
                    Common.PrintStatement(ref fTriggers, ref fSource, iRecords, "    ");
                    fSource.Write("  ");
                }
                fSource.Write("]),\r\n\r\n");
            }
            fSource.Write("]");
            fSource.Close();
            fTriggers.Close();
        }
コード例 #2
0
ファイル: TableauMaterials.cs プロジェクト: cuellius/decomp
        public static void Decompile()
        {
            var fTableaus = new Text(Path.Combine(Common.InputPath, "tableau_materials.txt"));
            var fSource   = new Win32FileWriter(Path.Combine(Common.OutputPath, "module_tableau_materials.py"));

            fSource.WriteLine(Header.Standard);
            fSource.WriteLine(Header.TableauMaterials);
            int iCount = fTableaus.GetInt();

            for (int i = 0; i < iCount; i++)
            {
                fSource.Write("  (\"{0}\", {1}, \"{2}\", ", fTableaus.GetWord().Remove(0, 4), fTableaus.GetDWord(), fTableaus.GetWord());
                for (int j = 0; j < 6; j++)
                {
                    fSource.Write(" {0},", fTableaus.GetInt());
                }
                fSource.WriteLine("\r\n  [");
                Common.PrintStatement(ref fTableaus, ref fSource, fTableaus.GetInt(), "    ");
                fSource.WriteLine("  ]),\r\n");
            }
            fSource.Write("]");
            fSource.Close();
            fTableaus.Close();
            Common.GenerateId("ID_tableau_materials.py", Common.Tableaus, "tableau");
        }
コード例 #3
0
ファイル: Sounds.cs プロジェクト: admiralnelson/decomp-cli
        public static string[] Initialize()
        {
            var fID = new Text(Common.InputPath + "/sounds.txt");

            fID.GetString();
            int n       = fID.GetInt();
            var aSounds = new string[n];

            for (int i = 0; i < n; i++)
            {
                fID.GetWord();
                fID.GetWord();
            }

            n = fID.GetInt();
            for (int i = 0; i < n; i++)
            {
                string strID = fID.GetWord();
                aSounds[i] = strID.Remove(0, 4);
                fID.GetString();
                //int iListCount = fID.GetInt();
                //for (int l = 0; l < iListCount; l++)
                //{
                //    fID.GetWord();
                //    fID.GetWord();
                //}
            }
            fID.Close();

            return(aSounds);
        }
コード例 #4
0
        public static string[] Initialize()
        {
            if (!File.Exists(Path.Combine(Common.InputPath, "sounds.txt")))
            {
                return(Array.Empty <string>());
            }

            var fId = new Text(Path.Combine(Common.InputPath, "sounds.txt"));

            fId.GetString();
            int n       = fId.GetInt();
            var aSounds = new string[n];

            for (int i = 0; i < n; i++)
            {
                fId.GetWord();
                fId.GetWord();
            }

            n = fId.GetInt();
            for (int i = 0; i < n; i++)
            {
                var strId = fId.GetWord();
                aSounds[i] = strId.Remove(0, 4);
                fId.GetString();
            }
            fId.Close();

            return(aSounds);
        }
コード例 #5
0
ファイル: Animations.cs プロジェクト: cuellius/decomp
        public static void Decompile()
        {
            var fActions = new Text(Path.Combine(Common.InputPath, "actions.txt"));
            var fSource  = new Win32FileWriter(Path.Combine(Common.OutputPath, "module_animations.py"));

            fSource.WriteLine(Header.Standard);
            fSource.WriteLine(Header.Animations);
            var iActions = fActions.GetInt();

            for (int a = 0; a < iActions; a++)
            {
                var strAnimId         = fActions.GetWord();
                var dwAnimFlags       = fActions.GetDWord();
                var dwMasterAnimFlags = fActions.GetDWord();
                fSource.WriteLine("  [\"{0}\", {1}, {2},", strAnimId, DecompileFlags(dwAnimFlags), DecompileMasterFlags(dwMasterAnimFlags));
                var iAnimSequences = fActions.GetInt();
                for (int s = 0; s < iAnimSequences; s++)
                {
                    var dDuration = fActions.GetDouble();
                    var strName   = fActions.GetWord();
                    fSource.Write("    [{0}, \"{1}\",", dDuration.ToString(CultureInfo.GetCultureInfo("en-US")), strName);
                    int iBeginFrame = fActions.GetInt(), iEndingFrame = fActions.GetInt();
                    var dwSequenceFlags = fActions.GetDWord();

                    var dd      = new string[5]; //NOTE: Type string for non-english version of windows
                    var bZeroes = true;
                    for (int d = 0; d < 5; d++)
                    {
                        dd[d] = fActions.GetDouble().ToString(CultureInfo.GetCultureInfo("en-US"));
                        if (dd[d] != "0")
                        {
                            bZeroes = false;
                        }
                    }
                    if (bZeroes)
                    {
                        fSource.Write(" {0}, {1}, {2}],\r\n", iBeginFrame, iEndingFrame, DecompileSequenceFlags(dwSequenceFlags));
                    }
                    else
                    {
                        fSource.Write(" {0}, {1}, {2}, {3}, ({4}, {5}, {6}), {7}],\r\n", iBeginFrame, iEndingFrame,
                                      DecompileSequenceFlags(dwSequenceFlags), DecompilePack((DWORD)Convert.ToDouble(dd[0], CultureInfo.GetCultureInfo("en-US"))), dd[1], dd[2], dd[3], dd[4]);
                    }
                }
                fSource.WriteLine("  ],");
            }
            fSource.Write("]");
            fSource.Close();
            fActions.Close();

            Common.GenerateId("ID_animations.py", Common.Animations, "anim");
        }
コード例 #6
0
ファイル: MapIcons.cs プロジェクト: cuellius/decomp
        public static void Decompile()
        {
            var fIcons  = new Text(Path.Combine(Common.InputPath, "map_icons.txt"));
            var fSource = new Win32FileWriter(Path.Combine(Common.OutputPath, "module_map_icons.py"));

            fSource.WriteLine(Header.Standard);
            fSource.WriteLine(Header.Icons);
            fIcons.GetString();
            int iMapIcons = fIcons.GetInt();

            for (int iMIcon = 0; iMIcon < iMapIcons; iMIcon++)
            {
                var strName = fIcons.GetWord();
                fSource.Write("  (\"{0}\",", strName);

                DWORD dwFlags = fIcons.GetDWord();
                fSource.Write(" {0},", dwFlags == 1 ? "mcn_no_shadow" : "0");

                var strMeshName = fIcons.GetWord();
                fSource.Write(" \"{0}\",", strMeshName);

                var    dScale = fIcons.GetDouble();
                int    iSound = fIcons.GetInt();
                double dX = fIcons.GetDouble(), dY = fIcons.GetDouble(), dZ = fIcons.GetDouble();

                fSource.Write(" {0}, {1}, {2}, {3}, {4}", dScale.ToString(CultureInfo.GetCultureInfo("en-US")), iSound != 0 ? iSound < Common.Sounds.Count ? "snd_" + Common.Sounds[iSound] : iSound.ToString(CultureInfo.GetCultureInfo("en-US")) : "0",
                              dX.ToString(CultureInfo.GetCultureInfo("en-US")), dY.ToString(CultureInfo.GetCultureInfo("en-US")), dZ.ToString(CultureInfo.GetCultureInfo("en-US")));

                int iTriggers = fIcons.GetInt();
                if (iTriggers > 0)
                {
                    fSource.Write(",\r\n  [\r\n");
                    for (int t = 0; t < iTriggers; t++)
                    {
                        double dInterval = fIcons.GetDouble();
                        fSource.WriteLine("    ({0},[", Common.GetTriggerParam(dInterval));

                        int iRecords = fIcons.GetInt();
                        Common.PrintStatement(ref fIcons, ref fSource, iRecords, "      ");

                        fSource.WriteLine("    ]),");
                    }
                    fSource.Write("  ]");
                }
                fSource.WriteLine("),");
            }
            fSource.Write("]");
            fSource.Close();
            fIcons.Close();

            Common.GenerateId("ID_map_icons.py", Common.MapIcons, "icon");
        }
コード例 #7
0
        public static void Decompile()
        {
            var fPresentations = new Text(Common.InputPath + "/presentations.txt");
            var fSource        = new Win32FileWriter(Common.OutputPath + "/module_presentations.py");

            fSource.WriteLine(Header.Standard);
            fSource.WriteLine(Header.Presentations);
            fPresentations.GetString();
            int iPresentations = fPresentations.GetInt();

            for (int i = 0; i < iPresentations; i++)
            {
                fSource.Write("  (\"{0}\"", fPresentations.GetWord().Remove(0, 6));

                int iFlag = fPresentations.GetInt();
                fSource.Write(", {0}", DecompileFlags(iFlag));

                int iMesh = fPresentations.GetInt();
                if (iMesh >= 0 && iMesh < Common.Meshes.Length)
                {
                    fSource.Write(", mesh_{0}", Common.Meshes[iMesh]);
                }
                else
                {
                    fSource.Write(", {0}", iMesh);
                }
                fSource.Write(",\r\n  [\r\n");

                int iTriggers = fPresentations.GetInt();
                for (int t = 0; t < iTriggers; t++)
                {
                    double dInterval = fPresentations.GetDouble();
                    fSource.Write("    ({0},\r\n    [\r\n", Common.GetTriggerParam(dInterval));
                    int iRecords = fPresentations.GetInt();
                    if (iRecords != 0)
                    {
                        //memcpy(indention, "      ", 7);
                        Common.PrintStatement(ref fPresentations, ref fSource, iRecords, "      ");
                    }
                    fSource.Write("    ]),\r\n");
                }
                fSource.Write("  ]),\r\n\r\n");
            }
            fSource.Write("]");
            fSource.Close();
            fPresentations.Close();

            Common.GenerateId("ID_presentations.py", Common.Presentations, "prsnt");
        }
コード例 #8
0
        public static string[] Initialize()
        {
            var fID = new Text(Common.InputPath + "/scene_props.txt");

            fID.GetString();
            int n           = fID.GetInt();
            var aSceneProps = new string[n];

            for (int i = 0; i < n; i++)
            {
                aSceneProps[i] = fID.GetWord().Remove(0, 4);

                fID.GetWord();
                fID.GetWord();
                fID.GetWord();
                fID.GetWord();

                var iTriggers = fID.GetInt();

                //idSceneProps[i - 1] = sceneprop.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)[0].Remove(0, 4);
                //var numTriggers = Convert.ToInt32(sceneprop.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)[5]);

                while (iTriggers != 0)
                {
                    fID.GetWord();

                    int iRecords = fID.GetInt();
                    if (iRecords != 0)
                    {
                        for (int r = 0; r < iRecords; r++)
                        {
                            fID.GetWord();
                            int iParams = fID.GetInt();
                            for (int p = 0; p < iParams; p++)
                            {
                                fID.GetWord();
                            }
                        }
                    }
                    iTriggers--;
                }

                //idFile.ReadLine();
                //idFile.ReadLine();
            }
            fID.Close();

            return(aSceneProps);
        }
コード例 #9
0
ファイル: MapIcons.cs プロジェクト: cuellius/decomp
        public static string[] Initialize()
        {
            if (!File.Exists(Path.Combine(Common.InputPath, "map_icons.txt")))
            {
                return(Array.Empty <string>());
            }

            var fId = new Text(Path.Combine(Common.InputPath, "map_icons.txt"));

            fId.GetString();
            var n         = Convert.ToInt32(fId.GetString(), CultureInfo.GetCultureInfo("en-US"));
            var aMapIcons = new string[n];

            for (int i = 0; i < n; i++)
            {
                aMapIcons[i] = fId.GetWord();
                fId.GetWord();
                fId.GetWord();

                fId.GetWord();
                fId.GetWord();
                fId.GetWord();
                fId.GetWord();
                fId.GetWord();

                var iTriggers = fId.GetInt();
                for (int t = 0; t < iTriggers; t++)
                {
                    fId.GetWord();

                    var iRecords = fId.GetInt();
                    if (iRecords != 0)
                    {
                        for (int r = 0; r < iRecords; r++)
                        {
                            fId.GetWord();
                            var iParams = fId.GetInt();
                            for (int p = 0; p < iParams; p++)
                            {
                                fId.GetWord();
                            }
                        }
                    }
                }
            }
            fId.Close();

            return(aMapIcons);
        }
コード例 #10
0
ファイル: SceneProps.cs プロジェクト: cuellius/decomp
        public static string[] Initialize()
        {
            if (!File.Exists(Path.Combine(Common.InputPath, "scene_props.txt")))
            {
                return(Array.Empty <string>());
            }

            var fId = new Text(Path.Combine(Common.InputPath, "scene_props.txt"));

            fId.GetString();
            int n           = fId.GetInt();
            var aSceneProps = new string[n];

            for (int i = 0; i < n; i++)
            {
                aSceneProps[i] = fId.GetWord().Remove(0, 4);

                fId.GetWord();
                fId.GetWord();
                fId.GetWord();
                fId.GetWord();

                var iTriggers = fId.GetInt();

                while (iTriggers != 0)
                {
                    fId.GetWord();

                    int iRecords = fId.GetInt();
                    if (iRecords != 0)
                    {
                        for (int r = 0; r < iRecords; r++)
                        {
                            fId.GetWord();
                            int iParams = fId.GetInt();
                            for (int p = 0; p < iParams; p++)
                            {
                                fId.GetWord();
                            }
                        }
                    }
                    iTriggers--;
                }
            }
            fId.Close();

            return(aSceneProps);
        }
コード例 #11
0
ファイル: Troops.cs プロジェクト: cuellius/decomp
        public static string[] Initialize()
        {
            if (!File.Exists(Path.Combine(Common.InputPath, "troops.txt")))
            {
                return(Array.Empty <string>());
            }

            var fId = new Text(Path.Combine(Common.InputPath, "troops.txt"));

            fId.GetString();
            int n       = fId.GetInt();
            var aTroops = new string[n];

            for (int i = 0; i < n; i++)
            {
                string strTroopId = fId.GetWord();
                aTroops[i] = strTroopId.Remove(0, 4);

                for (int j = 0; j < 163; j++)
                {
                    fId.GetWord();
                }
                if (Common.SelectedMode == Mode.Caribbean)
                {
                    fId.GetWord();
                }
            }
            fId.Close();

            return(aTroops);
        }
コード例 #12
0
        public static string[] Initialize()
        {
            var fID = new Text(Common.InputPath + "/presentations.txt");

            fID.GetString();
            int n = fID.GetInt();
            var aPresentations = new string[n];

            for (int i = 0; i < n; i++)
            {
                aPresentations[i] = fID.GetWord().Remove(0, 6);
                //idPresentations[i - 1] = presentation.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)[0].Remove(0, 6);
                //var numEvents = Convert.ToInt32(presentation.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)[3]);
                fID.GetWord();
                fID.GetWord();

                var iEvents = fID.GetInt();

                while (iEvents != 0)
                {
                    fID.GetWord();

                    int iRecords = fID.GetInt();
                    if (iRecords != 0)
                    {
                        for (int r = 0; r < iRecords; r++)
                        {
                            fID.GetWord();
                            int iParams = fID.GetInt();
                            for (int p = 0; p < iParams; p++)
                            {
                                fID.GetWord();
                            }
                        }
                    }
                    iEvents--;
                }

                //idFile.ReadLine();
                //idFile.ReadLine();
            }
            fID.Close();

            return(aPresentations);
        }
コード例 #13
0
ファイル: Presentations.cs プロジェクト: cuellius/decomp
        public static string[] Initialize()
        {
            if (!File.Exists(Path.Combine(Common.InputPath, "presentations.txt")))
            {
                return(Array.Empty <string>());
            }

            var fId = new Text(Path.Combine(Common.InputPath, "presentations.txt"));

            fId.GetString();
            int n = fId.GetInt();
            var aPresentations = new string[n];

            for (int i = 0; i < n; i++)
            {
                aPresentations[i] = fId.GetWord().Remove(0, 6);
                fId.GetWord();
                fId.GetWord();

                var iEvents = fId.GetInt();

                while (iEvents != 0)
                {
                    fId.GetWord();

                    int iRecords = fId.GetInt();
                    if (iRecords != 0)
                    {
                        for (int r = 0; r < iRecords; r++)
                        {
                            fId.GetWord();
                            int iParams = fId.GetInt();
                            for (int p = 0; p < iParams; p++)
                            {
                                fId.GetWord();
                            }
                        }
                    }
                    iEvents--;
                }
            }
            fId.Close();

            return(aPresentations);
        }
コード例 #14
0
        public static string[] Initialize()
        {
            var fID = new Text(Common.InputPath + "/map_icons.txt");

            fID.GetString();
            int n         = Convert.ToInt32(fID.GetString());
            var aMapIcons = new string[n];

            for (int i = 0; i < n; i++)
            {
                aMapIcons[i] = fID.GetWord();
                fID.GetWord();
                fID.GetWord();

                fID.GetWord();
                fID.GetWord();
                fID.GetWord();
                fID.GetWord();
                fID.GetWord();

                int iTriggers = fID.GetInt();
                for (int t = 0; t < iTriggers; t++)
                {
                    //idFile.GetString();
                    fID.GetWord();

                    int iRecords = fID.GetInt();
                    if (iRecords != 0)
                    {
                        for (int r = 0; r < iRecords; r++)
                        {
                            fID.GetWord();
                            int iParams = fID.GetInt();
                            for (int p = 0; p < iParams; p++)
                            {
                                fID.GetWord();
                            }
                        }
                    }
                }
            }
            fID.Close();

            return(aMapIcons);
        }
コード例 #15
0
        public static void Decompile()
        {
            var fPostfx = new Text(Path.Combine(Common.InputPath, "postfx.txt"));
            var fSource = new Win32FileWriter(Path.Combine(Common.OutputPath, "module_postfx.py"));

            fSource.WriteLine(Header.Standard);
            fSource.WriteLine(Header.Postfx);
            fPostfx.GetString();
            int iPostFXs   = fPostfx.GetInt();
            var postfxList = new string[iPostFXs];

            for (int i = 0; i < iPostFXs; i++)
            {
                postfxList[i] = fPostfx.GetWord().Remove(0, 4);
                fSource.Write("  (\"{0}\"", postfxList[i]);

                var dwFlag = fPostfx.GetDWord();
                if (dwFlag == 1)
                {
                    fSource.Write(", fxf_highhdr");
                }
                else
                {
                    fSource.Write(", {0}", dwFlag);
                }

                var iOpType = fPostfx.GetInt();
                fSource.Write(", {0},", iOpType);
                for (int p = 0; p < 3; p++)
                {
                    double d1 = fPostfx.GetDouble(), d2 = fPostfx.GetDouble(), d3 = fPostfx.GetDouble(), d4 = fPostfx.GetDouble();
                    fSource.Write(" [{0}, {1}, {2}, {3}]{4}", d1.ToString(CultureInfo.GetCultureInfo("en-US")), d2.ToString(CultureInfo.GetCultureInfo("en-US")),
                                  d3.ToString(CultureInfo.GetCultureInfo("en-US")), d4.ToString(CultureInfo.GetCultureInfo("en-US")), p < 2 ? "," : "");
                }
                fSource.WriteLine("),");
            }
            fSource.Write("]");
            fSource.Close();
            fPostfx.Close();

            Common.GenerateId("ID_postfx_params.py", postfxList, "pfx");
        }
コード例 #16
0
        public static string[] Initialize()
        {
            if (!File.Exists(Path.Combine(Common.InputPath, "parties.txt")))
            {
                return(Array.Empty <string>());
            }

            var fId = new Text(Path.Combine(Common.InputPath, "parties.txt"));

            fId.GetString();
            int n = fId.GetInt();

            fId.GetInt();

            var idParties = new string[n];

            for (int i = 0; i < n; i++)
            {
                fId.GetWord(); fId.GetWord(); fId.GetWord();
                idParties[i] = fId.GetWord().Remove(0, 2);

                for (int j = 0; j < 17; j++)
                {
                    fId.GetWord();
                }

                int iRecords = fId.GetInt();

                for (int j = 0; j < iRecords; j++)
                {
                    fId.GetWord();
                    fId.GetWord();
                    fId.GetWord();
                    fId.GetWord();
                }

                fId.GetWord();
            }
            fId.Close();

            return(idParties);
        }
コード例 #17
0
        public static void Decompile()
        {
            var fSkills = new Text(Path.Combine(Common.InputPath, "skills.txt"));
            var fSource = new Win32FileWriter(Path.Combine(Common.OutputPath, "module_skills.py"));

            fSource.WriteLine(Header.Standard);
            fSource.WriteLine(Header.Skills);
            int iSkills = fSkills.GetInt();

            for (int s = 0; s < iSkills; s++)
            {
                fSource.WriteLine("  (\"{0}\", \"{1}\", {2}, {3}, \"{4}\"),", fSkills.GetWord().Remove(0, 4), fSkills.GetWord().Replace('_', ' '),
                                  DecompileFlags(fSkills.GetDWord()), fSkills.GetInt(), fSkills.GetWord().Replace('_', ' '));
            }
            fSource.Write("]");
            fSource.Close();
            fSkills.Close();

            Common.GenerateId("ID_skills.py", Common.Skills, "skl");
        }
コード例 #18
0
        public static string[] Initialize()
        {
            if (!File.Exists(Path.Combine(Common.InputPath, "scenes.txt")))
            {
                return(Array.Empty <string>());
            }

            var fId = new Text(Path.Combine(Common.InputPath, "scenes.txt"));

            fId.GetString();
            int n       = fId.GetInt();
            var aScenes = new string[n];

            for (int i = 0; i < n; i++)
            {
                aScenes[i] = fId.GetWord().Remove(0, 4);

                for (int j = 0; j < 10; j++)
                {
                    fId.GetWord();
                }

                int iPassages = fId.GetInt();
                for (int j = 0; j < iPassages; j++)
                {
                    fId.GetWord();
                }

                int iChestTroops = fId.GetInt();
                for (int j = 0; j < iChestTroops; j++)
                {
                    fId.GetWord();
                }

                fId.GetWord();
            }
            fId.Close();

            return(aScenes);
        }
コード例 #19
0
        public static string[] Initialize()
        {
            if (!File.Exists(Path.Combine(Common.InputPath, "item_kinds1.txt")))
            {
                return(Array.Empty <string>());
            }

            var fId = new Text(Path.Combine(Common.InputPath, "item_kinds1.txt"));

            fId.GetString();
            var n      = Convert.ToInt32(fId.GetString(), CultureInfo.GetCultureInfo("en-US"));
            var aItems = new string[n];

            for (int i = 0; i < n; i++)
            {
                var strId = fId.GetWord();
                aItems[i] = strId.Remove(0, 4);
                fId.GetWord();
                fId.GetWord();

                var iMeshes = fId.GetInt();

                for (int m = 0; m < iMeshes; m++)
                {
                    fId.GetWord();
                    fId.GetWord();
                }

                for (int v = 0; v < 17; v++)
                {
                    fId.GetWord();
                }

                var iFactions = fId.GetInt();
                for (int j = 0; j < iFactions; j++)
                {
                    fId.GetInt();
                }

                var iTriggers = fId.GetInt();
                for (int t = 0; t < iTriggers; t++)
                {
                    fId.GetWord();
                    var iRecords = fId.GetInt();
                    for (int r = 0; r < iRecords; r++)
                    {
                        fId.GetWord();
                        var iParams = fId.GetInt();
                        for (int p = 0; p < iParams; p++)
                        {
                            fId.GetWord();
                        }
                    }
                }
            }
            fId.Close();

            return(aItems);
        }
コード例 #20
0
ファイル: SceneProps.cs プロジェクト: cuellius/decomp
        public static void Decompile()
        {
            var fSceneProps = new Text(Path.Combine(Common.InputPath, "scene_props.txt"));
            var fSource     = new Win32FileWriter(Path.Combine(Common.OutputPath, "module_scene_props.py"));

            fSource.WriteLine(Header.Standard);
            fSource.WriteLine(Header.SceneProps);
            fSceneProps.GetString();
            var iSceneProps = fSceneProps.GetInt();

            for (int i = 0; i < iSceneProps; i++)
            {
                var strId  = fSceneProps.GetWord();
                var dwFlag = fSceneProps.GetUInt();
                fSceneProps.GetInt();
                fSource.Write("  (\"{0}\", {1}, \"{2}\", \"{3}\", [", strId.Remove(0, 4), DecompileFlags(dwFlag), fSceneProps.GetWord(), fSceneProps.GetWord());

                var iTriggers = fSceneProps.GetInt();

                for (int t = 0; t < iTriggers; t++)
                {
                    var dInterval = fSceneProps.GetDouble();
                    fSource.Write("\r\n    ({0},[\r\n", Common.GetTriggerParam(dInterval));

                    var iRecords = fSceneProps.GetInt();
                    if (iRecords != 0)
                    {
                        Common.PrintStatement(ref fSceneProps, ref fSource, iRecords, "      ");
                    }
                    fSource.WriteLine("    ]),");
                }
                fSource.WriteLine(iTriggers > 0 ? "  ]),\r\n" : "]),\r\n");
            }
            fSource.Write("]");
            fSource.Close();
            fSceneProps.Close();

            Common.GenerateId("ID_scene_props.py", Common.SceneProps, "spr");
        }
コード例 #21
0
        public static void Decompile()
        {
            var fSounds = new Text(Path.Combine(Common.InputPath, "sounds.txt"));
            var fSource = new Win32FileWriter(Path.Combine(Common.OutputPath, "module_sounds.py"));

            fSource.WriteLine(Header.Standard);
            fSource.WriteLine(Header.Sounds);
            fSounds.GetString();
            int iSamples = fSounds.GetInt();
            var aSamples = new string[iSamples];

            for (int s = 0; s < iSamples; s++)
            {
                aSamples[s] = fSounds.GetWord();
                fSounds.GetString();
            }

            int iSounds = fSounds.GetInt();

            for (int s = 0; s < iSounds; s++)
            {
                fSource.Write("  (\"{0}\", {1},", fSounds.GetWord().Remove(0, 4), DecompileFlags(fSounds.GetDWord()));
                int iListCount = fSounds.GetInt();
                fSource.Write(" [");
                for (int l = 0; l < iListCount; l++)
                {
                    int iSample = fSounds.GetInt();
                    fSounds.GetInt();
                    fSource.Write("{0}{1}", iSample < aSamples.Length ? '"' + aSamples[iSample] + '"' : iSample.ToString(CultureInfo.GetCultureInfo("en-US")), l == iListCount - 1 ? "" : ", ");
                }
                fSource.WriteLine("]),");
            }

            fSource.Write("]");
            fSource.Close();
            fSounds.Close();

            Common.GenerateId("ID_sounds.py", Common.Sounds, "snd");
        }
コード例 #22
0
ファイル: Sounds.cs プロジェクト: admiralnelson/decomp-cli
        public static void Decompile()
        {
            var fSounds = new Text(Common.InputPath + "/sounds.txt");
            var fSource = new Win32FileWriter(Common.OutputPath + "/module_sounds.py");

            fSource.WriteLine(Header.Standard);
            fSource.WriteLine(Header.Sounds);
            fSounds.GetString();
            int iSamples = fSounds.GetInt();
            var aSamples = new List <string>();

            for (int s = 0; s < iSamples; s++)
            {
                aSamples.Add(fSounds.GetWord());
                fSounds.GetString();
            }

            int iSounds = fSounds.GetInt();

            for (int s = 0; s < iSounds; s++)
            {
                fSource.Write("  (\"{0}\", {1},", fSounds.GetWord().Remove(0, 4), DecompileFlags(fSounds.GetDWord()));
                int iListCount = fSounds.GetInt();
                fSource.Write(" [");
                for (int l = 0; l < iListCount; l++)
                {
                    int iSample = fSounds.GetInt();
                    fSounds.GetInt();
                    fSource.Write("\"{0}\"{1}", aSamples[iSample], l == iListCount - 1 ? "" : ", ");
                }
                fSource.WriteLine("]),");
            }

            fSource.Write("]");
            fSource.Close();
            fSounds.Close();

            Common.GenerateId("ID_sounds.py", Common.Sounds, "snd");
        }
コード例 #23
0
        public static string[] Initialize()
        {
            var fID = new Text(Common.InputPath + "/scenes.txt");

            fID.GetString();
            int n       = fID.GetInt();
            var aScenes = new string[n];

            for (int i = 0; i < n; i++)
            {
                aScenes[i] = fID.GetWord().Remove(0, 4);

                for (int j = 0; j < 10; j++)
                {
                    fID.GetWord();
                }

                int iPassages = fID.GetInt();
                for (int j = 0; j < iPassages; j++)
                {
                    fID.GetWord();
                }

                int iChestTroops = fID.GetInt();
                for (int j = 0; j < iChestTroops; j++)
                {
                    fID.GetWord();
                }

                fID.GetWord();
                //idFile.ReadLine();
                //idFile.ReadLine();
                //idFile.ReadLine();
            }
            fID.Close();

            return(aScenes);
        }
コード例 #24
0
        public static string[] Initialize()
        {
            if (!File.Exists(Path.Combine(Common.InputPath, "scripts.txt")))
            {
                return(Array.Empty <string>());
            }

            var fId = new Text(Path.Combine(Common.InputPath, "scripts.txt"));

            fId.GetString();
            int n        = fId.GetInt();
            var aScripts = new string[n];

            for (int i = 0; i < n; i++)
            {
                aScripts[i] = fId.GetWord();

                fId.GetWord();

                int iRecords = fId.GetInt();
                if (iRecords != 0)
                {
                    for (int r = 0; r < iRecords; r++)
                    {
                        fId.GetWord();
                        int iParams = fId.GetInt();
                        for (int p = 0; p < iParams; p++)
                        {
                            fId.GetWord();
                        }
                    }
                }
            }
            fId.Close();

            return(aScripts);
        }
コード例 #25
0
ファイル: Meshes.cs プロジェクト: admiralnelson/decomp-cli
        public static void Decompile()
        {
            var fMeshes = new Text(Common.InputPath + "/meshes.txt");
            var fSource = new Win32FileWriter(Common.OutputPath + "/module_meshes.py");

            fSource.WriteLine(Header.Standard);
            fSource.WriteLine(Header.Meshes);
            int iMeshes = fMeshes.GetInt();

            for (int m = 0; m < iMeshes; m++)
            {
                fSource.Write("  (\"{0}\", ", fMeshes.GetWord().Remove(0, 5));

                int iFlag = fMeshes.GetInt();
                if (iFlag == 1)
                {
                    fSource.Write("render_order_plus_1,");
                }
                else
                {
                    fSource.Write("{0},", iFlag);
                }

                fSource.Write(" \"{0}\"", fMeshes.GetWord());

                for (int i = 0; i < 9; i++)
                {
                    fSource.Write(", {0}", fMeshes.GetDouble().ToString(CultureInfo.GetCultureInfo("en-US")));
                }
                fSource.WriteLine("),");
            }
            fSource.Write("]");
            fSource.Close();
            fMeshes.Close();

            Common.GenerateId("ID_meshes.py", Common.Meshes, "mesh");
        }
コード例 #26
0
ファイル: Parties.cs プロジェクト: admiralnelson/decomp-cli
        public static string[] Initialize()
        {
            var fID = new Text(Common.InputPath + "/parties.txt");

            fID.GetString();
            int n = fID.GetInt();

            fID.GetInt();

            var idParties = new string[n];

            for (int i = 0; i < n; i++)
            {
                fID.GetWord(); fID.GetWord(); fID.GetWord();
                idParties[i] = fID.GetWord().Remove(0, 2);

                for (int j = 0; j < 17; j++)
                {
                    fID.GetWord();
                }

                int iRecords = fID.GetInt();

                for (int j = 0; j < iRecords; j++)
                {
                    fID.GetWord();
                    fID.GetWord();
                    fID.GetWord();
                    fID.GetWord();
                }

                fID.GetWord();
            }
            fID.Close();

            return(idParties);
        }
コード例 #27
0
ファイル: Skyboxes.cs プロジェクト: admiralnelson/decomp-cli
        public static void Decompile()
        {
            var fSkyboxes = new Text(Common.InputPath + "/skyboxes.txt");
            var fSource   = new Win32FileWriter(Common.OutputPath + "/module_skyboxes.py");

            fSource.WriteLine(Header.Standard);
            fSource.WriteLine(Header.Skyboxes);

            int iSkyboxes = fSkyboxes.GetInt();

            for (int i = 0; i < iSkyboxes; i++)
            {
                string strID   = fSkyboxes.GetWord();
                DWORD  dwFlags = fSkyboxes.GetDWord();
                fSource.Write("  (\"{0}\", {1},", strID, DecompileFlags(dwFlags));

                for (int j = 0; j < 3; j++)
                {
                    fSource.Write(" {0},", fSkyboxes.GetDouble().ToString(CultureInfo.GetCultureInfo("en-US")));
                }

                fSource.Write(" \"{0}\",", fSkyboxes.GetWord());

                for (int j = 0; j < 3; j++)
                {
                    fSource.Write(" ({0}, {1}, {2}),", fSkyboxes.GetDouble().ToString(CultureInfo.GetCultureInfo("en-US")),
                                  fSkyboxes.GetDouble().ToString(CultureInfo.GetCultureInfo("en-US")),
                                  fSkyboxes.GetDouble().ToString(CultureInfo.GetCultureInfo("en-US")));
                }

                fSource.WriteLine(" ({0}, 0x{1:X8})),", fSkyboxes.GetDouble().ToString(CultureInfo.GetCultureInfo("en-US")), fSkyboxes.GetDWord());
            }
            fSource.Write(@"]
def save_skyboxes():
  file = open(export_dir + ""Data/skyboxes.txt"",""w"")
  file.write(""d\n""%len(skyboxes))
  for skybox in  skyboxes:
    file.write(""%s %d %f %f %f %s\n""%(skybox[0],skybox[1],skybox[2],skybox[3],skybox[4],skybox[5]))
    file.write("" %f %f %f ""%skybox[6])
    file.write("" %f %f %f ""%skybox[7])
    file.write("" %f %f %f ""%skybox[8])
    file.write("" %f %d\n""%skybox[9])
  file.close()

print ""Exporting skyboxes...""
save_skyboxes()");
            fSource.Close();
            fSkyboxes.Close();
        }
コード例 #28
0
ファイル: Triggers.cs プロジェクト: cuellius/decomp
        public static void Decompile()
        {
            var fTriggers = new Text(Path.Combine(Common.InputPath, "triggers.txt"));
            var fSource   = new Win32FileWriter(Path.Combine(Common.OutputPath, "module_triggers.py"));

            fSource.WriteLine(Header.Standard);
            fSource.WriteLine(Header.Triggers);
            fTriggers.GetString();
            int iTriggers = fTriggers.GetInt();

            for (int t = 0; t < iTriggers; t++)
            {
                double dCheckInterval = fTriggers.GetDouble(), dDelayInterval = fTriggers.GetDouble(), dReArmInterval = fTriggers.GetDouble();
                fSource.Write("  ({0}, {1}, {2},[", GetTriggerParam(dCheckInterval), GetTriggerParam(dDelayInterval), GetTriggerParam(dReArmInterval));
                int iConditionRecords = fTriggers.GetInt();
                if (iConditionRecords != 0)
                {
                    fSource.WriteLine();
                    Common.PrintStatement(ref fTriggers, ref fSource, iConditionRecords, "    ");
                    fSource.Write("  ");
                }
                fSource.Write("],\r\n  [");
                iConditionRecords = fTriggers.GetInt();
                if (iConditionRecords != 0)
                {
                    fSource.WriteLine();
                    Common.PrintStatement(ref fTriggers, ref fSource, iConditionRecords, "    ");
                    fSource.Write("  ");
                }

                fSource.WriteLine("]),\r\n");
            }
            fSource.Write("]");
            fSource.Close();
            fTriggers.Close();
        }
コード例 #29
0
        public static void Decompile()
        {
            var fScripts = new Text(Path.Combine(Common.InputPath, "scripts.txt"));
            var fSource  = new Win32FileWriter(Path.Combine(Common.OutputPath, "module_scripts.py"));

            fSource.WriteLine(Header.Standard);
            fSource.WriteLine(Header.Scripts);
            fScripts.GetString();
            int iScripts = fScripts.GetInt();

            for (int s = 0; s < iScripts; s++)
            {
                fSource.Write("  (\"{0}\",\r\n  [\r\n", fScripts.GetWord());
                fScripts.GetInt();
                int iRecords = fScripts.GetInt();
                Common.PrintStatement(ref fScripts, ref fSource, iRecords, "    ");
                fSource.Write("  ]),\r\n\r\n");
            }
            fSource.Write("]");
            fSource.Close();
            fScripts.Close();

            Common.GenerateId("ID_scripts.py", Common.Procedures, "script");
        }
コード例 #30
0
        public static void Decompile()
        {
            var fTemplates = new Text(Path.Combine(Common.InputPath, "party_templates.txt"));
            var fSource    = new Win32FileWriter(Path.Combine(Common.OutputPath, "module_party_templates.py"));

            fSource.WriteLine(Header.Standard);
            fSource.WriteLine(Header.PartyTemplates);
            fTemplates.GetString();
            var iTemplates = fTemplates.GetInt();

            for (int i = 0; i < iTemplates; i++)
            {
                fSource.Write("  (\"{0}\", \"{1}\"", fTemplates.GetWord().Remove(0, 3), fTemplates.GetWord());

                var dwFlag = fTemplates.GetUInt64();
                fSource.Write(", {0}, {1}", DecompileFlags(dwFlag), fTemplates.GetInt());

                var iFaction = fTemplates.GetInt();
                if (iFaction >= 0 && iFaction < Common.Factions.Count)
                {
                    fSource.Write(", fac_{0}", Common.Factions[iFaction]);
                }
                else
                {
                    fSource.Write(", {0}", iFaction);
                }

                var dwPersonality = fTemplates.GetUInt();
                fSource.Write(", {0}, [", DecompilePersonality(dwPersonality));


                var sbTroopList = new StringBuilder(1024);
                for (int iStack = 0; iStack < 6; iStack++)
                {
                    var iTroop = fTemplates.GetInt();
                    if (-1 == iTroop)
                    {
                        continue;
                    }
                    var iMinTroops   = fTemplates.GetInt();
                    var iMaxTroops   = fTemplates.GetInt();
                    var dwMemberFlag = fTemplates.GetDWord();
                    sbTroopList.Append($"({(iTroop < Common.Troops.Count ? "trp_" + Common.Troops[iTroop] : iTroop.ToString(CultureInfo.GetCultureInfo("en-US")))}, {iMinTroops}, {iMaxTroops}{(dwMemberFlag == 1 ? ", pmf_is_prisoner" : "")}),");
                }
                if (sbTroopList.Length != 0)
                {
                    sbTroopList.Length--;
                }
                fSource.WriteLine("{0}]),", sbTroopList);
            }
            fSource.Write("]");
            fSource.Close();
            fTemplates.Close();

            Common.GenerateId("ID_party_templates.py", Common.PTemps, "pt");
        }