almost done

This commit is contained in:
PabstMirror
2015-01-16 02:13:29 -06:00
parent 4c5912e2f1
commit 687c7e98aa
12 changed files with 224 additions and 231 deletions

View File

@ -1,34 +0,0 @@
/*
* Author: KoffeinFlummi
*
* Initializes the blue force tracking module.
*
* Arguments:
* Whatever the module provides. (I dunno.)
*
* Return Value:
* None
*/
#include "script_component.hpp"
if !(hasInterface) exitWith {};
_logic = _this select 0;
_units = _this select 1;
_activated = _this select 2;
if !(_activated) exitWith {};
_logic spawn {
waitUntil {alive player};
GVAR(BFT_Enabled) = true;
[_this, QGVAR(BFT_Interval), "Interval"] call EFUNC(common,readNumericParameterFromModule);
[_this, QGVAR(BFT_HideAiGroups), "HideAiGroups"] call EFUNC(common,readBooleanParameterFromModule);
diag_log text "[ACE]: Blue Force Tracking Module initialized.";
TRACE_2("[ACE]: Blue Force Tracking Module initialized.",GVAR(BFT_Interval), GVAR(BFT_HideAiGroups));
//@toDo start BFT here:
};

View File

@ -0,0 +1,32 @@
/*
* Author: KoffeinFlummi
*
* Initializes the blue force tracking module.
*
* Arguments:
* Whatever the module provides. (I dunno.)
*
* Return Value:
* None
*/
#include "script_component.hpp"
if !(hasInterface) exitWith {};
_logic = _this select 0;
_units = _this select 1;
_activated = _this select 2;
if !(_activated) exitWith {};
GVAR(BFT_Enabled) = true;
[_logic, QGVAR(BFT_Interval), "Interval"] call EFUNC(common,readNumericParameterFromModule);
[_logic, QGVAR(BFT_HideAiGroups), "HideAiGroups"] call EFUNC(common,readBooleanParameterFromModule);
diag_log text "[ACE]: Blue Force Tracking Module initialized.";
TRACE_2("[ACE]: Blue Force Tracking Module initialized.",GVAR(BFT_Interval), GVAR(BFT_HideAiGroups));
//start BFT:
GVAR(BFT_markers) = [];
[FUNC(blueForceTrackingUpdate), GVAR(BFT_Interval), []] call CBA_fnc_addPerFrameHandler;

View File

@ -0,0 +1,38 @@
#include "script_component.hpp"
// Delete last set of markers (always)
{
deleteMarkerLocal _x;
} forEach GVAR(BFT_markers);
if (GVAR(BFT_Enabled) and {(!isNil "ACE_player") and {alive ACE_player}}) then {
_groupsToDrawMarkers = [];
_playerSide = call EFUNC(common,playerSide);
if (GVAR(BFT_HideAiGroups)) then {
_groupsToDrawMarkers = [allGroups, {side _this == _playerSide}] call EFUNC(common,filter);
} else {
_groupsToDrawMarkers = [allGroups, {
_anyPlayers = {
[_x] call EFUNC(common,isPlayer);
} count units _this;
(side _this == _playerSide) && _anyPlayers > 0
}] call EFUNC(common,filter);
};
{
_markerType = [_x] call EFUNC(common,getMarkerType);
_colour = format ["Color%1", side _x];
_marker = createMarkerLocal [format ["ACE_BFT_%1", _i], [(getPos leader _x) select 0, (getPos leader _x) select 1]];
_marker setMarkerTypeLocal _markerType;
_marker setMarkerColorLocal _colour;
_marker setMarkerTextLocal (groupID _x);
GVAR(BFT_markers) pushBack _marker;
} forEach _groupsToDrawMarkers;
};

View File

@ -3,4 +3,4 @@
#include "script_component.hpp"
(missionNameSpace getVariable [QGVAR(drawing_syncMarkers), true] && {GVAR(EveryoneCanDrawOnBriefing)}) ||
{(!isNull player) && {"ACE_MapTools" in items player}}
{(!isNull ACE_player) && {"ACE_MapTools" in items ACE_player}}

View File

@ -0,0 +1,39 @@
#include "script_component.hpp"
if (visibleMap) then {
// Show/Hide draw buttons
if ("ACE_MapTools" in items ACE_player) then {
{ ((finddisplay 12) displayctrl _x) ctrlShow true; } forEach GVAR(drawing_controls);
} else {
{ ((finddisplay 12) displayctrl _x) ctrlShow false; } forEach GVAR(drawing_controls);
if (GVAR(drawing_isDrawing)) then {
call FUNC(cancelDrawing);
};
};
};
//When Map is Closed:
if (GVAR(mapVisableLastFrame) && (!visibleMap)) then {
GVAR(mapVisableLastFrame) = false;
// Hide GPS
[false] call FUNC(openMapGps);
// Hide Map tools
deleteMarkerLocal MARKERNAME_MAPTOOL_FIXED;
deleteMarkerLocal MARKERNAME_MAPTOOL_ROTATINGNORMAL;
deleteMarkerLocal MARKERNAME_MAPTOOL_ROTATINGSMALL;
GVAR(mapTool_markerRotatingFixed) = nil;
GVAR(mapTool_markerRotatingNormal) = nil;
GVAR(mapTool_markerRotatingSmall) = nil;
// Cancel drawing
call FUNC(cancelDrawing);
};
//When Map is Opened:
if ((!GVAR(mapVisableLastFrame)) && (visibleMap)) then {
GVAR(mapVisableLastFrame) = true;
// Show and update map tools if required
[] call FUNC(updateMapToolMarkers);
// Show GPS if required
[GVAR(mapGpsShow)] call FUNC(openMapGps);
};

View File

@ -1,42 +1,24 @@
/*
* Author: CAA-Picard
*
* Opens or closes the gps on the map screen, showing coordinates
*
* Argument:
* 0: Open GPS? (Boolean)
*
* Return value:
* Nothing
*/
* Author: CAA-Picard
*
* Opens or closes the gps on the map screen, showing coordinates
*
* Argument:
* 0: Open GPS? (Boolean)
*
* Return value:
* Nothing
*/
#include "script_component.hpp"
_open = _this select 0;
_shouldOpenGps = _this select 0;
_isOpen = !(isNull (uiNamespace getVariable [QGVAR(ui_mapGpsDisplay), displayNull]));
if (_open && {"ItemGPS" in assignedItems player} && {!_isOpen}) then {
if (_shouldOpenGps && {"ItemGPS" in assignedItems ACE_player} && {!_isOpen}) then {
("RscACE_MapGps" call BIS_fnc_rscLayer) cutRsc ["RscACE_MapGps","PLAIN"];
// Spawn a thread to update gps display
[] spawn {
disableSerialization;
while {!(isNull (uiNamespace getVariable [QGVAR(ui_mapGpsDisplay), displayNull]))} do {
if !("ItemGPS" in assignedItems player) exitWith {};
_mapGpsDisplay = uiNamespace getVariable [QGVAR(ui_mapGpsDisplay), displayNull];
_ctrl = _mapGpsDisplay displayCtrl 913590;
_ctrl ctrlSetText str(round(getDir player));
_ctrl = _mapGpsDisplay displayCtrl 913591;
_ctrl ctrlSetText str(round((getPosASL player) select 2));
_ctrl = _mapGpsDisplay displayCtrl 913592;
_ctrl ctrlSetText mapGridPosition player;
sleep 0.5;
};
("RscACE_MapGps" call BIS_fnc_rscLayer) cutText ["","PLAIN"];
};
[FUNC(openMapGpsUpdate), 0.5, []] call CBA_fnc_addPerFrameHandler; //update bearing/altitude every 0.5 sec (ticktime)
} else {
("RscACE_MapGps" call BIS_fnc_rscLayer) cutText ["","PLAIN"];
};

View File

@ -0,0 +1,18 @@
//CAA-Picard
//update gps display
#include "script_component.hpp"
if ((!("ItemGPS" in assigneditems ACE_player)) || {isNull (uiNamespace getVariable [QGVAR(ui_mapGpsDisplay), displayNull])}) exitWith {
("RscACE_MapGps" call BIS_fnc_rscLayer) cutText ["","PLAIN"]; //close GPS RSC
[(_this select 1)] call CBA_fnc_removePerFrameHandler; //remove frameHandler
};
disableSerialization;
_mapGpsDisplay = uiNamespace getVariable [QGVAR(ui_mapGpsDisplay), displayNull];
_ctrl = _mapGpsDisplay displayCtrl 913590;
_ctrl ctrlSetText str(round(getDir player)); //set Heading
_ctrl = _mapGpsDisplay displayCtrl 913591;
_ctrl ctrlSetText str(round((getPosASL player) select 2)); //set Altitude
_ctrl = _mapGpsDisplay displayCtrl 913592;
_ctrl ctrlSetText mapGridPosition player; //set grid cords

View File

@ -17,38 +17,38 @@
#define CONSTANT_SCALE 0.2
// If markers exist and they should'nt, delete them
if (!("ACE_MapTools" in items player) || {GVAR(mapTool_Shown) == 0}) then {
if (!("ACE_MapTools" in items ACE_player) || {GVAR(mapTool_Shown) == 0}) then {
// If markers exist, delete them
if (!isNil QGVAR(mapTool_markerRotatingFixed)) then {
deleteMarkerLocal MARKERNAME_MAPTOOL_FIXED;
GVAR(mapTool_markerRotatingFixed) = nil;
};
};
if (!("ACE_MapTools" in items player) || {GVAR(mapTool_Shown) != 1}) then {
if (!isNil "GVAR(mapTool_markerRotatingNormal)") then {
if (!("ACE_MapTools" in items ACE_player) || {GVAR(mapTool_Shown) != 1}) then {
if (!isNil QGVAR(mapTool_markerRotatingNormal)) then {
deleteMarkerLocal MARKERNAME_MAPTOOL_ROTATINGNORMAL;
GVAR(mapTool_markerRotatingNormal) = nil;
};
};
if (!("ACE_MapTools" in items player) || {GVAR(mapTool_Shown) != 2}) then {
if (!isNil "GVAR(mapTool_markerRotatingSmall)") then {
if (!("ACE_MapTools" in items ACE_player) || {GVAR(mapTool_Shown) != 2}) then {
if (!isNil QGVAR(mapTool_markerRotatingSmall)) then {
deleteMarkerLocal MARKERNAME_MAPTOOL_ROTATINGSMALL;
GVAR(mapTool_markerRotatingSmall) = nil;
};
};
if (!("ACE_MapTools" in items player)|| {GVAR(mapTool_Shown) == 0}) exitWith {};
if (!("ACE_MapTools" in items ACE_player)|| {GVAR(mapTool_Shown) == 0}) exitWith {};
// If markers don't exist and should, create them
if (isNil QGVAR(mapTool_markerRotatingFixed)) then {
GVAR(mapTool_markerRotatingFixed) = createMarkerLocal [MARKERNAME_MAPTOOL_FIXED, GVAR(mapTool_pos)];
MARKERNAME_MAPTOOL_FIXED setMarkerType MARKERNAME_MAPTOOL_FIXED;
};
if ((isNil "GVAR(mapTool_markerRotatingNormal)") && {GVAR(mapTool_Shown) == 1}) then {
if ((isNil QGVAR(mapTool_markerRotatingNormal)) && {GVAR(mapTool_Shown) == 1}) then {
GVAR(mapTool_markerRotatingNormal) = createMarkerLocal [MARKERNAME_MAPTOOL_ROTATINGNORMAL, GVAR(mapTool_pos)];
MARKERNAME_MAPTOOL_ROTATINGNORMAL setMarkerType MARKERNAME_MAPTOOL_ROTATINGNORMAL;
};
if ((isNil "GVAR(mapTool_markerRotatingSmall)") && {GVAR(mapTool_Shown) == 2}) then {
if ((isNil QGVAR(mapTool_markerRotatingSmall)) && {GVAR(mapTool_Shown) == 2}) then {
GVAR(mapTool_markerRotatingSmall) = createMarkerLocal [MARKERNAME_MAPTOOL_ROTATINGSMALL, GVAR(mapTool_pos)];
MARKERNAME_MAPTOOL_ROTATINGSMALL setMarkerType MARKERNAME_MAPTOOL_ROTATINGSMALL;
};