mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
PFHs only as needed
This commit is contained in:
parent
e2e6091c1f
commit
c9750919a4
@ -19,11 +19,8 @@
|
||||
|
||||
params ["_display"];
|
||||
|
||||
// Kill PFH when display is closed
|
||||
if (isNull _display) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; };
|
||||
|
||||
// Reduce overhead when compass is hidden
|
||||
if !(ctrlShown (_display displayCtrl IDC_COMP)) exitWith {};
|
||||
// Kill PFH when compass hidden (or display is closed)
|
||||
if (isNil QGVAR(compHandler)) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; };
|
||||
|
||||
private ["_compass","_NE","_ES","_SW","_WN","_compassW","_degree","_heading","_offset","_positions","_sequence"];
|
||||
|
||||
|
@ -99,15 +99,9 @@ switch (toLower _mode) do {
|
||||
// Always show interface and hide map upon opening
|
||||
[_display,nil,nil,!GVAR(showInterface),GVAR(showMap)] call FUNC(toggleInterface);
|
||||
|
||||
// Keep unit tree up to date
|
||||
// Keep unit list and tree up to date
|
||||
[FUNC(handleUnits), 21, _display] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
// Handle the compass heading
|
||||
[FUNC(handleCompass), 0, _display] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
// Handle the toolbar values
|
||||
[FUNC(handleToolbar), 0, _display] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
// Populate the help splash
|
||||
private "_help";
|
||||
_help = (_display displayCtrl IDC_HELP) controlsGroupCtrl IDC_HELP_LIST;
|
||||
@ -159,6 +153,8 @@ switch (toLower _mode) do {
|
||||
};
|
||||
|
||||
GVAR(camHandler) = nil;
|
||||
GVAR(compHandler) = nil;
|
||||
GVAR(toolHandler) = nil;
|
||||
};
|
||||
// Mouse events
|
||||
case "onmousebuttondown": {
|
||||
@ -183,9 +179,9 @@ switch (toLower _mode) do {
|
||||
|
||||
// Scroll to change speed, modifier for zoom
|
||||
if (GVAR(ctrlKey)) then {
|
||||
GVAR(camZoom) = ((GVAR(camZoom) + _zChange * 0.1) max 0.01) min 2;
|
||||
[nil,nil,nil,nil,nil,nil, GVAR(camZoom) + _zChange * 0.1] call FUNC(setCameraAttributes);
|
||||
} else {
|
||||
GVAR(camSpeed) = ((GVAR(camSpeed) + _zChange * 0.2) max 0.05) min 10;
|
||||
[nil,nil,nil,nil,nil,nil,nil, GVAR(camSpeed) + _zChange * 0.2] call FUNC(setCameraAttributes);
|
||||
};
|
||||
};
|
||||
case "onmousemoving": {
|
||||
|
@ -19,14 +19,8 @@
|
||||
|
||||
params ["_display"];
|
||||
|
||||
// Kill PFH when display is closed
|
||||
if (isNull _display) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; };
|
||||
|
||||
GVAR(camera) camSetFov -(linearConversion [0.1,2,GVAR(camZoom),-2,-0.1,true]);
|
||||
GVAR(camera) camCommit 0;
|
||||
|
||||
// Reduce overhead when toolbar is hidden
|
||||
if !(ctrlShown (_display displayCtrl IDC_TOOL)) exitWith {};
|
||||
// Kill PFH when toolbar hidden (or display is closed)
|
||||
if (isNil QGVAR(toolHandler)) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; };
|
||||
|
||||
private ["_name","_vision","_fov","_speed","_mode","_time","_toolbar"];
|
||||
_toolbar = _display displayCtrl IDC_TOOL;
|
||||
|
@ -16,8 +16,8 @@
|
||||
* 3: Camera position (ATL) <ARRAY> <OPTIONAL>
|
||||
* 4: Camera pan (0 - 360) <NUMBER> <OPTIONAL>
|
||||
* 5: Camera tilt (-90 - 90) <NUMBER> <OPTIONAL>
|
||||
* 6: Camera zoom (0.1 - 2) <NUMBER> <OPTIONAL>
|
||||
* 7: Camera speed (m/s) <NUMBER> <OPTIONAL>
|
||||
* 6: Camera zoom (0.01 - 2) <NUMBER> <OPTIONAL>
|
||||
* 7: Camera speed in m/s (0.05 - 10) <NUMBER> <OPTIONAL>
|
||||
*
|
||||
* Return Value:
|
||||
* None <NIL>
|
||||
@ -52,11 +52,11 @@ if !(_vision in GVAR(availableVisions)) then {
|
||||
|
||||
GVAR(camPan) = ((_heading % 360) max 0);
|
||||
GVAR(camPosition) = (ATLtoASL _position);
|
||||
GVAR(camSpeed) = (_speed min 0.05) max 10;
|
||||
GVAR(camTilt) = (_heading min -89) max 89;
|
||||
GVAR(camSpeed) = (_speed max 0.05) min 10;
|
||||
GVAR(camTilt) = (_heading max -89) min 89;
|
||||
GVAR(camUnit) = _unit;
|
||||
GVAR(camVision) = _vision;
|
||||
GVAR(camZoom) = (_zoom min 2) max 0;
|
||||
GVAR(camZoom) = (_zoom min 2) max 0.01;
|
||||
|
||||
// Apply if camera exists
|
||||
if !(isNil QGVAR(camera)) then {
|
||||
|
@ -24,6 +24,13 @@
|
||||
|
||||
params ["_display", ["_toggleComp",false], ["_toggleHelp",false], ["_toggleInterface",false], ["_toggleMap",false], ["_toggleTool",false], ["_toggleUnit",false]];
|
||||
|
||||
private ["_comp","_display","_help","_map","_tool","_unit"];
|
||||
_comp = _display displayCtrl IDC_COMP;
|
||||
_help = _display displayCtrl IDC_HELP;
|
||||
_map = _display displayCtrl IDC_MAP;
|
||||
_tool = _display displayCtrl IDC_TOOL;
|
||||
_unit = _display displayCtrl IDC_UNIT;
|
||||
|
||||
// Map and help operate outside of interface
|
||||
GVAR(showHelp) = [GVAR(showHelp), !GVAR(showHelp)] select _toggleHelp;
|
||||
GVAR(showMap) = [GVAR(showMap), !GVAR(showMap)] select _toggleMap;
|
||||
@ -34,18 +41,20 @@ if (GVAR(showMap) && _toggleHelp) then {
|
||||
GVAR(showMap) = false;
|
||||
};
|
||||
|
||||
(_display displayCtrl IDC_HELP) ctrlShow GVAR(showHelp);
|
||||
(_display displayCtrl IDC_MAP) ctrlShow GVAR(showMap);
|
||||
_help ctrlShow GVAR(showHelp);
|
||||
_map ctrlShow GVAR(showMap);
|
||||
|
||||
if (GVAR(showMap)) then {
|
||||
// When map is shown, temporarily hide interface to stop overlapping
|
||||
{
|
||||
(_display displayCtrl _x) ctrlShow false;
|
||||
} forEach [IDC_COMP,IDC_HELP,IDC_TOOL,IDC_UNIT];
|
||||
_x ctrlShow false;
|
||||
} forEach [_comp,_help,_tool,_unit];
|
||||
|
||||
// Centre map on camera/unit
|
||||
(_display displayCtrl IDC_MAP) ctrlMapAnimAdd [0, 0.5, [GVAR(camUnit),GVAR(camera)] select (GVAR(camMode) == 0)];
|
||||
ctrlMapAnimCommit (_display displayCtrl IDC_MAP);
|
||||
// Centre map on camera/unit upon opening
|
||||
if (_toggleMap) then {
|
||||
_map ctrlMapAnimAdd [0, 0.5, [GVAR(camUnit),GVAR(camera)] select (GVAR(camMode) == 0)];
|
||||
ctrlMapAnimCommit _map;
|
||||
};
|
||||
} else {
|
||||
// Can only toggle interface with map minimised
|
||||
GVAR(showInterface) = [GVAR(showInterface), !GVAR(showInterface)] select _toggleInterface;
|
||||
@ -56,12 +65,25 @@ if (GVAR(showMap)) then {
|
||||
GVAR(showTool) = [GVAR(showTool), !GVAR(showTool)] select _toggleTool;
|
||||
GVAR(showUnit) = [GVAR(showUnit), !GVAR(showUnit)] select _toggleUnit;
|
||||
|
||||
(_display displayCtrl IDC_COMP) ctrlShow GVAR(showComp);
|
||||
(_display displayCtrl IDC_TOOL) ctrlShow GVAR(showTool);
|
||||
(_display displayCtrl IDC_UNIT) ctrlShow GVAR(showUnit);
|
||||
_comp ctrlShow GVAR(showComp);
|
||||
_tool ctrlShow GVAR(showTool);
|
||||
_unit ctrlShow GVAR(showUnit);
|
||||
} else {
|
||||
{
|
||||
(_display displayCtrl _x) ctrlShow false;
|
||||
} forEach [IDC_COMP,IDC_TOOL,IDC_UNIT];
|
||||
_x ctrlShow false;
|
||||
} forEach [_comp,_tool,_unit];
|
||||
};
|
||||
};
|
||||
|
||||
// Only run PFHs for toolbar and compass when respective control is shown, otherwise kill
|
||||
if (ctrlShown _comp) then {
|
||||
if (isNil QGVAR(compHandler)) then { GVAR(compHandler) = [FUNC(handleCompass), 0] call CBA_fnc_addPerFrameHandler; };
|
||||
} else {
|
||||
GVAR(compHandler) = nil;
|
||||
};
|
||||
|
||||
if (ctrlShown _tool) then {
|
||||
if (isNil QGVAR(toolHandler)) then { GVAR(toolHandler) = [FUNC(handleToolbar), 0] call CBA_fnc_addPerFrameHandler; };
|
||||
} else {
|
||||
GVAR(toolHandler) = nil;
|
||||
};
|
||||
|
@ -47,6 +47,10 @@ if (_newMode == 0) then { // Free
|
||||
// Preserve camUnit value for consistency when manually changing view
|
||||
GVAR(camera) cameraEffect ["internal", "back"];
|
||||
|
||||
// Apply the camera zoom
|
||||
GVAR(camera) camSetFov -(linearConversion [0.01,2,GVAR(camZoom),-2,-0.01,true]);
|
||||
GVAR(camera) camCommit 0;
|
||||
|
||||
// Switch to camera to stop AI group chat
|
||||
GVAR(camera) switchCamera "internal";
|
||||
clearRadio;
|
||||
@ -88,6 +92,11 @@ if (_newMode == 0) then { // Free
|
||||
_newUnit switchCamera "external";
|
||||
};
|
||||
|
||||
// Clear radio if group changed
|
||||
if (group _newUnit != group GVAR(camUnit)) then {
|
||||
clearRadio;
|
||||
};
|
||||
|
||||
GVAR(camUnit) = _newUnit;
|
||||
|
||||
// Terminate camera view
|
||||
|
Loading…
Reference in New Issue
Block a user