From a49f78b66bc6cc035d4a3a7964e660ccc5ec8127 Mon Sep 17 00:00:00 2001 From: Jakob Fries Date: Wed, 15 Aug 2007 10:18:01 +0000 Subject: [PATCH] improved emoticon selector --- src/engine/client/client.cpp | 2 +- src/engine/config_variables.h | 2 +- src/game/client/game_client.cpp | 19 +++++++++++-------- src/game/client/menu.cpp | 6 ++++++ src/game/game_variables.h | 15 +++++++++------ 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index e3bf2c321..a4cb45093 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -938,7 +938,7 @@ static void client_run(const char *direct_connect_server) } // screenshot button - if(inp_key_down(input::f10)) + if(inp_key_down(config.key_screenshot)) gfx_screenshot(); // panic button diff --git a/src/engine/config_variables.h b/src/engine/config_variables.h index ba9852aaa..26fadf71f 100644 --- a/src/engine/config_variables.h +++ b/src/engine/config_variables.h @@ -21,7 +21,7 @@ MACRO_CONFIG_INT(gfx_texture_compression, 0, 0, 1) MACRO_CONFIG_INT(gfx_high_detail, 1, 0, 1) MACRO_CONFIG_INT(gfx_texture_quality, 1, 0, 1) - +MACRO_CONFIG_INT(key_screenshot, 'Q', 32, 512) MACRO_CONFIG_STR(masterserver, 128, "master.teewars.com") diff --git a/src/game/client/game_client.cpp b/src/game/client/game_client.cpp index a04ccf34c..8479f4a73 100644 --- a/src/game/client/game_client.cpp +++ b/src/game/client/game_client.cpp @@ -1586,13 +1586,16 @@ void render_game() // center at char but can be moved when mouse is far away float offx = 0, offy = 0; - int deadzone = 300; - if(mouse_pos.x > deadzone) offx = mouse_pos.x-deadzone; - if(mouse_pos.x <-deadzone) offx = mouse_pos.x+deadzone; - if(mouse_pos.y > deadzone) offy = mouse_pos.y-deadzone; - if(mouse_pos.y <-deadzone) offy = mouse_pos.y+deadzone; - offx = offx*2/3; - offy = offy*2/3; + if (config.dynamic_camera) + { + int deadzone = 300; + if(mouse_pos.x > deadzone) offx = mouse_pos.x-deadzone; + if(mouse_pos.x <-deadzone) offx = mouse_pos.x+deadzone; + if(mouse_pos.y > deadzone) offy = mouse_pos.y-deadzone; + if(mouse_pos.y <-deadzone) offy = mouse_pos.y+deadzone; + offx = offx*2/3; + offy = offy*2/3; + } screen_x = local_player_pos.x+offx; screen_y = local_player_pos.y+offy; @@ -1855,7 +1858,7 @@ void render_game() return; } - if (inp_key_pressed('E')) + if (inp_key_pressed(config.key_emoticon)) { if (!emoticon_selector_active) { diff --git a/src/game/client/menu.cpp b/src/game/client/menu.cpp index 9c8814889..86be2421b 100644 --- a/src/game/client/menu.cpp +++ b/src/game/client/menu.cpp @@ -775,6 +775,10 @@ static int settings_general_render() ui_do_label(column1_x, row1_y, "Name:", 36); ui_do_edit_box(config_copy.player_name, column2_x, row1_y, 300, 36, config_copy.player_name, sizeof(config_copy.player_name)); + // Dynamic camera + ui_do_label(column1_x, row2_y, "Dynamic Camera:", 36); + config_set_dynamic_camera(&config_copy, ui_do_check_box(&config_copy.dynamic_camera, column2_x, row2_y, 22, 22, config_copy.dynamic_camera)); + return 0; } @@ -802,6 +806,8 @@ static int settings_controls_render() { "Grenade:", &config_copy.key_weapon2, config_set_key_weapon2 }, { "Shotgun:", &config_copy.key_weapon3, config_set_key_weapon3 }, { "Hammer:", &config_copy.key_weapon4, config_set_key_weapon4 }, + { "Emoticon:", &config_copy.key_emoticon, config_set_key_emoticon }, + { "Screenshot:", &config_copy.key_screenshot, config_set_key_screenshot }, }; for (int i = 0; i < 6; i++) diff --git a/src/game/game_variables.h b/src/game/game_variables.h index 6b380f856..edd3f263c 100644 --- a/src/game/game_variables.h +++ b/src/game/game_variables.h @@ -1,13 +1,16 @@ -MACRO_CONFIG_INT(key_move_left, 65, 32, 512) -MACRO_CONFIG_INT(key_move_right, 68, 32, 512) +MACRO_CONFIG_INT(key_move_left, 'A', 32, 512) +MACRO_CONFIG_INT(key_move_right, 'D', 32, 512) MACRO_CONFIG_INT(key_jump, 32, 32, 512) MACRO_CONFIG_INT(key_fire, 384, 32, 512) MACRO_CONFIG_INT(key_hook, 385, 32, 512) -MACRO_CONFIG_INT(key_weapon1, 49, 32, 512) -MACRO_CONFIG_INT(key_weapon2, 50, 32, 512) -MACRO_CONFIG_INT(key_weapon3, 51, 32, 512) -MACRO_CONFIG_INT(key_weapon4, 52, 32, 512) +MACRO_CONFIG_INT(key_weapon1, '1', 32, 512) +MACRO_CONFIG_INT(key_weapon2, '2', 32, 512) +MACRO_CONFIG_INT(key_weapon3, '3', 32, 512) +MACRO_CONFIG_INT(key_weapon4, '4', 32, 512) +MACRO_CONFIG_INT(key_emoticon, 'E', 32, 512) MACRO_CONFIG_INT(scroll_weapon, 1, 0, 1) MACRO_CONFIG_INT(scorelimit, 20, 0, 1000) MACRO_CONFIG_INT(timelimit, 0, 0, 1000) + +MACRO_CONFIG_INT(dynamic_camera, 1, 0, 1)