diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-11-26 22:26:33 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-11-26 22:26:33 +0000 |
| commit | 8f72a35dbb37f341e46b157c84b5ddd9ffe47299 (patch) | |
| tree | 1581432b254da135afed1c36aa968fee83db769c | |
| parent | ad5523dac47b0503f7323be7d93a0bfdadbbae14 (diff) | |
| download | zcatch-8f72a35dbb37f341e46b157c84b5ddd9ffe47299.tar.gz zcatch-8f72a35dbb37f341e46b157c84b5ddd9ffe47299.zip | |
fixed coloring of tees
| -rw-r--r-- | src/game/client/cl_skin.cpp | 37 | ||||
| -rw-r--r-- | src/game/client/menu2.cpp | 47 | ||||
| -rw-r--r-- | src/game/server/srv_common.cpp | 2 |
3 files changed, 69 insertions, 17 deletions
diff --git a/src/game/client/cl_skin.cpp b/src/game/client/cl_skin.cpp index f70105a3..da8fe535 100644 --- a/src/game/client/cl_skin.cpp +++ b/src/game/client/cl_skin.cpp @@ -45,6 +45,43 @@ static void skinscan(const char *name, int is_dir, void *user) d[i*step+2] = v; } + if(1) + { + int bs = 96; // body size + int pitch = info.width*4; + int freq[256] = {0}; + + for(int y = 0; y < bs; y++) + for(int x = 0; x < bs; x++) + { + if(d[y*pitch+x*4+3] > 128) + freq[d[y*pitch+x*4]]++; + } + + int org_weight = 0; + int new_weight = 192; + for(int i = 1; i < 256; i++) + { + if(freq[org_weight] < freq[i]) + org_weight = i; + } + + int inv_org_weight = 255-org_weight; + int inv_new_weight = 255-new_weight; + for(int y = 0; y < bs; y++) + for(int x = 0; x < bs; x++) + { + int v = d[y*pitch+x*4]; + if(v <= org_weight) + v = (int)(((v/(float)org_weight) * new_weight)); + else + v = (int)(((v-org_weight)/(float)inv_org_weight)*inv_new_weight + new_weight); + d[y*pitch+x*4] = v; + d[y*pitch+x*4+1] = v; + d[y*pitch+x*4+2] = v; + } + } + skins[num_skins].color_texture = gfx_load_texture_raw(info.width, info.height, info.format, info.data); mem_free(info.data); diff --git a/src/game/client/menu2.cpp b/src/game/client/menu2.cpp index 860136f1..34541e4b 100644 --- a/src/game/client/menu2.cpp +++ b/src/game/client/menu2.cpp @@ -1439,23 +1439,38 @@ static void menu2_render_game(RECT main_view) int menu2_render() { - /* - gfx_mapscreen(0,0,2*4/3.0f,2); - gfx_clear(gui_color.r, gui_color.g, gui_color.b); - - animstate state; - anim_eval(&data->animations[ANIM_BASE], 0, &state); - //anim_eval_add(&idlestate, &data->animations[ANIM_IDLE], 0, 1.0f); - anim_eval_add(&state, &data->animations[ANIM_WALK], fmod(client_localtime(), 1.0f), 1.0f); - - tee_render_info info; - info.texture = skin_get(1)->org_texture; - info.color = vec4(1,1,1,1); - info.size = 1.0f; //ui2_scale()*16.0f; - render_tee(&state, &info, 0, vec2(sinf(client_localtime()*3), cosf(client_localtime()*3)), vec2(1,1)); + if(1) + { + gfx_mapscreen(0,0,10*4/3.0f,10); + gfx_clear(gui_color.r, gui_color.g, gui_color.b); - return 0; - */ + animstate state; + anim_eval(&data->animations[ANIM_BASE], 0, &state); + anim_eval_add(&state, &data->animations[ANIM_IDLE], 0, 1.0f); + //anim_eval_add(&state, &data->animations[ANIM_WALK], fmod(client_localtime(), 1.0f), 1.0f); + + for(int i = 0; i < skin_num(); i++) + { + float x = (i/8)*3; + float y = (i%8); + for(int c = 0; c < 2; c++) + { + //int colors[2] = {54090, 10998628}; + //int colors[2] = {65432, 9895832}; // NEW + int colors[2] = {65387, 10223467}; // NEW + + tee_render_info info; + info.texture = skin_get(i)->color_texture; + info.color_feet = info.color_body = skin_get_color(colors[c]); + //info.color_feet = info.color_body = vec4(1,1,1,1); + info.size = 1.0f; //ui2_scale()*16.0f; + //render_tee(&state, &info, 0, vec2(sinf(client_localtime()*3), cosf(client_localtime()*3)), vec2(1+x+c,1+y)); + render_tee(&state, &info, 0, vec2(1,0), vec2(1+x+c,1+y)); + } + } + + return 0; + } gfx_mapscreen(0,0,800,600); diff --git a/src/game/server/srv_common.cpp b/src/game/server/srv_common.cpp index 417c9db7..bd5d0964 100644 --- a/src/game/server/srv_common.cpp +++ b/src/game/server/srv_common.cpp @@ -115,7 +115,7 @@ void gameobject::post_reset() void gameobject::on_player_info_change(class player *p) { - const int team_colors[2] = {54090, 10998628}; + const int team_colors[2] = {65387, 10223467}; if(is_teamplay) { if(p->team >= 0 || p->team <= 1) |