If anyone wants to add a ton of maps easily (say, you're bored)...
You can get PHP, install the script below, and then easily get map information. It's kind of hacky if you bother to read it.
Thanks to sort for giving me the offset to the position about the entities. =]
<?php
// By sk89q
// Available under GPLv2
$map_info_dir = "C:/Games/Paintball2/pball/maps/mapinfo";
///////////////
$file = $argv[1];
$filename = substr(basename($file), 0, -4);
// Entity parser
$contents = file_get_contents($file);
$contains_ctp = strpos($contents, "ctp1/") !== false ? "yes" : "no";
$entities_offset = unpack("Voffset", substr($contents, 8, 4));
$entities_offset = $entities_offset['offset'];
preg_match_all('#^{$(.*?)^\}$#sim', trim(substr($contents, $entities_offset)), $matches);
$matches = $matches[1];
unset($contents);
$entities = array();
for($i = 0; $i < count($matches); $i++)
{
if(strpos($matches[$i], "classname") === false)
continue;
$data = explode("\n", $matches[$i]);
$entity = array();
foreach($data as $line)
{
$line = trim($line);
preg_match('#^["\']([^"]+)["\'] ["\'](.*)["\']$#', $line, $m);
if(!$m[2])
continue;
$entity[strtolower($m[1])] = $m[2];
}
$entities[] = $entity;
}
unset($matches);
if(count($entities) == 0)
{
echo "ERROR: No entities parsed!\n";
exit;
}
//print_r($entities);
// Process
$guns = array('pgp' => 0,
'trracer' => 1,
'stingray' => 2,
'vm68' => 3,
'carbine' => 4,
'spyder' => 5,
'autococker' => 6,
'automag' => 7,
'low' => 2,
'medium' => 5,
'high' => 7);
$guns_to = array('pgp', 'trracer', 'stingray', 'vm68', 'carbine', 'spyder', 'autococker', 'automag');
$map_name = "";
$starting_best_gun = 0;
$best_gun = 0;
$has_dsm = "no";
$has_jail = "no";
$sky_type = "";
$teams = array();
$flags = array();
$worldspawn_entity = array();
foreach($entities as $entity)
{
// Map name, teams, sky
if($entity['classname'] == "worldspawn")
{
$worldspawn_entity = $entity;
$map_name = $entity['message'];
foreach($entity as $key => $value)
{
if(preg_match("#^team[0-9]$#", $key))
{
$teams[$key] = 1;
}
}
if(in_array($entity['sky'], array("", "pbsky2", "pbsky4", "riverscape1", "arctic1")))
{
$sky_type = "daytime";
}
else if(in_array($entity['sky'], array("unit1_")))
{
$sky_type = "orange";
}
else if(in_array($entity['sky'], array("pbsky1")))
{
$sky_type = "gloomy";
}
else if(in_array($entity['sky'], array("pbsky3")))
{
$sky_type = "night";
}
}
// Flags
if($entity['classname'] == "flag")
{
if(in_array($entity['gamemode'], array(4, 8, 0, "")))
{
if(intval($flag['teamnumber']) != 0)
{
$flags[$flag['teamnumber']]++;
}
else
{
for($i = 1; $i <= 4; $i++)
{
$flags[$i]++;
}
}
}
}
// Best starting gun, jail
if($entity['classname'] == "info_player_deathmatch")
{
if($entity['GiveGun'])
{
if($guns[strtolower($entity['GiveGun'])] > $starting_best_gun)
$starting_best_gun = $guns[strtolower($entity['GiveGun'])];
}
if($entity['jail'])
{
$has_jail = "yes";
}
}
// Best gun
if($entity['classname'] == "weapon_pballgun")
{
if($entity['group'])
{
}
else if($entity['type'])
{
if($guns[strtolower($entity['type'])] > $best_gun)
$best_gun = $guns[strtolower($entity['type'])];
}
else
{
$best_gun = 7;
}
}
// DSM
if($entity['classname'] == "func_dsm")
{
$has_dsm = "yes";
}
}
// Change format
$team_count = count($teams);
$flag_array_keys = array_keys($flags);
$flag_count = count($flags[$flag_array_keys[0]]);
// Other facts
$filesize = number_format(round(filesize($file)/1024))."kb";
$md5_checksum = md5_file($file);
// Game modes
$modes = array();
if($worldspawn_entity['gamemode'] & 1)
$modes[] = "dm";
if($worldspawn_entity['gamemode'] & 2)
$modes[] = "1-flag";
if($worldspawn_entity['gamemode'] & 4)
$modes[] = "2-flag";
if($worldspawn_entity['gamemode'] & 8)
$modes[] = "siege";
if($worldspawn_entity['gamemode'] & 16)
$modes[] = "koth";
if($worldspawn_entity['gamemode'] & 64)
$modes[] = "pong";
$modes_list = implode(" ", $modes);
// Map info
if(file_exists("$map_info_dir/$filename.txt"))
{
$map_info = file_get_contents("$map_info_dir/$filename.txt");
// Min players
preg_match("#minplayers ([0-9]+)#i", $map_info, $m);
$min_players = $m[1];
// Max players
preg_match("#maxplayers ([0-9]+)#i", $map_info, $m);
$max_players = $m[1];
// Max players
preg_match("#^supports (.+)$#im", $map_info, $m);
$modes_list2 = $m[1];
}
echo "* guessed\n";
echo "Map name: $map_name\n";
echo "Filesize: $filesize\n";
echo "MD5 checksum: $md5_checksum\n";
echo "Game modes: $modes_list\n";
echo "Game modes (mapinfo): $modes_list2\n";
echo "Min players: $min_players\n";
echo "Max players: $max_players\n";
echo "Contains CTP*: {$contains_ctp}\n";
echo "Teams: $team_count\n";
echo "Flags per team: $flag_count\n";
echo "Best starting gun*: {$guns_to[$starting_best_gun]}\n";
echo "Best gun: {$guns_to[$best_gun]}\n";
echo "Has DSM: $has_dsm\n";
echo "Has jail: $has_jail\n";
echo "Sky type: $sky_type\n";
fread(STDIN, 1024);
?>