2015-03-09 15:46:59 +00:00
|
|
|
/*
|
|
|
|
* Author: PabstMirror
|
2015-03-11 07:06:07 +00:00
|
|
|
* Saves the current mode and sets a new mode
|
2015-04-17 20:45:00 +00:00
|
|
|
* Used to backup display when switching display modes
|
2015-03-09 15:46:59 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2015-03-11 07:06:07 +00:00
|
|
|
* 0: New Mode <NUMBER>
|
2015-03-09 15:46:59 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-03-11 07:06:07 +00:00
|
|
|
* Nothing
|
2015-03-09 15:46:59 +00:00
|
|
|
*
|
|
|
|
* Example:
|
2015-03-11 07:06:07 +00:00
|
|
|
* [2] call ace_microdagr_fnc_saveCurrentAndSetNewMode
|
2015-03-09 15:46:59 +00:00
|
|
|
*
|
2015-03-11 07:06:07 +00:00
|
|
|
* Public: No
|
2015-03-09 15:46:59 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-04-17 20:45:00 +00:00
|
|
|
private ["_display", "_theMap", "_mapSize", "_centerPos", "_mapCtrlPos"];
|
2015-03-11 07:06:07 +00:00
|
|
|
|
2015-03-09 15:46:59 +00:00
|
|
|
PARAMS_1(_newMode);
|
|
|
|
|
|
|
|
disableSerialization;
|
2015-03-09 18:52:15 +00:00
|
|
|
_display = displayNull;
|
|
|
|
if (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG) then {
|
|
|
|
_display = (uiNamespace getVariable [QGVAR(DialogDisplay), displayNull]);
|
|
|
|
} else {
|
|
|
|
_display = (uiNamespace getVariable [QGVAR(RscTitleDisplay), displayNull]);
|
|
|
|
};
|
|
|
|
if (isNull _display) exitWith {ERROR("No Display");};
|
2015-03-09 15:46:59 +00:00
|
|
|
|
|
|
|
if (GVAR(currentApplicationPage) == 2) then {
|
|
|
|
_theMap = if (!GVAR(mapShowTexture)) then {_display displayCtrl IDC_MAPPLAIN} else {_display displayCtrl IDC_MAPDETAILS};
|
2015-03-11 07:06:07 +00:00
|
|
|
_mapCtrlPos = ctrlPosition _theMap;
|
|
|
|
_mapSize = _mapCtrlPos select 3;
|
|
|
|
_centerPos = [((_mapCtrlPos select 0) + (_mapCtrlPos select 2) / 2), ((_mapCtrlPos select 1) + (_mapCtrlPos select 3) / 2)];
|
2015-03-09 15:46:59 +00:00
|
|
|
GVAR(mapPosition) = _theMap ctrlMapScreenToWorld _centerPos;
|
|
|
|
GVAR(mapZoom) = (ctrlMapScale _theMap) * _mapSize;
|
2015-04-17 20:45:00 +00:00
|
|
|
|
2015-03-09 15:46:59 +00:00
|
|
|
//Hit button again, toggle map modes:
|
|
|
|
if (_newMode == 2) then {
|
2015-04-17 20:45:00 +00:00
|
|
|
if (GVAR(mapShowTexture)) then {
|
|
|
|
GVAR(mapShowTexture) = false;
|
|
|
|
} else {
|
2015-03-09 18:52:15 +00:00
|
|
|
if (GVAR(MapDataAvailable) == MAP_DETAIL_SAT) then {
|
|
|
|
GVAR(mapShowTexture) = true;
|
|
|
|
};
|
2015-04-17 20:45:00 +00:00
|
|
|
};
|
2015-03-09 18:52:15 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
//Can't switch to map if no map loaded
|
|
|
|
if (_newMode == APP_MODE_MAP) then {
|
|
|
|
if (GVAR(MapDataAvailable) == MAP_DETAIL_NONE) then {
|
|
|
|
_newMode = -1;
|
2015-03-09 15:46:59 +00:00
|
|
|
};
|
|
|
|
};
|
2015-03-09 18:52:15 +00:00
|
|
|
|
2015-03-09 15:46:59 +00:00
|
|
|
if (_newMode != -1) then {
|
|
|
|
GVAR(currentApplicationPage) = _newMode;
|
|
|
|
[] call FUNC(showApplicationPage);
|
|
|
|
};
|