print("Loading Santa Polco Level")
saveSlot();
clear();

--LEVEL SETUP

--set Background
--texture, width, height, position X, position Y
--setBackGround(map_BackGround, 200, 200, 0, 0);
setBackGround("map_polco.dds", 200, 200, 0, 0);
setTerrainMap("terraininfo_polco.tga");
setGameMode(3);
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(100, 0, HALFPI, 0.7);
addBorder(0, -100, 0, 0.7);
addBorder(-100, 0, THREEHALFPI, 0.7);

--setWaypoints
--position X, position Y
addWaypoint(-60, 65);
addWaypoint(50, 65);
addWaypoint(40, -25);
addWaypoint(-60, -30);

--setLinkPoints
--position X, position Y, radius, clearlevel?(never use), mustStop?, dofile
addLinkPoint(-100, -44.8, 14, false, false, "saveTown(); gofile(\"control.lua\")");
addLinkPoint(100, -77.44, 14, false, false, "saveTown(); gofile(\"control.lua\")");
addLinkPoint(-57.1, -14.6, 7, false, true, "gofile(\"store/store_dealer.lua\")");
addLinkPoint(-30.0, 35.73, 7, false, true, "gofile(\"store/store_gunsPolco.lua\")");
addLinkPoint(59, 21, 7, false, true, "gofile(\"store/store_trader.lua\")");
addLinkPoint(40.65, -3.63, 7, false, true, "gofile(\"store/store_missions.lua\")");

addBaseSprite(vel_baseArrow, -94, -44.8, PI * 0.46);
addBaseSprite(vel_baseArrow, 94, -77.5, PI * 1.46);
addBaseSprite(vel_baseCars, -57.1, -14.6, PI * 0.00);
addBaseSprite(vel_baseGuns, -30.0, 35.73, PI * 0.00);
addBaseSprite(vel_baseTrade, 59, 21, PI * 0.00);
addBaseSprite(vel_baseJobs, 40.65, -3.63, PI * 0.00);


--set Camera Extents
--max X, min X, max Y, min Y
--setCameraExtents(50.0, -50.0, 62.5, -62.5);
autoCameraExtents();

--set Obstacles
--texture, size X, size Y, position X, position Y, direction 
addObstacleBox(map_Building, 36.1, 14.9, -57.25, 70.87, PI * 1.949);
addObstacleBox(map_Building, 40.3, 54.09, -25.66, 73.51, PI * 1.95066);
addObstacleBox(map_Building, 61.8, 24.4, 18.29, 58.521, PI * 1.959414);
addObstacleBox(map_Building, 34.0, 55.9, 63.4268, 57.51, PI * 1.959414);
addObstacleBox(map_Building, 59.2, 23.9, -19.7767, -19.9246, PI * 1.954640);

addObstacleBox(map_Building, 11.1, 12.5, 13.033, -27.886, PI * 1.954640);
addObstacleBox(map_Building, 35.1, 22.8, 33.17, -30.99, PI * 1.946682);
addObstacleBox(map_Building, 16.7, 10.7, 35.948, -16.219, PI * 1.946682);

addObstacleBox(map_Building, 16.7, 23.1, 71.079, 90.755, PI * 1.962598);



--misc Mobs
--texture, size X, size Y, position X, position Y, mass, elastic, friction, round 

--set Waves
--line1 return handle> min Enemies
--lines wave handel, being handle, pos X, pos Y, team, tatic
--wave_1 = addWave(0);
--setWaveEntry(wave_1, car_camino, 60, -220, 2, 0);

loadTown(townpolco);

--dealership
car1 = addBeing(dealerCar1, -43.7, -36.6, PI * 1.9395, 1);
car2 = addBeing(dealerCar2, -33.0, -38.037, PI * 1.9395, 1);
addToDealer(car1);
addToDealer(car2);
--addBeing(playerCar, -36.8, -10.0, 0, 1);

--general store
--carParts, tequlia, fireworks, swag, pills
--setStoreCargo(4, 13, 5, 12, 1);
--setCargoPrices(3, 8, 10, 5, 50);
--setStoreCash(780);




--setup Player: Car, audio listener, and camera follow
player = addBeing(playerCar, -73.0, -2.4, PI * 1.696, 1);
setPlayerBeing(player);
setMobHealth(player, getPlayerHealth());
setWeapon(player, 1, playerWeapon1);
setWeapon(player, 2, playerWeapon2);

saveSlot();
