diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-03-23 12:36:24 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-03-23 12:36:24 +0000 |
| commit | 960dd7b7840840da2e8f201cd9761e9d9f28248e (patch) | |
| tree | f48c3ebe318416b710948d0ff357102cce57f08f /src/game/client/gc_skin.cpp | |
| parent | 10ea1a90c219805c8215cc2c6104b8b739ec753a (diff) | |
| download | zcatch-960dd7b7840840da2e8f201cd9761e9d9f28248e.tar.gz zcatch-960dd7b7840840da2e8f201cd9761e9d9f28248e.zip | |
removed the threaded loading of sounds. fixed the custom coloring of the tees
Diffstat (limited to 'src/game/client/gc_skin.cpp')
| -rw-r--r-- | src/game/client/gc_skin.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/game/client/gc_skin.cpp b/src/game/client/gc_skin.cpp index 7198665f..e7fd1fba 100644 --- a/src/game/client/gc_skin.cpp +++ b/src/game/client/gc_skin.cpp @@ -57,7 +57,8 @@ static void skinscan(const char *name, int is_dir, void *user) // create colorless version int step = info.format == IMG_RGBA ? 4 : 3; - + + // make the texture gray scale for(int i = 0; i < info.width*info.height; i++) { int v = (d[i*step]+d[i*step+1]+d[i*step+2])/3; @@ -72,12 +73,22 @@ static void skinscan(const char *name, int is_dir, void *user) int freq[256] = {0}; int org_weight = 0; int new_weight = 192; + + // find most common frequence + for(int y = 0; y < body_size; y++) + for(int x = 0; x < body_size; x++) + { + if(d[y*pitch+x*4+3] > 128) + freq[d[y*pitch+x*4]]++; + } + for(int i = 1; i < 256; i++) { if(freq[org_weight] < freq[i]) org_weight = i; } + // reorder int inv_org_weight = 255-org_weight; int inv_new_weight = 255-new_weight; for(int y = 0; y < body_size; y++) |