コード例 #1
0
ファイル: Renderer.cs プロジェクト: sinshu/managed-doom
        private void RenderWipe(Doom doom, byte[] destination)
        {
            RenderDoom(doom);

            var wipe  = doom.WipeEffect;
            var scale = screen.Width / 320;

            for (var i = 0; i < wipeBandCount - 1; i++)
            {
                var x1 = wipeBandWidth * i;
                var x2 = x1 + wipeBandWidth;
                var y1 = Math.Max(scale * wipe.Y[i], 0);
                var y2 = Math.Max(scale * wipe.Y[i + 1], 0);
                var dy = (float)(y2 - y1) / wipeBandWidth;
                for (var x = x1; x < x2; x++)
                {
                    var y          = (int)MathF.Round(y1 + dy * ((x - x1) / 2 * 2));
                    var copyLength = screen.Height - y;
                    if (copyLength > 0)
                    {
                        var srcPos = screen.Height * x;
                        var dstPos = screen.Height * x + y;
                        Array.Copy(wipeBuffer, srcPos, screen.Data, dstPos, copyLength);
                    }
                }
            }

            RenderMenu(doom);

            WriteData(palette[0], destination);
        }
コード例 #2
0
ファイル: Renderer.cs プロジェクト: sinshu/managed-doom
        public void RenderDoom(Doom doom)
        {
            if (doom.State == DoomState.Opening)
            {
                openingSequence.Render(doom.Opening);
            }
            else if (doom.State == DoomState.DemoPlayback)
            {
                RenderGame(doom.DemoPlayback.Game);
            }
            else if (doom.State == DoomState.Game)
            {
                RenderGame(doom.Game);
            }

            if (!doom.Menu.Active)
            {
                if (doom.State == DoomState.Game &&
                    doom.Game.State == GameState.Level &&
                    doom.Game.Paused)
                {
                    var scale = screen.Width / 320;
                    screen.DrawPatch(
                        pause,
                        (screen.Width - scale * pause.Width) / 2,
                        4 * scale,
                        scale);
                }
            }
        }
コード例 #3
0
ファイル: Renderer.cs プロジェクト: sinshu/managed-doom
        public void Render(Doom doom, byte[] destination)
        {
            if (doom.Wiping)
            {
                RenderWipe(doom, destination);
                return;
            }

            RenderDoom(doom);
            RenderMenu(doom);

            var colors = palette[0];

            if (doom.State == DoomState.Game &&
                doom.Game.State == GameState.Level)
            {
                colors = palette[GetPaletteNumber(doom.Game.World.ConsolePlayer)];
            }
            else if (doom.State == DoomState.Opening &&
                     doom.Opening.State == OpeningSequenceState.Demo &&
                     doom.Opening.DemoGame.State == GameState.Level)
            {
                colors = palette[GetPaletteNumber(doom.Opening.DemoGame.World.ConsolePlayer)];
            }
            else if (doom.State == DoomState.DemoPlayback &&
                     doom.DemoPlayback.Game.State == GameState.Level)
            {
                colors = palette[GetPaletteNumber(doom.DemoPlayback.Game.World.ConsolePlayer)];
            }

            WriteData(colors, destination);
        }
コード例 #4
0
ファイル: Renderer.cs プロジェクト: sinshu/managed-doom
 public void RenderMenu(Doom doom)
 {
     if (doom.Menu.Active)
     {
         menu.Render(doom.Menu);
     }
 }
コード例 #5
0
ファイル: SfmlVideo.cs プロジェクト: sinshu/managed-doom
        public void Render(Doom doom)
        {
            renderer.Render(doom, textureData);

            texture.Update(textureData, (uint)renderer.Height, (uint)renderer.Width, 0, 0);
            window.Draw(sprite, renderStates);
            window.Display();
        }
コード例 #6
0
ファイル: SfmlDoom.cs プロジェクト: sinshu/managed-doom
        public SfmlDoom(CommandLineArgs args)
        {
            config = SfmlConfigUtilities.GetConfig();

            try
            {
                config.video_screenwidth  = Math.Clamp(config.video_screenwidth, 320, 3200);
                config.video_screenheight = Math.Clamp(config.video_screenheight, 200, 2000);
                var videoMode = new VideoMode((uint)config.video_screenwidth, (uint)config.video_screenheight);
                var style     = Styles.Close | Styles.Titlebar;
                if (config.video_fullscreen)
                {
                    style = Styles.Fullscreen;
                }

                window = new RenderWindow(videoMode, ApplicationInfo.Title, style);
                window.Clear(new Color(64, 64, 64));
                window.Display();

                content = new GameContent(ConfigUtilities.GetWadPaths(args));

                video = new SfmlVideo(config, content, window);

                if (!args.nosound.Present && !args.nosfx.Present)
                {
                    sound = new SfmlSound(config, content.Wad);
                }

                if (!args.nosound.Present && !args.nomusic.Present)
                {
                    music = SfmlConfigUtilities.GetMusicInstance(config, content.Wad);
                }

                userInput = new SfmlUserInput(config, window, !args.nomouse.Present);

                window.Closed      += (sender, e) => window.Close();
                window.KeyPressed  += KeyPressed;
                window.KeyReleased += KeyReleased;

                if (!args.timedemo.Present)
                {
                    window.SetFramerateLimit(35);
                }

                doom = new Doom(args, config, content, video, sound, music, userInput);
            }
            catch (Exception e)
            {
                Dispose();
                ExceptionDispatchInfo.Throw(e);
            }
        }
コード例 #7
0
    static void Main(string[] args)
    {
        Doom doom = new Doom(120, 40);

        while (true)
        {
            doom.CheckInputs();
            doom.RayCasting();
            doom.Draw(doom.map, 0, 0);
            doom.Draw('P', (int)doom.playerX, (int)doom.playerY);
            doom.Draw((int)(1 / doom.DeltaTime), 16, 0);//you can think this as if they were the FPS lol
            doom.DrawScreen();
        }
    }
コード例 #8
0
    public void Revive(bool restartMap)
    {
        if (restartMap)
        {
            weaponManager.ResetMissionWeapons();
            Doom.UnloadCurrentMap();
            WadLoader.Instance.LoadMap();
        }

        if (health > 0)
        {
            Debug.LogWarning("Trying to revive when Health > 0");
            return;
        }
        health = 100;
        Camera.main.transform.localPosition = cameraStartPos;
        UpdateGUIStats();
        faceManager.UpdateFace(health);
    }
コード例 #9
0
ファイル: WadLoader.cs プロジェクト: swordlegend/Unity-Doom
    public bool LoadMap(int episode, int mission)
    {
        if (MapLoader.vertices != null && MapLoader.vertices.Count > 0)
        {
            Doom.UnloadCurrentMap();
        }

        Shader.SetGlobalColor("_AMBIENTLIGHT", ambientLightColor);

        autoLoadEpisode = episode;
        currentMission  = mission;

        string map = "E" + autoLoadEpisode.ToString() + "M" + currentMission.ToString();

        if (string.IsNullOrEmpty(autoloadWad))
        {
            return(false);
        }

        if (MapLoader.Instance.Load(map))
        {
            Mesher.Instance.CreateMeshes();

            MapLoader.Instance.ApplyLinedefBehavior();

            ThingManager.Instance.CreateThings(deathmatch);

            if (PlayerStart.PlayerStarts[0] == null)
            {
                Debug.LogError("PlayerStart1 == null");
            }
            else
            {
                PlayerObject.transform.position = PlayerStart.PlayerStarts[0].transform.position;
                PlayerObject.transform.rotation = PlayerStart.PlayerStarts[0].transform.rotation;
            }

            Doom.isLoaded = true;
            //PlayerObject.GetComponent<AudioSource>().clip = SoundLoader.LoadSound("DSPISTOL");
            //PlayerObject.GetComponent<AudioSource>().Play();
        }
        return(Doom.isLoaded);
    }
コード例 #10
0
ファイル: Death.cs プロジェクト: thewildvegetable/Portfolio
        //constructor
        private Death()
        {
            die = Doom.alive;

        }
コード例 #11
0
ファイル: NullVideo.cs プロジェクト: sinshu/managed-doom
 public void Render(Doom doom)
 {
 }
コード例 #12
0
ファイル: WadLoader.cs プロジェクト: swordlegend/Unity-Doom
 public void ReloadScene()
 {
     Doom.LoadScene(UnityEngine.SceneManagement.SceneManager.GetActiveScene());
 }