From 8c08cd1522644565618d5219f92743052d5aa8a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Witold=20Pi=C5=82at?= Date: Thu, 23 Oct 2014 01:19:44 +0200 Subject: [PATCH 1/2] define missing OF macro --- src/zip/ioapi.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/zip/ioapi.h b/src/zip/ioapi.h index d87be00..610f579 100644 --- a/src/zip/ioapi.h +++ b/src/zip/ioapi.h @@ -35,6 +35,10 @@ extern "C" { #endif +#ifndef OF +#define OF(args) args +#endif + typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); From c8f6c25c06f8d326b9bff5280ff4f1365f759482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Witold=20Pi=C5=82at?= Date: Thu, 23 Oct 2014 18:10:45 +0200 Subject: [PATCH 2/2] fix Jedi Outcast support --- src/game.c | 36 +++++++++++++++++++++++++++++++++--- src/games.c | 2 +- src/games.xml | 2 +- src/pref.c | 4 ++-- src/qstat.cfg | 3 ++- src/source.c | 4 +++- 6 files changed, 42 insertions(+), 9 deletions(-) diff --git a/src/game.c b/src/game.c index f9b71ba..9f3c644 100644 --- a/src/game.c +++ b/src/game.c @@ -1229,12 +1229,12 @@ static char *jk2_gametypes[MAX_JK2_TYPES] = { "FFA", // 0 - Free For All "Holocron", // 1 - Holocron "Jedi Master", // 2 - Jedi Master - "Duell", // 3 - Duell + "Duel", // 3 - Duel "FFA", // 4 - Free For All "TFFA", // 5 - Team Free For All NULL, // 6 - Unknown "CTF", // 7 - Capture the Flag - "Capture the Ysalimari" // 8 - Capture the Ysalimari + "CTY" // 8 - Capture the Ysalimari }; #define MAX_JK3_TYPES 9 @@ -1605,6 +1605,35 @@ void q3_decode_gametype (struct server *s, struct q3a_gametype_s map[]) { } } +void q3_decode_gametype_fallback (struct server *s, struct q3a_gametype_s map[]) { + char *endptr; + int n; + struct q3a_gametype_s* ptr; + + if (!s->game) return; + + n = strtol (s->gametype, &endptr, 10); + + // strtol returns a pointer to the first invalid digit, if both pointers + // are equal there was no number at all + if (s->gametype == endptr || n < 0) + return; + + // Exact match not found - use the first one in the list + // which should be the game's original game types + if ( n < map->number && map->gametypes[n] ) + s->gametype = map->gametypes[n]; + + for ( ptr=map; ptr && ptr->mod; ptr++ ) { + if ( !strcasecmp (s->game, ptr->mod) + && n < ptr->number + && ptr->gametypes[n] ) { + s->gametype = ptr->gametypes[n]; + break; + } + } +} + static void q3_analyze_serverinfo (struct server *s) { char **info_ptr; long n; @@ -1825,7 +1854,8 @@ static void q3_analyze_serverinfo (struct server *s) { q3_decode_gametype( s, wolfet_gametype_map ); } else if (s->type == JK2_SERVER) { - q3_decode_gametype( s, jk2_gametype_map ); + // There is a ton of mods and they all use default gametype numbers + q3_decode_gametype_fallback( s, jk2_gametype_map ); } else if (s->type == JK3_SERVER) { q3_decode_gametype( s, jk3_gametype_map ); diff --git a/src/games.c b/src/games.c index 5c253a5..f0aaa44 100644 --- a/src/games.c +++ b/src/games.c @@ -41,7 +41,7 @@ static char* stringlist038[] = { "main", NULL }; static char* stringlist039[] = { "codmp", NULL }; static char* stringlist040[] = { "savage", NULL }; static char* stringlist041[] = { "base", NULL }; -static char* stringlist042[] = { "jamp", NULL }; +static char* stringlist042[] = { "jk2mp", NULL }; static char* stringlist043[] = { "base", NULL }; static char* stringlist044[] = { "jamp", NULL }; static char* stringlist045[] = { "netpanzer", NULL }; diff --git a/src/games.xml b/src/games.xml index d235ced..c432f54 100644 --- a/src/games.xml +++ b/src/games.xml @@ -671,7 +671,7 @@ jk2.xpm config_is_valid_generic NULL - jamp + jk2mp q3_prefs_load_common q3_update_prefs_common base diff --git a/src/pref.c b/src/pref.c index 5daa8c6..3806f29 100644 --- a/src/pref.c +++ b/src/pref.c @@ -374,7 +374,7 @@ static struct q3_common_prefs_s cod_prefs = { }; static const char* jk2_masterprotocols[] = { - "26 - v1.5", + "15 - v1.02", "16 - v1.04", NULL }; @@ -387,7 +387,7 @@ static const char* jk3_masterprotocols[] = { static struct q3_common_prefs_s jk2_prefs = { protocols: jk2_masterprotocols, - defproto : "26", + defproto : "16", }; static struct q3_common_prefs_s jk3_prefs = { diff --git a/src/qstat.cfg b/src/qstat.cfg index 35428ba..727cdac 100644 --- a/src/qstat.cfg +++ b/src/qstat.cfg @@ -344,7 +344,8 @@ end gametype JK2M new extend JK3M name = Jedi Knight 2 default port = 28060 - master protocol = 26 + template var = JK2MASTER + master protocol = 16 master for gametype = JK2S end diff --git a/src/source.c b/src/source.c index b29640e..57487c2 100644 --- a/src/source.c +++ b/src/source.c @@ -1119,7 +1119,9 @@ static char *builtin_masters_update_info[] = { "DELETE BF1942 http://tourneys.multiplay.co.uk/public/servers.pl?opt=ListGamespy&event=Online&type=BF1942&hostport=1 multiplay.co.uk - BF1942", - "ADD JK2S master://masterjk2.ravensoft.com:29060 Ravensoft", + "ADD JK2S master://masterjk2.ravensoft.com:28060 Ravensoft", + "ADD JK2S master://master.ouned.de:28060 master.ouned.de", + "ADD JK3S master://masterjk3.ravensoft.com:29060 Ravensoft", "ADD UT2004S master://ut2004master1.epicgames.com:28902 Epic 1",