X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fcarfire;a=blobdiff_plain;f=CarFire%2FCarFire%2FCarFire%2FMap.cs;h=8c744bad3e8a96962288d966ea47c991911d099a;hp=f3d59d4a705a6e2e341a0177cf4e87f23fb46f7f;hb=af9deb873b24dadd0d509ce199fc6cac2b3efbc9;hpb=a67a04fbbf048dc08edd2ed726aa8c6da4c26a6b
diff --git a/CarFire/CarFire/CarFire/Map.cs b/CarFire/CarFire/CarFire/Map.cs
index f3d59d4..8c744ba 100644
--- a/CarFire/CarFire/CarFire/Map.cs
+++ b/CarFire/CarFire/CarFire/Map.cs
@@ -48,7 +48,7 @@ namespace CarFire
#region Public Constants
- public const float PixelsToUnitSquares = 60.0f;
+ public const float PixelsToUnitSquares = 64.0f;
#endregion
@@ -92,7 +92,7 @@ namespace CarFire
#endregion
- #region Public Attributes
+ #region Public Properties
///
/// Get the name of the map.
@@ -128,14 +128,27 @@ namespace CarFire
public string Tileset { get { return mData.Metadata.Tileset; } }
///
- /// Get a list of the raw entity containers loaded with the map.
+ /// Get the current grid of open cells. On the grid, true means
+ /// the cell is open (i.e. an entity can occupy that cell), and false
+ /// means the cell is closed. Note that, just like Map.IsCellOpen,
+ /// only static scenery is considered; the grid cannot tell you
+ /// whether or not an entity is already occupying the cell.
+ ///
+ public bool[,] Grid { get { return mData.Grid; } }
+
+ ///
+ /// Get a list of the raw entity containers loaded with the map. If you
+ /// want to get the actual entity objects, use Map.GetEntities and
+ /// Map.GetAllEntities instead.
///
public List RawEntities { get { return mData.Entities; } }
///
/// Get and set the coordinate of the grid cell that should be in
- /// the center of the screen when the map is drawn.
+ /// the center of the screen when the map is drawn. Setting this
+ /// will change the viewport of the map and will effect the return
+ /// values of Map.GetPointFromCoordinates and Map.GetRectangleFromCoordinates.
///
public Vector2 CenterCell
{
@@ -143,6 +156,26 @@ namespace CarFire
set { mView.CenterCell = value; }
}
+ ///
+ /// Get and set the zoom of the map view. The default zoom is
+ /// Map.PixelsToUnitSquares.
+ ///
+ public float Zoom
+ {
+ get { return mView.Zoom; }
+ set { mView.Zoom = value; }
+ }
+
+
+ ///
+ /// Get and set the associated game object.
+ ///
+ public Game Game
+ {
+ get { return mData.Game; }
+ set { mData.Game = value; }
+ }
+
#endregion
@@ -154,9 +187,10 @@ namespace CarFire
/// The metadata.
/// The grid.
/// The entities.
- public Map(Metadata metadata, char[,] grid, List entities, Point[] playerPositions)
+ public Map(Metadata metadata, char[,] grid, char defaultTile,
+ List entities, Point[] playerPositions)
{
- mData = new Modal(metadata, grid, entities, playerPositions);
+ mData = new Model(metadata, grid, defaultTile, entities, playerPositions);
mView = new View(mData);
}
@@ -254,7 +288,7 @@ namespace CarFire
/// thrown if there are entities without associated classes.
///
/// List of entity objects loaded.
- public List