#!/usr/bin/perl
#
# (C)2001 by Falcon <falcon@lemuria.org>
# released to the public domain - do what you wish
#

$dedicated=1;
$gametype=0;

print "Q3TC Dedicated Server\n";
print "=====================\n\n";
do {
    print "(I)nternet or (L)an mode? ";
    chomp($input=<STDIN>);
} while ($input ne "i"&&$input ne "I"&&$input ne "l"&&$input ne "L");
if ($input eq "i" || $input eq "I") {
    $dedicated=2;
} else {
    $dedicated=1;
}
print "\n";
print "(1) Free For All\n";
print "(2) Survivor\n";
print "(3) Team Deathmatch\n";
print "(4) Team Survivor\n";

do {
    print "Game Type? ";
    chomp($input=<STDIN>);
} while ($input ne "1"&&$input ne "2"&&$input ne "3"&&$input ne "4");
if ($input eq "1") { $gametype=0; }
if ($input eq "2") { $gametype=3; }
if ($input eq "3") { $gametype=4; }
if ($input eq "4") { $gametype=6; }


# we're doing some bouncing around here, trying to automatically determine
# the location and name of the q3 executable
@guesses=("./quake3","quake3","../quake3","quake3.exe","..\quake3.exe");
foreach $exe (@guesses) {
    exec("$exe +set dedicated $dedicated +set fs_game q3tc +set vm_game 2 +set g_gametype $gametype +exec q3tc_server.cfg");
}
