AGS.Editor.AGSEditor.RunPreCompilationChecks C# (CSharp) Method

RunPreCompilationChecks() private method

private RunPreCompilationChecks ( CompileMessages errors ) : void
errors CompileMessages
return void
        private void RunPreCompilationChecks(CompileMessages errors)
        {
            if ((_game.LipSync.Type == LipSyncType.PamelaVoiceFiles) &&
                (_game.Settings.SpeechStyle == SpeechStyle.Lucasarts))
            {
                errors.Add(new CompileError("Voice lip-sync cannot be used with Lucasarts-style speech"));
            }

            if ((_game.Settings.EnhancedSaveGames) &&
                (_game.Settings.SaveGameFileExtension == string.Empty))
            {
                errors.Add(new CompileError("Enhanced Save Games are enabled but no file extension is specified"));
            }

            if (_game.PlayerCharacter == null)
            {
                errors.Add(new CompileError("No character has been set as the player character"));
            }
            else if (_game.FindRoomByID(_game.PlayerCharacter.StartingRoom) == null)
            {
                errors.Add(new CompileError("The game is set to start in room " + _game.PlayerCharacter.StartingRoom + " which does not exist"));
            }

            if ((_game.Settings.GraphicsDriver == GraphicsDriver.D3D9) &&
                (_game.Settings.ColorDepth == GameColorDepth.Palette))
            {
                errors.Add(new CompileError("Direct3D graphics driver does not support 256-colour games"));
            }

            if ((_game.Settings.ColorDepth == GameColorDepth.Palette) &&
                (_game.Settings.RoomTransition == RoomTransitionStyle.CrossFade))
            {
                errors.Add(new CompileError("You cannot use the CrossFade room transition with 256-colour games"));
            }

            if ((_game.Settings.DialogOptionsGUI < 0) ||
                (_game.Settings.DialogOptionsGUI >= _game.RootGUIFolder.GetAllItemsCount()))
            {
                if (_game.Settings.DialogOptionsGUI != 0)
                {
                    errors.Add(new CompileError("Invalid GUI number set for Dialog Options GUI"));
                }
            }

            foreach (Character character in _game.RootCharacterFolder.AllItemsFlat)
            {
                AGS.Types.View view = _game.FindViewByID(character.NormalView);
                if (view == null)
                {
                    errors.Add(new CompileError("Character " + character.ID + " (" + character.RealName + ") has invalid normal view."));
                }
                else
                {
                    EnsureViewHasAtLeast4LoopsAndAFrameInLeftRightLoops(view);
                }
            }

            foreach (GUI gui in _game.RootGUIFolder.AllItemsFlat)
            {
                NormalGUI normalGui = gui as NormalGUI;
                if (normalGui != null)
                {
                    if ((normalGui.Width > _game.MinRoomWidth) ||
                        (normalGui.Height > _game.MinRoomHeight))
                    {
                        errors.Add(new CompileWarning("GUI " + gui.Name + " is larger than the screen size and may cause errors in the game."));
                    }
                }
            }

            Dictionary<string, AGS.Types.View> viewNames = new Dictionary<string, AGS.Types.View>();
            EnsureViewNamesAreUnique(_game.RootViewFolder, viewNames, errors);

            foreach (AudioClip clip in _game.RootAudioClipFolder.GetAllAudioClipsFromAllSubFolders())
            {
                if (!File.Exists(clip.CacheFileName))
                {
                    errors.Add(new CompileError("Audio file missing for " + clip.ScriptName + ": " + clip.CacheFileName));
                }
            }

            if (!IsEnoughSpaceFreeOnDisk(MINIMUM_BYTES_FREE_TO_COMPILE))
            {
                errors.Add(new CompileError("There is not enough space on the disk."));
            }
        }