Ejemplo n.º 1
0
        // This matches a WAD file with the specified game configuration
        // by checking if the specific lumps are detected
        private bool MatchConfiguration(string configfile, WAD wadfile)
        {
            Configuration cfg;
            IDictionary   detectlumps;
            Lump          lumpresult;
            bool          result = false;

            // Load the configuration
            cfg = General.LoadGameConfiguration(configfile);

            // Get the lumps to detect
            detectlumps = cfg.ReadSetting("gamedetect", new Hashtable());

            // Go for all the lumps
            foreach (DictionaryEntry lmp in detectlumps)
            {
                // Setting not broken?
                if ((lmp.Value is int) && (lmp.Key is string))
                {
                    // Find the lump in the WAD file
                    lumpresult = wadfile.FindLump((string)lmp.Key);

                    // If one of these lumps must exist, and it is found
                    if (((int)lmp.Value == 1) && (lumpresult != null))
                    {
                        // Good result.
                        result = true;
                    }
                    // If this lumps may not exist, and it is found
                    else if (((int)lmp.Value == 2) && (lumpresult != null))
                    {
                        // Bad result.
                        result = false;
                        break;
                    }
                    // If this lumps must exist, and is found
                    else if (((int)lmp.Value == 3) && (lumpresult != null))
                    {
                        // Good result.
                        result = true;
                    }
                    // If this lumps must exist, and it is missing
                    else if (((int)lmp.Value == 3) && (lumpresult == null))
                    {
                        // Bad result.
                        result = false;
                        break;
                    }
                }
            }

            // Return result
            return(result);
        }
Ejemplo n.º 2
0
        // This loads the PLAYPAL palette
        public override Playpal LoadPalette()
        {
            Lump lump;

            // Error when suspended
            if (issuspended)
            {
                throw new Exception("Data reader is suspended");
            }

            // Look for a lump named PLAYPAL
            lump = file.FindLump("PLAYPAL");
            if (lump != null)
            {
                // Read the PLAYPAL from stream
                return(new Playpal(lump.Stream));
            }
            else
            {
                // No palette
                return(null);
            }
        }