print("Loading MallMart Level")
saveSlot();
clear();

--LEVEL SETUP

--set Background
--texture, width, height, position X, position Y
--setBackGround(map_BackGround, 200, 200, 0, 0);
setBackGround("map_mallmart.dds", 200, 200, 0, 0);
setTerrainMap("terraininfo_mallmart.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, 0);
addWaypoint(50, 0);


--setLinkPoints
--position X, position Y, radius, clearlevel?(never use), mustStop?, dofile
addLinkPoint(-100, -77, 14, false, false, "saveTown(); gofile(\"control.lua\")");
addLinkPoint(100, -77, 14, false, false, "saveTown(); gofile(\"control.lua\")");
addLinkPoint(28, -47, 7, false, true, "gofile(\"store/store_dealer.lua\")");
addLinkPoint(25, 59, 7, false, true, "gofile(\"store/store_gunsMallmart.lua\")");
addLinkPoint(0, 59, 7, false, true, "gofile(\"store/store_trader.lua\")");
addLinkPoint(-41.4, 47, 7, false, true, "gofile(\"store/store_missions.lua\")");

addBaseSprite(vel_baseArrow,-92, -77, PI * 0.50);
addBaseSprite(vel_baseArrow, 92, -77, PI * 1.50);
addBaseSprite(vel_baseCars, 28, -47, PI * 0.00);
addBaseSprite(vel_baseGuns, 25, 59, PI * 0.00);
addBaseSprite(vel_baseTrade, 0, 59, PI * 0.00);
addBaseSprite(vel_baseJobs,-41.4, 47, 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, 91, 50, 22.7, 99, PI * -0.00);
addObstacleBox(map_Building, 60, 52, -55, 89, PI * 0.13);


--misc Mobs
--texture, size X, size Y, position X, position Y, mass, elastic, friction, round 
--addMob  (map_tireutil,    4,      4,      -37,     -15,      12,      0.5,   0.99,    true);
--addMob  (map_tireold,     3,      3,      -40,     -20,      12,      0.5,   0.99,    true);

--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(townmall);

--dealership
car1 = addBeing(dealerCar1, 32.5, -22, PI * -0.5, 1);
car2 = addBeing(dealerCar2, 32.5, -15, PI * -0.5, 1);
addToDealer(car1);
addToDealer(car2);

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

saveSlot();
