about summary refs log tree commit diff
path: root/src/game/editor/ed_layer_tiles.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/editor/ed_layer_tiles.cpp')
-rw-r--r--src/game/editor/ed_layer_tiles.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/game/editor/ed_layer_tiles.cpp b/src/game/editor/ed_layer_tiles.cpp
index dcbb0afe..d0c9041c 100644
--- a/src/game/editor/ed_layer_tiles.cpp
+++ b/src/game/editor/ed_layer_tiles.cpp
@@ -25,7 +25,7 @@ CLayerTiles::CLayerTiles(int w, int h)
 	m_Color.g = 255;
 	m_Color.b = 255;
 	m_Color.a = 255;
-	
+
 	m_pTiles = new CTile[m_Width*m_Height];
 	mem_zero(m_pTiles, m_Width*m_Height*sizeof(CTile));
 }
@@ -93,19 +93,19 @@ void CLayerTiles::Clamp(RECTi *pRect)
 		pRect->w += pRect->x;
 		pRect->x = 0;
 	}
-		
+
 	if(pRect->y < 0)
 	{
 		pRect->h += pRect->y;
 		pRect->y = 0;
 	}
-	
+
 	if(pRect->x+pRect->w > m_Width)
 		pRect->w = m_Width - pRect->x;
 
 	if(pRect->y+pRect->h > m_Height)
 		pRect->h = m_Height - pRect->y;
-		
+
 	if(pRect->h < 0)
 		pRect->h = 0;
 	if(pRect->w < 0)
@@ -131,10 +131,10 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
 	RECTi r;
 	Convert(Rect, &r);
 	Clamp(&r);
-	
+
 	if(!r.w || !r.h)
 		return 0;
-	
+
 	// create new layers
 	CLayerTiles *pGrabbed = new CLayerTiles(r.w, r.h);
 	pGrabbed->m_pEditor = m_pEditor;
@@ -142,12 +142,12 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
 	pGrabbed->m_Image = m_Image;
 	pGrabbed->m_Game = m_Game;
 	pBrush->AddLayer(pGrabbed);
-	
+
 	// copy the tiles
 	for(int y = 0; y < r.h; y++)
 		for(int x = 0; x < r.w; x++)
 			pGrabbed->m_pTiles[y*pGrabbed->m_Width+x] = m_pTiles[(r.y+y)*m_Width+(r.x+x)];
-	
+
 	return 1;
 }
 
@@ -155,28 +155,28 @@ void CLayerTiles::FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect)
 {
 	if(m_Readonly)
 		return;
-		
+
 	int sx = ConvertX(Rect.x);
 	int sy = ConvertY(Rect.y);
 	int w = ConvertX(Rect.w);
 	int h = ConvertY(Rect.h);
-	
+
 	CLayerTiles *pLt = static_cast<CLayerTiles*>(pBrush);
-	
+
 	for(int y = 0; y <= h; y++)
 	{
 		for(int x = 0; x <= w; x++)
 		{
 			int fx = x+sx;
 			int fy = y+sy;
-			
+
 			if(fx < 0 || fx >= m_Width || fy < 0 || fy >= m_Height)
 				continue;
-			
-			if(Empty)	
-                m_pTiles[fy*m_Width+fx].m_Index = 1;
-            else
-                m_pTiles[fy*m_Width+fx] = pLt->m_pTiles[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)];
+
+			if(Empty)
+				m_pTiles[fy*m_Width+fx].m_Index = 1;
+			else
+				m_pTiles[fy*m_Width+fx] = pLt->m_pTiles[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)];
 		}
 	}
 	m_pEditor->m_Map.m_Modified = true;
@@ -186,12 +186,12 @@ void CLayerTiles::BrushDraw(CLayer *pBrush, float wx, float wy)
 {
 	if(m_Readonly)
 		return;
-	
+
 	//
 	CLayerTiles *l = (CLayerTiles *)pBrush;
 	int sx = ConvertX(wx);
 	int sy = ConvertY(wy);
-	
+
 	for(int y = 0; y < l->m_Height; y++)
 		for(int x = 0; x < l->m_Width; x++)
 		{
@@ -199,7 +199,7 @@ void CLayerTiles::BrushDraw(CLayer *pBrush, float wx, float wy)
 			int fy = y+sy;
 			if(fx<0 || fx >= m_Width || fy < 0 || fy >= m_Height)
 				continue;
-				
+
 			m_pTiles[fy*m_Width+fx] = l->m_pTiles[y*l->m_Width+x];
 		}
 	m_pEditor->m_Map.m_Modified = true;
@@ -279,10 +279,10 @@ void CLayerTiles::Resize(int NewW, int NewH)
 	CTile *pNewData = new CTile[NewW*NewH];
 	mem_zero(pNewData, NewW*NewH*sizeof(CTile));
 
-	// copy old data	
+	// copy old data
 	for(int y = 0; y < min(NewH, m_Height); y++)
 		mem_copy(&pNewData[y*NewW], &m_pTiles[y*m_Width], min(m_Width, NewW)*sizeof(CTile));
-	
+
 	// replace old
 	delete [] m_pTiles;
 	m_pTiles = pNewData;
@@ -329,12 +329,12 @@ void CLayerTiles::ShowInfo()
 	float ScreenX0, ScreenY0, ScreenX1, ScreenY1;
 	Graphics()->GetScreen(&ScreenX0, &ScreenY0, &ScreenX1, &ScreenY1);
 	Graphics()->TextureSet(m_pEditor->Client()->GetDebugFont());
-	
+
 	int StartY = max(0, (int)(ScreenY0/32.0f)-1);
 	int StartX = max(0, (int)(ScreenX0/32.0f)-1);
 	int EndY = min((int)(ScreenY1/32.0f)+1, m_Height);
 	int EndX = min((int)(ScreenX1/32.0f)+1, m_Width);
-	
+
 	for(int y = StartY; y < EndY; y++)
 		for(int x = StartX; x < EndX; x++)
 		{
@@ -359,7 +359,7 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox)
 {
 	CUIRect Button;
 	pToolBox->HSplitBottom(12.0f, pToolBox, &Button);
-	
+
 	bool InGameGroup = !find_linear(m_pEditor->m_Map.m_pGameGroup->m_lLayers.all(), this).empty();
 	if(m_pEditor->m_Map.m_pGameLayer == this)
 		InGameGroup = false;
@@ -384,7 +384,7 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox)
 			return 1;
 		}
 	}
-	
+
 	enum
 	{
 		PROP_WIDTH=0,
@@ -394,13 +394,13 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox)
 		PROP_COLOR,
 		NUM_PROPS,
 	};
-	
+
 	int Color = 0;
 	Color |= m_Color.r<<24;
 	Color |= m_Color.g<<16;
 	Color |= m_Color.b<<8;
 	Color |= m_Color.a;
-	
+
 	CProperty aProps[] = {
 		{"Width", m_Width, PROPTYPE_INT_SCROLL, 1, 1000000000},
 		{"Height", m_Height, PROPTYPE_INT_SCROLL, 1, 1000000000},
@@ -409,19 +409,19 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox)
 		{"Color", Color, PROPTYPE_COLOR, 0, 0},
 		{0},
 	};
-	
+
 	if(m_pEditor->m_Map.m_pGameLayer == this) // remove the image and color properties if this is the game layer
 	{
 		aProps[3].m_pName = 0;
 		aProps[4].m_pName = 0;
 	}
-	
+
 	static int s_aIds[NUM_PROPS] = {0};
 	int NewVal = 0;
 	int Prop = m_pEditor->DoProperties(pToolBox, aProps, s_aIds, &NewVal);
 	if(Prop != -1)
 		m_pEditor->m_Map.m_Modified = true;
-	
+
 	if(Prop == PROP_WIDTH && NewVal > 1)
 		Resize(NewVal, m_Height);
 	else if(Prop == PROP_HEIGHT && NewVal > 1)
@@ -445,7 +445,7 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox)
 		m_Color.b = (NewVal>>8)&0xff;
 		m_Color.a = NewVal&0xff;
 	}
-	
+
 	return 0;
 }