Пример #1
0
        public static string[] Initialize()
        {
            var fID = new Text(Common.InputPath + "/factions.txt");

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

            for (int i = 0; i < n; i++)
            {
                string strFacID = fID.GetWord();
                if (strFacID == "0")
                {
                    strFacID = fID.GetWord();
                }
                aFactions[i] = strFacID.Remove(0, 4);

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

                for (int r = 0; r < n; r++)
                {
                    fID.GetDouble();
                }
            }
            fID.Close();

            return(aFactions);
        }
Пример #2
0
        public static void Decompile()
        {
            var fStrings = new Text(Path.Combine(Common.InputPath, "strings.txt"));
            var fSource  = new Win32FileWriter(Path.Combine(Common.OutputPath, "module_strings.py"));

            fSource.WriteLine(Header.Standard);
            fSource.WriteLine(Header.Strings);
            fStrings.GetString();
            int iStrings = Convert.ToInt32(fStrings.GetString(), CultureInfo.GetCultureInfo("en-US")); //fStrings.GetInt();

            for (int s = 0; s < iStrings; s++)
            {
                var str = fStrings.GetString();
                if (str == null)
                {
                    continue;
                }
                var strDataArray = str.Split(new [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); //.st
                //string strID = fStrings.GetWord();
                //string strText = fStrings.GetWord();
                var strId   = strDataArray[0];
                var strText = strDataArray[1];
                //Console.WriteLine($@"process {s} = ""{strID}""");
                fSource.WriteLine("  (\"{0}\", \"{1}\"),", strId.Remove(0, 4), strText.Replace('_', ' '));
                //fSource.Close();
            }

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

            Common.GenerateId("ID_strings.py", Common.Strings, "str");
        }
Пример #3
0
        public static string[] Initialize()
        {
            if (!File.Exists(Path.Combine(Common.InputPath, "particle_systems.txt")))
            {
                return(Array.Empty <string>());
            }

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

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

            for (int i = 0; i < n; i++)
            {
                aParticleSystems[i] = fId.GetWord().Remove(0, 5);
                for (int j = 0; j < 37; j++)
                {
                    fId.GetWord();
                }
            }
            fId.Close();

            return(aParticleSystems);
        }
Пример #4
0
        public static string[] Initialize()
        {
            if (!File.Exists(Path.Combine(Common.InputPath, "factions.txt")))
            {
                return(Array.Empty <string>());
            }

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

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

            for (int i = 0; i < n; i++)
            {
                var strFacId = fId.GetWord();
                if (strFacId == "0")
                {
                    strFacId = fId.GetWord();
                }
                aFactions[i] = strFacId.Remove(0, 4);

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

                for (int r = 0; r < n; r++)
                {
                    fId.GetDouble();
                }
            }
            fId.Close();

            return(aFactions);
        }
Пример #5
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);
        }
Пример #6
0
        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);
        }
Пример #7
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);
        }
Пример #8
0
        public static string[] Initialize()
        {
            var fID = new Text(Common.InputPath + "/item_kinds1.txt");

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

            for (int i = 0; i < n; i++)
            {
                string strID = fID.GetWord();
                //Console.WriteLine(strID);
                aItems[i] = strID.Remove(0, 4);
                fID.GetWord();
                fID.GetWord();

                int iMeshes = fID.GetInt();

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

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

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

                int iTriggers = fID.GetInt();
                for (int t = 0; t < iTriggers; t++)
                {
                    fID.GetWord();
                    int iRecords = fID.GetInt();
                    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(aItems);
        }
Пример #9
0
        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
        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);
        }
Пример #11
0
        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();
        }
Пример #12
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);
        }
Пример #13
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");
        }
Пример #14
0
        public static string[] Initialize()
        {
            var fID = new Text(Common.InputPath + "/particle_systems.txt");

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

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

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

            return(aParticleSystems);
        }
Пример #15
0
        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");
        }
Пример #16
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");
        }
Пример #17
0
        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");
        }
Пример #18
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");
        }
Пример #19
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);
        }
Пример #20
0
        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);
        }
Пример #21
0
        public static void Decompile()
        {
            var fParticles = new Text(Path.Combine(Common.InputPath, "particle_systems.txt"));
            var fSource    = new Win32FileWriter(Path.Combine(Common.OutputPath, "module_particle_systems.py"));

            fSource.WriteLine(Header.Standard);
            fSource.WriteLine(Header.ParticleSystems);
            fParticles.GetString();
            int iParticles = fParticles.GetInt();

            for (int i = 0; i < iParticles; i++)
            {
                fSource.Write("  (\"{0}\", ", fParticles.GetWord().Remove(0, 5));

                DWORD dwFlag = fParticles.GetDWord();
                fSource.Write("{0}, \"{1}\",\r\n   ", DecompileFlags(dwFlag), fParticles.GetWord());
                for (int j = 0; j < 6; j++)
                {
                    fSource.Write(" {0},", fParticles.GetDouble().ToString(CultureInfo.GetCultureInfo("en-US")));
                }
                fSource.WriteLine();

                double d0, d1;
                for (int j = 0; j < 5; j++)
                {
                    d0 = fParticles.GetDouble(); d1 = fParticles.GetDouble();
                    fSource.Write("    ({0}, {1}),", d0.ToString(CultureInfo.GetCultureInfo("en-US")), d1.ToString(CultureInfo.GetCultureInfo("en-US")));
                    d0 = fParticles.GetDouble(); d1 = fParticles.GetDouble();
                    fSource.WriteLine(" ({0}, {1}),", d0.ToString(CultureInfo.GetCultureInfo("en-US")), d1.ToString(CultureInfo.GetCultureInfo("en-US")));
                }

                d0 = fParticles.GetDouble(); d1 = fParticles.GetDouble(); var d2 = fParticles.GetDouble();
                fSource.WriteLine("    ({0}, {1}, {2}),", d0.ToString(CultureInfo.GetCultureInfo("en-US")), d1.ToString(CultureInfo.GetCultureInfo("en-US")), d2.ToString(CultureInfo.GetCultureInfo("en-US")));

                d0 = fParticles.GetDouble(); d1 = fParticles.GetDouble(); d2 = fParticles.GetDouble();
                fSource.WriteLine("    ({0}, {1}, {2}),", d0.ToString(CultureInfo.GetCultureInfo("en-US")), d1.ToString(CultureInfo.GetCultureInfo("en-US")), d2.ToString(CultureInfo.GetCultureInfo("en-US")));

                d0 = fParticles.GetDouble(); d1 = fParticles.GetDouble(); d2 = fParticles.GetDouble();
                fSource.WriteLine("    {0},\r\n    {1}, {2}\r\n  ),\r\n", d0.ToString(CultureInfo.GetCultureInfo("en-US")), d1.ToString(CultureInfo.GetCultureInfo("en-US")), d2.ToString(CultureInfo.GetCultureInfo("en-US")));
            }
            fSource.Write("]");
            fSource.Close();
            fParticles.Close();

            Common.GenerateId("ID_particle_systems.py", Common.ParticleSystems, "psys");
        }
Пример #22
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);
        }
Пример #23
0
        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);
        }
Пример #24
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");
        }
Пример #25
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);
        }
Пример #26
0
        public static void Decompile()
        {
            var fQuests = new Text(Common.InputPath + "/quests.txt");
            var fSource = new Win32FileWriter(Common.OutputPath + "/module_quests.py");

            fSource.WriteLine(Header.Standard);
            fSource.WriteLine(Header.Quests);
            fQuests.GetString();
            int iQuests = fQuests.GetInt();

            for (int iQuest = 0; iQuest < iQuests; iQuest++)
            {
                fSource.WriteLine("  (\"{0}\", \"{1}\", {2}, \"{3}\"),", fQuests.GetWord().Remove(0, 4), fQuests.GetWord().Replace('_', ' '), DecompileFlags(fQuests.GetInt()), fQuests.GetWord().Replace('_', ' '));
            }

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

            Common.GenerateId("ID_quests.py", Common.Quests, "qst");
        }
Пример #27
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);
        }
Пример #28
0
        public static string[] Initialize()
        {
            var fID = new Text(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 < 9; j++)
                 * {
                 *  fID.GetWord();
                 * }
                 *
                 * for (int j = 0; j < 64; j++)
                 * {
                 *  fID.GetWord();
                 *  fID.GetWord();
                 * }
                 *
                 * for (int j = 0; j < 26; j++)
                 *  fID.GetWord();*/

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

            return(aTroops);
        }
Пример #29
0
        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");
        }
Пример #30
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);
        }