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 | |
| 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')
| -rw-r--r-- | src/game/client/gc_hooks.cpp | 12 | ||||
| -rw-r--r-- | src/game/client/gc_skin.cpp | 13 |
2 files changed, 17 insertions, 8 deletions
diff --git a/src/game/client/gc_hooks.cpp b/src/game/client/gc_hooks.cpp index 601575f3..82ec33e2 100644 --- a/src/game/client/gc_hooks.cpp +++ b/src/game/client/gc_hooks.cpp @@ -33,7 +33,7 @@ extern "C" void modc_console_init() //binds_save() -static void load_sounds_thread(void *) +/*static void load_sounds_thread(void *) { // load sounds for(int s = 0; s < data->num_sounds; s++) @@ -45,7 +45,7 @@ static void load_sounds_thread(void *) data->sounds[s].sounds[i].id = id; } } -} +}*/ extern "C" void modc_init() { @@ -81,7 +81,7 @@ extern "C" void modc_init() // TODO: should be removed snd_set_listener_pos(0.0f, 0.0f); - float total = data->num_images; + float total = data->num_images+data->num_sounds; float current = 0; // load textures @@ -95,10 +95,9 @@ extern "C" void modc_init() skin_init(); //load_sounds_thread(0); - thread_create(load_sounds_thread, 0); + //thread_create(load_sounds_thread, 0); // load sounds - /* for(int s = 0; s < data->num_sounds; s++) { render_loading(current/total); @@ -114,8 +113,7 @@ extern "C" void modc_init() } current++; - }*/ - + } int64 end = time_get(); dbg_msg("", "%f.2ms", ((end-start)*1000)/(float)time_freq()); 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++) |