2015-07-19 15:35:53 +00:00
|
|
|
/*
|
|
|
|
* Author: Karel Moricky, SilentSpike
|
|
|
|
* Handles the spectator UI toolbar values and applies them to the camera
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Parameters <ANY>
|
|
|
|
* 1: PFH handle <NUMBER>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None <NIL>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [ace_spectator_fnc_handleToolbar, 0, _display] call CBA_fnc_addPerFrameHandler;
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
params ["_display"];
|
|
|
|
|
|
|
|
// Kill PFH when display is closed
|
|
|
|
if (isNull _display) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; };
|
|
|
|
|
2015-07-19 19:26:26 +00:00
|
|
|
if (GVAR(camFocus) == 0) then {
|
|
|
|
GVAR(camera) camSetFocus [-1,-1];
|
|
|
|
} else {
|
|
|
|
GVAR(camera) camSetFocus [GVAR(camFocus),1];
|
|
|
|
};
|
2015-07-19 15:35:53 +00:00
|
|
|
GVAR(camera) camSetFov -(linearConversion [0.1,2,GVAR(camZoom),-2,-0.1,true]);
|
|
|
|
GVAR(camera) camCommit 0;
|
|
|
|
|
|
|
|
// Reduce overhead when toolbar is hidden
|
2015-07-19 22:03:40 +00:00
|
|
|
if !(ctrlShown (_display displayCtrl IDC_TOOL)) exitWith {};
|
2015-07-19 15:35:53 +00:00
|
|
|
|
|
|
|
private ["_name","_focus","_fov","_speed","_mode","_time","_toolbar"];
|
2015-07-19 22:03:40 +00:00
|
|
|
_toolbar = _display displayCtrl IDC_TOOL;
|
2015-07-19 15:35:53 +00:00
|
|
|
|
|
|
|
// Find all tool values
|
|
|
|
if (GVAR(camMode) == 0) then {
|
2015-07-19 19:26:26 +00:00
|
|
|
_focus = ["AUTO FOCUS", format ["%1 m", round GVAR(camFocus)]] select (GVAR(camFocus) > 0);
|
|
|
|
_fov = format ["%1x", floor(GVAR(camZoom) * 100) * 0.01];
|
2015-07-19 15:35:53 +00:00
|
|
|
_name = "None";
|
|
|
|
_speed = format ["%1 m/s", GVAR(camSpeed)];
|
|
|
|
} else {
|
2015-07-19 19:26:26 +00:00
|
|
|
_focus = rank GVAR(camUnit);
|
2015-07-20 16:17:23 +00:00
|
|
|
_fov = WFSideText (group GVAR(camUnit));
|
2015-07-19 15:35:53 +00:00
|
|
|
_name = name GVAR(camUnit);
|
|
|
|
_speed = format ["%1 km/h", floor(speed GVAR(camUnit))];
|
|
|
|
};
|
|
|
|
|
|
|
|
_mode = ["FREE","FIRST","THIRD"] select GVAR(camMode);
|
|
|
|
_time = [daytime,"HH:MM"] call BIS_fnc_timeToString;
|
|
|
|
|
|
|
|
// Update the UI tools
|
|
|
|
(_toolbar controlsGroupCtrl IDC_TOOL_CLOCK) ctrlSetText _time;
|
|
|
|
(_toolbar controlsGroupCtrl IDC_TOOL_FOCUS) ctrlSetText _focus;
|
|
|
|
(_toolbar controlsGroupCtrl IDC_TOOL_FOV) ctrlSetText _fov;
|
|
|
|
(_toolbar controlsGroupCtrl IDC_TOOL_NAME) ctrlSetText _name;
|
|
|
|
(_toolbar controlsGroupCtrl IDC_TOOL_SPEED) ctrlSetText _speed;
|
|
|
|
(_toolbar controlsGroupCtrl IDC_TOOL_VIEW) ctrlSetText _mode;
|