diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2009-05-31 09:44:20 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2009-05-31 09:44:20 +0000 |
| commit | 4bb1df318905f491740f4298c69cda317fb53fcb (patch) | |
| tree | 486c4edf2d6af2089ffab60a7422d5e7abefa891 /src/game/client | |
| parent | b28ede2da2c42643c5aa710a8076f0249d48c9e4 (diff) | |
| download | zcatch-4bb1df318905f491740f4298c69cda317fb53fcb.tar.gz zcatch-4bb1df318905f491740f4298c69cda317fb53fcb.zip | |
moved 0.5 branch to trunk
Diffstat (limited to 'src/game/client')
| -rw-r--r-- | src/game/client/components/chat.cpp | 13 | ||||
| -rw-r--r-- | src/game/client/components/chat.hpp | 2 | ||||
| -rw-r--r-- | src/game/client/components/console.cpp | 7 | ||||
| -rw-r--r-- | src/game/client/components/hud.cpp | 2 | ||||
| -rw-r--r-- | src/game/client/components/menus_browser.cpp | 7 | ||||
| -rw-r--r-- | src/game/client/components/players.cpp | 2 | ||||
| -rw-r--r-- | src/game/client/components/scoreboard.cpp | 34 | ||||
| -rw-r--r-- | src/game/client/render.hpp | 4 |
8 files changed, 49 insertions, 22 deletions
diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp index 01b9f457..8ef4e17d 100644 --- a/src/game/client/components/chat.cpp +++ b/src/game/client/components/chat.cpp @@ -10,12 +10,15 @@ #include "chat.hpp" -void CHAT::on_reset() +void CHAT::on_statechange(int new_state, int old_state) { - mode = MODE_NONE; - for(int i = 0; i < MAX_LINES; i++) - lines[i].time = -1000000; - current_line = 0; + if(old_state <= CLIENTSTATE_CONNECTING) + { + mode = MODE_NONE; + for(int i = 0; i < MAX_LINES; i++) + lines[i].time = 0; + current_line = 0; + } } void CHAT::con_say(void *result, void *user_data) diff --git a/src/game/client/components/chat.hpp b/src/game/client/components/chat.hpp index 593ef87e..ca34237d 100644 --- a/src/game/client/components/chat.hpp +++ b/src/game/client/components/chat.hpp @@ -47,7 +47,7 @@ public: void say(int team, const char *line); virtual void on_console_init(); - virtual void on_reset(); + virtual void on_statechange(int new_state, int old_state); virtual void on_render(); virtual void on_message(int msgtype, void *rawmsg); virtual bool on_input(INPUT_EVENT e); diff --git a/src/game/client/components/console.cpp b/src/game/client/components/console.cpp index c1493fb8..53d5637e 100644 --- a/src/game/client/components/console.cpp +++ b/src/game/client/components/console.cpp @@ -276,8 +276,11 @@ void CONSOLE::on_render() progress = 1.0f; } - - if (console_state == CONSOLE_CLOSED || config.cl_editor) + + if (console_state == CONSOLE_OPEN && config.cl_editor) + toggle(0); + + if (console_state == CONSOLE_CLOSED) return; if (console_state == CONSOLE_OPEN) diff --git a/src/game/client/components/hud.cpp b/src/game/client/components/hud.cpp index b86d3873..b1926ab4 100644 --- a/src/game/client/components/hud.cpp +++ b/src/game/client/components/hud.cpp @@ -171,7 +171,7 @@ void HUD::render_teambalancewarning() { // render prompt about team-balance bool flash = time_get()/(time_freq()/2)%2 == 0; - if (gameclient.snap.gameobj && gameclient.snap.gameobj->flags&GAMEFLAG_TEAMS != 0) + if (gameclient.snap.gameobj && (gameclient.snap.gameobj->flags&GAMEFLAG_TEAMS) != 0) { if (config.cl_warning_teambalance && abs(gameclient.snap.team_size[0]-gameclient.snap.team_size[1]) >= 2) { diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp index 17c7775f..c26bddba 100644 --- a/src/game/client/components/menus_browser.cpp +++ b/src/game/client/components/menus_browser.cpp @@ -373,10 +373,15 @@ void MENUS::render_serverbrowser_filters(RECT view) config.b_filter_compatversion ^= 1; ui_hsplit_t(&view, 20.0f, &button, &view); - if (ui_do_button((char *)&config.b_filter_pure, "Only pure", config.b_filter_pure, &button, ui_draw_checkbox, 0)) + if (ui_do_button((char *)&config.b_filter_pure, "Standard gametype", config.b_filter_pure, &button, ui_draw_checkbox, 0)) config.b_filter_pure ^= 1; ui_hsplit_t(&view, 20.0f, &button, &view); + /*ui_vsplit_l(&button, 20.0f, 0, &button);*/ + if (ui_do_button((char *)&config.b_filter_pure_map, "Standard map", config.b_filter_pure_map, &button, ui_draw_checkbox, 0)) + config.b_filter_pure_map ^= 1; + + ui_hsplit_t(&view, 20.0f, &button, &view); ui_do_label(&button, "Game types: ", 14.0f, -1); ui_vsplit_l(&button, 95.0f, 0, &button); ui_margin(&button, 1.0f, &button); diff --git a/src/game/client/components/players.cpp b/src/game/client/components/players.cpp index f8e73dfb..6d6bcc37 100644 --- a/src/game/client/components/players.cpp +++ b/src/game/client/components/players.cpp @@ -95,7 +95,7 @@ void PLAYERS::render_player( bool is_teamplay = false; bool new_tick = gameclient.new_tick; if(gameclient.snap.gameobj) - is_teamplay = gameclient.snap.gameobj->flags&GAMEFLAG_TEAMS != 0; + is_teamplay = (gameclient.snap.gameobj->flags&GAMEFLAG_TEAMS) != 0; // check for ninja if (player.weapon == WEAPON_NINJA) diff --git a/src/game/client/components/scoreboard.cpp b/src/game/client/components/scoreboard.cpp index 59a23508..dc1c4283 100644 --- a/src/game/client/components/scoreboard.cpp +++ b/src/game/client/components/scoreboard.cpp @@ -113,7 +113,7 @@ void SCOREBOARD::render_scoreboard(float x, float y, float w, int team, const ch gfx_texture_set(-1); gfx_quads_begin(); gfx_setcolor(0,0,0,0.5f); - draw_round_rect(x-10.f, y-10.f, w, h, 40.0f); + draw_round_rect(x-10.f, y-10.f, w, h, 17.0f); gfx_quads_end(); // render title @@ -157,8 +157,12 @@ void SCOREBOARD::render_scoreboard(float x, float y, float w, int team, const ch if(item.type == NETOBJTYPE_PLAYER_INFO) { - players[num_players] = (const NETOBJ_PLAYER_INFO *)data; - num_players++; + const NETOBJ_PLAYER_INFO *info = (const NETOBJ_PLAYER_INFO *)data; + if(info->team == team) + { + players[num_players] = info; + num_players++; + } } } @@ -182,24 +186,34 @@ void SCOREBOARD::render_scoreboard(float x, float y, float w, int team, const ch gfx_text(0, x+w-70, y, 24.0f, "Ping", -1); y += 29.0f; + float font_size = 35.0f; + float line_height = 50.0f; + float tee_sizemod = 1.0f; + float tee_offset = 0.0f; + + if(num_players > 13) + { + font_size = 30.0f; + line_height = 40.0f; + tee_sizemod = 0.8f; + tee_offset = -5.0f; + } + // render player scores for(int i = 0; i < num_players; i++) { const NETOBJ_PLAYER_INFO *info = players[i]; // make sure that we render the correct team - if(team == -1 || info->team != team) - continue; char buf[128]; - float font_size = 35.0f; if(info->local) { // background so it's easy to find the local player gfx_texture_set(-1); gfx_quads_begin(); gfx_setcolor(1,1,1,0.25f); - draw_round_rect(x, y, w-20, 48, 20.0f); + draw_round_rect(x, y, w-20, line_height*0.95f, 17.0f); gfx_quads_end(); } @@ -228,10 +242,12 @@ void SCOREBOARD::render_scoreboard(float x, float y, float w, int team, const ch gfx_quads_end(); } - render_tee(ANIMSTATE::get_idle(), &gameclient.clients[info->cid].render_info, EMOTE_NORMAL, vec2(1,0), vec2(x+90, y+28)); + TEE_RENDER_INFO teeinfo = gameclient.clients[info->cid].render_info; + teeinfo.size *= tee_sizemod; + render_tee(ANIMSTATE::get_idle(), &teeinfo, EMOTE_NORMAL, vec2(1,0), vec2(x+90, y+28+tee_offset)); - y += 50.0f; + y += line_height; } } diff --git a/src/game/client/render.hpp b/src/game/client/render.hpp index 917641c8..9ce555d2 100644 --- a/src/game/client/render.hpp +++ b/src/game/client/render.hpp @@ -37,9 +37,9 @@ enum TILERENDERFLAG_EXTEND=4, }; -typedef struct SPRITE; +//typedef struct SPRITE; -void select_sprite(SPRITE *spr, int flags=0, int sx=0, int sy=0); +void select_sprite(struct SPRITE *spr, int flags=0, int sx=0, int sy=0); void select_sprite(int id, int flags=0, int sx=0, int sy=0); void draw_sprite(float x, float y, float size); |