From 4bb1df318905f491740f4298c69cda317fb53fcb Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Sun, 31 May 2009 09:44:20 +0000 Subject: moved 0.5 branch to trunk --- src/game/client/components/chat.cpp | 13 +++++++---- src/game/client/components/chat.hpp | 2 +- src/game/client/components/console.cpp | 7 ++++-- src/game/client/components/hud.cpp | 2 +- src/game/client/components/menus_browser.cpp | 7 +++++- src/game/client/components/players.cpp | 2 +- src/game/client/components/scoreboard.cpp | 34 ++++++++++++++++++++-------- src/game/client/render.hpp | 4 ++-- src/game/editor/ed_editor.cpp | 25 +++++++++++++------- src/game/server/entities/character.cpp | 8 +++---- src/game/server/gamemodes/ctf.cpp | 7 ++---- src/game/server/hooks.cpp | 2 +- src/game/version.hpp | 2 +- 13 files changed, 74 insertions(+), 41 deletions(-) (limited to 'src/game') 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,9 +373,14 @@ 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); 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); diff --git a/src/game/editor/ed_editor.cpp b/src/game/editor/ed_editor.cpp index 19727490..7a8a1ae7 100644 --- a/src/game/editor/ed_editor.cpp +++ b/src/game/editor/ed_editor.cpp @@ -1168,14 +1168,14 @@ static void do_map_editor(RECT view, RECT toolbar) ui_set_hot_item(editor_id); // do global operations like pan and zoom - if(ui_active_item() == 0 && ui_mouse_button(0)) + if(ui_active_item() == 0 && (ui_mouse_button(0) || ui_mouse_button(2))) { start_wx = wx; start_wy = wy; start_mx = mx; start_my = my; - if(inp_key_pressed(KEY_LCTRL) || inp_key_pressed(KEY_RCTRL)) + if(inp_key_pressed(KEY_LCTRL) || inp_key_pressed(KEY_RCTRL) || ui_mouse_button(2)) { if(inp_key_pressed(KEY_LSHIFT)) operation = OP_PAN_EDITOR; @@ -2411,11 +2411,12 @@ static void render_envelopeeditor(RECT view) static int popup_menu_file(RECT view) { - static int new_map_button = 0; - static int save_button = 0; - static int save_as_button = 0; - static int open_button = 0; - static int append_button = 0; + static int new_map_button = 0; + static int save_button = 0; + static int save_as_button = 0; + static int open_button = 0; + static int append_button = 0; + static int exit_button = 0; RECT slot; ui_hsplit_t(&view, 2.0f, &slot, &view); @@ -2456,6 +2457,14 @@ static int popup_menu_file(RECT view) editor.invoke_file_dialog(LISTDIRTYPE_SAVE, "Save Map", "Save", "maps/", "", callback_save_map); return 1; } + + ui_hsplit_t(&view, 10.0f, &slot, &view); + ui_hsplit_t(&view, 12.0f, &slot, &view); + if(do_editor_button(&exit_button, "Exit", 0, &slot, draw_editor_button_menuitem, 0, "Exits from the editor")) + { + config.cl_editor = 0; + return 1; + } return 0; } @@ -2680,7 +2689,7 @@ extern "C" void editor_update_and_render() { static int mouse_x = 0; static int mouse_y = 0; - + if(editor.animate) editor.animate_time = (time_get()-editor.animate_start)/(float)time_freq(); else diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 3bbe8670..8ba91a80 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -546,10 +546,10 @@ void CHARACTER::tick() float phys_size = 28.0f; // handle death-tiles - if(col_get((int)(pos.x+phys_size/2), (int)(pos.y-phys_size/2))&COLFLAG_DEATH || - col_get((int)(pos.x+phys_size/2), (int)(pos.y+phys_size/2))&COLFLAG_DEATH || - col_get((int)(pos.x-phys_size/2), (int)(pos.y-phys_size/2))&COLFLAG_DEATH || - col_get((int)(pos.x-phys_size/2), (int)(pos.y+phys_size/2))&COLFLAG_DEATH) + if(col_get((int)(pos.x+phys_size/3), (int)(pos.y-phys_size/3))&COLFLAG_DEATH || + col_get((int)(pos.x+phys_size/3), (int)(pos.y+phys_size/3))&COLFLAG_DEATH || + col_get((int)(pos.x-phys_size/3), (int)(pos.y-phys_size/3))&COLFLAG_DEATH || + col_get((int)(pos.x-phys_size/3), (int)(pos.y+phys_size/3))&COLFLAG_DEATH) { die(player->client_id, WEAPON_WORLD); } diff --git a/src/game/server/gamemodes/ctf.cpp b/src/game/server/gamemodes/ctf.cpp index f1c7c236..b2146b51 100644 --- a/src/game/server/gamemodes/ctf.cpp +++ b/src/game/server/gamemodes/ctf.cpp @@ -216,11 +216,8 @@ void FLAG::reset() void FLAG::snap(int snapping_client) { NETOBJ_FLAG *flag = (NETOBJ_FLAG *)snap_new_item(NETOBJTYPE_FLAG, team, sizeof(NETOBJ_FLAG)); - if(!networkclipped(snapping_client, pos)) - { - flag->x = (int)pos.x; - flag->y = (int)pos.y; - } + flag->x = (int)pos.x; + flag->y = (int)pos.y; flag->team = team; flag->carried_by = -1; diff --git a/src/game/server/hooks.cpp b/src/game/server/hooks.cpp index 18626b4e..1ae38ce2 100644 --- a/src/game/server/hooks.cpp +++ b/src/game/server/hooks.cpp @@ -257,7 +257,7 @@ void mods_message(int msgtype, int client_id) return; } - str_format(chatmsg, sizeof(chatmsg), "Vote called to kick '%s'", server_clientname(kick_id)); + str_format(chatmsg, sizeof(chatmsg), "%s called for vote to kick '%s'", server_clientname(client_id), server_clientname(kick_id)); str_format(desc, sizeof(desc), "Kick '%s'", server_clientname(kick_id)); str_format(cmd, sizeof(cmd), "kick %d", kick_id); if (!config.sv_vote_kick_bantime) diff --git a/src/game/version.hpp b/src/game/version.hpp index 1277ccfa..2692752c 100644 --- a/src/game/version.hpp +++ b/src/game/version.hpp @@ -1,4 +1,4 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ #include "generated/nethash.c" -#define GAME_VERSION "0.5.1" +#define GAME_VERSION "trunk" #define GAME_NETVERSION "0.5 " GAME_NETVERSION_HASH -- cgit 1.4.1