From 182c77721e60c6a3b68cc3f1f83e485374d85096 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Tue, 11 Dec 2007 23:10:07 +0000 Subject: cleaned up the console variables --- src/engine/client/client.c | 11 +++++++---- src/engine/client/gfx.c | 6 +++--- src/engine/client/snd.c | 2 +- src/engine/config_variables.h | 16 ++++++---------- src/game/client/game_client.cpp | 14 +++++++------- src/game/client/menu2.cpp | 14 +++++++------- src/game/game_variables.h | 25 +++++++++++-------------- src/game/server/game_server.cpp | 14 +++++++------- src/game/server/srv_common.cpp | 26 +++++++++++++------------- src/game/server/srv_dm.cpp | 4 ++-- 10 files changed, 64 insertions(+), 68 deletions(-) (limited to 'src') diff --git a/src/engine/client/client.c b/src/engine/client/client.c index 7a545988..646ca4b4 100644 --- a/src/engine/client/client.c +++ b/src/engine/client/client.c @@ -950,8 +950,8 @@ static void client_update() } /* STRESS TEST: join the server again */ - if(client_state() == CLIENTSTATE_OFFLINE && config.stress && (frames%100) == 0) - client_connect(config.cl_stress_server); + if(client_state() == CLIENTSTATE_OFFLINE && config.dbg_stress && (frames%100) == 0) + client_connect(config.dbg_stress_server); /* pump the network */ client_pump_network(); @@ -996,8 +996,11 @@ static void client_run() net = netclient_open(bindaddr, 0); /* connect to the server if wanted */ + /* if(config.cl_connect[0] != 0) client_connect(config.cl_connect); + config.cl_connect[0] = 0; + */ inp_mouse_mode_relative(); @@ -1073,7 +1076,7 @@ static void client_run() { client_update(); - if(config.stress) + if(config.dbg_stress) { if((frames%10) == 0) { @@ -1093,7 +1096,7 @@ static void client_run() break; /* be nice */ - if(config.cpu_throttle || !gfx_window_active()) + if(config.cl_cpu_throttle || !gfx_window_active()) thread_sleep(1); if(reporttime < time_get()) diff --git a/src/engine/client/gfx.c b/src/engine/client/gfx.c index 31483224..c61f0cb1 100644 --- a/src/engine/client/gfx.c +++ b/src/engine/client/gfx.c @@ -185,7 +185,7 @@ int gfx_init() glfwInit(); - if(config.stress) + if(config.dbg_stress) { screen_width = 320; screen_height = 240; @@ -228,7 +228,7 @@ int gfx_init() glfwSetWindowTitle("Teewars"); /* We don't want to see the window when we run the stress testing */ - if(config.stress) + if(config.dbg_stress) glfwIconifyWindow(); /* Init vertices */ @@ -408,7 +408,7 @@ int gfx_load_texture_raw(int w, int h, int format, const void *data) int tex = 0; /* don't waste memory on texture if we are stress testing */ - if(config.stress) + if(config.dbg_stress) return -1; /* grab texture */ diff --git a/src/engine/client/snd.c b/src/engine/client/snd.c index 9d851dcc..aa155c0c 100644 --- a/src/engine/client/snd.c +++ b/src/engine/client/snd.c @@ -350,7 +350,7 @@ int snd_load_wv(const char *filename) WavpackContext *context; /* don't waste memory on sound when we are stress testing */ - if(config.stress) + if(config.dbg_stress) return -1; /* no need to load sound when we are running with no sound */ diff --git a/src/engine/config_variables.h b/src/engine/config_variables.h index 49f2a0d9..9e3fb4d7 100644 --- a/src/engine/config_variables.h +++ b/src/engine/config_variables.h @@ -1,20 +1,14 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ #include "../game/game_variables.h" -MACRO_CONFIG_INT(volume, 200, 0, 255) -MACRO_CONFIG_INT(cpu_throttle, 0, 0, 1) MACRO_CONFIG_STR(player_name, 32, "nameless tee") - MACRO_CONFIG_STR(clan_name, 32, "") MACRO_CONFIG_STR(password, 32, "") - MACRO_CONFIG_STR(rcon_password, 32, "") -MACRO_CONFIG_INT(debug, 0, 0, 1) -MACRO_CONFIG_INT(stress, 0, 0, 0) -MACRO_CONFIG_STR(cl_stress_server, 32, "localhost") -MACRO_CONFIG_STR(cl_connect, 32, "") +MACRO_CONFIG_INT(cl_cpu_throttle, 0, 0, 1) +/*MACRO_CONFIG_STR(cl_connect, 32, "")*/ MACRO_CONFIG_INT(cl_editor, 0, 0, 1) MACRO_CONFIG_STR(b_filter_string, 64, "") @@ -52,8 +46,10 @@ MACRO_CONFIG_INT(sv_port, 8303, 0, 0) MACRO_CONFIG_INT(sv_sendheartbeats, 1, 0, 1) MACRO_CONFIG_STR(sv_map, 128, "dm1") MACRO_CONFIG_INT(sv_map_reload, 0, 0, 1) - MACRO_CONFIG_INT(sv_max_clients, 8, 1, 12) - MACRO_CONFIG_INT(sv_bandwidth_mode, 0, 0, 2) +MACRO_CONFIG_INT(debug, 0, 0, 1) +MACRO_CONFIG_INT(dbg_stress, 0, 0, 0) +MACRO_CONFIG_STR(dbg_stress_server, 32, "localhost") + diff --git a/src/game/client/game_client.cpp b/src/game/client/game_client.cpp index c910014c..3621935d 100644 --- a/src/game/client/game_client.cpp +++ b/src/game/client/game_client.cpp @@ -892,7 +892,7 @@ extern "C" void modc_newsnapshot() { process_events(SNAP_CURRENT); - if(config.stress) + if(config.dbg_stress) { if((client_tick()%250) == 0) { @@ -2294,7 +2294,7 @@ void render_game() if(inp_key_presses(config.key_next_weapon) || inp_key_presses(config.key_prev_weapon)) input.wanted_weapon = 0; - else if (config.autoswitch_weapons && picked_up_weapon) + else if (config.cl_autoswitch_weapons && picked_up_weapon) { input.wanted_weapon = picked_up_weapon; } @@ -2312,7 +2312,7 @@ void render_game() } // stress testing - if(config.stress) + if(config.dbg_stress) { float t = client_localtime(); mem_zero(&input, sizeof(input)); @@ -2332,7 +2332,7 @@ void render_game() // center at char but can be moved when mouse is far away float offx = 0, offy = 0; - if (config.dynamic_camera) + if (config.cl_dynamic_camera) { int deadzone = 300; if(mouse_pos.x > deadzone) offx = mouse_pos.x-deadzone; @@ -2849,10 +2849,10 @@ extern "C" void modc_render() // handle team switching // TODO: FUGLY!!! - if(config.team != -10) + if(config.cl_team != -10) { msg_pack_start(MSG_SETTEAM, MSGFLAG_VITAL); - msg_pack_int(config.team); + msg_pack_int(config.cl_team); msg_pack_end(); client_send_msg(); } @@ -2863,7 +2863,7 @@ extern "C" void modc_render() } // - config.team = -10; + config.cl_team = -10; } diff --git a/src/game/client/menu2.cpp b/src/game/client/menu2.cpp index bc23173b..3483ecfe 100644 --- a/src/game/client/menu2.cpp +++ b/src/game/client/menu2.cpp @@ -1098,12 +1098,12 @@ static void menu2_render_settings_player(RECT main_view) ui2_do_edit_box(config.player_name, &button, config.player_name, sizeof(config.player_name)); ui2_hsplit_t(&main_view, 20.0f, &button, &main_view); - if (ui2_do_button(&config.dynamic_camera, "Dynamic camera", config.dynamic_camera, &button, ui2_draw_checkbox, 0)) - config.dynamic_camera ^= 1; + if (ui2_do_button(&config.cl_dynamic_camera, "Dynamic camera", config.cl_dynamic_camera, &button, ui2_draw_checkbox, 0)) + config.cl_dynamic_camera ^= 1; ui2_hsplit_t(&main_view, 20.0f, &button, &main_view); - if (ui2_do_button(&config.autoswitch_weapons, "Switch weapon on pickup", config.autoswitch_weapons, &button, ui2_draw_checkbox, 0)) - config.autoswitch_weapons ^= 1; + if (ui2_do_button(&config.cl_autoswitch_weapons, "Switch weapon on pickup", config.cl_autoswitch_weapons, &button, ui2_draw_checkbox, 0)) + config.cl_autoswitch_weapons ^= 1; ui2_hsplit_t(&main_view, 20.0f, &button, &main_view); if (ui2_do_button(&config.cl_nameplates, "Show name plates", config.cl_nameplates, &button, ui2_draw_checkbox, 0)) @@ -1541,7 +1541,7 @@ static void menu2_render_game(RECT main_view) static int spectate_button = 0; if(ui2_do_button(&spectate_button, "Spectate", 0, &button, ui2_draw_menu_button, 0)) { - config.team = -1; + config.cl_team = -1; menu_active = false; } } @@ -1553,7 +1553,7 @@ static void menu2_render_game(RECT main_view) static int spectate_button = 0; if(ui2_do_button(&spectate_button, "Join Red", 0, &button, ui2_draw_menu_button, 0)) { - config.team = 0; + config.cl_team = 0; menu_active = false; } } @@ -1565,7 +1565,7 @@ static void menu2_render_game(RECT main_view) static int spectate_button = 0; if(ui2_do_button(&spectate_button, "Join Blue", 0, &button, ui2_draw_menu_button, 0)) { - config.team = 1; + config.cl_team = 1; menu_active = false; } } diff --git a/src/game/game_variables.h b/src/game/game_variables.h index 9840192d..9aaaaa33 100644 --- a/src/game/game_variables.h +++ b/src/game/game_variables.h @@ -23,26 +23,15 @@ MACRO_CONFIG_INT(key_teamchat, 'Y', 32, 512) MACRO_CONFIG_INT(key_console, 256+2, 32, 512) MACRO_CONFIG_INT(key_remoteconsole, 256+3, 32, 512) -MACRO_CONFIG_INT(autoswitch_weapons, 0, 0, 1) - -MACRO_CONFIG_INT(scorelimit, 20, 0, 1000) -MACRO_CONFIG_INT(timelimit, 0, 0, 1000) -MACRO_CONFIG_STR(gametype, 32, "dm") -MACRO_CONFIG_INT(restart, 0, 0, 120) MACRO_CONFIG_INT(dbg_bots, 0, 0, 7) MACRO_CONFIG_INT(cl_predict, 1, 0, 1) MACRO_CONFIG_INT(cl_nameplates, 0, 0, 1) MACRO_CONFIG_INT(cl_nameplates_always, 0, 0, 1) - -MACRO_CONFIG_STR(sv_maprotation, 512, "") -MACRO_CONFIG_INT(sv_powerups, 1, 0, 1) - -MACRO_CONFIG_INT(dynamic_camera, 1, 0, 1) - -MACRO_CONFIG_INT(warmup, 0, 0, 0) -MACRO_CONFIG_INT(team, -10, -1, 0) +MACRO_CONFIG_INT(cl_dynamic_camera, 1, 0, 1) +MACRO_CONFIG_INT(cl_team, -10, -1, 0) +MACRO_CONFIG_INT(cl_autoswitch_weapons, 0, 0, 1) MACRO_CONFIG_INT(player_use_custom_color, 0, 0, 1) MACRO_CONFIG_INT(player_color_body, 65408, 0, 0) @@ -55,7 +44,15 @@ MACRO_CONFIG_INT(ui_page, 1, 0, 5) MACRO_CONFIG_STR(ui_server_address, 128, "localhost:8303") MACRO_CONFIG_INT(ui_scale, 100, 1, 100000) +MACRO_CONFIG_INT(sv_warmup, 0, 0, 0) MACRO_CONFIG_STR(sv_msg, 512, "") MACRO_CONFIG_INT(sv_teamdamage, 0, 0, 1) +MACRO_CONFIG_STR(sv_maprotation, 512, "") +MACRO_CONFIG_INT(sv_powerups, 1, 0, 1) +MACRO_CONFIG_INT(sv_scorelimit, 20, 0, 1000) +MACRO_CONFIG_INT(sv_timelimit, 0, 0, 1000) +MACRO_CONFIG_STR(sv_gametype, 32, "dm") +MACRO_CONFIG_INT(sv_restart, 0, 0, 120) + diff --git a/src/game/server/game_server.cpp b/src/game/server/game_server.cpp index b91db050..353e4188 100644 --- a/src/game/server/game_server.cpp +++ b/src/game/server/game_server.cpp @@ -712,7 +712,7 @@ int player::handle_weapons() { vec2 direction = normalize(vec2(input.target_x, input.target_y)); - if(config.stress) + if(config.dbg_stress) { for(int i = 0; i < NUM_WEAPONS; i++) { @@ -1539,14 +1539,14 @@ void mods_tick() if(world->paused) // make sure that the game object always updates gameobj->tick(); - if(config.restart) + if(config.sv_restart) { - if(config.restart > 1) - gameobj->do_warmup(config.restart); + if(config.sv_restart > 1) + gameobj->do_warmup(config.sv_restart); else gameobj->startround(); - config.restart = 0; + config.sv_restart = 0; } if(config.sv_msg[0] != 0) @@ -1736,9 +1736,9 @@ void mods_init() players = new player[MAX_CLIENTS]; // select gametype - if(strcmp(config.gametype, "ctf") == 0) + if(strcmp(config.sv_gametype, "ctf") == 0) gameobj = new gameobject_ctf; - else if(strcmp(config.gametype, "tdm") == 0) + else if(strcmp(config.sv_gametype, "tdm") == 0) gameobj = new gameobject_tdm; else gameobj = new gameobject_dm; diff --git a/src/game/server/srv_common.cpp b/src/game/server/srv_common.cpp index 14cabaf3..83754780 100644 --- a/src/game/server/srv_common.cpp +++ b/src/game/server/srv_common.cpp @@ -7,12 +7,12 @@ gameobject::gameobject() : entity(OBJTYPE_GAME) { // select gametype - if(strcmp(config.gametype, "ctf") == 0) + if(strcmp(config.sv_gametype, "ctf") == 0) { gametype = GAMETYPE_CTF; dbg_msg("game", "-- Capture The Flag --"); } - else if(strcmp(config.gametype, "tdm") == 0) + else if(strcmp(config.sv_gametype, "tdm") == 0) { gametype = GAMETYPE_TDM; dbg_msg("game", "-- Team Death Match --"); @@ -24,7 +24,7 @@ gameobject::gameobject() } // - do_warmup(config.warmup); + do_warmup(config.sv_warmup); game_over_tick = -1; sudden_death = 0; round_start_tick = server_tick(); @@ -187,22 +187,22 @@ void gameobject::tick() // update browse info int prog = -1; - if(config.timelimit > 0) - prog = max(prog, (server_tick()-round_start_tick) * 100 / (config.timelimit*server_tickspeed()*60)); + if(config.sv_timelimit > 0) + prog = max(prog, (server_tick()-round_start_tick) * 100 / (config.sv_timelimit*server_tickspeed()*60)); - if(config.scorelimit) + if(config.sv_scorelimit) { if(is_teamplay) { - prog = max(prog, (teamscore[0]*100)/config.scorelimit); - prog = max(prog, (teamscore[1]*100)/config.scorelimit); + prog = max(prog, (teamscore[0]*100)/config.sv_scorelimit); + prog = max(prog, (teamscore[1]*100)/config.sv_scorelimit); } else { for(int i = 0; i < MAX_CLIENTS; i++) { if(players[i].client_id != -1) - prog = max(prog, (players[i].score*100)/config.scorelimit); + prog = max(prog, (players[i].score*100)/config.sv_scorelimit); } } } @@ -220,8 +220,8 @@ void gameobject::snap(int snapping_client) game->game_over = game_over_tick==-1?0:1; game->sudden_death = sudden_death; - game->score_limit = config.scorelimit; - game->time_limit = config.timelimit; + game->score_limit = config.sv_scorelimit; + game->time_limit = config.sv_timelimit; game->round_start_tick = round_start_tick; game->gametype = gametype; @@ -250,8 +250,8 @@ void gameobject::do_team_wincheck() if(game_over_tick == -1 && !warmup) { // check score win condition - if((config.scorelimit > 0 && (teamscore[0] >= config.scorelimit || teamscore[1] >= config.scorelimit)) || - (config.timelimit > 0 && (server_tick()-round_start_tick) >= config.timelimit*server_tickspeed()*60)) + if((config.sv_scorelimit > 0 && (teamscore[0] >= config.sv_scorelimit || teamscore[1] >= config.sv_scorelimit)) || + (config.sv_timelimit > 0 && (server_tick()-round_start_tick) >= config.sv_timelimit*server_tickspeed()*60)) { if(teamscore[0] != teamscore[1]) endround(); diff --git a/src/game/server/srv_dm.cpp b/src/game/server/srv_dm.cpp index 1dd90874..d5720856 100644 --- a/src/game/server/srv_dm.cpp +++ b/src/game/server/srv_dm.cpp @@ -27,8 +27,8 @@ void gameobject_dm::tick() } // check score win condition - if((config.scorelimit > 0 && topscore >= config.scorelimit) || - (config.timelimit > 0 && (server_tick()-round_start_tick) >= config.timelimit*server_tickspeed()*60)) + if((config.sv_scorelimit > 0 && topscore >= config.sv_scorelimit) || + (config.sv_timelimit > 0 && (server_tick()-round_start_tick) >= config.sv_timelimit*server_tickspeed()*60)) { if(topscore_count == 1) endround(); -- cgit 1.4.1