From b089d7460cdbf14c9303224b120fa0db24b7ae4c Mon Sep 17 00:00:00 2001 From: Ludwig Nussel Date: Sat, 8 Apr 2006 08:00:56 +0000 Subject: [PATCH] - Tremulous support - don't pass -steam option to hl2 - strip newline when reading the doom3 version file git-svn-id: http://svn.code.sf.net/p/xqf/code/trunk@779 d2ac09be-c843-0410-8b1f-f8a84130e0ec --- xqf/ChangeLog | 5 +++++ xqf/src/game.c | 11 ++++++----- xqf/src/game.h | 1 + xqf/src/games.c | 38 ++++++++++++++++++++++++++++++++++++-- xqf/src/games.xml | 24 ++++++++++++++++++++++-- xqf/src/pixmaps.c | 1 + xqf/src/pref.c | 29 +++++++++++++++++++++++++++++ xqf/src/pref.h | 1 + xqf/src/qstat.cfg | 13 +++++++++++++ xqf/src/source.c | 2 ++ xqf/src/stat.c | 2 +- xqf/src/xpm/tremulous.xpm | 35 +++++++++++++++++++++++++++++++++++ xqf/src/xqf.h | 1 + 13 files changed, 153 insertions(+), 10 deletions(-) create mode 100644 xqf/src/xpm/tremulous.xpm diff --git a/xqf/ChangeLog b/xqf/ChangeLog index 79b555f..af68865 100644 --- a/xqf/ChangeLog +++ b/xqf/ChangeLog @@ -1,3 +1,8 @@ +Apr 08, 2006: +- Tremulous support +- don't pass -steam option to hl2 +- strip newline when reading the doom3 version file + Jan 05, 2006: - fix cursor navigation in server list (thanks Simon Philips) diff --git a/xqf/src/game.c b/xqf/src/game.c index 95a4613..17c9c90 100644 --- a/xqf/src/game.c +++ b/xqf/src/game.c @@ -56,6 +56,7 @@ extern void qw_cmd_or_dir_changed(struct game* g); extern void q2_cmd_or_dir_changed(struct game* g); extern void ut2004_cmd_or_dir_changed(struct game* g); extern void doom3_cmd_or_dir_changed(struct game* g); +extern void tremulous_cmd_or_dir_changed(struct game* g); static struct player *poqs_parse_player(char *tokens[], int num, struct server *s); static struct player *qw_parse_player(char *tokens[], int num, struct server *s); @@ -162,6 +163,7 @@ static struct quake_private jk3_private; static struct quake_private doom3_private; static struct quake_private quake4_private; static struct quake_private warsow_private; +static struct quake_private tremulous_private; #include "games.c" @@ -1483,6 +1485,10 @@ static void q3_analyze_serverinfo (struct server *s) { { s->type=SOF2S_SERVER; } + else if(!strncmp(info_ptr[1],"tremulous",9)) + { + s->type=TREMULOUS_SERVER; + } break; } @@ -2528,11 +2534,6 @@ static int hl_exec (const struct condef *con, int forkit) { while ((argv[argi] = strtok (NULL, delim)) != NULL) argi++; - if(con->s->type == HL2_SERVER) // XXX - { - argv[argi++] = "-steam"; - } - if (con->gamedir) { argv[argi++] = "-game"; argv[argi++] = con->gamedir; diff --git a/xqf/src/game.h b/xqf/src/game.h index 4f32726..2c0bde7 100644 --- a/xqf/src/game.h +++ b/xqf/src/game.h @@ -43,6 +43,7 @@ enum { GAME_LAUNCH_HOSTPORT = 0x0800, // use hostport rule as port when launching GAME_MASTER_CDKEY = 0x1000, // master server requires CD key GAME_Q3COLORS = 0x2000, // Q3 color codes + GAME_MASTER_STEAM = 0x4000, // server side filter }; struct game { diff --git a/xqf/src/games.c b/xqf/src/games.c index 85e9bf7..95e89c7 100644 --- a/xqf/src/games.c +++ b/xqf/src/games.c @@ -42,6 +42,8 @@ static char* stringlist039[] = { "data", NULL }; static char* stringlist040[] = { "nexuiz", NULL }; static char* stringlist041[] = { "basewsw", NULL }; static char* stringlist042[] = { "warsow", NULL }; +static char* stringlist043[] = { "base", NULL }; +static char* stringlist044[] = { "tremulous", NULL }; struct game games[] = { { type : Q1_SERVER, @@ -361,7 +363,7 @@ struct game games[] = { }, { type : HL_SERVER, - flags : GAME_CONNECT | GAME_PASSWORD | GAME_RCON, + flags : GAME_CONNECT | GAME_PASSWORD | GAME_RCON | GAME_MASTER_STEAM, name : "Half-Life", default_port : 27015, default_master_port : 27010, @@ -384,7 +386,7 @@ struct game games[] = { }, { type : HL2_SERVER, - flags : GAME_CONNECT | GAME_PASSWORD, + flags : GAME_CONNECT | GAME_PASSWORD | GAME_MASTER_STEAM, name : "Half-Life 2", default_port : 27015, default_master_port : 27011, @@ -876,6 +878,38 @@ struct game games[] = { main_mod : stringlist041, command : stringlist042, }, + { + type : TREMULOUS_SERVER, + flags : GAME_CONNECT | GAME_PASSWORD | GAME_RCON | GAME_QUAKE3_MASTERPROTOCOL | GAME_Q3COLORS, + name : "Tremulous", + default_port : 30720, + default_master_port : 30710, + id : "TREMULOUS", + qstat_str : "TREMULOUS", + qstat_option : "-tremulous", + qstat_master_option : "-tremulousm", + icon : "tremulous.xpm", + parse_player : q3_parse_player, + parse_server : quake_parse_server, + analyze_serverinfo : q3_analyze_serverinfo, + config_is_valid : config_is_valid_generic, + exec_client : q3_exec, + custom_cfgs : quake_custom_cfgs, + save_info : quake_save_info, + init_maps : q3_init_maps, + has_map : quake_has_map, + get_mapshot : q3_get_mapshot, + arch_identifier : "version", + identify_cpu : identify_cpu, + identify_os : identify_os, + cmd_or_dir_changed : tremulous_cmd_or_dir_changed, + prefs_load : q3_prefs_load_common, + update_prefs : tremulous_update_prefs, + default_home : "~/.tremulous", + pd : &tremulous_private, + main_mod : stringlist043, + command : stringlist044, + }, { type : GPS_SERVER, flags : GAME_CONNECT, diff --git a/xqf/src/games.xml b/xqf/src/games.xml index 76e5ab0..cbdb5bc 100644 --- a/xqf/src/games.xml +++ b/xqf/src/games.xml @@ -302,7 +302,7 @@ HL_SERVER Half-Life - GAME_CONNECT | GAME_PASSWORD | GAME_RCON + GAME_CONNECT | GAME_PASSWORD | GAME_RCON | GAME_MASTER_STEAM 27015 27010 HLS @@ -322,7 +322,7 @@ HL2_SERVER Half-Life 2 - GAME_CONNECT | GAME_PASSWORD + GAME_CONNECT | GAME_PASSWORD | GAME_MASTER_STEAM 27015 27011 A2S @@ -672,6 +672,26 @@ basewsw warsow_private + + Q3_SERVER + TREMULOUS_SERVER + Tremulous + 30720 + 30710 + TREMULOUS + TREMULOUS + -tremulous + -tremulousm + tremulous.xpm + config_is_valid_generic + tremulous + ~/.tremulous + tremulous_cmd_or_dir_changed + q3_prefs_load_common + tremulous_update_prefs + base + tremulous_private + GPS_SERVER Generic Gamespy diff --git a/xqf/src/pixmaps.c b/xqf/src/pixmaps.c index 9a072e1..1c9995e 100644 --- a/xqf/src/pixmaps.c +++ b/xqf/src/pixmaps.c @@ -70,6 +70,7 @@ #include "xpm/netp.xpm" #include "xpm/nexuiz.xpm" #include "xpm/warsow.xpm" +#include "xpm/tremulous.xpm" #include "xpm/gamespy3d.xpm" #include "xpm/ssam.xpm" diff --git a/xqf/src/pref.c b/xqf/src/pref.c index 60f605a..a5a077d 100644 --- a/xqf/src/pref.c +++ b/xqf/src/pref.c @@ -445,6 +445,19 @@ static struct q3_common_prefs_s warsow_prefs = defproto : "6", }; +static const char* tremulous_masterprotocols[] = { + "auto", + "69 - v1.1.0", + NULL +}; + +static struct q3_common_prefs_s tremulous_prefs = +{ + protocols: tremulous_masterprotocols, + defproto : "69", +}; + + static struct q3_common_prefs_s* get_pref_widgets_for_game(enum server_type type); static void game_file_dialog(enum server_type type); @@ -897,6 +910,9 @@ static void doom3_detect_version(struct game* g) if(!fgets(line, sizeof(line), f)) goto out; + if(strlen(line) && line[strlen(line)-1] == '\n') + line[strlen(line)-1] = '\0'; + debug(3, "detected %s protocol version %s", g->name, line); game_set_attribute(g->type, "_masterprotocol", g_strdup(line)); @@ -918,6 +934,12 @@ void quake4_update_prefs (struct game* g) doom3_detect_version(g); } +void tremulous_update_prefs (struct game* g) +{ + q3_update_prefs_common(g); + doom3_detect_version(g); +} + void tribes2_update_prefs (struct game* g) { char* str; @@ -3067,6 +3089,7 @@ static struct q3_common_prefs_s* get_pref_widgets_for_game(enum server_type type case JK3_SERVER: return &jk3_prefs; case NEXUIZ_SERVER: return &nexuiz_prefs; case WARSOW_SERVER: return &warsow_prefs; + case TREMULOUS_SERVER: return &tremulous_prefs; default: return NULL; } } @@ -4629,6 +4652,7 @@ static struct generic_prefs* new_generic_prefs (void) { new_genprefs[EF_SERVER].add_options_to_notebook = add_q3_options_to_notebook; new_genprefs[NEXUIZ_SERVER].add_options_to_notebook = add_q3_options_to_notebook; new_genprefs[WARSOW_SERVER].add_options_to_notebook = add_q3_options_to_notebook; + new_genprefs[TREMULOUS_SERVER].add_options_to_notebook = add_q3_options_to_notebook; for (i = 0; i < GAMES_TOTAL; i++) { new_genprefs[i].pref_dir = g_strdup (games[i].dir); @@ -5335,3 +5359,8 @@ void doom3_cmd_or_dir_changed(struct game* g) { doom3_detect_version(g); } + +void tremulous_cmd_or_dir_changed(struct game* g) +{ + doom3_detect_version(g); +} diff --git a/xqf/src/pref.h b/xqf/src/pref.h index 6d26f6e..2cb76bd 100644 --- a/xqf/src/pref.h +++ b/xqf/src/pref.h @@ -132,6 +132,7 @@ void q3_update_prefs (struct game* g); void q3_update_prefs_common (struct game* g); void doom3_update_prefs (struct game* g); void quake4_update_prefs (struct game* g); +void tremulous_update_prefs (struct game* g); void tribes2_update_prefs (struct game* g); void ut2004_update_prefs (struct game* g); diff --git a/xqf/src/qstat.cfg b/xqf/src/qstat.cfg index 0a3c2a1..8a3fdc9 100644 --- a/xqf/src/qstat.cfg +++ b/xqf/src/qstat.cfg @@ -183,3 +183,16 @@ gametype WARSOWM new extend Q3M master query = empty full master for gametype = WARSOWS end + +gametype TREMULOUS new extend Q3S + name = Tremulous + template var = TREMULOUS + game rule = gamename +end +gametype TREMULOUSM new extend Q3M + name = Tremulous Master + template var = TREMULOUSMASTER + default port = 30710 + master protocol = 69 + master for gametype = TREMULOUS +end diff --git a/xqf/src/source.c b/xqf/src/source.c index f3b544f..0b64f50 100644 --- a/xqf/src/source.c +++ b/xqf/src/source.c @@ -1151,6 +1151,8 @@ static char *builtin_masters_update_info[] = { "ADD WARSOWS master://ghdigital.com ghdigital.com", "ADD WARSOWS master://dpmaster.deathmask.net dpmaster.deathmask.net", + "ADD TREMULOUS master://master.tremulous.net:30710 tremulous.net", + "ADD QS lan://255.255.255.255 LAN", "ADD QWS lan://255.255.255.255 LAN", "ADD Q2S lan://255.255.255.255 LAN", diff --git a/xqf/src/stat.c b/xqf/src/stat.c index 71c65c8..a41a997 100644 --- a/xqf/src/stat.c +++ b/xqf/src/stat.c @@ -1343,7 +1343,7 @@ static struct stat_conn *stat_update_master_qstat (struct stat_job *job, arg_type = g_strdup_printf("%s,outfile", master_qstat_option(m)); } } - else if( m->type == HL_SERVER && current_server_filter > 0 && (cur_filter & FILTER_SERVER_MASK)) + else if( (games[m->type].flags & GAME_MASTER_STEAM) && current_server_filter > 0 && (cur_filter & FILTER_SERVER_MASK)) { struct server_filter_vars* filter = g_array_index (server_filters, struct server_filter_vars*, current_server_filter-1); diff --git a/xqf/src/xpm/tremulous.xpm b/xqf/src/xpm/tremulous.xpm new file mode 100644 index 0000000..2363e3c --- /dev/null +++ b/xqf/src/xpm/tremulous.xpm @@ -0,0 +1,35 @@ +/* XPM */ +static char * tremulous_xpm[] = { +"16 16 16 1", +" c None", +". c #000000", +"+ c #010101", +"@ c #020202", +"# c #030303", +"$ c #040404", +"% c #050505", +"& c #060606", +"* c #070707", +"= c #080808", +"- c #090909", +"; c #0A0A0A", +"> c #0B0B0B", +", c #0C0C0C", +"' c #0D0D0D", +") c #0E0E0E", +" & ", +" =.+ ", +" * +.. $ ", +" -+ ...# #; ", +" %@ +.. .* ", +" +# )...,+& ", +" @@+.... ", +" %..... ", +" $.....+ ", +" -$+...... ", +" ....., ", +" *....++, ", +" # #.@ # ", +" & > ", +" ' ", +" "}; diff --git a/xqf/src/xqf.h b/xqf/src/xqf.h index be600f5..d775950 100644 --- a/xqf/src/xqf.h +++ b/xqf/src/xqf.h @@ -133,6 +133,7 @@ enum server_type { NETP_SERVER, NEXUIZ_SERVER, WARSOW_SERVER, + TREMULOUS_SERVER, GPS_SERVER, UNKNOWN_SERVER };