Esempio n. 1
0
		public ConnectionPoint(Point _begin, Point _end, Room _room, EDirections _dir)
		{
			Begin = _begin;
			End = _end;
			Room = _room;
			Dir = _dir;
		}
Esempio n. 2
0
        public override void DrawContent()
        {
            var size = new Point(Constants.WORLD_MAP_SIZE, Constants.WORLD_MAP_SIZE);

            var halfSize = size / 2;

            var rsz             = Math.Min((float)ContentRct.Width * Constants.TILE_SIZE / size.X, (float)ContentRct.Height * Constants.TILE_SIZE / size.Y);
            var rectSize        = new PointF(rsz, rsz);
            var halfContentRect = new Point(ContentRct.Left * Constants.TILE_SIZE + ContentRct.Width * Constants.TILE_SIZE / 2,
                                            ContentRct.Top * Constants.TILE_SIZE + ContentRct.Height * Constants.TILE_SIZE / 2);

            for (var i = 0; i < size.X; ++i)
            {
                for (var j = 0; j < size.Y; ++j)
                {
                    var pnt  = new Point(i, j) - halfSize;
                    var type = World.TheWorld.CurrentLayer.GetBlockType(pnt);

                    //if(World.TheWorld.CurrentLayer[pnt].SeenCells.All(_u => _u==0)) continue;

                    var color = GetColor(type);

                    if (World.TheWorld.Avatar[0, 0].MapBlockId == pnt)
                    {
                        color = FColor.Crimson;
                    }

                    DrawHelper.DrawRect(new RectangleF(halfContentRect.X + pnt.X * rectSize.X, halfContentRect.Y + pnt.Y * rectSize.Y, rectSize.X, rectSize.Y), color);
                }
            }
            DrawLine("[z|Esc] - " + EALConst.EXIT.GetString(), ForeColor, TextLinesMax - 2, 21, EAlignment.RIGHT);
        }
Esempio n. 3
0
		public void LightCells(LiveMap _liveMap, Point _point)
		{
			if (!m_lightManagers.ContainsKey(Radius))
			{
				m_lightManagers.Add(Radius, new LosManager(Radius));
			}
			m_lightManagers[Radius].LightCells(_liveMap, _point, Color);
		}
Esempio n. 4
0
        private void ПодготовкаКарты(LiveMap _liveMap, Point _avatarXY)
        {
#if DEBUG
            using (new Profiler())
#endif
            {
                var liveBlocks = _liveMap.GetLightedLiveBlocks();
                var point      = new Point(1, 1);

                for (var i = 0; i < 9; i++)
                {
                    var dlt        = (liveBlocks[i, 0] + point) * Constants.MAP_BLOCK_SIZE;
                    var livBlockXY = liveBlocks[i, 1];
                    for (var index = 0; index < m_allBlockPoints.Length; index++)
                    {
                        var blockPoint  = m_allBlockPoints[index];
                        var liveCellXY  = livBlockXY * Constants.MAP_BLOCK_SIZE + blockPoint;
                        var liveMapCell = _liveMap.Cells[liveCellXY.X, liveCellXY.Y];

                        m_shadowCasters[dlt.X + blockPoint.X, dlt.Y + blockPoint.Y].LiveMapCell = liveMapCell;
                        m_shadowCasters[dlt.X + blockPoint.X, dlt.Y + blockPoint.Y].Opacity     = liveMapCell.CalcOpacity();

                        #region источники света от существ

                        var creature = liveMapCell.Creature;
                        if (creature == null || creature.Light == null || _avatarXY.GetDistTill(liveCellXY) > (MAX_VISIBLE_RADIUS * 2))
                        {
                            continue;
                        }

                        var tempPoint = dlt + blockPoint;
                        m_lights[m_lightsCount].Point         = new PointF(tempPoint.X, tempPoint.Y);
                        m_lights[m_lightsCount].LiveMapCell   = liveMapCell;
                        m_lights[m_lightsCount++].LightSource = creature.Light;

                        #endregion
                    }

                    #region остальные источники света

                    foreach (var info in _liveMap.Blocks[livBlockXY.X, livBlockXY.Y].MapBlock.LightSources)
                    {
                        var tempPoint = dlt + info.Point;
                        if (_avatarXY.GetDistTill(tempPoint) > (MAX_VISIBLE_RADIUS * 2))
                        {
                            continue;
                        }
                        m_lights[m_lightsCount].Point         = new PointF(tempPoint.X, tempPoint.Y);
                        m_lights[m_lightsCount++].LightSource = info.Source;
                    }

                    #endregion
                }
            }
        }
Esempio n. 5
0
		public void UpdateTexCoords(int _x, int _y, float _imgWidth, float _imgHeight)
		{
			Point = new Point(_x, _y);
			float u1 = 0.0f, u2 = 0.0f, v1 = 0.0f, v2 = 0.0f;

			if (_x != 0) u1 = 1.0f/(_imgWidth/_x/Constants.TILE_SIZE);
			if (Constants.TILE_SIZE != 0) u2 = 1.0f/(_imgWidth/Constants.TILE_SIZE);
			if (_y != 0) v1 = 1.0f/(_imgHeight/_y/Constants.TILE_SIZE);
			if (Constants.TILE_SIZE != 0) v2 = 1.0f/(_imgHeight/Constants.TILE_SIZE);

			Texcoords[0].U = u1;
			Texcoords[0].V = v1;
			Texcoords[1].U = u1 + u2;
			Texcoords[1].V = v1;
			Texcoords[2].U = u1 + u2;
			Texcoords[2].V = v1 + v2;
			Texcoords[3].U = u1;
			Texcoords[3].V = v1 + v2;
		}
Esempio n. 6
0
        public void Clear(Rct _rct, FColor _backgroundColor)
        {
            GL.BindTexture(TextureTarget.Texture2D, 0);

            GL.Begin(BeginMode.Quads);
            var xy  = new Point(_rct.Left, _rct.Top) * Constants.TILE_SIZE;
            var xy1 = new Point(_rct.Right + 1, _rct.Bottom + 1) * Constants.TILE_SIZE;

            GL.Color4(_backgroundColor.R, _backgroundColor.G, _backgroundColor.B, _backgroundColor.A);
            GL.Vertex2(xy.X, xy.Y);
            GL.Vertex2(xy1.X, xy.Y);
            GL.Vertex2(xy1.X, xy1.Y);
            GL.Vertex2(xy.X, xy1.Y);
            GL.End();

            for (var i = _rct.Left; i <= _rct.Right; i++)
            {
                for (var j = _rct.Top; j <= _rct.Bottom; j++)
                {
                    m_tiles[i, j].Clear();
                }
            }
        }
Esempio n. 7
0
		protected ATile(int _x, int _y, FColor _color)
		{
			Color = _color;
			Point = new Point(_x, _y);
			SrcPoint = new Point(_x, _y);
		}
Esempio n. 8
0
		public abstract void FogIt(Point _point);
Esempio n. 9
0
		public abstract void Draw(Point _point);
Esempio n. 10
0
		public void FogTile(Point _point)
		{
			m_tiles[_point.X, _point.Y].IsFogged = true;
		}
Esempio n. 11
0
        private void Отрисовка(Point _center)
        {
#if DEBUG
            using (new Profiler())
#endif
            {
                using (new Profiler("DrawShadows(each)"))
                    for (var i = 0; i < m_lightsCount; i++)
                    {
                        using (new FboWrapper.DrawHelper(m_fbo))
                        {
                            DrawShadows(m_lights[i], new PointF(_center.X, _center.Y));
                            m_fbo.BlitTo(m_fboBlit, i);
                        }
                    }
                m_fbo.BlitTo(m_fboBlit, m_lightsCount + 1);

                if (false)
                {
                    for (var a = 0; a < m_lightsCount + 1; ++a)
                    {
                        using (new FboWrapper.DrawHelper(m_fboBlit))
                        {
                            GL.ReadBuffer(ReadBufferMode.ColorAttachment0 + a);
                            FboWrapper.DrawHelper.Screenshot("e:\\1\\a" + a + ".png");
                        }
                    }
                }

                using (new FboWrapper.DrawHelper(m_fbo))
                {
                    var ambient = World.TheWorld.Avatar.GeoInfo.Layer.Ambient;
                    GL.ClearColor(ambient.R, ambient.G, ambient.B, 1f);
                    GL.Clear(ClearBufferMask.ColorBufferBit);
                    GL.Color3(1f, 1f, 1f);
                    GL.Enable(EnableCap.Texture2D);

                    GL.Enable(EnableCap.Blend);
                    GL.BlendFunc(BlendingFactorSrc.One, BlendingFactorDest.OneMinusSrcColor);

                    const float sz = MAP_SIZE;
                    const float to = ((float)MAP_SIZE) / FboWrapper.SIZE;

                    using (new Profiler("DrawShadows.lightShader(each)"))
                        using (var sh = new ShaderWrapper.DrawHelper(m_lightShader))
                        {
                            for (var a = 1; a < m_lightsCount; ++a)
                            {
                                sh.BindTexture(m_fboBlit[a], TextureUnit.Texture0, "_light");
                                sh.BindVec2(m_lights[a].Point, "_position");
                                GL.Begin(BeginMode.Quads);
                                {
                                    GL.TexCoord2(0f, 0f);
                                    GL.Vertex2(0f, 0f);

                                    GL.TexCoord2(to, 0f);
                                    GL.Vertex2(sz, 0f);

                                    GL.TexCoord2(to, to);
                                    GL.Vertex2(sz, sz);

                                    GL.TexCoord2(0f, to);
                                    GL.Vertex2(0f, sz);
                                }
                                GL.End();
                            }
                        }

                    using (new Profiler("DrawShadows.sightShader"))
                        using (var sh = new ShaderWrapper.DrawHelper(m_sightShader))
                        {
                            sh.BindTexture(m_fboBlit[0], TextureUnit.Texture0, "_sight");
                            sh.BindVec2(m_lights[0].Point, "_position");
                            GL.BlendFunc(BlendingFactorSrc.DstColor, BlendingFactorDest.OneMinusSrcAlpha);
                            GL.Begin(BeginMode.Quads);
                            {
                                GL.TexCoord2(0f, 0f);
                                GL.Vertex2(0f, 0f);

                                GL.TexCoord2(to, 0f);
                                GL.Vertex2(sz, 0f);

                                GL.TexCoord2(to, to);
                                GL.Vertex2(sz, sz);

                                GL.TexCoord2(0f, to);
                                GL.Vertex2(0f, sz);
                            }
                            GL.End();
                        }

                    m_fbo.BlitTo(m_fboBlit, 1);
                }
            }
        }
Esempio n. 12
0
		public override void Draw(Point _point)
		{
			GameProvider.TileMapRenderer.DrawTile(this, _point.X, _point.Y, Color, EDirections.DOWN, false);
		}
Esempio n. 13
0
		public override void Draw(Point _point, FColor _color, EDirections _direction, bool _isCorpse)
		{
			GameProvider.TileMapRenderer.DrawTile(this, _point.X, _point.Y, _color, _direction, _isCorpse);
		}
Esempio n. 14
0
 public void FogTile(Point _point)
 {
     m_tiles[_point.X, _point.Y].IsFogged = true;
 }
Esempio n. 15
0
		public override void DrawContent()
		{
			var size = new Point(Constants.WORLD_MAP_SIZE, Constants.WORLD_MAP_SIZE);

			var halfSize = size/2;

			var rsz = Math.Min((float)ContentRct.Width * Constants.TILE_SIZE / size.X, (float)ContentRct.Height * Constants.TILE_SIZE / size.Y);
			var rectSize = new PointF(rsz, rsz);
			var halfContentRect = new Point(ContentRct.Left*Constants.TILE_SIZE + ContentRct.Width*Constants.TILE_SIZE/2,
			                                ContentRct.Top*Constants.TILE_SIZE + ContentRct.Height*Constants.TILE_SIZE/2);

			for (var i = 0; i < size.X; ++i)
			{
				for (var j = 0; j < size.Y; ++j)
				{
					var pnt = new Point(i, j) - halfSize;
					var type = World.TheWorld.CurrentLayer.GetBlockType(pnt);
                    
                    //if(World.TheWorld.CurrentLayer[pnt].SeenCells.All(_u => _u==0)) continue;
					
                    var color = GetColor(type);

					if (World.TheWorld.Avatar[0, 0].MapBlockId == pnt)
					{
						color = FColor.Crimson;
					}

					DrawHelper.DrawRect(new RectangleF(halfContentRect.X + pnt.X * rectSize.X, halfContentRect.Y + pnt.Y * rectSize.Y, rectSize.X, rectSize.Y), color);
				}
			}
			DrawLine("[z|Esc] - " + EALConst.EXIT.GetString(), ForeColor, TextLinesMax - 2, 21, EAlignment.RIGHT);
		}
Esempio n. 16
0
		public void LightCells(LiveMap _liveMap, Point _point) { m_lightSource.LightCells(_liveMap, _point); }
Esempio n. 17
0
		public override void FogIt(Point _point)
		{
			GameProvider.TileMapRenderer.FogTile(_point);
		}
Esempio n. 18
0
		public abstract void Draw(Point _point, FColor _color, EDirections _direction, bool _isCorpse);
Esempio n. 19
0
		public void FogTile(Point _point)
		{
			m_gameProvider.TileMapRenderer.FogTile(_point);
		}
Esempio n. 20
0
		public abstract void Draw(Point _point, FColor _color);
Esempio n. 21
0
		public void Clear(Rct _rct, FColor _backgroundColor)
		{
			GL.BindTexture(TextureTarget.Texture2D, 0);

			GL.Begin(BeginMode.Quads);
			var xy = new Point(_rct.Left, _rct.Top) * Constants.TILE_SIZE;
			var xy1 = new Point(_rct.Right + 1, _rct.Bottom + 1) * Constants.TILE_SIZE;
			GL.Color4(_backgroundColor.R, _backgroundColor.G, _backgroundColor.B, _backgroundColor.A);
			GL.Vertex2(xy.X, xy.Y);
			GL.Vertex2(xy1.X, xy.Y);
			GL.Vertex2(xy1.X, xy1.Y);
			GL.Vertex2(xy.X, xy1.Y);
			GL.End();

			for (var i = _rct.Left; i <= _rct.Right; i++)
			{
				for (var j = _rct.Top; j <= _rct.Bottom; j++)
				{
					m_tiles[i, j].Clear();
				}
			}
		}
Esempio n. 22
0
 public void FogTile(Point _point)
 {
     m_gameProvider.TileMapRenderer.FogTile(_point);
 }