[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

森の下草


森林プラグインに、下草画像を表示できるよう拡張したいと思います。
こんな具合にコードを修正したいのですが・・・

cvs diff ForestVoxel.cs ForestBuilder.cs AssemblyInfo.cs (ディレクトリ C:\Project\FreeTrain\FreeTrain\plugins\org.kohsuke.freetrain.land.forest\src\ 内)
Index: ForestVoxel.cs
===================================================================
RCS file: /cvsroot/freetrain/FreeTrain/plugins/org.kohsuke.freetrain.land.forest/src/ForestVoxel.cs,v
retrieving revision 1.2
diff -u -r1.2 ForestVoxel.cs
--- ForestVoxel.cs	2 Feb 2003 15:44:10 -0000	1.2
+++ ForestVoxel.cs	24 Jun 2003 13:25:48 -0000
@@ -33,6 +33,8 @@
 
 
 		public override void draw( DrawContext surface, Point pt, int heightCutDiff ) {
+			if( contrib.ground != null )
+				contrib.ground.draw( surface.surface, pt );
 			for( int i=0; i<patterns.Length; i+=3 )
 				contrib.sprites[ patterns[i+2] ].draw( surface.surface,
 					new Point( pt.X+patterns[i+0], pt.Y+patterns[i+1] ) );
Index: ForestBuilder.cs
===================================================================
RCS file: /cvsroot/freetrain/FreeTrain/plugins/org.kohsuke.freetrain.land.forest/src/ForestBuilder.cs,v
retrieving revision 1.4
diff -u -r1.4 ForestBuilder.cs
--- ForestBuilder.cs	27 Mar 2003 01:57:41 -0000	1.4
+++ ForestBuilder.cs	24 Jun 2003 13:25:49 -0000
@@ -36,11 +36,24 @@
 			sprites = new Sprite[count];
 			for( int i=0; i<count; i++ )
 				sprites[i] = spriteFactory.createSprite( picture, offset, new Point(i*size.Width,0), size );
+
+			// create ground
+			XmlNode node = e.SelectSingleNode("ground");
+			if( node != null ) 
+			{
+				XmlElement pic = (XmlElement)XmlUtil.selectSingleNode(node,"picture");
+				Point origin = XmlUtil.parsePoint( pic.Attributes["origin"].Value );
+				picture = getPicture((XmlElement)node);
+				spriteFactory =SpriteFactory.getSpriteFactory(node);
+				ground = spriteFactory.createSprite( picture, new Point(0,0), origin, new Size(32,16) );
+			}
 		}
 
 		/// <summary> Sprite of trees. </summary>
 		public readonly Sprite[] sprites;
 
+		public readonly Sprite ground;
+
 		/// <summary>
 		/// Average density of trees in one voxel.
 		/// </summary>
@@ -163,6 +176,8 @@
 			if( anchor!=UNPLACED && loc.inBetween(anchor,currentLoc) ) {
 				byte[] tree = contrib.createRandomTrees();
 				
+				if( contrib.ground != null )
+					contrib.ground.draw( canvas.surface, pt );
 				for( int i=0; i<tree.Length; i+=3 )
 					contrib.sprites[ tree[i+2] ].draw( canvas.surface,
 						new Point( pt.X+tree[i+0], pt.Y+tree[i+1] ) );


_______________________________________________
FreeTrain-general mailing list
FreeTrain-general@lists.sourceforge.jp
http://lists.sourceforge.jp/mailman/listinfo/freetrain-general

題名

名前

メッセージ