about summary refs log tree commit diff
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-02-18 10:49:54 +0100
committeroy <Tom_Adams@web.de>2011-02-18 10:49:54 +0100
commitae94c36f547a699b1657b0b2284fb14f04da0d41 (patch)
tree244c9f03991a680219ec5b4e6a6a2cc51a38a7be
parentb2f66978c981351727ded03bca5d87b1b990b2d6 (diff)
downloadzcatch-ae94c36f547a699b1657b0b2284fb14f04da0d41.tar.gz
zcatch-ae94c36f547a699b1657b0b2284fb14f04da0d41.zip
made game tile construction in the editor more usable
-rw-r--r--data/languages/bosnian.txt6
-rw-r--r--data/languages/czech.txt6
-rw-r--r--data/languages/dutch.txt6
-rw-r--r--data/languages/finnish.txt6
-rw-r--r--data/languages/french.txt6
-rw-r--r--data/languages/german.txt6
-rw-r--r--data/languages/italian.txt6
-rw-r--r--data/languages/polish.txt6
-rw-r--r--data/languages/portuguese.txt6
-rw-r--r--data/languages/romanian.txt6
-rw-r--r--data/languages/russian.txt6
-rw-r--r--data/languages/serbian.txt6
-rw-r--r--data/languages/spanish.txt6
-rw-r--r--data/languages/swedish.txt6
-rw-r--r--data/languages/ukrainian.txt6
-rw-r--r--src/game/editor/ed_layer_tiles.cpp4
-rw-r--r--src/game/editor/ed_popups.cpp49
17 files changed, 136 insertions, 7 deletions
diff --git a/data/languages/bosnian.txt b/data/languages/bosnian.txt
index f34536fe..d3bbf5e7 100644
--- a/data/languages/bosnian.txt
+++ b/data/languages/bosnian.txt
@@ -570,6 +570,9 @@ CW
 Cancel
 == 
 
+Clean-up game tiles
+== 
+
 Clear
 == 
 
@@ -816,6 +819,9 @@ Refocus
 Remove
 == 
 
+Removes game tiles that aren't based on a layer
+== 
+
 Removes the image from the map
 == 
 
diff --git a/data/languages/czech.txt b/data/languages/czech.txt
index 5d68ab2c..829a0059 100644
--- a/data/languages/czech.txt
+++ b/data/languages/czech.txt
@@ -519,6 +519,9 @@ CW
 Cancel
 == 
 
+Clean-up game tiles
+== 
+
 Clear
 == 
 
@@ -804,6 +807,9 @@ Refocus
 Remove
 == 
 
+Removes game tiles that aren't based on a layer
+== 
+
 Removes the image from the map
 == 
 
diff --git a/data/languages/dutch.txt b/data/languages/dutch.txt
index d547b81b..ce649d21 100644
--- a/data/languages/dutch.txt
+++ b/data/languages/dutch.txt
@@ -960,6 +960,9 @@ no limit
 
 ##### needs translation #####
 
+Clean-up game tiles
+== 
+
 Clear
 == 
 
@@ -975,6 +978,9 @@ Death
 Game tiles
 == 
 
+Removes game tiles that aren't based on a layer
+== 
+
 Unhookable
 == 
 
diff --git a/data/languages/finnish.txt b/data/languages/finnish.txt
index dc709c90..0b76d6ed 100644
--- a/data/languages/finnish.txt
+++ b/data/languages/finnish.txt
@@ -543,6 +543,9 @@ CW
 Cancel
 == 
 
+Clean-up game tiles
+== 
+
 Clear
 == 
 
@@ -813,6 +816,9 @@ Refocus
 Remove
 == 
 
+Removes game tiles that aren't based on a layer
+== 
+
 Removes the image from the map
 == 
 
diff --git a/data/languages/french.txt b/data/languages/french.txt
index a0133b0f..278efb26 100644
--- a/data/languages/french.txt
+++ b/data/languages/french.txt
@@ -828,6 +828,9 @@ Adds a new quad
 Aspect ratio
 == 
 
+Clean-up game tiles
+== 
+
 Clear
 == 
 
@@ -900,6 +903,9 @@ Quads
 Refocus
 == 
 
+Removes game tiles that aren't based on a layer
+== 
+
 Resizes the current Quad based on the aspect ratio of the image
 == 
 
diff --git a/data/languages/german.txt b/data/languages/german.txt
index 602b7f5e..43c96f41 100644
--- a/data/languages/german.txt
+++ b/data/languages/german.txt
@@ -960,6 +960,9 @@ no limit
 
 ##### needs translation #####
 
+Clean-up game tiles
+== 
+
 Clear
 == 
 
@@ -975,6 +978,9 @@ Death
 Game tiles
 == 
 
+Removes game tiles that aren't based on a layer
+== 
+
 Unhookable
 == 
 
diff --git a/data/languages/italian.txt b/data/languages/italian.txt
index 83414241..85b4e345 100644
--- a/data/languages/italian.txt
+++ b/data/languages/italian.txt
@@ -930,6 +930,9 @@ no limit
 
 ##### needs translation #####
 
+Clean-up game tiles
+== 
+
 Clear
 == 
 
@@ -963,6 +966,9 @@ Max demos
 REC
 == 
 
+Removes game tiles that aren't based on a layer
+== 
+
 Shift
 == 
 
diff --git a/data/languages/polish.txt b/data/languages/polish.txt
index c589fc77..d1b9c368 100644
--- a/data/languages/polish.txt
+++ b/data/languages/polish.txt
@@ -801,6 +801,9 @@ Automatically take game over screenshot
 Blue value of the envelope
 == 
 
+Clean-up game tiles
+== 
+
 Clear
 == 
 
@@ -918,6 +921,9 @@ Red value of the envelope
 Refocus
 == 
 
+Removes game tiles that aren't based on a layer
+== 
+
 Resizes the current Quad based on the aspect ratio of the image
 == 
 
diff --git a/data/languages/portuguese.txt b/data/languages/portuguese.txt
index 507a3eef..81a5f37a 100644
--- a/data/languages/portuguese.txt
+++ b/data/languages/portuguese.txt
@@ -540,6 +540,9 @@ CW
 Cancel
 == 
 
+Clean-up game tiles
+== 
+
 Clear
 == 
 
@@ -813,6 +816,9 @@ Refocus
 Remove
 == 
 
+Removes game tiles that aren't based on a layer
+== 
+
 Removes the image from the map
 == 
 
diff --git a/data/languages/romanian.txt b/data/languages/romanian.txt
index c20fb401..5c967699 100644
--- a/data/languages/romanian.txt
+++ b/data/languages/romanian.txt
@@ -960,6 +960,9 @@ no limit
 
 ##### needs translation #####
 
+Clean-up game tiles
+== 
+
 Clear
 == 
 
@@ -975,6 +978,9 @@ Death
 Game tiles
 == 
 
+Removes game tiles that aren't based on a layer
+== 
+
 Unhookable
 == 
 
diff --git a/data/languages/russian.txt b/data/languages/russian.txt
index 6b97f09f..bdf12a9b 100644
--- a/data/languages/russian.txt
+++ b/data/languages/russian.txt
@@ -813,6 +813,9 @@ Automatically take game over screenshot
 Blue value of the envelope
 == 
 
+Clean-up game tiles
+== 
+
 Clear
 == 
 
@@ -918,6 +921,9 @@ Record demo
 Red value of the envelope
 == 
 
+Removes game tiles that aren't based on a layer
+== 
+
 Resizes the current Quad based on the aspect ratio of the image
 == 
 
diff --git a/data/languages/serbian.txt b/data/languages/serbian.txt
index 6df4962c..8bbe71e7 100644
--- a/data/languages/serbian.txt
+++ b/data/languages/serbian.txt
@@ -543,6 +543,9 @@ CW
 Cancel
 == 
 
+Clean-up game tiles
+== 
+
 Clear
 == 
 
@@ -813,6 +816,9 @@ Refocus
 Remove
 == 
 
+Removes game tiles that aren't based on a layer
+== 
+
 Removes the image from the map
 == 
 
diff --git a/data/languages/spanish.txt b/data/languages/spanish.txt
index e767d500..807ccfc9 100644
--- a/data/languages/spanish.txt
+++ b/data/languages/spanish.txt
@@ -960,6 +960,9 @@ no limit
 
 ##### needs translation #####
 
+Clean-up game tiles
+== 
+
 Clear
 == 
 
@@ -975,6 +978,9 @@ Death
 Game tiles
 == 
 
+Removes game tiles that aren't based on a layer
+== 
+
 Unhookable
 == 
 
diff --git a/data/languages/swedish.txt b/data/languages/swedish.txt
index 29184e95..bc39692f 100644
--- a/data/languages/swedish.txt
+++ b/data/languages/swedish.txt
@@ -513,6 +513,9 @@ CW
 Cancel
 == 
 
+Clean-up game tiles
+== 
+
 Clear
 == 
 
@@ -801,6 +804,9 @@ Refocus
 Remove
 == 
 
+Removes game tiles that aren't based on a layer
+== 
+
 Removes the image from the map
 == 
 
diff --git a/data/languages/ukrainian.txt b/data/languages/ukrainian.txt
index ad5982ab..ac5b002f 100644
--- a/data/languages/ukrainian.txt
+++ b/data/languages/ukrainian.txt
@@ -861,6 +861,9 @@ Automatically take game over screenshot
 Blue value of the envelope
 == 
 
+Clean-up game tiles
+== 
+
 Clear
 == 
 
@@ -942,6 +945,9 @@ REC
 Red value of the envelope
 == 
 
+Removes game tiles that aren't based on a layer
+== 
+
 Rotation of the envelope
 == 
 
diff --git a/src/game/editor/ed_layer_tiles.cpp b/src/game/editor/ed_layer_tiles.cpp
index c8425947..57b77e36 100644
--- a/src/game/editor/ed_layer_tiles.cpp
+++ b/src/game/editor/ed_layer_tiles.cpp
@@ -344,8 +344,8 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox)
 			int h = min(gl->m_Height, m_Height);
 			for(int y = 0; y < h; y++)
 				for(int x = 0; x < w; x++)
-					if(gl->m_pTiles[y*gl->m_Width+x].m_Index >= TILE_AIR && gl->m_pTiles[y*gl->m_Width+x].m_Index <= TILE_NOHOOK)
-						gl->m_pTiles[y*gl->m_Width+x].m_Index = m_pTiles[y*m_Width+x].m_Index?TILE_AIR+Result:TILE_AIR;
+					if(m_pTiles[y*m_Width+x].m_Index)
+						gl->m_pTiles[y*gl->m_Width+x].m_Index = TILE_AIR+Result;
 
 			return 1;
 		}
diff --git a/src/game/editor/ed_popups.cpp b/src/game/editor/ed_popups.cpp
index 3ab4ab49..c34a1b1b 100644
--- a/src/game/editor/ed_popups.cpp
+++ b/src/game/editor/ed_popups.cpp
@@ -87,12 +87,51 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View)
 	static int s_DeleteButton = 0;
 	
 	// don't allow deletion of game group
-	if(pEditor->m_Map.m_pGameGroup != pEditor->GetSelectedGroup() &&
-		pEditor->DoButton_Editor(&s_DeleteButton, Localize("Delete group"), 0, &Button, 0, Localize("Delete group")))
+	if(pEditor->m_Map.m_pGameGroup != pEditor->GetSelectedGroup())
 	{
-		pEditor->m_Map.DeleteGroup(pEditor->m_SelectedGroup);
-		pEditor->m_SelectedGroup = max(0, pEditor->m_SelectedGroup-1);
-		return 1;
+		if(pEditor->DoButton_Editor(&s_DeleteButton, Localize("Delete group"), 0, &Button, 0, Localize("Delete group")))
+		{
+			pEditor->m_Map.DeleteGroup(pEditor->m_SelectedGroup);
+			pEditor->m_SelectedGroup = max(0, pEditor->m_SelectedGroup-1);
+			return 1;
+		}
+	}
+	else
+	{
+		if(pEditor->DoButton_Editor(&s_DeleteButton, Localize("Clean-up game tiles"), 0, &Button, 0, Localize("Removes game tiles that aren't based on a layer")))
+		{
+			// gather all tile layers
+			array<CLayerTiles*> Layers;
+			for(int i = 0; i < pEditor->m_Map.m_pGameGroup->m_lLayers.size(); ++i)
+			{
+				if(pEditor->m_Map.m_pGameGroup->m_lLayers[i] != pEditor->m_Map.m_pGameLayer && pEditor->m_Map.m_pGameGroup->m_lLayers[i]->m_Type == LAYERTYPE_TILES)
+					Layers.add(static_cast<CLayerTiles *>(pEditor->m_Map.m_pGameGroup->m_lLayers[i]));
+			}
+
+			// search for unneeded game tiles
+			CLayerTiles *gl = pEditor->m_Map.m_pGameLayer;
+			for(int y = 0; y < gl->m_Height; ++y)
+				for(int x = 0; x < gl->m_Width; ++x)
+				{
+					if(gl->m_pTiles[y*gl->m_Width+x].m_Index > static_cast<unsigned char>(TILE_NOHOOK))
+						continue;
+
+					bool Found = false;
+					for(int i = 0; i < Layers.size(); ++i)
+					{
+						if(x < Layers[i]->m_Width && y < Layers[i]->m_Height && Layers[i]->m_pTiles[y*Layers[i]->m_Width+x].m_Index)
+						{
+							Found = true;
+							break;
+						}
+					}
+
+					if(!Found)
+						gl->m_pTiles[y*gl->m_Width+x].m_Index = TILE_AIR;
+				}
+
+			return 1;
+		}
 	}
 
 	// new tile layer