forked from Mirrors/openclonk
Add another default scenario template
parent
22306bd266
commit
ef5626774d
|
@ -0,0 +1,85 @@
|
|||
/* Default scenario map */
|
||||
// Use gold rush map with minor adjustments
|
||||
|
||||
#include Library_Map
|
||||
|
||||
// Called be the engine: draw the complete map here.
|
||||
public func InitializeMap(proplist map)
|
||||
{
|
||||
// Draw the main surface: a rectangle with some turbulence on top makes.
|
||||
var rect = {X = 0, Y = Min(map.Hgt / 7 + 5, map.Hgt / 3), Wdt = map.Wdt, Hgt = 6 * map.Hgt / 10};
|
||||
rect.Hgt = map.Hgt - rect.Y;
|
||||
var surface = {Algo = MAPALGO_Rect, X = rect.X, Y = rect.Y, Wdt = rect.Wdt, Hgt = 8 * rect.Hgt / 6};
|
||||
surface = {Algo = MAPALGO_Turbulence, Iterations = 4, Amplitude = [0, 12], Seed = Random(65536), Op = surface};
|
||||
Draw("Earth", surface);
|
||||
|
||||
// Draw materials inside the main surface.
|
||||
DrawMaterials(rect, surface);
|
||||
|
||||
// Return true to tell the engine a map has been successfully created.
|
||||
return true;
|
||||
}
|
||||
|
||||
// Draws materials on the given surface.
|
||||
public func DrawMaterials(proplist rect, proplist surface)
|
||||
{
|
||||
var mask;
|
||||
var x = rect.X;
|
||||
var y = rect.Y;
|
||||
var wdt = rect.Wdt;
|
||||
var hgt = rect.Hgt;
|
||||
|
||||
// A bit of different types of earth all around the surface.
|
||||
mask = {Algo = MAPALGO_Rect, X = x, Y = y, Wdt = wdt, Hgt = hgt};
|
||||
mask = {Algo = MAPALGO_And, Op = [surface, mask]};
|
||||
DrawMaterial("Earth-earth", mask, 4, 12);
|
||||
DrawMaterial("Earth-earth_root", mask, 2, 16);
|
||||
DrawMaterial("Earth-earth_spongy", mask, 2, 16);
|
||||
DrawMaterial("Earth-earth", mask, 4, 12);
|
||||
|
||||
// Coal and surface in the first layer.
|
||||
mask = {Algo = MAPALGO_Rect, X = x, Y = y, Wdt = wdt, Hgt = hgt / 4};
|
||||
mask = {Algo = MAPALGO_Turbulence, Iterations = 4, Op = mask};
|
||||
mask = {Algo = MAPALGO_And, Op = [surface, mask]};
|
||||
DrawMaterial("Firestone", mask, 4, 5);
|
||||
DrawMaterial("Coal", mask, 4, 5);
|
||||
DrawMaterial("Firestone", mask);
|
||||
DrawMaterial("Coal", mask);
|
||||
|
||||
// Some small lakes as well in a second layer .
|
||||
mask = {Algo = MAPALGO_Rect, X = x, Y = y + 1 * hgt / 4, Wdt = wdt, Hgt = hgt / 4};
|
||||
mask = {Algo = MAPALGO_Turbulence, Iterations = 4, Op = mask};
|
||||
mask = {Algo = MAPALGO_And, Op = [surface, mask]};
|
||||
DrawMaterial("Coal", mask, 3, 8);
|
||||
DrawMaterial("Firestone", mask, 4, 5);
|
||||
DrawMaterial("Water", mask, 4, 10);
|
||||
|
||||
// Ore and rock in the third layer.
|
||||
mask = {Algo = MAPALGO_Rect, X = x, Y = y + 2 * hgt / 4, Wdt = wdt, Hgt = hgt / 4};
|
||||
mask = {Algo = MAPALGO_Turbulence, Iterations = 4, Op = mask};
|
||||
mask = {Algo = MAPALGO_And, Op = [surface, mask]};
|
||||
DrawMaterial("Ore", mask, 3, 10);
|
||||
DrawMaterial("Rock", mask, 2, 8);
|
||||
DrawMaterial("Granite", mask, 2, 8);
|
||||
DrawMaterial("Rock", mask);
|
||||
DrawMaterial("Ore", mask);
|
||||
|
||||
// Gold in the last layer.
|
||||
mask = {Algo = MAPALGO_Rect, X = x, Y = y + 3 * hgt / 4, Wdt = wdt, Hgt = hgt / 4};
|
||||
mask = {Algo = MAPALGO_Turbulence, Iterations = 4, Op = mask};
|
||||
mask = {Algo = MAPALGO_And, Op = [surface, mask]};
|
||||
DrawMaterial("Gold", mask, 2, 5);
|
||||
DrawMaterial("Coal", mask, 2, 10);
|
||||
DrawMaterial("Gold", mask, 2, 5);
|
||||
DrawMaterial("Gold", mask, 5, 10);
|
||||
|
||||
// The top border consists of top soil and dry earth and a bit of sand.
|
||||
var border = {Algo = MAPALGO_Border, Top = 4, Op = surface};
|
||||
Draw("Earth", border);
|
||||
var rnd_checker = {Algo = MAPALGO_RndChecker, Ratio = 30, Wdt = 2, Hgt = 2};
|
||||
var rnd_border = {Algo = MAPALGO_And, Op = [border, rnd_checker]};
|
||||
Draw("Sand", rnd_border);
|
||||
Draw("Earth-earth_root", rnd_border);
|
||||
return;
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
/* Default scenario objects */
|
||||
// Use gold rush objects with minor adjustments
|
||||
|
||||
/*-- Scenario Initialization --*/
|
||||
|
||||
public func InitializeObjects()
|
||||
{
|
||||
// Place player start centered above ground
|
||||
var start_x = LandscapeWidth()/2;
|
||||
var start_y = 0;
|
||||
while (!GBackSolid(start_x, start_y) && start_y < LandscapeHeight()) ++start_y;
|
||||
CreateObjectAbove(PlayerStart, start_x, start_y);
|
||||
// Place regular objects
|
||||
InitEnvironment();
|
||||
InitVegetation();
|
||||
InitAnimals();
|
||||
return true;
|
||||
}
|
||||
|
||||
private func InitEnvironment()
|
||||
{
|
||||
CreateEnvironmentObjects("Temperate");
|
||||
|
||||
// Set time of day to evening and create some clouds and celestials.
|
||||
Cloud->Place(10);
|
||||
Cloud->SetPrecipitation("Water", 8);
|
||||
var time = CreateObject(Time);
|
||||
time->SetTime(60 * 12);
|
||||
time->SetCycleSpeed(20);
|
||||
}
|
||||
|
||||
private func InitVegetation()
|
||||
{
|
||||
// Place some trees in a forest shape.
|
||||
PlaceForest([Tree_Deciduous, Tree_Coniferous2], 0, LandscapeHeight() / 2 + 50, nil, true);
|
||||
|
||||
SproutBerryBush->Place();
|
||||
PlaceGrass(100);
|
||||
|
||||
// Some objects in the earth.
|
||||
var map_size = Max(1, LandscapeWidth() * LandscapeHeight() / 250000);
|
||||
PlaceObjects(Rock, 25 + 10 * map_size + Random(10),"Earth");
|
||||
PlaceObjects(Firestone, 20 + 10 * map_size + Random(5), "Earth");
|
||||
PlaceObjects(Loam, 20 + 10 * map_size + Random(5), "Earth");
|
||||
}
|
||||
|
||||
private func InitAnimals(int map_size)
|
||||
{
|
||||
// Some butterflies
|
||||
for (var i = 0; i < 10 + 5 * Max(1, LandscapeWidth() / 500); i++)
|
||||
PlaceAnimal(Butterfly);
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
[Head]
|
||||
Title=DefaultWorld
|
|
@ -0,0 +1,2 @@
|
|||
DE:Standardwelt
|
||||
US:Default World
|
Loading…
Reference in New Issue