2011-03-22 02:34:45 +01:00
|
|
|
var g_Map;
|
|
|
|
|
|
|
|
var g_Environment = {
|
2011-03-22 09:19:19 +01:00
|
|
|
SkySet: "default",
|
2011-03-28 00:00:49 +02:00
|
|
|
SunColour: {r: 0.749020, g: 0.749020, b: 0.749020, a: 0},
|
2011-03-22 09:19:19 +01:00
|
|
|
SunElevation: 0.785398,
|
|
|
|
SunRotation: 5.49779,
|
2011-03-28 00:00:49 +02:00
|
|
|
TerrainAmbientColour: {r: 0.501961, g: 0.501961, b: 0.501961, a: 0},
|
2011-03-23 09:12:04 +01:00
|
|
|
UnitsAmbientColour: {r: 0.501961, g: 0.501961, b: 0.501961, a: 0},
|
2011-03-22 02:34:45 +01:00
|
|
|
Water: {
|
|
|
|
WaterBody: {
|
|
|
|
Type: "default",
|
2011-03-23 09:12:04 +01:00
|
|
|
Colour: {r: 0.3, g: 0.35, b: 0.7, a: 0},
|
2011-03-22 09:19:19 +01:00
|
|
|
Height: 5,
|
2011-03-22 02:34:45 +01:00
|
|
|
Shininess: 150,
|
|
|
|
Waviness: 8,
|
2011-03-22 09:19:19 +01:00
|
|
|
Murkiness: 0.45,
|
2011-03-23 09:12:04 +01:00
|
|
|
Tint: {r: 0.28, g: 0.3, b: 0.59, a: 0},
|
|
|
|
ReflectionTint: {r: 0.28, g: 0.3, b: 0.59, a: 0},
|
2011-03-22 09:19:19 +01:00
|
|
|
ReflectionTintStrength: 0.0
|
2011-03-22 02:34:45 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
var g_Camera = {
|
|
|
|
Position: {x: 100, y: 150, z: -100},
|
|
|
|
Rotation: 0,
|
|
|
|
Declination: 0.523599
|
|
|
|
};
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
function InitMap()
|
|
|
|
{
|
2011-04-10 07:31:18 +02:00
|
|
|
if (g_MapSettings === undefined)
|
|
|
|
{
|
|
|
|
// Should never get this far, failed settings would abort prior to loading scripts
|
|
|
|
error("InitMapGen: settings missing");
|
2011-03-22 02:34:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Create new map
|
|
|
|
log("Creating new map...");
|
|
|
|
var terrain = createTerrain(g_MapSettings.BaseTerrain);
|
|
|
|
|
2011-04-10 07:31:18 +02:00
|
|
|
// XXX: Temporary hack to keep typed arrays from complaining about invalid arguments,
|
|
|
|
// until SpiderMonkey gets upgraded
|
|
|
|
g_MapSettings.Size = Math.floor(g_MapSettings.Size);
|
|
|
|
|
2011-03-22 02:34:45 +01:00
|
|
|
g_Map = new Map(g_MapSettings.Size * TILES_PER_PATCH, g_MapSettings.BaseHeight);
|
|
|
|
g_Map.initTerrain(terrain);
|
|
|
|
}
|
|
|
|
|
|
|
|
function ExportMap()
|
|
|
|
{ // Wrapper for engine function
|
|
|
|
log("Saving map...");
|
|
|
|
|
|
|
|
// Get necessary data from map
|
|
|
|
var data = g_Map.getMapData();
|
|
|
|
|
|
|
|
// Add environment and camera settings
|
|
|
|
g_Environment.Water.WaterBody.Height = SEA_LEVEL - 0.1;
|
|
|
|
data.Environment = g_Environment;
|
|
|
|
data.Camera = g_Camera;
|
|
|
|
|
|
|
|
RMS.ExportMap(data);
|
|
|
|
}
|