Permalink
Browse files

Fixed up 0 density grassland and added more types to the world view.

Added River, Ocean and Shallows.  Looks like Material has the high nibble as a bitfield of some kind.
  • Loading branch information...
haeal committed Jan 17, 2014
1 parent 1dfde42 commit db965a60a2674b258535f24e081fe6bf8d1b6b64
@@ -54,10 +54,7 @@ private Bitmap DrawBitmap(int width, int height)
switch (_world.MaterialType)
{
case WorldView.Material.Grassland:
- if (_world.Density > 0)
- g.FillRectangle(Brushes.Green, x * tileSize, y * tileSize, tileSize - 1, tileSize - 1);
- else
- g.FillRectangle(Brushes.Blue, x * tileSize, y * tileSize, tileSize - 1, tileSize - 1);
+ g.FillRectangle(Brushes.Green, x * tileSize, y * tileSize, tileSize - 1, tileSize - 1);
break;
case WorldView.Material.Rock:
g.FillRectangle(Brushes.Gray, x * tileSize, y * tileSize, tileSize - 1, tileSize - 1);
@@ -81,11 +78,23 @@ private Bitmap DrawBitmap(int width, int height)
g.FillRectangle(Brushes.LightYellow, x * tileSize, y * tileSize, tileSize - 1, tileSize - 1);
g.DrawLine(Pens.Black, x * tileSize, y * tileSize, x * tileSize + tileSize - 1, y * tileSize + tileSize - 1);
break;
+ case WorldView.Material.Ocean:
+ g.FillRectangle(Brushes.Blue, x * tileSize, y * tileSize, tileSize - 1, tileSize - 1);
+ break;
+ case WorldView.Material.River:
+ g.FillRectangle(Brushes.LightBlue, x * tileSize, y * tileSize, tileSize - 1, tileSize - 1);
+ break;
+ case WorldView.Material.Shallows:
+ g.FillRectangle(Brushes.LightGreen, x * tileSize, y * tileSize, tileSize - 1, tileSize - 1);
+ break;
}
//Draw any people that may exist on that tile.
if (_world.OccupyingHero != 0)
+ {
g.FillRectangle(Brushes.White, x * tileSize + tileSize / 4, y * tileSize + tileSize / 4, tileSize / 2, tileSize / 2);
+ g.DrawRectangle(Pens.Black, x * tileSize + tileSize / 4, y * tileSize + tileSize / 4, tileSize / 2, tileSize / 2);
+ }
}
}
}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -124,5 +124,14 @@
<value>132, 17</value>
</metadata>
<data name="isRegion.Collection" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>
+ AAEAAAD/////AQAAAAAAAAAMAgAAAJEBQmFsb3JFZGl0b3IsIFZlcnNpb249MS4wLjAuMCwgQ3VsdHVy
+ ZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsXV0sIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAs
+ IEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OQwDAAAAQkJhbG9y
+ RWRpdG9yLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVs
+ bAUBAAAAN1N5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljLkxpc3RgMVtbQmFsb3JFZGl0b3IuRGF0YUl0
+ ZW0DAAAABl9pdGVtcwVfc2l6ZQhfdmVyc2lvbgQAABZCYWxvckVkaXRvci5EYXRhSXRlbVtdAwAAAAgI
+ AgAAAAkEAAAAAAAAAAAAAAAHBAAAAAABAAAAAAAAAAQUQmFsb3JFZGl0b3IuRGF0YUl0ZW0DAAAACw==
+</value>
</data>
</root>
@@ -99,12 +99,20 @@ public enum Material
Farmland=4,
Burg,
Citadel,
- Tent
+ Tent = 7,
+ River = 9,
+ Ocean = 10,
+ Shallows = 11,
}
//public int Height { get { return _worldViewData[Offset(Field.Height)]; } set { _worldViewData[Offset(Field.Height)] = (byte)value; } }
public int Density { get { return _worldViewData[Offset(Field.Density)]; } set { _worldViewData[Offset(Field.Density)] = (byte)value; } }
- public Material MaterialType { get { return (Material)_worldViewData[Offset(Field.MaterialType)]; } set { _worldViewData[Offset(Field.MaterialType)] = (byte)value; } }
+ /// <summary>
+ /// Looks like a partial mask.
+ /// 0x10, and 0x20 look like height?
+ /// 0x0F appare to be actual terrain.
+ /// </summary>
+ public Material MaterialType { get { return (Material)(_worldViewData[Offset(Field.MaterialType)] & 0x0F); } set { _worldViewData[Offset(Field.MaterialType)] = (byte)value; } }
public int OccupyingHero { get { return _worldViewData[Offset(Field.OccupyingHero)]; } set { _worldViewData[Offset(Field.OccupyingHero)] = (byte)value; } }
public IEnumerable<string> GetRegions()

0 comments on commit db965a6

Please sign in to comment.