about summary refs log tree commit diff
path: root/src/game/editor/ed_layer_tiles.cpp
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2008-01-13 22:03:32 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2008-01-13 22:03:32 +0000
commitc04df11f1ec1e3dd3e23fced9e1b127e5b05ab91 (patch)
tree5de978408407862833300fbdef37b200b2c51a9c /src/game/editor/ed_layer_tiles.cpp
parente26b898b74405f7133778c2fae2609c986f040fc (diff)
downloadzcatch-c04df11f1ec1e3dd3e23fced9e1b127e5b05ab91.tar.gz
zcatch-c04df11f1ec1e3dd3e23fced9e1b127e5b05ab91.zip
editor update
Diffstat (limited to 'src/game/editor/ed_layer_tiles.cpp')
-rw-r--r--src/game/editor/ed_layer_tiles.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/game/editor/ed_layer_tiles.cpp b/src/game/editor/ed_layer_tiles.cpp
index a514d011..434208fa 100644
--- a/src/game/editor/ed_layer_tiles.cpp
+++ b/src/game/editor/ed_layer_tiles.cpp
@@ -184,10 +184,26 @@ void LAYER_TILES::resize(int new_w, int new_h)
 }
 
 
-void LAYER_TILES::render_properties(RECT *toolbox)
+int LAYER_TILES::render_properties(RECT *toolbox)
 {
-	if(editor.props != PROPS_LAYER)
-		return;
+	RECT button;
+	ui_hsplit_b(toolbox, 12.0f, toolbox, &button);
+	bool in_gamegroup = editor.game_group->layers.find(this) != -1;
+	static int col_button = 0;
+	if(do_editor_button(&col_button, "Make Collision", in_gamegroup?0:-1, &button, draw_editor_button, 0, "Constructs collision from the this layer"))
+	{
+		LAYER_TILES *gl = editor.game_layer;
+		int w = min(gl->width, width);
+		int h = min(gl->height, height);
+		for(int y = 0; y < h; y++)
+			for(int x = 0; x < w; x++)
+			{
+				if(gl->tiles[y*gl->width+x].index <= TILE_SOLID)
+					gl->tiles[y*gl->width+x].index = tiles[y*width+x].index?TILE_SOLID:TILE_AIR;
+			}
+			
+		return 1;
+	}
 	
 	enum
 	{
@@ -214,4 +230,6 @@ void LAYER_TILES::render_properties(RECT *toolbox)
 		resize(new_val, height);
 	else if(prop == PROP_HEIGHT && new_val > 1)
 		resize(width, new_val);
+	
+	return 0;
 }