1
0
forked from 0ad/0ad

Moved BUILDING_ANGlE from the maps to BUILDING_ORIENTATION in a random map lib. Made some arguments optional with the default set to that constant, renamed some arguments and moved "orientation" in placeCivDefaultEntities to kwargs. Removed unneeded comments. Fixes #3988

This was SVN commit r18198.
This commit is contained in:
FeXoR 2016-05-19 14:48:21 +00:00
parent 4921056b9e
commit 1c5a7f6267
54 changed files with 72 additions and 222 deletions

View File

@ -49,8 +49,6 @@ const aDecorativeRock = "actor|geology/stone_granite_med.xml";
// terrain + entity (for painting)
const pForest = [tForestFloor, tForestFloor + TERRAIN_SEPARATOR + oCarob, tForestFloor + TERRAIN_SEPARATOR + oDatePalm, tForestFloor + TERRAIN_SEPARATOR + oSDatePalm, tForestFloor];
const BUILDING_ANGlE = -PI/4;
log("Initializing map...");
InitMap();
@ -135,7 +133,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -87,9 +87,7 @@ else
//other constants
const pForest = [tForestFloor + TERRAIN_SEPARATOR + oPine, tForestFloor];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
InitMap();
@ -170,7 +168,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -74,9 +74,7 @@ else
//other constants
const pForest = [tForestFloor + TERRAIN_SEPARATOR + oPine, tForestFloor];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
InitMap();
@ -157,7 +155,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -33,9 +33,6 @@ const aBushMedium = "actor|props/flora/bush_medit_me.xml";
const aBushSmall = "actor|props/flora/bush_medit_sm.xml";
const pForest = [tForestFloor + TERRAIN_SEPARATOR + oPoplar, tForestFloor];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -107,7 +104,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -49,9 +49,6 @@ const aBushSmall = rBiomeA8();
const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2];
const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -127,7 +124,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, [terrainPainter, elevationPainter, paintClass(clPlayer)], null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : 'towers'});
placeCivDefaultEntities(fx, fz, id, { 'iberWall': 'towers' });
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -1,9 +1,5 @@
RMS.LoadLibrary("rmgen");
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
InitMap();
@ -177,7 +173,7 @@ for (var i=0; i < numPlayers; i++)
var iz = round(fz);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
var citySize = 250

View File

@ -46,10 +46,6 @@ const aAleppoPine = "actor|flora/trees/aleppo_pine.xml";
const pForest1 = [tForestFloor + TERRAIN_SEPARATOR + oCarob, tForestFloor];
const pForest2 = [tForestFloor + TERRAIN_SEPARATOR + oAleppoPine, tForestFloor];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
InitMap();
@ -121,7 +117,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -6,10 +6,6 @@ timeArray.push(new Date().getTime());
RMS.LoadLibrary("rmgen");
RMS.LoadLibrary("heightmap");
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
InitMap();
@ -419,14 +415,14 @@ for (var p = 0; p < numPlayers; p++)
{
var actualX = possibleStartPositions[bestDerivation[p]][0];
var actualY = possibleStartPositions[bestDerivation[p]][1];
placeCivDefaultEntities(actualX, actualY, p + 1, BUILDING_ANGlE, {"iberWall" : false});
placeCivDefaultEntities(actualX, actualY, p + 1, { "iberWall": false });
// Place some start resources
var uDist = 8;
var uSpace = 1;
for (var j = 1; j <= 4; ++j)
{
var uAngle = BUILDING_ANGlE - PI * (2-j) / 2;
var uAngle = BUILDING_ORIENTATION - PI * (2-j) / 2;
var count = 4;
for (var numberofentities = 0; numberofentities < count; numberofentities++)
{

View File

@ -47,10 +47,6 @@ const aBushSmall = "actor|props/flora/bush_medit_sm.xml";
const pForestD = [tGrassDForest + TERRAIN_SEPARATOR + oOak, tGrassDForest + TERRAIN_SEPARATOR + oOakLarge, tGrassDForest];
const pForestP = [tGrassPForest + TERRAIN_SEPARATOR + oPine, tGrassPForest + TERRAIN_SEPARATOR + oAleppoPine, tGrassPForest];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
InitMap();
@ -145,7 +141,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : false});
placeCivDefaultEntities(fx, fz, id, { 'iberWall': false });
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -49,9 +49,6 @@ const aTree = rBiomeA9();
const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2];
const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -156,7 +153,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, [terrainPainter, elevationPainter, paintClass(clLand)], null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -46,9 +46,6 @@ const aBushSmall = rBiomeA8();
const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2];
const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -153,7 +150,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, [elevationPainter, paintClass(clLand)], null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -46,8 +46,6 @@ const aDecorativeRock = "actor|geology/stone_granite_med.xml";
// terrain + entity (for painting)
const pForest = [tForestFloor, tForestFloor + TERRAIN_SEPARATOR + oCarob, tForestFloor + TERRAIN_SEPARATOR + oDatePalm, tForestFloor + TERRAIN_SEPARATOR + oSDatePalm, tForestFloor];
const BUILDING_ANGlE = -PI/4;
log("Initializing map...");
InitMap();
@ -182,7 +180,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : 'towers'});
placeCivDefaultEntities(fx, fz, id, { 'iberWall': 'towers' });
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -61,10 +61,6 @@ var tForestNicae = [tForestFloor + TERRAIN_SEPARATOR + ePine,tForestFloor + TERR
var tForestNicaeLight = [tForestFloor + TERRAIN_SEPARATOR + ePine,tForestFloor + TERRAIN_SEPARATOR + ePine,tForestFloor + TERRAIN_SEPARATOR + eFanPalm, tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor];
var tForestNicaeScarce = [tForestFloor + TERRAIN_SEPARATOR + ePine,tForestFloor + TERRAIN_SEPARATOR + ePine,tForestFloor + TERRAIN_SEPARATOR + eFanPalm, tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor,tForestFloor];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
InitMap();
@ -336,7 +332,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, [painter,paintClass(clSettlement),elevationPainter], null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : false});
placeCivDefaultEntities(fx, fz, id, { 'iberWall': false });
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -70,10 +70,6 @@ const pPineForest = [tForestFloor+TERRAIN_SEPARATOR+oPine, tGrass];
const pPoplarForest = [tForestFloor+TERRAIN_SEPARATOR+oLombardyPoplar, tGrass];
const pMainForest = [tForestFloor+TERRAIN_SEPARATOR+oCarob, tForestFloor+TERRAIN_SEPARATOR+oBeech, tGrass, tGrass];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
InitMap();
@ -284,7 +280,7 @@ if((numPlayers>=6)||(i==startingPlaces[numPlayers-1][nPlayer])){
createArea(placer, [painter,paintClass(clCity)], null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : 'towers'});
placeCivDefaultEntities(fx, fz, id, { 'iberWall': 'towers' });
nPlayer++;
}

View File

@ -58,7 +58,6 @@ var numPlayers = getNumPlayers();
var baseRadius = 20;
var minPlayerRadius = min(mapRadius-1.5*baseRadius, 5*mapRadius/8);
var maxPlayerRadius = min(mapRadius-baseRadius, 3*mapRadius/4);
const BUILDING_ANGlE = -PI/4;
var playerStartLocX = new Array(numPlayers);
var playerStartLocZ = new Array(numPlayers);
var playerAngle = new Array(numPlayers);
@ -96,7 +95,7 @@ for (var i=0; i < numPlayers; i++)
playerStartLocX[i] = x;
playerStartLocZ[i] = z;
// Place starting entities
placeCivDefaultEntities(x, z, i+1, BUILDING_ANGlE);
placeCivDefaultEntities(x, z, i+1);
// Place base texture
var placer = new ClumpPlacer(2*baseRadius*baseRadius, 2/3, 1/8, 10, x, z);
var painter = [new LayeredPainter([terrainBaseBorder, terrainBase, terrainBaseCenter], [baseRadius/4, baseRadius/4]), paintClass(clPlayer)];

View File

@ -49,10 +49,6 @@ const pForestP = [tGrassPForest + TERRAIN_SEPARATOR + oOak, tGrassPForest];
const WATER_WIDTH = 0.25;
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
InitMap();
@ -144,7 +140,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, [painter, paintClass(clPlayer)], null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -47,7 +47,6 @@ const aBushSmall = rBiomeA8();
const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2];
const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1];
const BUILDING_ANGlE = -PI/4;
log("Initializing map...");
InitMap();
@ -146,7 +145,7 @@ for (let i = 0; i < numPlayers; ++i)
addToClass(ix - 5, iz, clPlayer);
addToClass(ix, iz - 5, clPlayer);
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, { "iberWall": false });
placeCivDefaultEntities(fx, fz, id, { "iberWall": false });
// Create the city patch
let cityRadius = radius/3;

View File

@ -47,10 +47,6 @@ const pForestD = [tForestFloor + TERRAIN_SEPARATOR + oBeech, tForestFloor];
const pForestO = [tForestFloor + TERRAIN_SEPARATOR + oOak, tForestFloor];
const pForestP = [tForestFloor + TERRAIN_SEPARATOR + oPine, tForestFloor];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
InitMap();
@ -100,12 +96,12 @@ for (var i=0; i < numPlayers; i++)
{
var startEntities = getStartingEntities(i);
// Place starting entities
createStartingPlayerEntities(playerX[i], playerZ[i], i+1, startEntities, BUILDING_ANGlE)
createStartingPlayerEntities(playerX[i], playerZ[i], i+1, startEntities)
var uDist = 8;
var uSpace = 2;
for (var j = 1; j < startEntities.length - 1; ++j)
{
var uAngle = BUILDING_ANGlE - PI * (2-j) / 2;
var uAngle = BUILDING_ORIENTATION - PI * (2-j) / 2;
var count = (startEntities[j].Count !== undefined ? startEntities[j].Count : 1);
for (var numberofentities = 0; numberofentities < count; numberofentities++)
{
@ -115,7 +111,7 @@ for (var i=0; i < numPlayers; i++)
}
}
// create resources
var bbAngle = BUILDING_ANGlE;
var bbAngle = BUILDING_ORIENTATION;
var bbDist = 10;
var bbX = round(playerX[i] + bbDist * cos(bbAngle));
var bbZ = round(playerZ[i] + bbDist * sin(bbAngle));
@ -191,7 +187,7 @@ for (var i=0; i < numPlayers; i++)
"cornerIn", "wallLong", "house", "tower", "wallLong", "tower", "wallLong",
"cornerIn", "wallLong", "house", "tower"];
}
placeCustomFortress(playerX[i], playerZ[i], new Fortress("Spahbod", wall), civ, i+1, BUILDING_ANGlE);
placeCustomFortress(playerX[i], playerZ[i], new Fortress("Spahbod", wall), civ, i+1);
}
// create lakes

View File

@ -48,10 +48,6 @@ const aBushSmall = rBiomeA8();
const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2];
const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -156,7 +152,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : 'towers'});
placeCivDefaultEntities(fx, fz, id, { 'iberWall': 'towers' });
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -43,9 +43,6 @@ const aBushSmall = "actor|props/flora/bush_medit_sm.xml";
const pForestP = [tForestFloorP + TERRAIN_SEPARATOR + oPoplar, tForestFloorP];
const pForestC = [tForestFloorC + TERRAIN_SEPARATOR + oCarob, tForestFloorC];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -152,7 +149,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : false});
placeCivDefaultEntities(fx, fz, id, { 'iberWall': false });
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -121,9 +121,6 @@ else
}
const pForest = [tForestFloor + TERRAIN_SEPARATOR + oPine, tForestFloor];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -209,7 +206,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -47,10 +47,6 @@ const pForestP = [tGrassPForest + TERRAIN_SEPARATOR + oOak, tGrassPForest];
const WATER_WIDTH = 0.25;
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
InitMap();
@ -128,7 +124,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -59,7 +59,6 @@ const aRockMedium = rBiomeA6();
const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2];
const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1];
const BUILDING_ANGlE = -PI/4;
log("Initializing map...");
InitMap();
@ -166,7 +165,7 @@ for (let i = 0; i < teams.length; ++i)
createArea(placer, [terrainPainter, elevationPainter, paintClass(clLand)], null);
// create starting units
placeCivDefaultEntities(fx, fz, teams[i][p], BUILDING_ANGlE, { "iberWall": false });
placeCivDefaultEntities(fx, fz, teams[i][p], { "iberWall": false });
}
log("Create initial mines for team " + i);

View File

@ -48,9 +48,6 @@ const aBushSmall = rBiomeA8();
const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2];
const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -124,7 +121,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, [terrainPainter, elevationPainter, paintClass(clPlayer)], null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : 'towers'});
placeCivDefaultEntities(fx, fz, id, { 'iberWall': 'towers' });
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -34,9 +34,6 @@ const aBush3 = "actor|props/flora/plant_tropic_large.xml";
const pForestD = [tForestFloor + TERRAIN_SEPARATOR + oTree, tForestFloor];
const pForestP = [tForestFloor + TERRAIN_SEPARATOR + oPalm, tForestFloor];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -112,7 +109,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -46,9 +46,6 @@ const aBushSmall = rBiomeA8();
const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2];
const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -125,7 +122,7 @@ for (var i = 0; i < numPlayers; i++)
addToClass(ix, iz-5, clPlayer);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -63,10 +63,6 @@ const pPineForest = [tForestFloor+TERRAIN_SEPARATOR+oPine, tGrass];
const pPoplarForest = [tForestFloor+TERRAIN_SEPARATOR+oLombardyPoplar, tGrass];
const pMainForest = [tForestFloor+TERRAIN_SEPARATOR+oCarob, tForestFloor+TERRAIN_SEPARATOR+oBeech, tGrass, tGrass];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
InitMap();
@ -431,7 +427,7 @@ for (var i = 1; i <= numPlayers; i++)
createArea(placer, [painter, elevationPainter], null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -42,9 +42,6 @@ const aBushSmall = "actor|props/flora/bush_medit_sm.xml";
const pForestB = [tGrassDForest + TERRAIN_SEPARATOR + oBeech, tGrassDForest];
const pForestO = [tGrassPForest + TERRAIN_SEPARATOR + oOak, tGrassPForest];
const pForestR = [tGrassDForest + TERRAIN_SEPARATOR + oBeech, tGrassDForest, tGrassDForest + TERRAIN_SEPARATOR + oOak, tGrassDForest, tGrassDForest, tGrassDForest];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -133,7 +130,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : 'towers'});
placeCivDefaultEntities(fx, fz, id, { 'iberWall': 'towers' });
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -46,9 +46,6 @@ const aBushSmall = rBiomeA8();
const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2];
const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -125,7 +122,7 @@ for (var i = 0; i < numPlayers; i++)
addToClass(ix, iz-5, clPlayer);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create the city patch
var cityRadius = radius/3;

View File

@ -47,9 +47,6 @@ const aBushSmall = rBiomeA8();
const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2];
const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -132,7 +129,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : false});
placeCivDefaultEntities(fx, fz, id, { 'iberWall': false });
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -43,10 +43,6 @@ const aDecorativeRock = "actor|geology/stone_desert_med.xml";
const pForest = [tForestFloor + TERRAIN_SEPARATOR + oDatePalm, tForestFloor + TERRAIN_SEPARATOR + oSDatePalm, tForestFloor];
const pForestOasis = [tGrass + TERRAIN_SEPARATOR + oDatePalm, tGrass + TERRAIN_SEPARATOR + oSDatePalm, tGrass];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
InitMap();
@ -119,7 +115,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -1,9 +1,5 @@
RMS.LoadLibrary("rmgen");
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
InitMap();
@ -56,7 +52,7 @@ for (var i=0; i < numPlayers; i++)
var iz = round(fz);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
}

View File

@ -29,9 +29,6 @@ const aIceberg = "actor|props/special/eyecandy/iceberg.xml";
const pForestD = [tForestFloor + TERRAIN_SEPARATOR + oPine, tForestFloor, tForestFloor];
const pForestS = [tForestFloor + TERRAIN_SEPARATOR + oPine, tForestFloor, tForestFloor, tForestFloor];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -107,7 +104,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create metal mine
var bbAngle = randFloat(0, TWO_PI);

View File

@ -39,9 +39,6 @@ const aSand = "actor|particle/blowing_sand.xml";
const pForestMain = [tForestFloor + TERRAIN_SEPARATOR + ePalmShort, tForestFloor + TERRAIN_SEPARATOR + ePalmTall, tForestFloor];
const pOasisForestLight = [tForestFloor + TERRAIN_SEPARATOR + ePalmShort, tForestFloor + TERRAIN_SEPARATOR + ePalmTall, tForestFloor,tForestFloor,tForestFloor
,tForestFloor,tForestFloor,tForestFloor,tForestFloor];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -126,7 +123,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -54,8 +54,6 @@ const aDecorativeRock = "actor|geology/stone_desert_med.xml";
// terrain + entity (for painting)
const pForestO = [tForestFloor + TERRAIN_SEPARATOR + oOak, tForestFloor + TERRAIN_SEPARATOR + oOak, tForestFloor, tDirtMain, tDirtMain];
const BUILDING_ANGlE = -PI/4;
log("Initializing map...");
InitMap();
@ -136,7 +134,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -44,8 +44,6 @@ const aDecorativeRock = "actor|geology/stone_granite_med.xml";
// terrain + entity (for painting)
const pForest = [tForestFloor + TERRAIN_SEPARATOR + oDatePalm, tForestFloor + TERRAIN_SEPARATOR + oSDatePalm, tForestFloor + TERRAIN_SEPARATOR + oCarob, tForestFloor, tForestFloor];
const BUILDING_ANGlE = -PI/4;
log("Initializing map...");
InitMap();
@ -118,7 +116,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -242,9 +242,6 @@ const pForestLandVeryLight = [ tGrassLandForest2 + TERRAIN_SEPARATOR + oPine,tGr
tForestTransition,tGrassLandForest2,tForestTransition,tForestTransition,tForestTransition,
tGrassLandForest,tForestTransition,tGrassLandForest2,tForestTransition,
tGrassLandForest2,tGrassLandForest2,tGrassLandForest2,tGrassLandForest2];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -351,7 +348,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -37,9 +37,6 @@ const aBushSmall = "actor|props/flora/bush_medit_sm.xml";
const pForestD = [tForestFloor + TERRAIN_SEPARATOR + oBeech, tForestFloor];
const pForestP = [tForestFloor + TERRAIN_SEPARATOR + oOak, tForestFloor];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -113,7 +110,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -50,9 +50,6 @@ const aBushSmall = rBiomeA8();
const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2];
const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -154,7 +151,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -13,6 +13,8 @@ const FALLBACK_CIV = "athen";
const MAX_HEIGHT_RANGE = 0xFFFF / HEIGHT_UNITS_PER_METRE // Engine limit, Roughly 700 meters
const MIN_HEIGHT = - SEA_LEVEL;
const MAX_HEIGHT = MAX_HEIGHT_RANGE - SEA_LEVEL;
// Default angle for buildings
const BUILDING_ORIENTATION = - PI / 4;
function fractionToTiles(f)
{

View File

@ -136,17 +136,17 @@ function rndRiver(f, seed)
// fx&fz: position of player base
// playerid: id of player
// civEntities: use getStartingEntities(id-1) fo this one
// BUILDING_ANGlE: angle of main base building
// orientation: orientation of the main base building, default is BUILDING_ORIENTATION
//
///////////////////////////////////////////////////////////////////////////////////////////
function createStartingPlayerEntities(fx, fz, playerid, civEntities, BUILDING_ANGlE)
function createStartingPlayerEntities(fx, fz, playerid, civEntities, orientation = BUILDING_ORIENTATION)
{
var uDist = 6;
var uSpace = 2;
placeObject(fx, fz, civEntities[0].Template, playerid, BUILDING_ANGlE);
placeObject(fx, fz, civEntities[0].Template, playerid, orientation);
for (var j = 1; j < civEntities.length; ++j)
{
var uAngle = BUILDING_ANGlE - PI * (2-j) / 2;
var uAngle = orientation - PI * (2-j) / 2;
var count = (civEntities[j].Count !== undefined ? civEntities[j].Count : 1);
for (var numberofentities = 0; numberofentities < count; numberofentities++)
{
@ -163,29 +163,31 @@ function createStartingPlayerEntities(fx, fz, playerid, civEntities, BUILDING_AN
// Creates the default starting player entities depending on the players civ
// fx&fy: position of player base
// playerid: id of player
// angle: angle of main base building, optional, default is BUILDING_ANGlE
// kwargs: Takes some optional keyword arguments to tweek things
// 'iberWall': may be false, 'walls' (default) or 'towers'. Determines the defensive structures Iberians get as civ bonus
// 'orientation': angle of the main base building, default is BUILDING_ORIENTATION
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function placeCivDefaultEntities(fx, fz, playerid, angle, kwargs)
function placeCivDefaultEntities(fx, fz, playerid, kwargs = {})
{
// Unpack kwargs
kwargs = (kwargs || {});
var iberWall = 'walls';
if (getMapSize() <= 128)
iberWall = false;
if ('iberWall' in kwargs)
iberWall = kwargs['iberWall'];
var orientation = BUILDING_ORIENTATION
if ('orientation' in kwargs)
orientation = kwargs['orientation'];
// Place default civ starting entities
var civ = getCivCode(playerid-1);
var civEntities = getStartingEntities(playerid-1);
var uDist = 6;
var uSpace = 2;
placeObject(fx, fz, civEntities[0].Template, playerid, angle);
placeObject(fx, fz, civEntities[0].Template, playerid, orientation);
for (var j = 1; j < civEntities.length; ++j)
{
var uAngle = angle - PI * (2-j) / 2;
var uAngle = orientation - PI * (2-j) / 2;
var count = (civEntities[j].Count !== undefined ? civEntities[j].Count : 1);
for (var numberofentities = 0; numberofentities < count; numberofentities++)
{
@ -198,7 +200,7 @@ function placeCivDefaultEntities(fx, fz, playerid, angle, kwargs)
if (civ == 'iber' && iberWall != false)
{
if (iberWall == 'towers')
placePolygonalWall(fx, fz, 15, ['entry'], 'tower', civ, playerid, angle, 7);
placePolygonalWall(fx, fz, 15, ['entry'], 'tower', civ, playerid, orientation, 7);
else
placeGenericFortress(fx, fz, 20/*radius*/, playerid);
}

View File

@ -470,13 +470,12 @@ function placeWall(startX, startY, wall, style, playerId, orientation)
// fortress An instance of Fortress with a wall defined
// style Optional. Wall style string. Default is the civ of the given player, "palisades" for gaia
// playerId Optional. Number of the player the wall will be placed for. Default is 0 (gaia)
// orientation Optional. Angle the first wall element (should be a gate or entrance) is placed. Default is 0
// orientation Optional. Angle the first wall element (should be a gate or entrance) is placed. Default is BUILDING_ORIENTATION
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function placeCustomFortress(centerX, centerY, fortress, style, playerId, orientation)
function placeCustomFortress(centerX, centerY, fortress, style, playerId = 0, orientation = BUILDING_ORIENTATION)
{
// Graciously handle arguments
fortress = (fortress || fortressTypes["medium"]);
playerId = (playerId || 0);
if (!wallStyles.hasOwnProperty(style))
{
if (playerId == 0)
@ -484,7 +483,6 @@ function placeCustomFortress(centerX, centerY, fortress, style, playerId, orient
else
style = (getCivCode(playerId-1));
}
orientation = (orientation || 0);
// Calculate center if fortress.centerToFirstElement is undefined (default)
var centerToFirstElement = fortress.centerToFirstElement;

View File

@ -47,8 +47,6 @@ const aLillies = "actor|props/flora/water_lillies.xml";
// terrain + entity (for painting)
const pForest = [tLush + TERRAIN_SEPARATOR + oDatePalm, tLush + TERRAIN_SEPARATOR + oSDatePalm, tLush];
const BUILDING_ANGlE = -PI/4;
log("Initializing map...");
InitMap();
@ -118,7 +116,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -52,10 +52,6 @@ function placeStoneMineFormation(x, z)
}
}
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
InitMap();
@ -121,7 +117,7 @@ for (var i = 0; i < numPlayers; i++)
addToClass(ix, iz-5, clPlayer);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -40,9 +40,6 @@ const aBushMedium = "actor|props/flora/bush_desert_dry_a.xml";
const aBushSmall = "actor|props/flora/bush_dry_a.xml";
const pForest = [tForestFloor + TERRAIN_SEPARATOR + oBaobab, tForestFloor + TERRAIN_SEPARATOR + oBaobab, tForestFloor];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -116,7 +113,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -109,8 +109,6 @@ var terrainHillBorder = ['temp_highlands', 'temp_highlands', 'temp_highlands', '
var tWater = ['dirt_brown_d'];
var tWaterBorder = ['dirt_brown_d'];
const BUILDING_ANGlE = -PI/4;
// Setup map
var mapSize = getMapSize();
var mapRadius = mapSize/2;
@ -242,7 +240,7 @@ for (var i=0; i < numPlayers; i++)
rectangularSmoothToHeight([x,z] , 20, 20, playerHeight, 0.8);
placeCivDefaultEntities(x, z, i+1, BUILDING_ANGlE, {'iberWall': false});
placeCivDefaultEntities(x, z, i+1, { 'iberWall': false });
// Place base texture
var placer = new ClumpPlacer(2*baseRadius*baseRadius, 2/3, 1/8, 10, x, z);

View File

@ -46,10 +46,6 @@ const aBushSmall = rBiomeA8();
const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2];
const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -1555,7 +1551,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : 'towers'});
placeCivDefaultEntities(fx, fz, id, { 'iberWall': 'towers' });
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -49,9 +49,6 @@ const aTree = rBiomeA9();
const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2];
const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -163,8 +160,8 @@ for (var i = 0; i < numPlayers; i++)
// Place default civ starting entities
var uDist = 6;
var uSpace = 2;
placeObject(fx, fz, "skirmish/structures/default_civil_centre", id, BUILDING_ANGlE);
var uAngle = BUILDING_ANGlE - PI / 2;
placeObject(fx, fz, "skirmish/structures/default_civil_centre", id, BUILDING_ORIENTATION);
var uAngle = BUILDING_ORIENTATION - PI / 2;
var count = 4;
for (var numberofentities = 0; numberofentities < count; numberofentities++)
{

View File

@ -40,10 +40,6 @@ const aSand = "actor|particle/blowing_sand.xml";
const pForestP = [tForestFloor2 + TERRAIN_SEPARATOR + oPalm, tForestFloor2];
const pForestT = [tForestFloor1 + TERRAIN_SEPARATOR + oTamarix,tForestFloor2];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -122,7 +118,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -49,8 +49,6 @@ var aLillies = "actor|props/flora/water_lillies.xml";
var pForest = [tForestFloor + TERRAIN_SEPARATOR + oDatePalm, tForestFloor + TERRAIN_SEPARATOR + oSDatePalm, tForestFloor];
var pForestOasis = [tGrass + TERRAIN_SEPARATOR + oDatePalm, tGrass + TERRAIN_SEPARATOR + oSDatePalm, tGrass];
const BUILDING_ANGlE = -PI/4;
log("Initializing map...");
InitMap();
@ -144,7 +142,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -48,9 +48,6 @@ const aBushSmall = rBiomeA8();
const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2];
const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -1668,9 +1665,9 @@ for (var i = 0; i < numPlayers; i++)
// create starting units
if (iberianTowers)
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE, {'iberWall' : 'towers'});
placeCivDefaultEntities(fx, fz, id, { 'iberWall': 'towers' });
else
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -48,9 +48,6 @@ const aBushSmall = rBiomeA8();
const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2];
const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");
@ -1440,7 +1437,7 @@ for (var i = 0; i < numPlayers; i++)
var iz = round(fz);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create animals
for (var j = 0; j < 2; ++j)

View File

@ -48,9 +48,6 @@ var aBushSmall = rBiomeA8();
var pForestD = [tGrassDForest + TERRAIN_SEPARATOR + oOak, tGrassDForest + TERRAIN_SEPARATOR + oOakLarge, tGrassDForest];
var pForestP = [tGrassPForest + TERRAIN_SEPARATOR + oPine, tGrassPForest + TERRAIN_SEPARATOR + oAleppoPine, tGrassPForest];
const BUILDING_ANGlE = -PI/4;
// initialize map
log("Initializing map...");

View File

@ -24,7 +24,6 @@ var aSmoke = "actor|particle/smoke.xml";
var pForestD = [tGrassC + TERRAIN_SEPARATOR + oTree, tGrassC];
var pForestP = [tGrassB + TERRAIN_SEPARATOR + oTree, tGrassB];
const BUILDING_ANGlE = -PI/4;
log("Initializing map...");
InitMap();
@ -90,7 +89,7 @@ for (var i = 0; i < numPlayers; i++)
createArea(placer, painter, null);
// create starting units
placeCivDefaultEntities(fx, fz, id, BUILDING_ANGlE);
placeCivDefaultEntities(fx, fz, id);
// create metal mine
var bbAngle = randFloat(0, TWO_PI);