/* File: fn_vehicleShopMenu.sqf Author: Bryan "Tonic" Boardwine Description: Blah */ private["_shop","_sideCheck","_spawnMarkers","_spawnPositions","_shopFlag","_disableBuy"]; _shop = [(_this select 3),0,"",[""]] call BIS_fnc_param; _sideCheck = [(_this select 3),1,sideUnknown,[civilian]] call BIS_fnc_param; _spawnMarkers = [(_this select 3),2,"",["",[]]] call BIS_fnc_param; _shopFlag = [(_this select 3),3,"",[""]] call BIS_fnc_param; _disableBuy = [(_this select 3),5,false,[true]] call BIS_fnc_param; disableSerialization; //Long boring series of checks if(dialog) exitWith {}; if(_shop == "") exitWith {}; if( count _spawnMarkers == 0 ) exitWith {}; if(_sideCheck != sideUnknown && {playerSide != _sideCheck}) exitWith {hint localize "STR_Shop_Veh_NotAllowed"}; if(!createDialog "Life_Vehicle_Shop_v2") exitWith {}; if( typeName _spawnMarkers == "STRING" ) then { _spawnMarkers = [_spawnMarkers]; }; // Convert markers to [position, direction] _spawnPositions = []; { _spawnPositions pushBack [ getMarkerPos _x, markerDir _x ]; } forEach _spawnMarkers; life_veh_shop = [_shop,_spawnPositions,_shopFlag,_disableBuy]; //Store it so so other parts of the system can access it. ctrlSetText [2301,((_this select 3) select 4)]; if(_disableBuy) then { //Disable the buy button. ctrlEnable [2309,false]; }; //Fetch the shop config. _vehicleList = [_shop] call life_fnc_vehicleListCfg; _control = ((findDisplay 2300) displayCtrl 2302); lbClear _control; //Flush the list. ctrlShow [2330,false]; ctrlShow [2304,false]; // ::: NEW SHOP CAM ::: \\ _pos = [9047.5,7822.19,0]; _oldDir = getDir player; _oldPos = visiblePositionASL player; _light = "#lightpoint" createVehicleLocal [9047.5,7822.19,0]; _light setLightBrightness 1; _light setLightAmbient [1.0, 1.0, 1.0]; player setPosASL _pos; player setDir 90; {if(_x != player) then {_x hideObject true;};} foreach playableUnits; player switchMove ""; life_CarPreview = "Sign_Arrow_Yellow_F" createVehicleLocal (getPosATL player); life_CarPreview setPos (player modelToWorld [3,9,0]); life_CarPreview setDir ([life_CarPreview,player] call BIS_fnc_dirTo); life_CarPreview enableSimulation false; life_CarCAMPreview = "CAMERA" camCreate getPos player; showCinemaBorder false; life_CarCAMPreview cameraEffect ["Internal","Back"]; life_CarCAMPreview camSetTarget (life_CarPreview modelToWorld [3,0,0]); life_CarCAMPreview camSetPos (player modelToWorld [1,0,5]); life_CarCAMPreview camSetFovRange [0.1,0.7]; life_CarCAMPreview camSetFocus [50,0]; life_CarCAMPreview camCommit 0; //Loop through { _className = _x select 0; _basePrice = _x select 1; _vehicleInfo = [_className] call life_fnc_fetchVehInfo; _control lbAdd (_vehicleInfo select 3); _control lbSetPicture [(lbSize _control)-1,(_vehicleInfo select 2)]; _control lbSetData [(lbSize _control)-1,_className]; _control lbSetValue [(lbSize _control)-1,_ForEachIndex]; } foreach _vehicleList; waitUntil {isNull (findDisplay 2300)}; {if(_x != player) then {_x hideObject false;};} foreach playableUnits; player setPosASL _oldPos; player setDir _oldDir; {deleteVehicle _x;} foreach [_light]; life_CarCAMPreview cameraEffect ["TERMINATE","BACK"]; camDestroy life_CarCAMPreview; if((!isNil "life_CarPreview") AND (!isNull life_CarPreview)) then{ deleteVehicle life_CarPreview; };