print("Loading boneyard setting")


clear();

--LEVEL SETUP

--set Background
--texture, width, height, position X, position Y
setBackGround("map_boneyard.dds", 400, 200, 0, 0);
setTerrainMap("terraininfo_boneyard.tga");
setGameMode(1);
gofile("setViewDistance.lua");

--set Sun
--distance X, distance Y
setSunDist(-0.55, 1.0);

--set Dust visual element
setDustElement(vel_dust);
setSkidElement(vel_skid);

--set Borders
--position X, position Y, direction, elasticity
addBorder(0, 100, PI, 0.7);
addBorder(200, 0, HALFPI, 0.7);
addBorder(0, -100, 0, 0.7);
addBorder(-200, 0, THREEHALFPI, 0.7);

--setWaypoints
--position X, position Y
addWaypoint(-45, 78);
addWaypoint(-97, 57);
addWaypoint(-143, 22);
addWaypoint(-149, -45);
addWaypoint(-90, -70);
addWaypoint(-31, -85);
addWaypoint(73, -72);
addWaypoint(132, -4);
addWaypoint(124, 67);
addWaypoint(35, 70);
addWaypoint(-10, 74);



--set Camera Extents
autoCameraExtents();

--set Obstacles
--texture, size X, size Y, position X, position Y, direction 
--building
addObstacleBox(map_Building, 44.5, 50.5, -95.5, -11.2, PI * 1.9825);

--heli
addObstacleBox(map_Building, 3.3, 27.5, -135.6, 68.35, PI * 1.6936);
addObstacleBox(map_Building, 9.7, 4.9, -131.855, 71.05, PI * 1.685);

--wood
addObstacleBox(map_Building, 7.1, 24.9, -47.094, 47.878, PI * 1.937);
addObstacleBox(map_Building, 8.6, 24.9, -47.76, 46.878, PI * 0.2045);

--f16s
addObstacleBox(map_Building, 17.3, 41.5, 7.23, -28.25, PI * 0.16393);
addObstacleBox(map_Building, 7.2, 34.3, -3.6, -33.5, PI * 0.156);
addObstacleBox(map_Building, 10.3, 3.0, -13.4, -21.7, PI * 0.156);
addObstacleBox(map_Building, 10.3, 3.0, 1.05, -48.115, PI * 0.156);

--wwii planes
addObstacleBox(map_Building, 27.6, 21.0, 75.3, 18.66, PI * 1.785);
addObstacleBox(map_Building, 28.2, 5.1, 70.94, 26.61, PI * 1.785);
addObstacleBox(map_Building, 21.7, 2.6, 96.25, 37.25, PI * 1.814);
addObstacleBox(map_Building, 3.8, 25.8, 91.72, 31.47, PI * 1.800);

--wwii tanks
addObstacleBox(map_Building, 10.1, 13.5, -184.725, -64.969, PI * 1.774);
addObstacleBox(map_Building, 13.9, 9.4, -177.9556, -69.91, PI * 1.8185);
addObstacleBox(map_Building, 11.0, 17.2, -169.277, -75.87, PI * 1.809);
addObstacleBox(map_Building, 16.4, 14.2, -160.077, -82.345, PI * 1.809);

--misc Mobs
--texture, size X, size Y, position X, position Y, mass, elastic, friction, round, dir 
addGroundMob(map_tireutil,    4,      4,      70,     35,      6,      0.9,   0.1,    true, 0.1);
addGroundMob(map_tireold,     3,      3,      101,     25,      6,      0.9,   0.1,    true, 0.2);
addGroundMob(map_tireold,     3,      3,      68,     7,      6,      0.9,   0.1,    true, 0.2);

--texture, size X, size Y, position X, position Y, mass, elastic, friction, round, dir
addGroundMobq(map_barrelblue, 3, 5, -110, -40, 2, 0.9, 0.1, false, 0.5);
addGroundMobq(map_barrelblue, 3, 5, -90, -46, 2, 0.9, 0.1, false, 0.8);




--addObstacleSprite(map_PropFighter, 2.8, 22, 0, -25.5, PI * -0.00, 30, 25);

--addTopSprite(map_PropFighter, 30, 25, 33, -25.5, PI * -0.20);




--setup enemy spawn points
spawn1_X = -220;
spawn1_Y = 60;
spawn2_X = 220;
spawn2_Y = 0;
spawn3_X = -220;
spawn3_Y = 60;
spawn4_X = -220;
spawn4_Y = 60;



--setup Player: Car, audio listener, and camera follow
player = addBeing(playerCar, -14.0, -76.0, PI * 1.85, 1);
setPlayerBeing(player);
setMobHealth(player, getPlayerHealth());

setWeapon(player, 1, playerWeapon1);
setWeapon(player, 2, playerWeapon2);



