Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
                }
            }
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 public void RenderMenu(Doom doom)
 {
     if (doom.Menu.Active)
     {
         menu.Render(doom.Menu);
     }
 }
Beispiel #5
0
        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();
        }
Beispiel #6
0
        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);
            }
        }
Beispiel #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();
        }
    }
    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);
    }
Beispiel #9
0
    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);
    }
Beispiel #10
0
        //constructor
        private Death()
        {
            die = Doom.alive;

        }
Beispiel #11
0
 public void Render(Doom doom)
 {
 }
Beispiel #12
0
 public void ReloadScene()
 {
     Doom.LoadScene(UnityEngine.SceneManagement.SceneManager.GetActiveScene());
 }