2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
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-08-26 03:31:33 +00:00
|
|
|
* None
|
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
|
|
|
*/
|
2015-08-26 03:31:33 +00:00
|
|
|
params ["_newMode"];
|
2015-03-09 15:46:59 +00:00
|
|
|
|
|
|
|
disableSerialization;
|
2017-10-10 14:39:59 +00:00
|
|
|
private _display = uiNamespace getVariable [[QGVAR(RscTitleDisplay), QGVAR(DialogDisplay)] select (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG), displayNull];
|
2015-08-26 03:31:33 +00:00
|
|
|
|
2021-04-22 03:37:25 +00:00
|
|
|
if (isNull _display) exitWith {LOG("No Display");};
|
2015-03-09 15:46:59 +00:00
|
|
|
|
|
|
|
if (GVAR(currentApplicationPage) == 2) then {
|
2017-10-10 14:39:59 +00:00
|
|
|
private _theMap = [_display displayCtrl IDC_MAPDETAILS, _display displayCtrl IDC_MAPPLAIN] select (!GVAR(mapShowTexture));
|
|
|
|
private _mapCtrlPos = ctrlPosition _theMap;
|
2015-08-26 03:31:33 +00:00
|
|
|
|
|
|
|
_mapCtrlPos params ["_mapCtrlPosX", "_mapCtrlPosY", "_mapCtrlPosZ", "_mapSize"];
|
2017-10-10 14:39:59 +00:00
|
|
|
private _centerPos = [(_mapCtrlPosX + _mapCtrlPosZ / 2), (_mapCtrlPosY + _mapSize / 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);
|
|
|
|
};
|