HotIce alternate map added.

Also converted old map to Map.c and fixed some spawning issues.
stable-6.1
Sven Eberhardt 2015-04-17 16:57:32 +02:00 committed by Maikel de Vries
parent e9b076f6d3
commit b1b8fedb25
7 changed files with 102 additions and 40 deletions

View File

@ -1,31 +0,0 @@
/* Hot ice */
overlay Ice {
mat=Ice; tex=ice2;
overlay {
algo=rndchecker; a=0;
zoomX=-100; zoomY=-100;
turbulence=100; lambda=3;
mat=Ice; tex=ice3;
};
};
map HotIce {
overlay { algo=sin; ox=21; oy=65; zoomX=-100; zoomY=-100; invert=1; turbulence=10; } &
Ice { algo=poly;
point {x=12%; y=58%; };
point {x=88%; y=58%; };
point {x=70%; y=68%; };
point {x=30%; y=68%; };
};
overlay { algo=random; a=50; } &
Ice { algo=poly;
point {x=30%; y=5%; };
point {x=70%; y=5%; };
point {x=88%; y=50%; };
point {x=12%; y=50%; };
};
overlay { mat=DuroLava; tex=lava_red; y=80; sub=0; };
};

View File

@ -0,0 +1,46 @@
/**
Hot Ice
Ice islands above a lava lake
@authors Sven2
*/
// Called be the engine: draw the complete map here.
public func InitializeMap(proplist map)
{
// Map type 0: One big island; more small islands above
// Map type 1: Only many small islands
var t = SCENPAR_MapType;
var w = map.Wdt, h=map.Hgt;
// Bottom lava lake
map->Draw("^DuroLava", nil, [0,h*4/5,w,h/5]);
// Big island
if (t == 0)
{
var island = { Algo=MAPALGO_Polygon, X=[0,w,w*6/8,w*2/8], Y=[h*4/10,h*4/10,h*7/10,h*7/10] };
island = { Algo=MAPALGO_Turbulence, Op=island, Amplitude=[0, 8] };
map->Draw("^Ice-ice2", island, [w/10,h*13/20,w*8/10,h*3/20]);
}
// Small islands
var n_islands = [12,37][t];
while(n_islands--)
{
var y = h*2/10 + Random(h*(3+t*2)/10);
var x = w*1/10 + Random(w*8/10);
var szx = t*Random(3);
var szy = 1+t*Random(Random(2));
map->Draw("^Ice-ice2", nil, [x-szx,y,1+2*szx,szy]);
}
// Alternate texctures
var icealt_tex = { Algo=MAPALGO_RndChecker, Wdt=2, Hgt=3 };
icealt_tex = { Algo=MAPALGO_Turbulence, Op=icealt_tex };
icealt_tex = { Algo=MAPALGO_And, Op=[Duplicate("Ice"), icealt_tex]};
map->Draw("^Ice-ice3", icealt_tex);
// Return true to tell the engine a map has been successfully created.
return true;
}

View File

@ -0,0 +1,17 @@
[ParameterDef]
Name=$MapType$
Description=$DescMapType$
ID=MapType
Default=0
[Options]
[Option]
Name=$MapTypeBigIsland$
Description=$DescMapTypeBigIsland$
Value=0
[Option]
Name=$MapTypeSpots$
Description=$DescMapTypeSpots$
Value=1

View File

@ -10,8 +10,8 @@ Goals=Goal_Melee=1;
Rules=Rule_KillLogs=1;Rule_Gravestones=1;
[Landscape]
MapWidth=20
MapHeight=20
MapWidth=64
MapHeight=40
TopOpen=1
BottomOpen=1
MapZoom=18,0,0,18

View File

@ -5,8 +5,9 @@ func Initialize()
// Materials: Chests
var i,pos;
var ls_wdt = LandscapeWidth(), ls_hgt = LandscapeHeight();
var top_area_hgt = ls_hgt*[50,80][SCENPAR_MapType]/100;
for (i=0; i<6; ++i)
if (pos=FindLocation(Loc_InRect(0,0,ls_wdt,ls_hgt/2-100), Loc_Wall(CNAT_Bottom))) // Loc_Wall adds us 100 pixels...
if (pos=FindLocation(Loc_InRect(0,0,ls_wdt,top_area_hgt-100), Loc_Wall(CNAT_Bottom))) // Loc_Wall adds us 100 pixels...
{
var chest = CreateObjectAbove(Chest,pos.x,pos.y);
if (chest)
@ -23,13 +24,13 @@ func Initialize()
}
// Materials: Firestones
for (i=0; i<30; ++i)
if (pos=FindLocation(Loc_InRect(0,0,ls_wdt,ls_hgt/2), Loc_Solid()))
if (GBackSolid(pos.x,pos.y-1))
if (pos=FindLocation(Loc_InRect(0,0,ls_wdt,top_area_hgt), Loc_Solid()))
if (IsFirestoneSpot(pos.x,pos.y))
CreateObjectAbove(Firestone,pos.x,pos.y-1);
// Some firestones in lower half
// Some firestones in lower half. For ap type 1, more firestones in lower than upper half.
for (i=0; i<30; ++i)
if (pos=FindLocation(Loc_InRect(0,ls_hgt/2,ls_wdt,ls_hgt/3), Loc_Solid()))
if (GBackSolid(pos.x,pos.y-1))
if (IsFirestoneSpot(pos.x,pos.y))
CreateObjectAbove(Firestone,pos.x,pos.y-1);
return true;
}
@ -38,10 +39,11 @@ func InitializePlayer(int plr)
{
// everything visible
SetFoW(false, plr);
// player positioning
// player positioning. In lower area for both maps becuase starting high is an an advantage.
var ls_wdt = LandscapeWidth(), ls_hgt = LandscapeHeight();
var crew = GetCrew(plr);
var start_pos = FindLocation(Loc_InRect(ls_wdt/5,ls_hgt/2,ls_wdt*3/5,ls_hgt/3), Loc_Wall(CNAT_Bottom), Loc_Space(20), Loc_Space(20,true));
var start_pos = FindLocation(Loc_InRect(ls_wdt/5,ls_hgt/2,ls_wdt*3/5,ls_hgt/3), Loc_Wall(CNAT_Bottom), Loc_Func(Scenario.IsStartSpot));
if (!start_pos) start_pos = FindLocation(Loc_InRect(ls_wdt/10,0,ls_wdt*8/10,ls_hgt*4/5), Loc_Wall(CNAT_Bottom), Loc_Func(Scenario.IsStartSpot));
if (!start_pos) start_pos = {x=Random(ls_wdt*6/10)+ls_wdt*2/10, y=ls_hgt*58/100};
crew->SetPosition(start_pos.x, start_pos.y-10);
// initial material
@ -53,3 +55,19 @@ func InitializePlayer(int plr)
crew->DoEnergy(1000);
return true;
}
// Horizontal Loc_Space doesn't work with Loc_Wall because it checks inside the ground.
func IsStartSpot(int x, int y)
{
// Don't spawn just at the border of an island.
if (!GBackSolid(x-3,y+2)) return false;
if (!GBackSolid(x+3,y+2)) return false;
// Spawn with some space.
return PathFree(x-5, y, x+5, y) && PathFree(x, y-21, x, y-1);
}
func IsFirestoneSpot(int x, int y)
{
// Very thorough ice surrounding check so they don't explode right away or when the first layer of ice melts
return GBackSolid(x,y-1) && GBackSolid(x,y+4) && GBackSolid(x-2,y) && GBackSolid(x+2,y);
}

View File

@ -0,0 +1,6 @@
MapType=Karte
DescMapType=Definiert die Landschaftsform.
MapTypeBigIsland=Große Insel
DescMapTypeBigIsland=Eine zentrale Hauptinsel mit einigen Eisflecken in der Luft.
MapTypeSpots=Kleine inseln
DescMapTypeSpots=Viele kleine Eisflecken in der Luft.

View File

@ -0,0 +1,6 @@
MapType=Map
DescMapType=Defines the shape of the landscape.
MapTypeBigIsland=Big island
DescMapTypeBigIsland=One central main island with small spots of ice in the air above.
MapTypeSpots=Small islands
DescMapTypeSpots=Many small spots of ice in the air.