about summary refs log tree commit diff
path: root/src/game/client/components/skins.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/client/components/skins.cpp')
-rw-r--r--src/game/client/components/skins.cpp63
1 files changed, 30 insertions, 33 deletions
diff --git a/src/game/client/components/skins.cpp b/src/game/client/components/skins.cpp
index d89d0647..d24e36f0 100644
--- a/src/game/client/components/skins.cpp
+++ b/src/game/client/components/skins.cpp
@@ -65,42 +65,39 @@ void CSkins::SkinScan(const char *pName, int IsDir, int DirType, void *pUser)
 	}
 
 	
-	if(1)
-	{
-		int Freq[256] = {0};
-		int OrgWeight = 0;
-		int NewWeight = 192;
+	int Freq[256] = {0};
+	int OrgWeight = 0;
+	int NewWeight = 192;
 		
-		// find most common frequence
-		for(int y = 0; y < BodySize; y++)
-			for(int x = 0; x < BodySize; x++)
-			{
-				if(d[y*Pitch+x*4+3] > 128)
-					Freq[d[y*Pitch+x*4]]++;
-			}
-		
-		for(int i = 1; i < 256; i++)
+	// find most common frequence
+	for(int y = 0; y < BodySize; y++)
+		for(int x = 0; x < BodySize; x++)
 		{
-			if(Freq[OrgWeight] < Freq[i])
-				OrgWeight = i;
+			if(d[y*Pitch+x*4+3] > 128)
+				Freq[d[y*Pitch+x*4]]++;
 		}
-
-		// reorder
-		int InvOrgWeight = 255-OrgWeight;
-		int InvNewWeight = 255-NewWeight;
-		for(int y = 0; y < BodySize; y++)
-			for(int x = 0; x < BodySize; x++)
-			{
-				int v = d[y*Pitch+x*4];
-				if(v <= OrgWeight)
-					v = (int)(((v/(float)OrgWeight) * NewWeight));
-				else
-					v = (int)(((v-OrgWeight)/(float)InvOrgWeight)*InvNewWeight + NewWeight);
-				d[y*Pitch+x*4] = v;
-				d[y*Pitch+x*4+1] = v;
-				d[y*Pitch+x*4+2] = v;
-			}
+		
+	for(int i = 1; i < 256; i++)
+	{
+		if(Freq[OrgWeight] < Freq[i])
+			OrgWeight = i;
 	}
+
+	// reorder
+	int InvOrgWeight = 255-OrgWeight;
+	int InvNewWeight = 255-NewWeight;
+	for(int y = 0; y < BodySize; y++)
+		for(int x = 0; x < BodySize; x++)
+		{
+			int v = d[y*Pitch+x*4];
+			if(v <= OrgWeight)
+				v = (int)(((v/(float)OrgWeight) * NewWeight));
+			else
+				v = (int)(((v-OrgWeight)/(float)InvOrgWeight)*InvNewWeight + NewWeight);
+			d[y*Pitch+x*4] = v;
+			d[y*Pitch+x*4+1] = v;
+			d[y*Pitch+x*4+2] = v;
+		}
 	
 	Skin.m_ColorTexture = pSelf->Graphics()->LoadTextureRaw(Info.m_Width, Info.m_Height, Info.m_Format, Info.m_pData, Info.m_Format, 0);
 	mem_free(Info.m_pData);
@@ -113,7 +110,7 @@ void CSkins::SkinScan(const char *pName, int IsDir, int DirType, void *pUser)
 }
 
 
-void CSkins::Init()
+void CSkins::OnInit()
 {
 	// load skins
 	m_aSkins.clear();