private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
        {
            StringBuilder sb   = new StringBuilder();
            int           rIdx = e.Location.X + e.Location.Y * _drawingSurface.Width;

            sb.AppendFormat("Mouse: ({0},{1})", e.Location.X, e.Location.Y);
            var tile = _tiles.GetTileScreen(e.Location);

            if (tile == null)
            {
                sb.Append("No valid tile under mouse");
            }
            else
            {
                var tileFile = (tile.Drawable as TileDrawable).GetTileFile(tile);
                sb.AppendFormat("   Tile {4}: d({0},{1}) r({2},{3})", tile.Dx, tile.Dy, tile.Rx, tile.Ry, tileFile.FileName.ToUpper());
                if (tileFile.Images[tile.SubTile].RampType != 0)
                {
                    sb.AppendFormat(" ramp {0}", tileFile.Images[tile.SubTile].RampType);
                }
                if (tileFile.Images[tile.SubTile].TerrainType != 0)
                {
                    sb.AppendFormat(" terrain {0}", tileFile.Images[tile.SubTile].TerrainType);
                }

                var gridTilenoZ = _tiles.GetTileScreen(e.Location, true, true);
                sb.AppendFormat("   Touched: {0}", _tiles.GridTouched[gridTilenoZ.Dx, gridTilenoZ.Dy / 2]);

                if (_tiles.GridTouchedBy[gridTilenoZ.Dx, gridTilenoZ.Dy / 2] != null)
                {
                    sb.AppendFormat(" by {0} ", _tiles.GridTouchedBy[gridTilenoZ.Dx, gridTilenoZ.Dy / 2]);
                }

                sb.AppendFormat("   Z-buf: {0}", _drawingSurface.GetZBuffer()[rIdx]);
                sb.AppendFormat("   S-buf: {0}", _drawingSurface.GetShadows()[rIdx]);

                var objs = _map.GetObjectsAt(tile.Dx, tile.Dy / 2);
                if (objs.Any())
                {
                    sb.Append("   Objects: ");
                    foreach (var obj in objs)
                    {
                        sb.Append(obj);

                        if (obj is OverlayObject)
                        {
                            var ovl = (obj as OverlayObject);
                            if (ovl.IsGeneratedVeins)
                            {
                                sb.Append("(gen)");
                            }
                        }

                        sb.Append(" ");
                    }
                }
            }

            toolStripStatusLabel1.Text = sb.ToString();
        }
Esempio n. 2
0
        internal void ExamineNeighbourhood(GameObject obj)
        {
            // Debug.WriteLine("Examining neighhourhood of " + obj);
            // Debug.Assert(!_hist.Contains(obj), "examining neighbourhood for an object that's already in the draw list");
            var objBB  = obj.GetBounds();
            var tileTL = _map.GetTileScreen(objBB.Location, true, false);
            var tileBR = _map.GetTileScreen(objBB.Location + objBB.Size);

            for (int y = tileTL.Dy - 3; y <= tileBR.Dy + 3; y++)
            {
                for (int x = tileTL.Dx - 3; x <= tileBR.Dx + 3; x += 2)
                {
                    if ((x + (y + obj.TopTile.Dy)) < 0 || y < 0)
                    {
                        continue;
                    }
                    var tile2 = _map[x + (y + obj.TopTile.Dy) % 2, y / 2];
                    if (tile2 == null)
                    {
                        continue;
                    }

                    // Debug.WriteLine("neighhourhood tile " + tile2 + " of obj " + obj + " at " + obj.Tile);
                    ExamineObjects(obj, tile2);
                    foreach (var obj2 in tile2.AllObjects)
                    {
                        ExamineObjects(obj, obj2);
                    }
                }
            }
        }