mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Add BFT Components
This commit is contained in:
parent
d3ee125d5e
commit
04f89cbe3a
@ -13,6 +13,7 @@ Felix Wiegand <koffeinflummi@gmail.com>
|
||||
Garth "L-H" de Wet <garthofhearts@gmail.com>
|
||||
Giallustio
|
||||
Glowbal
|
||||
Gundy
|
||||
Janus
|
||||
jokoho482 <jokoho482@gmail.com>
|
||||
Jonpas <jonpas33@gmail.com>
|
||||
|
1
addons/bft/$PBOPREFIX$
Normal file
1
addons/bft/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
z\ace\addons\bft
|
80
addons/bft/ACE_BFT.hpp
Normal file
80
addons/bft/ACE_BFT.hpp
Normal file
@ -0,0 +1,80 @@
|
||||
class ACE_BFT {
|
||||
class Side {
|
||||
class WEST {
|
||||
encryptionKeys[] = {""};
|
||||
};
|
||||
class EAST {
|
||||
encryptionKeys[] = {""};
|
||||
};
|
||||
class IND {
|
||||
encryptionKeys[] = {""};
|
||||
};
|
||||
};
|
||||
|
||||
class Types {
|
||||
class Inf {
|
||||
displayName = "";
|
||||
iconPath = "\A3\ui_f\data\map\markers\nato\b_inf.paa";
|
||||
};
|
||||
class Motorized {
|
||||
displayName = "";
|
||||
iconPath = "\A3\ui_f\data\map\markers\nato\b_motor_inf.paa";
|
||||
};
|
||||
class Plane {
|
||||
displayName = "";
|
||||
iconPath = "\A3\ui_f\data\map\markers\nato\b_plane.paa";
|
||||
};
|
||||
class Helicopter {
|
||||
displayName = "";
|
||||
iconPath = "\A3\ui_f\data\map\markers\nato\b_air.paa";
|
||||
};
|
||||
class Armor {
|
||||
displayName = "";
|
||||
iconPath = "\A3\ui_f\data\map\markers\nato\b_armor.paa";
|
||||
};
|
||||
class Naval {
|
||||
displayName = "";
|
||||
iconPath = "\A3\ui_f\data\map\markers\nato\b_naval.paa";
|
||||
};
|
||||
class HQ {
|
||||
displayName = "";
|
||||
iconPath = "\A3\ui_f\data\map\markers\nato\b_hq.paa";
|
||||
};
|
||||
class Medical {
|
||||
displayName = "";
|
||||
iconPath = "\A3\ui_f\data\map\markers\nato\b_med.paa";
|
||||
};
|
||||
class Maintenance {
|
||||
displayName = "";
|
||||
iconPath = "\A3\ui_f\data\map\markers\nato\b_maint.paa";
|
||||
};
|
||||
class Artillery {
|
||||
displayName = "";
|
||||
iconPath = "\A3\ui_f\data\map\markers\nato\b_art.paa";
|
||||
};
|
||||
class Mortar {
|
||||
displayName = "";
|
||||
iconPath = "\A3\ui_f\data\map\markers\nato\b_mortar.paa";
|
||||
};
|
||||
class Service {
|
||||
displayName = "";
|
||||
iconPath = "\A3\ui_f\data\map\markers\nato\b_service.paa";
|
||||
};
|
||||
class Recon {
|
||||
displayName = "";
|
||||
iconPath = "\A3\ui_f\data\map\markers\nato\b_recon.paa";
|
||||
};
|
||||
class Mechanized {
|
||||
displayName = "";
|
||||
iconPath = "\A3\ui_f\data\map\markers\nato\b_mech_inf.paa";
|
||||
};
|
||||
class UAV {
|
||||
displayName = "";
|
||||
iconPath = "\A3\ui_f\data\map\markers\nato\b_uav.paa";
|
||||
};
|
||||
class Installation {
|
||||
displayName = "";
|
||||
iconPath = "\A3\ui_f\data\map\markers\nato\b_installation.paa";
|
||||
};
|
||||
};
|
||||
};
|
97
addons/bft/CfgEventHandlers.hpp
Normal file
97
addons/bft/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,97 @@
|
||||
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_InitPost_EventHandlers {
|
||||
class Air {
|
||||
class ADDON {
|
||||
init = QUOTE(call FUNC(vehicleInit));
|
||||
};
|
||||
};
|
||||
class LandVehicle {
|
||||
class ADDON {
|
||||
init = QUOTE(call FUNC(vehicleInit));
|
||||
};
|
||||
};
|
||||
class Ship {
|
||||
class ADDON {
|
||||
init = QUOTE(call FUNC(vehicleInit));
|
||||
};
|
||||
};
|
||||
};
|
||||
class Extended_Killed_EventHandlers {
|
||||
class Air {
|
||||
class ADDON {
|
||||
Killed = QUOTE(call FUNC(handleKilled));
|
||||
};
|
||||
};
|
||||
class LandVehicle {
|
||||
class ADDON {
|
||||
Killed = QUOTE(call FUNC(handleKilled));
|
||||
};
|
||||
};
|
||||
class Ship {
|
||||
class ADDON {
|
||||
Killed = QUOTE(call FUNC(handleKilled));
|
||||
};
|
||||
};
|
||||
};
|
||||
class Extended_Engine_EventHandlers {
|
||||
class Air {
|
||||
class ADDON {
|
||||
Engine = QUOTE(call FUNC(handleEngine));
|
||||
};
|
||||
};
|
||||
class LandVehicle {
|
||||
class ADDON {
|
||||
Engine = QUOTE(call FUNC(handleEngine));
|
||||
};
|
||||
};
|
||||
class Ship {
|
||||
class ADDON {
|
||||
Engine = QUOTE(call FUNC(handleEngine));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
class Extended_Init_EventHandlers {
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
init = QUOTE(call FUNC(validateInventory));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_Respawn_EventHandlers {
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
respawn = QUOTE(call FUNC(validateInventory));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_Take_EventHandlers {
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
Take = QUOTE(call FUNC(validateInventory));
|
||||
};
|
||||
};
|
||||
};
|
||||
class Extended_Put_EventHandlers {
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
Put = QUOTE(call FUNC(validateInventory));
|
||||
};
|
||||
};
|
||||
};
|
||||
*/
|
18
addons/bft/CfgMagazines.hpp
Normal file
18
addons/bft/CfgMagazines.hpp
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
class CfgMagazines {
|
||||
class CA_magazine;
|
||||
class ACE_bftMagazineBase: CA_magazine {
|
||||
scope = 2;
|
||||
value = 1;
|
||||
count = 1;
|
||||
type = 16;
|
||||
displayName = "BFT Base Magazine";
|
||||
picture = PATHTOF(data\icon_base.paa);
|
||||
descriptionShort = "";
|
||||
descriptionUse = "";
|
||||
mass = 1;
|
||||
|
||||
// classname of the item entry, for easily identifying the device type
|
||||
GVAR(type) = "ACE_bftItemBase";
|
||||
};
|
||||
};
|
9
addons/bft/CfgVehicles.hpp
Normal file
9
addons/bft/CfgVehicles.hpp
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
// Sample entry:
|
||||
/*class CfgVehicles {
|
||||
class MRAP_01_base_F;
|
||||
class B_MRAP_01_F: MRAP_01_base_F {
|
||||
// what devices are available?
|
||||
GVAR(vehicleDevices)[] = {"FBCB2VehDevice"};
|
||||
};
|
||||
};*/
|
22
addons/bft/CfgWeapons.hpp
Normal file
22
addons/bft/CfgWeapons.hpp
Normal file
@ -0,0 +1,22 @@
|
||||
class CfgWeapons {
|
||||
class ACE_ItemCore;
|
||||
class InventoryItem_Base_F;
|
||||
class ACE_bftItemBase: ACE_ItemCore {
|
||||
author = "$STR_ACE_Common_ACETeam";
|
||||
scope = 2;
|
||||
displayName = "BFT Base Item";
|
||||
descriptionShort = "";
|
||||
picture = PATHTOF(data\icon_base.paa);
|
||||
icon = "iconObject_circle";
|
||||
mapSize = 0.034;
|
||||
|
||||
// Specify if this item has BFT enabled.
|
||||
GVAR(deviceType) = "FBCB2Device";
|
||||
// Magazine type for unique IDs. This is the magazine classname by which this item will be replaced. Will be replaced once BI implements unique Ids for items.
|
||||
GVAR(magazineItem) = "ACE_bftMagazineBase";
|
||||
|
||||
class ItemInfo: InventoryItem_Base_F {
|
||||
mass = 1;
|
||||
};
|
||||
};
|
||||
};
|
62
addons/bft/XEH_PREP.hpp
Normal file
62
addons/bft/XEH_PREP.hpp
Normal file
@ -0,0 +1,62 @@
|
||||
PREP(chatMessage_getId);
|
||||
PREP(chatMessages_get);
|
||||
PREP(chatMessages_send);
|
||||
|
||||
PREP(checkInventory);
|
||||
PREP(checkItem);
|
||||
PREP(getAllReportingModes);
|
||||
PREP(getDeviceData);
|
||||
PREP(getMagazineID);
|
||||
PREP(getOwnedDevices);
|
||||
PREP(handleAddDeviceData);
|
||||
PREP(handleItemCreated);
|
||||
PREP(handleKilled);
|
||||
PREP(handleEngine);
|
||||
PREP(handleVehicleDeviceKilled);
|
||||
|
||||
PREP(handleUpdateDeviceOwner);
|
||||
PREP(handleUpdateDeviceGroup);
|
||||
PREP(handleUpdateDeviceElementType);
|
||||
PREP(handleUpdateDeviceCallsign);
|
||||
PREP(handleUpdateDeviceKeys);
|
||||
PREP(handleUpdateDeviceAppData);
|
||||
|
||||
PREP(handleDeviceDataChanged);
|
||||
PREP(handleRegisteredEncryptionKeysChanged);
|
||||
PREP(handleRegisteredModeChanged);
|
||||
PREP(handleColorFilteringChanged);
|
||||
PREP(handleDeviceOpened);
|
||||
PREP(handleDeviceClosed);
|
||||
|
||||
PREP(handleRequestAllData);
|
||||
PREP(isDeviceOwned);
|
||||
PREP(setDeviceOwner);
|
||||
PREP(validateInventory);
|
||||
PREP(deviceDataToMapData);
|
||||
PREP(getSizeIcon);
|
||||
PREP(getTypeIcon);
|
||||
PREP(getInterfaces);
|
||||
PREP(vehicleInit);
|
||||
PREP(encryptionKeyMatch);
|
||||
PREP(updateRegisteredEncryptionKeys);
|
||||
PREP(updateRegisteredModes);
|
||||
PREP(removeDeviceByOwner);
|
||||
|
||||
PREP(handleSyncedArrayPushback);
|
||||
PREP(handleSyncedArrayDelete);
|
||||
PREP(handleSyncedArrayUpdate);
|
||||
PREP(syncedArrayPushback);
|
||||
PREP(syncedArrayDelete);
|
||||
PREP(syncedArrayUpdate);
|
||||
|
||||
PREP(getGroupData);
|
||||
PREP(createGroup);
|
||||
PREP(updateGroup);
|
||||
PREP(getGroupColor);
|
||||
|
||||
PREP(getEncryptionKey);
|
||||
PREP(generateEncryptionKey);
|
||||
PREP(addDefaultSideEncryptionKey);
|
||||
PREP(updateAllEncryptionKeys);
|
||||
PREP(updateAvailableDevicesPosition);
|
||||
PREP(handleUpdateAllEncryptionKeys);
|
53
addons/bft/XEH_postInit.sqf
Normal file
53
addons/bft/XEH_postInit.sqf
Normal file
@ -0,0 +1,53 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
["bft_itemCreated", FUNC(handleItemCreated)] call EFUNC(common,addEventHandler);
|
||||
["bft_addDeviceData", FUNC(handleAddDeviceData)] call EFUNC(common,addEventHandler);
|
||||
["bft_updateDeviceOwner", FUNC(handleUpdateDeviceOwner)] call EFUNC(common,addEventHandler);
|
||||
["bft_updateDeviceGroup", FUNC(handleUpdateDeviceGroup)] call EFUNC(common,addEventHandler);
|
||||
["bft_updateDeviceElementType", FUNC(handleUpdateDeviceElementType)] call EFUNC(common,addEventHandler);
|
||||
["bft_updateDeviceCallsign", FUNC(handleUpdateDeviceCallsign)] call EFUNC(common,addEventHandler);
|
||||
["bft_updateDeviceKeys", FUNC(handleUpdateDeviceKeys)] call EFUNC(common,addEventHandler);
|
||||
["bft_updateDeviceAppData", FUNC(handleUpdateDeviceAppData)] call EFUNC(common,addEventHandler);
|
||||
|
||||
["bft_syncedArrayDelete", FUNC(handleSyncedArrayDelete)] call EFUNC(common,addEventHandler);
|
||||
["bft_syncedArrayPushback", FUNC(handleSyncedArrayPushback)] call EFUNC(common,addEventHandler);
|
||||
["bft_syncedArrayUpdate", FUNC(handleSyncedArrayUpdate)] call EFUNC(common,addEventHandler);
|
||||
|
||||
["bft_vehicleDeviceKilled", FUNC(handleVehicleDeviceKilled)] call EFUNC(common,addEventHandler);
|
||||
|
||||
if(!isServer) then {
|
||||
["PlayerJip", {
|
||||
diag_log text format["[ACE] * JIP BFT Data Synchronization initialized"];
|
||||
["bft_requestAllData", [player]] call EFUNC(common,serverEvent);
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
} else {
|
||||
["bft_requestAllData", FUNC(handleRequestAllData)] call EFUNC(common,addEventHandler);
|
||||
|
||||
/*[QGVAR(messages), [0, "Message content!"]] call FUNC(syncedArrayPushback);
|
||||
[QGVAR(messages), ["0/1", "Message content!"]] call FUNC(syncedArrayPushback);
|
||||
[QGVAR(messages), [2, "Message content!"]] call FUNC(syncedArrayPushback);
|
||||
[QGVAR(messages), [3, "Message content!"]] call FUNC(syncedArrayPushback);
|
||||
|
||||
[QGVAR(messages), [0, "updated content!"]] call FUNC(syncedArrayUpdate);
|
||||
[QGVAR(messages), [2, "updated content!"]] call FUNC(syncedArrayUpdate);
|
||||
[QGVAR(messages), ["0/1", "another content!"]] call FUNC(syncedArrayUpdate);
|
||||
|
||||
[QGVAR(messages), 0] call FUNC(syncedArrayDelete);
|
||||
[QGVAR(messages), "0/1"] call FUNC(syncedArrayDelete);
|
||||
[QGVAR(messages), 2] call FUNC(syncedArrayDelete);
|
||||
[QGVAR(messages), 3] call FUNC(syncedArrayDelete);*/
|
||||
|
||||
// this setvariable ["ace_bft_assignableInformation_MDFDevice", ["elementType", 0, "elementCallsign", 1]];
|
||||
};
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
["playerInventoryChanged", FUNC(validateInventory)] call EFUNC(common,addEventHandler);
|
||||
["playerChanged", FUNC(validateInventory)] call EFUNC(common,addEventHandler);
|
||||
|
||||
["bft_deviceDataChanged", FUNC(handleDeviceDataChanged)] call EFUNC(common,addEventHandler);
|
||||
["bft_registeredEncryptionKeysChanged", FUNC(handleRegisteredEncryptionKeysChanged)] call EFUNC(common,addEventHandler);
|
||||
["bft_registeredModeChanged", FUNC(handleRegisteredModeChanged)] call EFUNC(common,addEventHandler);
|
||||
["bft_colorFilteringChanged", FUNC(handleColorFilteringChanged)] call EFUNC(common,addEventHandler);
|
||||
["bft_deviceOpened", FUNC(handleDeviceOpened)] call EFUNC(common,addEventHandler);
|
||||
["bft_deviceClosed", FUNC(handleDeviceClosed)] call EFUNC(common,addEventHandler);
|
42
addons/bft/XEH_preInit.sqf
Normal file
42
addons/bft/XEH_preInit.sqf
Normal file
@ -0,0 +1,42 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
ADDON = false;
|
||||
|
||||
#include "XEH_PREP.hpp"
|
||||
|
||||
GVAR(pendingIdAssignmentList) = [];
|
||||
|
||||
// Synced data collections
|
||||
GVAR(syncedArrayVariables) = [];
|
||||
GVAR(saluteReports) = [];
|
||||
GVAR(deviceData) = [];
|
||||
GVAR(routes) = [];
|
||||
GVAR(messages) = [];
|
||||
GVAR(requests) = [];
|
||||
GVAR(orbatElements) = [];
|
||||
|
||||
GVAR(registeredEncyptionKeys) = [];
|
||||
GVAR(registeredViewModes) = [];
|
||||
GVAR(availableDevices) = [];
|
||||
GVAR(allReportingModes) = [] call FUNC(getAllReportingModes);
|
||||
|
||||
// local data collections
|
||||
GVAR(colorFilters) = [[1, [1,0,0,1]]];
|
||||
|
||||
GVAR(localOwnedEncyptionKeys) = [];
|
||||
GVAR(currentOpenedDevice) = [];
|
||||
|
||||
GVAR(colorWest) = [
|
||||
profileNamespace getvariable ['Map_BLUFOR_R', 0],
|
||||
profileNamespace getvariable ['Map_BLUFOR_G', 0.8],
|
||||
profileNamespace getvariable ['Map_BLUFOR_B', 1],
|
||||
profileNamespace getvariable ['Map_BLUFOR_A', 0.8]
|
||||
];
|
||||
|
||||
if (isServer) then {
|
||||
["WEST", "west-key" /*call FUNC(generateEncryptionKey)*/] call FUNC(addDefaultSideEncryptionKey);
|
||||
["EAST", "east-key" /*call FUNC(generateEncryptionKey)*/] call FUNC(addDefaultSideEncryptionKey);
|
||||
["IND", "ind-key" /*call FUNC(generateEncryptionKey)*/] call FUNC(addDefaultSideEncryptionKey);
|
||||
};
|
||||
|
||||
ADDON = true;
|
3
addons/bft/XEH_preStart.sqf
Normal file
3
addons/bft/XEH_preStart.sqf
Normal file
@ -0,0 +1,3 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#include "XEH_PREP.hpp"
|
19
addons/bft/config.cpp
Normal file
19
addons/bft/config.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_common"};
|
||||
author[] = {ECSTRING(Common,ACETeam)};
|
||||
authorUrl = "http://ace3mod.com";
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgWeapons.hpp"
|
||||
#include "CfgMagazines.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "ACE_BFT.hpp"
|
BIN
addons/bft/data/icon_base.paa
Normal file
BIN
addons/bft/data/icon_base.paa
Normal file
Binary file not shown.
49
addons/bft/device_getters.hpp
Normal file
49
addons/bft/device_getters.hpp
Normal file
@ -0,0 +1,49 @@
|
||||
|
||||
// [_deviceID, _callsign, _typeIconPath, _sizeIconPath, _position, _encryptionKeys, [_groupID, _color], _deviceClass, time, _refreshRate, _owner, _viewModes, _direction];
|
||||
#define AD_GET_ID(DATA) (DATA select 0)
|
||||
#define AD_GET_CALLSIGN(DATA) (DATA select 1)
|
||||
#define AD_GET_TYPEICON(DATA) (DATA select 2)
|
||||
#define AD_GET_SIZEICON(DATA) (DATA select 3)
|
||||
#define AD_GET_POSITION(DATA) (DATA select 4)
|
||||
#define AD_GET_ENCRYPTION(DATA) (DATA select 5)
|
||||
#define AD_GET_GROUP_ID(DATA) ((DATA select 6) select 0)
|
||||
#define AD_GET_COLOR(DATA) ((DATA select 6) select 1)
|
||||
#define AD_GET_CLASSNAME(DATA) (DATA select 7)
|
||||
#define AD_GET_TIME(DATA) (DATA select 8)
|
||||
#define AD_GET_REFRESH_RATE(DATA) (DATA select 9)
|
||||
#define AD_GET_OWNER(DATA) (DATA select 10)
|
||||
#define AD_GET_VIEWMOES(DATA) (DATA select 11)
|
||||
#define AD_GET_DIRECTION(DATA) (DATA select 12)
|
||||
#define AD_GET_DEVICE_STATE(DATA) (DATA select 13)
|
||||
#define AD_GET_DEVICE_STATE_VALUE(DATA) (AD_GET_DEVICE_STATE(DATA) select 0)
|
||||
|
||||
|
||||
// [_magID, [_deviceSide, _deviceEncryptionKeys], _assignableInformation, _app, -1, _owner, _item, _deviceType, _refreshRate, _deviceModes]
|
||||
// format: device ID, deviceSide [side, encryptionKeys], deviceInformation [elementType, elementSize, callsign, orbatID], appInformation [appID, appData], timeLoggedIn, owner, item, deviceType, _refreshRate [TX, RX], _deviceModes]
|
||||
|
||||
#define DEVICE_PARAMS(DATA) DATA params ["_id", "_sideInfo", "_typeInfo"]; // TODO finish
|
||||
|
||||
#define D_GET_ID(DATA) (DATA select 0)
|
||||
#define D_GET_SIDE(DATA) ((DATA select 1) select 0)
|
||||
#define D_GET_ENCRYPTION(DATA) ((DATA select 1) select 1)
|
||||
#define D_GET_TYPE(DATA) ((DATA select 2) select 0)
|
||||
#define D_GET_SIZE(DATA) ((DATA select 2) select 1)
|
||||
#define D_GET_CALLSIGN(DATA) ((DATA select 2) select 2)
|
||||
#define D_GET_GROUP_ID(DATA) ((DATA select 2) select 3)
|
||||
#define D_GET_APP_ID(DATA) ((DATA select 3) select 0)
|
||||
#define D_GET_APP_DATA(DATA) ((DATA select 3) select 1)
|
||||
#define D_GET_TIME_LOGGED_IN(DATA) (DATA select 4)
|
||||
#define D_GET_OWNER(DATA) (DATA select 5)
|
||||
#define D_GET_CLASSNAME(DATA) (DATA select 6)
|
||||
#define D_GET_DEVICETYPE(DATA) (DATA select 7)
|
||||
#define D_GET_REFRESH_RATE_TX(DATA) ((DATA select 8) select 0)
|
||||
#define D_GET_REFRESH_RATE_RX(DATA) ((DATA select 8) select 1)
|
||||
#define D_GET_DEVICEMODES(DATA) (DATA select 9)
|
||||
#define D_GET_DEVICE_STATE(DATA) (DATA select 10)
|
||||
#define D_GET_DEVICE_STATE_VALUE(DATA) (D_GET_DEVICE_STATE(DATA) select 0)
|
||||
|
||||
// DEVICE STATES
|
||||
#define STATE_NORMAL 0
|
||||
#define STATE_DESTROYED 1
|
||||
#define STATE_LOCKED 2
|
||||
#define STATE_OFFLINE 3
|
25
addons/bft/functions/fnc_addDefaultSideEncryptionKey.sqf
Normal file
25
addons/bft/functions/fnc_addDefaultSideEncryptionKey.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Side <string>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_side", "_key"];
|
||||
|
||||
private ["_variableName", "_keys"];
|
||||
|
||||
_variableName = format[QGVAR(%1_encryptionKey), _side];
|
||||
_keys = missionNamespace getvariable [_variableName, []];
|
||||
if !(_key in _keys) then {
|
||||
_keys pushback _key;
|
||||
missionNamespace setvariable [_variableName, _keys];
|
||||
publicVariable "_variableName";
|
||||
};
|
29
addons/bft/functions/fnc_chatMessage_getId.sqf
Normal file
29
addons/bft/functions/fnc_chatMessage_getId.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Get Chat messages Id
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Device Id One <STRING>
|
||||
* 1: Device Id two <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* Id representing the chatMessages list <STRING>
|
||||
*
|
||||
* Example:
|
||||
* ["myDeviceId", "myOtherDeviceId"] call ace_bft_fnc_chatMessages_getId
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_deviceId", "_otherDeviceId"];
|
||||
|
||||
private _id = QGVAR(chatMessages);
|
||||
private _deviceIds = [_deviceId, _otherDeviceId] sort true;
|
||||
|
||||
{
|
||||
_id = _id + _x;
|
||||
} forEach _deviceIds;
|
||||
|
||||
_id;
|
31
addons/bft/functions/fnc_chatMessages_get.sqf
Normal file
31
addons/bft/functions/fnc_chatMessages_get.sqf
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Get All Chat messages sent between two devices
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Device Id One <STRING>
|
||||
* 1: Device Id two <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* List of chat messages ordered by time sent <ARRAY>
|
||||
* format: [[timestamp, message, sender], ..]
|
||||
*
|
||||
* Example:
|
||||
* ["myDeviceId", "myOtherDeviceId"] call ace_bft_fnc_chatMessages_get
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_deviceId", "_otherDeviceId"];
|
||||
|
||||
// Check if both are valid device Ids
|
||||
private _deviceDataOne = [_deviceId] call FUNC(getDeviceData);
|
||||
private _deviceDataTwo = [_otherDeviceId] call FUNC(getDeviceData);
|
||||
|
||||
if (_deviceDataOne isEqualTo [] || _deviceDataTwo isEqualTo []) exitwith {[]}; // neither are valid devices
|
||||
|
||||
private _messagesId = [_deviceId, _otherDeviceId] call FUNC(chatMessage_getId);
|
||||
|
||||
(missionNamespace getVariable [_messagesId, []]);
|
28
addons/bft/functions/fnc_chatMessages_send.sqf
Normal file
28
addons/bft/functions/fnc_chatMessages_send.sqf
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Get Chat messages Id
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Device Id One <STRING>
|
||||
* 1: Device Id two <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* Id representing the chatMessages list <STRING>
|
||||
*
|
||||
* Example:
|
||||
* ["myDeviceId", "myOtherDeviceId"] call ace_bft_fnc_chatMessages_getId
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_fromId", "_toId", "_message"];
|
||||
|
||||
private _messagesListKey = [_deviceId, _otherDeviceId] call FUNC(chatMessage_getId);
|
||||
|
||||
private _timeStamp = format["00:00"];
|
||||
private _messageId = [] call FUNC(generateEncryptionKey); // some random key TODO improve or implement some unique Id generator
|
||||
private _constructedMessage = [_messageId, _timestamp, _message, _fromId];
|
||||
|
||||
[_messagesListKey, _constructedMessage] call FUNC(syncedArrayPushback);
|
22
addons/bft/functions/fnc_checkInventory.sqf
Normal file
22
addons/bft/functions/fnc_checkInventory.sqf
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
if !(local _unit) exitwith {};
|
||||
|
||||
{
|
||||
[_unit, _x] call FUNC(checkItem);
|
||||
}foreach items _unit;
|
51
addons/bft/functions/fnc_checkItem.sqf
Normal file
51
addons/bft/functions/fnc_checkItem.sqf
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: object <OBJECT>
|
||||
* 1: item <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit", "_item"];
|
||||
|
||||
private ["_magazine", "_previousMags", "_newMagName", "_newMags", "_magID"];
|
||||
|
||||
if !(local _unit) exitwith {};
|
||||
|
||||
if (isText (configFile >> "CfgWeapons" >> _item >> QGVAR(deviceType)) && {getText(configFile >> "CfgWeapons" >> _item >> QGVAR(deviceType)) != ""}) then {
|
||||
|
||||
if !(isClass (configFile >> "ACE_BFT" >> "Devices" >> (getText(configFile >> "CfgWeapons" >> _item >> QGVAR(deviceType))))) exitwith {};
|
||||
|
||||
systemChat format["%1 BFT enabled item %2", _unit, _item];
|
||||
diag_log format["%1 BFT enabled item %2", _unit, _item];
|
||||
|
||||
_magazine = getText (configFile >> "CfgWeapons" >> _item >> QGVAR(magazineItem));
|
||||
if (_magazine != "") then {
|
||||
systemChat format["%1 replacing by %2", _item, _magazine];
|
||||
diag_log format["%1 replacing by %2", _item, _magazine];
|
||||
|
||||
_unit removeItem _item;
|
||||
_previousMags = magazinesDetail _unit;
|
||||
_unit addMagazine _magazine;
|
||||
_newMags = (magazinesDetail _unit) - _previousMags;
|
||||
if ((count _newMags) == 0) exitWith {ERROR("failed to add magazine (inventory full?)");};
|
||||
_newMagName = _newMags select 0;
|
||||
|
||||
_magID = [_newMagName] call FUNC(getMagazineID);
|
||||
systemChat format["%1 id %2", _item, _magID];
|
||||
diag_log format["%1 id %2", _item, _magID];
|
||||
|
||||
if (_magID != "") then {
|
||||
GVAR(pendingIdAssignmentList) pushback _magID;
|
||||
["bft_itemCreated", [_unit, _item, _magazine, _magID]] call EFUNC(common,serverEvent);
|
||||
};
|
||||
};
|
||||
};
|
30
addons/bft/functions/fnc_createGroup.sqf
Normal file
30
addons/bft/functions/fnc_createGroup.sqf
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: group ID <STRING>
|
||||
* 1: data <ARRAY> ?
|
||||
* 2: ?
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_groupID"];
|
||||
|
||||
if (count _this < 3) exitwith {}; // What is the 3rd parameter?
|
||||
|
||||
private ["_found"];
|
||||
_found = false;
|
||||
{
|
||||
if (_x select 0 == _groupID) exitwith {_found = true;};
|
||||
} forEach GVAR(orbatElements);
|
||||
|
||||
if (!_found) then {
|
||||
[QGVAR(orbatElements), _this] call FUNC(syncedArrayPushback);
|
||||
};
|
45
addons/bft/functions/fnc_deviceDataToMapData.sqf
Normal file
45
addons/bft/functions/fnc_deviceDataToMapData.sqf
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: ID <string>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private [ "_deviceID", "_owner","_deviceClass", "_encryptionKeys", "_access", "_typeIconPath", "_sizeIconPath", "_callsign","_groupID", "_position", "_direction", "_refreshRate", "_viewModes", "_color", "_state"];
|
||||
_deviceID = D_GET_ID(_this);
|
||||
_owner = D_GET_OWNER(_this);
|
||||
_deviceClass = D_GET_CLASSNAME(_this);
|
||||
_refreshRate = D_GET_REFRESH_RATE_TX(_this);
|
||||
_viewModes = D_GET_DEVICEMODES(_this);
|
||||
|
||||
_encryptionKeys = D_GET_ENCRYPTION(_this);
|
||||
_state = D_GET_DEVICE_STATE(_this);
|
||||
/*_access = true;
|
||||
{
|
||||
if (_x in _encryptionKeys) exitwith {_access = true; };
|
||||
}foreach GVAR(localOwnedEncyptionKeys);
|
||||
|
||||
if !(_access) exitwith {[]};*/
|
||||
|
||||
_typeIconPath = [D_GET_SIDE(_this), D_GET_TYPE(_this)] call FUNC(getTypeIcon);
|
||||
_sizeIconPath = [D_GET_SIDE(_this), D_GET_SIZE(_this)] call FUNC(getSizeIcon);
|
||||
_callsign = D_GET_CALLSIGN(_this);
|
||||
_groupID = D_GET_GROUP_ID(_this);
|
||||
|
||||
_position = getPosASL vehicle _owner;
|
||||
_direction = direction vehicle _owner;
|
||||
_color = [_groupID] call FUNC(getGroupColor);
|
||||
|
||||
if (_callsign == "" && {_owner isKindOf "CAManBase"}) then {
|
||||
_callsign = groupId group _owner;
|
||||
};
|
||||
|
||||
[_deviceID, _callsign, _typeIconPath, _sizeIconPath, _position, _encryptionKeys, [_groupID, _color], _deviceClass, time, _refreshRate, _owner, _viewModes, _direction, _state];
|
28
addons/bft/functions/fnc_encryptionKeyMatch.sqf
Normal file
28
addons/bft/functions/fnc_encryptionKeyMatch.sqf
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: keySetOne <ARRAY>
|
||||
* 1: keySetTwo <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* has common keys? <BOOLEAN>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_keySetOne", "_keySetTwo"];
|
||||
|
||||
private ["_return"];
|
||||
// ToDo: replace with arrayIntersect when available
|
||||
// count (_keySetOne arrayIntersect _keySetTwo) > 0
|
||||
|
||||
_return = false;
|
||||
{
|
||||
if (_x in _keySetTwo) exitWith { _return = true; };
|
||||
} forEach _keySetOne;
|
||||
|
||||
_return
|
22
addons/bft/functions/fnc_generateEncryptionKey.sqf
Normal file
22
addons/bft/functions/fnc_generateEncryptionKey.sqf
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
* Return Value:
|
||||
* keyString - 15 characters <STRING>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_newKeyArray"];
|
||||
_newKeyArray = [];
|
||||
|
||||
for "_i" from 1 to 15 /* step +1 */ do {
|
||||
_newKeyArray pushback (48 + floor(random(74)));
|
||||
};
|
||||
|
||||
(toString _newKeyArray)
|
33
addons/bft/functions/fnc_getAllReportingModes.sqf
Normal file
33
addons/bft/functions/fnc_getAllReportingModes.sqf
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Author: Gundy
|
||||
*
|
||||
* Description:
|
||||
* Return all available reporting modes
|
||||
*
|
||||
* Arguments:
|
||||
* NONE
|
||||
*
|
||||
* Return Value:
|
||||
* List of reporting modes <ARRAY>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_deviceConfigs","_allReportingModes","_deviceReportingModes"];
|
||||
|
||||
_deviceConfigs = "true" configClasses (configFile >> "ACE_BFT" >> "Devices");
|
||||
|
||||
_allReportingModes = [];
|
||||
{
|
||||
if (isClass _x) then {
|
||||
if (isArray (_x >> "reportingModes")) then {
|
||||
_deviceReportingModes = getArray (_x >> "reportingModes");
|
||||
// only append what isn't there already
|
||||
_allReportingModes append (_deviceReportingModes - _allReportingModes);
|
||||
};
|
||||
}
|
||||
} forEach _deviceConfigs;
|
||||
|
||||
_allReportingModes
|
26
addons/bft/functions/fnc_getDeviceData.sqf
Normal file
26
addons/bft/functions/fnc_getDeviceData.sqf
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: device ID <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* device data <ARRAY>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_deviceID"];
|
||||
|
||||
private ["_data"];
|
||||
_data = [];
|
||||
{
|
||||
if (_x select 0 == _deviceID) exitWith {
|
||||
_data = _x; // GVAR(deviceData) select _foreachIndex;
|
||||
};
|
||||
} forEach GVAR(deviceData);
|
||||
|
||||
_data
|
23
addons/bft/functions/fnc_getEncryptionKey.sqf
Normal file
23
addons/bft/functions/fnc_getEncryptionKey.sqf
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
* Description: Return the side specific encryption keys for the provided object or side string
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Side-String or Object <STRING> or <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Encryption Key <STRING>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_side"];
|
||||
|
||||
if (typeName _side == "OBJECT") then {
|
||||
_side = str side _side;
|
||||
};
|
||||
|
||||
(missionNamespace getvariable [format[QGVAR(%1_encryptionKey), _side], [""]])
|
38
addons/bft/functions/fnc_getGroupColor.sqf
Normal file
38
addons/bft/functions/fnc_getGroupColor.sqf
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: group ID <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* color <ARRAY>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_groupID"];
|
||||
|
||||
private ["_data", "_found", "_color"];
|
||||
_data = [_groupID] call FUNC(getGroupData);
|
||||
_found = false;
|
||||
_color = GVAR(colorWest);
|
||||
|
||||
while {!_found} do {
|
||||
if (_groupID < 0) exitWith {};
|
||||
{
|
||||
if (_x select 0 == _groupID) exitWith {
|
||||
_found = true;
|
||||
_color = _x select 1;
|
||||
};
|
||||
} forEach GVAR(colorFilters);
|
||||
|
||||
if (!_found) then {
|
||||
_groupID = _data select 2;
|
||||
_data = [_groupID] call FUNC(getGroupData);
|
||||
};
|
||||
};
|
||||
|
||||
_color
|
26
addons/bft/functions/fnc_getGroupData.sqf
Normal file
26
addons/bft/functions/fnc_getGroupData.sqf
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: group ID <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* orbat element data <ARRAY>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_groupID"];
|
||||
|
||||
private ["_data"];
|
||||
_data = [_groupID, "", -1/*parent group ID*/];
|
||||
{
|
||||
if (_x select 0 == _groupID) exitWith {
|
||||
_data = _x;
|
||||
};
|
||||
} forEach GVAR(orbatElements);
|
||||
|
||||
_data
|
84
addons/bft/functions/fnc_getInterfaces.sqf
Normal file
84
addons/bft/functions/fnc_getInterfaces.sqf
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Author: Gundy
|
||||
*
|
||||
* Description:
|
||||
* Retrieve available interfaces
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Device ID <STRING>
|
||||
* 1: Unit to check for <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* List of interface strings <ARRAY>
|
||||
*
|
||||
* Example:
|
||||
* ["deviceID",ACE_player] call ace_bft_fnc_getInterfaces;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_deviceData","_deviceOwner","_interfaces","_interface","_deviceType","_vehicleInterfaces","_assignedVehicleRole","_roleIndex","_roleName","_whereAvailable","_found"];
|
||||
params ["_deviceID", "_unit"];
|
||||
|
||||
_deviceData = [_deviceID] call EFUNC(bft,getDeviceData);
|
||||
_deviceOwner = D_GET_OWNER(_deviceData);
|
||||
|
||||
_interfaces = [];
|
||||
|
||||
if (_deviceOwner isKindOf "ParachuteBase" || _deviceOwner isKindOf "CAManBase") then {
|
||||
// personal device
|
||||
_deviceType = D_GET_DEVICETYPE(_deviceData);
|
||||
if (isText (configFile >> "ACE_BFT" >> "Devices" >> _deviceType >> "interface")) then {
|
||||
_interface = getText (configFile >> "ACE_BFT" >> "Devices" >> _deviceType >> "interface");
|
||||
if (_interface != "") then {
|
||||
_interfaces pushBack _interface;
|
||||
};
|
||||
};
|
||||
} else {
|
||||
// vehicle device
|
||||
_vehicleInterfaces = _deviceOwner getvariable [QGVAR(vehicleInterfaces), getArray (configFile >> "CfgVehicles" >> typeOf _deviceOwner >> QGVAR(vehicleInterfaces))];
|
||||
|
||||
// bail if there are no interfaces defined
|
||||
if (isNil "_vehicleInterfaces" || {_vehicleInterfaces isEqualTo []}) exitWith {};
|
||||
|
||||
_assignedVehicleRole = assignedVehicleRole _unit;
|
||||
|
||||
// bail if unit is not in a vehicle
|
||||
if (_assignedVehicleRole isEqualTo []) exitWith {};
|
||||
|
||||
_roleName = _assignedVehicleRole select 0;
|
||||
_roleIndex = call {
|
||||
if (_roleName == "Cargo") exitWith {_deviceOwner getCargoIndex _unit};
|
||||
if (_roleName == "Turret") exitWith {_assignedVehicleRole select 1 select 0};
|
||||
0
|
||||
};
|
||||
|
||||
{
|
||||
switch (typeName _x) do {
|
||||
case "STRING": {_interfaces pushBack _x};
|
||||
|
||||
case "ARRAY": {
|
||||
// whereAvailable test
|
||||
_interface = _x select 0;
|
||||
_whereAvailable = _x select 1;
|
||||
{
|
||||
_found = switch (typeName _x) do {
|
||||
case "STRING": {
|
||||
if (_x == _roleName) then {true};
|
||||
};
|
||||
case "ARRAY": {
|
||||
if ((_x select 0) == _roleName && _roleIndex in (_x select 1)) then {true};
|
||||
};
|
||||
default {false};
|
||||
};
|
||||
|
||||
if (_found) exitWith {_interfaces pushBack _interface};
|
||||
} forEach _whereAvailable;
|
||||
};
|
||||
};
|
||||
} forEach _vehicleInterfaces;
|
||||
};
|
||||
|
||||
_interfaces
|
28
addons/bft/functions/fnc_getMagazineID.sqf
Normal file
28
addons/bft/functions/fnc_getMagazineID.sqf
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: details entry <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* ID <STRING>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_detailsEntry"];
|
||||
|
||||
private ["_index", "_value", "_id"];
|
||||
_index = _detailsEntry find "[";
|
||||
_id = "";
|
||||
|
||||
if (_index > 0) then {
|
||||
_value = toArray _detailsEntry;
|
||||
_value deleteRange [0, _index];
|
||||
_id = toString _value;
|
||||
};
|
||||
|
||||
_id
|
28
addons/bft/functions/fnc_getOwnedDevices.sqf
Normal file
28
addons/bft/functions/fnc_getOwnedDevices.sqf
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: owner <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* device IDs <ARRAY>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_owner"];
|
||||
|
||||
// Or use OBJECT getvariable [QGVAR(ownedDevices), []]; ?
|
||||
private ["_ids"];
|
||||
_ids = [];
|
||||
|
||||
{
|
||||
if ((_x select 5) == _owner) then {
|
||||
_ids pushback (_x select 0);
|
||||
};
|
||||
} forEach GVAR(deviceData);
|
||||
|
||||
_ids
|
2
addons/bft/functions/fnc_getSizeIcon.sqf
Normal file
2
addons/bft/functions/fnc_getSizeIcon.sqf
Normal file
@ -0,0 +1,2 @@
|
||||
// TODO implement
|
||||
"";
|
23
addons/bft/functions/fnc_getTypeIcon.sqf
Normal file
23
addons/bft/functions/fnc_getTypeIcon.sqf
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: side <SIDE>
|
||||
* 1: type <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* icon path <STRING>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_side", "_type"];
|
||||
|
||||
if (isClass (configFile >> "ACE_BFT" >> "Types" >> _type)) exitwith {
|
||||
getText (configFile >> "ACE_BFT" >> "Types" >> _type >> "iconPath");
|
||||
};
|
||||
|
||||
"\A3\ui_f\data\map\markers\nato\b_inf.paa"
|
43
addons/bft/functions/fnc_handleAddDeviceData.sqf
Normal file
43
addons/bft/functions/fnc_handleAddDeviceData.sqf
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: ?
|
||||
* 1: ?
|
||||
* 2: ?
|
||||
* 3: ?
|
||||
* 4: ?
|
||||
* 5: ?
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_currentDevices"];
|
||||
// [_magID, [_deviceSide, _deviceEncryptionKeys], _assignableInformation, _app, -1, _owner]
|
||||
diag_log format["added to deviceData: %1", _this];
|
||||
GVAR(deviceData) pushback _this;
|
||||
|
||||
systemChat format["handleAddDeviceData: %1", _this];
|
||||
diag_log format["handleAddDeviceData: %1", _this];
|
||||
|
||||
if (local (_this select 5)) then {
|
||||
_currentDevices = (_this select 5) getvariable [QGVAR(ownedDevices), []];
|
||||
if !((_this select 0) in _currentDevices) then {
|
||||
_currentDevices pushback (_this select 0);
|
||||
(_this select 5) setvariable [QGVAR(ownedDevices), _currentDevices, true];
|
||||
|
||||
GVAR(pendingIdAssignmentList) = GVAR(pendingIdAssignmentList) - [(_this select 0)]; // remove the id from the assignment list
|
||||
systemChat format["handleAdd - ownedDevices: %1 %2", (_this select 5), _currentDevices];
|
||||
diag_log format["handleAdd - ownedDevices: %1 %2", (_this select 5), _currentDevices];
|
||||
};
|
||||
} else {
|
||||
diag_log format["handleAdd - not the owner of device: %1", (_this select 5)];
|
||||
};
|
||||
|
||||
["bft_deviceDataChanged", [_this, true]] call EFUNC(common,localEvent);
|
22
addons/bft/functions/fnc_handleColorFilteringChanged.sqf
Normal file
22
addons/bft/functions/fnc_handleColorFilteringChanged.sqf
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
{
|
||||
private ["_groupID","_color"];
|
||||
_groupID = (_x select 6) select 0;
|
||||
if (_groupID >= 0) then {
|
||||
_color = [_groupID] call FUNC(getGroupColor);
|
||||
(_x select 6) set [1, _color];
|
||||
};
|
||||
} foreach GVAR(availableDevices);
|
18
addons/bft/functions/fnc_handleDeviceClosed.sqf
Normal file
18
addons/bft/functions/fnc_handleDeviceClosed.sqf
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(currentOpenedDevice) = [];
|
||||
GVAR(registeredEncyptionKeys) = [];
|
||||
|
||||
[false] call FUNC(updateAvailableDevicesPosition);
|
66
addons/bft/functions/fnc_handleDeviceDataChanged.sqf
Normal file
66
addons/bft/functions/fnc_handleDeviceDataChanged.sqf
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_data", "_deviceID", "_displayData", "_encryptionKeys", "_deviceModes"];
|
||||
_data = _this select 0;
|
||||
_deviceID = D_GET_ID(_data);
|
||||
diag_log format["hanldeDeviceDataChanged for: %1", _deviceID];
|
||||
|
||||
if (isNull D_GET_OWNER(_data)) exitwith { // doesn't have an owner anymore, remove.
|
||||
diag_log format["hanldeDeviceDataChanged for: %1 - has no owner, removing", _deviceID];
|
||||
if !(_this select 1) then {
|
||||
// remove from availableDevices
|
||||
{
|
||||
if (AD_GET_ID(_x) == _deviceID) exitwith {
|
||||
GVAR(availableDevices) deleteAt _forEachIndex;
|
||||
};
|
||||
} foreach GVAR(availableDevices);
|
||||
};
|
||||
};
|
||||
_encryptionKeys = D_GET_ENCRYPTION(_data);
|
||||
_deviceModes = D_GET_DEVICEMODES(_data);
|
||||
|
||||
if (_this select 1) then { // add new
|
||||
if !([_encryptionKeys, GVAR(registeredEncyptionKeys)] call FUNC(encryptionKeyMatch)) exitwith {
|
||||
diag_log format["hanldeDeviceDataChanged for: %1 - encryptionkeys not known - %2", _deviceID, _encryptionKeys];
|
||||
}; // if the encryption key is not know, the device is not available
|
||||
if !([_deviceModes, GVAR(registeredViewModes)] call FUNC(encryptionKeyMatch)) exitwith {
|
||||
diag_log format["hanldeDeviceDataChanged for: %1 - viewModes not known - %2", _deviceID, _deviceModes];
|
||||
}; // if the encryption key is not know, the device is not available
|
||||
if (!(D_GET_OWNER(_data) isKindOf "CAManBAse") && {D_GET_DEVICE_STATE_VALUE(_data) isEqualTo STATE_NORMAL} && {!(isEngineOn D_GET_OWNER(_data)) && alive D_GET_OWNER(_data)}) exitwith {};
|
||||
if (D_GET_DEVICE_STATE_VALUE(_data) in [STATE_OFFLINE, STATE_DESTROYED]) exitwith {};
|
||||
_displayData = _data call FUNC(deviceDataToMapData);
|
||||
if (count _displayData > 0) then {
|
||||
GVAR(availableDevices) pushback _displayData;
|
||||
};
|
||||
} else { // update existing
|
||||
{
|
||||
if (AD_GET_ID(_x) == _deviceID) exitwith { // device was already available
|
||||
if !([_encryptionKeys, GVAR(registeredEncyptionKeys)] call FUNC(encryptionKeyMatch)) exitwith {
|
||||
GVAR(availableDevices) deleteAt _forEachIndex; // no longer a match, so we remove it from available devices
|
||||
};
|
||||
if !([_deviceModes, GVAR(registeredViewModes)] call FUNC(encryptionKeyMatch)) exitwith {
|
||||
GVAR(availableDevices) deleteAt _forEachIndex; // no longer a match, so we remove it from available devices
|
||||
};
|
||||
if (D_GET_DEVICE_STATE_VALUE(_data) in [STATE_OFFLINE, STATE_DESTROYED]) exitwith {};
|
||||
// TODO I don't think we need this check here? It should never make it in and otherwise be removed if the engine goes off?
|
||||
//if (!(D_GET_OWNER(_data) isKindOf "CAManBAse") && {D_GET_DEVICE_STATE_VALUE(_data) isEqualTo STATE_NORMAL} && {!(isEngineOn D_GET_OWNER(_data))}) exitwith {
|
||||
// GVAR(availableDevices) deleteAt _forEachIndex; // no longer a match, so we remove it from available devices
|
||||
//};
|
||||
// we don't know what info has changed, so we just replace it completely.
|
||||
_displayData = _data call FUNC(deviceDataToMapData);
|
||||
GVAR(availableDevices) set [_forEachIndex, _displayData];
|
||||
};
|
||||
} foreach GVAR(availableDevices);
|
||||
};
|
27
addons/bft/functions/fnc_handleDeviceOpened.sqf
Normal file
27
addons/bft/functions/fnc_handleDeviceOpened.sqf
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_deviceID","_refreshRateRX","_deviceData"];
|
||||
|
||||
// by default, consider the device not having a receiver
|
||||
_refreshRateRX = -1;
|
||||
_deviceID = _this select 0;
|
||||
_deviceData = [_deviceID] call FUNC(getDeviceData);
|
||||
GVAR(currentOpenedDevice) = _deviceData;
|
||||
if !(_deviceData isEqualTo []) then {
|
||||
_refreshRateRX = D_GET_REFRESH_RATE_RX(_deviceData);
|
||||
[D_GET_ENCRYPTION(_deviceData)] call FUNC(updateRegisteredEncryptionKeys);
|
||||
};
|
||||
|
||||
[true,_refreshRateRX] call FUNC(updateAvailableDevicesPosition);
|
72
addons/bft/functions/fnc_handleEngine.sqf
Normal file
72
addons/bft/functions/fnc_handleEngine.sqf
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_object", "_turnedOn"];
|
||||
|
||||
// clear out any device in available devices that is owned by the object.
|
||||
// We do this for both engine on and engine off to avoid any duplicates
|
||||
private ["_device","_i"];
|
||||
|
||||
|
||||
for "_i" from (count GVAR(availableDevices) - 1) to 0 step -1 do {
|
||||
_device = GVAR(availableDevices) select _i;
|
||||
if (AD_GET_DEVICE_STATE_VALUE(_device) isEqualTo STATE_NORMAL) then {
|
||||
if (AD_GET_OWNER(_device) == _object) then {
|
||||
GVAR(availableDevices) deleteAt _i;
|
||||
_i = _i - 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if (_turnedOn) then {
|
||||
private ["_deviceData", "_encryptionKeys", "_deviceModes", "_displayData"];
|
||||
{
|
||||
_deviceData = [_x] call FUNC(getDeviceData);
|
||||
if (!(_deviceData isEqualTo [])) then {
|
||||
if !(isNull D_GET_OWNER(_deviceData)) then {
|
||||
if (D_GET_DEVICE_STATE_VALUE(_deviceData) isEqualTo STATE_OFFLINE) then {
|
||||
private _deviceState = D_GET_DEVICE_STATE(_deviceData);
|
||||
_deviceState set [0, STATE_NORMAL];
|
||||
};
|
||||
|
||||
if !(D_GET_DEVICE_STATE_VALUE(_deviceData) isEqualTo STATE_NORMAL) exitwith {}; // means we didn't remove it
|
||||
_encryptionKeys = D_GET_ENCRYPTION(_deviceData);
|
||||
if !([_encryptionKeys, GVAR(registeredEncyptionKeys)] call FUNC(encryptionKeyMatch)) exitWith {};
|
||||
|
||||
_deviceModes = D_GET_DEVICEMODES(_deviceData);
|
||||
if !([_deviceModes, GVAR(registeredViewModes)] call FUNC(encryptionKeyMatch)) exitWith {};
|
||||
|
||||
_displayData = _deviceData call FUNC(deviceDataToMapData);
|
||||
if (count _displayData > 0) then {
|
||||
GVAR(availableDevices) pushback _displayData;
|
||||
};
|
||||
};
|
||||
};
|
||||
}foreach (_object getvariable [QGVAR(ownedDevices), []]);
|
||||
} else {
|
||||
if (!alive _object) exitwith {};
|
||||
|
||||
private ["_deviceData", "_encryptionKeys", "_deviceModes", "_displayData"];
|
||||
{
|
||||
_deviceData = [_x] call FUNC(getDeviceData);
|
||||
if (!(_deviceData isEqualTo [])) then {
|
||||
if !(isNull D_GET_OWNER(_deviceData)) then {
|
||||
if (D_GET_DEVICE_STATE_VALUE(_deviceData) isEqualTo STATE_NORMAL) then {
|
||||
private _deviceState = D_GET_DEVICE_STATE(_deviceData);
|
||||
_deviceState set [0, STATE_OFFLINE];
|
||||
};
|
||||
};
|
||||
};
|
||||
}foreach (_object getvariable [QGVAR(ownedDevices), []]);
|
||||
};
|
99
addons/bft/functions/fnc_handleItemCreated.sqf
Normal file
99
addons/bft/functions/fnc_handleItemCreated.sqf
Normal file
@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: owner <OBJECT>
|
||||
* 1: item <STRING>
|
||||
* 2: magazine <STRING
|
||||
* 3: magazine ID <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_owner", "_item", "_magazine", "_magID", ["_initialState", STATE_NORMAL]];
|
||||
|
||||
private ["_deviceType", "_deviceSide", "_refreshRate", "_deviceEncryptionKeys", "_assignableInformation", "_app", "_deviceInformation", "_exists", "_deviceModes", "_defaultValues", "_elementCallsign", "_elementSize", "_elementType", "_groupID"];
|
||||
|
||||
/*
|
||||
Device ID
|
||||
Side ID/encyrption ID
|
||||
time logged in
|
||||
opened app ID
|
||||
app data [map position, map zoom level, ..]
|
||||
element type
|
||||
element size
|
||||
element callsign
|
||||
currentOwner
|
||||
ORBAT element ID
|
||||
*/
|
||||
systemChat format["handleItemCreated: %1", _this];
|
||||
diag_log format["handleItemCreated: entry args: %1", _this];
|
||||
|
||||
_exists = false;
|
||||
{
|
||||
if (_magID == (_x select 0)) exitwith {_exists = true};
|
||||
} forEach GVAR(deviceData);
|
||||
if (_exists) exitwith {
|
||||
diag_log format["handleItemCreated: Already exists: %1", _magID];
|
||||
};
|
||||
|
||||
_deviceType = if (_magazine != "") then { getText(configFile >> "CfgWeapons" >> _item >> QGVAR(deviceType)) } else { _item };
|
||||
_deviceSide = getText(configFile >> "ACE_BFT" >> "Devices" >> _deviceType >> "deviceSide");
|
||||
_deviceModes = getArray(configFile >> "ACE_BFT" >> "Devices" >> _deviceType >> "reportingModes");
|
||||
|
||||
_defaultValues = [];
|
||||
// if this is a vehicle device, see if the default information is present on the vehicle
|
||||
if !(isNull _owner || {_owner isKindOf "ParachuteBase" || _owner isKindOf "CAManBase"}) then {
|
||||
if (isArray (configFile >> "CfgVehicles" >> typeOf _owner >> QGVAR(defaultInformation))) then {
|
||||
_defaultValues = getArray (configFile >> "CfgVehicles" >> typeOf _owner >> QGVAR(defaultInformation));
|
||||
};
|
||||
};
|
||||
// otherwise, get the default information from the device
|
||||
if (_defaultValues isEqualTo []) then {
|
||||
_defaultValues = getArray (configFile >> "ACE_BFT" >> "Devices" >> _deviceType >> "defaultInformation");
|
||||
};
|
||||
|
||||
_refreshRate = getArray(configFile >> "ACE_BFT" >> "Devices" >> _deviceType >> "refreshRate");
|
||||
|
||||
_deviceEncryptionKeys = [_deviceSide] call FUNC(getEncryptionKey); // getting the default encryption keys for this side
|
||||
|
||||
_elementType = _owner getvariable format[QGVAR(elementType_%1),_item];
|
||||
_elementSize = _owner getvariable format[QGVAR(elementSize_%1),_item];
|
||||
_elementCallsign = _owner getvariable format[QGVAR(elementCallsign_%1),_item];
|
||||
_groupID = _owner getvariable format[QGVAR(groupID_%1),_item];
|
||||
|
||||
|
||||
// format: [elementType, elementSize, elementCallsign, orbatElementID]
|
||||
_assignableInformation = _owner getvariable [format[QGVAR(assignableInformation_%1),_item], _defaultValues];
|
||||
|
||||
if (!isnil "_elementType") then {
|
||||
_assignableInformation set [0, _elementType];
|
||||
};
|
||||
if (!isnil "_elementSize") then {
|
||||
_assignableInformation set [1, _elementSize];
|
||||
};
|
||||
if (!isnil "_elementCallsign") then {
|
||||
_assignableInformation set [2, _elementCallsign];
|
||||
};
|
||||
|
||||
if (!isnil "_groupID") then {
|
||||
_assignableInformation set [3, _groupID];
|
||||
};
|
||||
|
||||
// format: app ID, app data
|
||||
_app = [-1, []];
|
||||
|
||||
// format: device ID, deviceSide [side, encryptionKeys], deviceInformation [elementType, elementSize, callsign, orbatID], appInformation [appID, appData], timeLoggedIn, owner, item, deviceType, _refreshRate [TX, RX], _deviceModes, deviceState]
|
||||
_deviceInformation = [_magID, [_deviceSide, _deviceEncryptionKeys], _assignableInformation, _app, -1, _owner, _item, _deviceType, _refreshRate, _deviceModes, [_initialState]];
|
||||
|
||||
diag_log format["Prep raising bft_addDeviceData _deviceInformation with: %1", _deviceInformation];
|
||||
[{
|
||||
diag_log format["exec bft_addDeviceData _deviceInformation with: %1", _this];
|
||||
["bft_addDeviceData", _this] call EFUNC(common,globalEvent);
|
||||
}, _deviceInformation, 1] call EFUNC(common,waitAndExecute);
|
26
addons/bft/functions/fnc_handleKilled.sqf
Normal file
26
addons/bft/functions/fnc_handleKilled.sqf
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_object"];
|
||||
if (!isServer) exitwith {};
|
||||
|
||||
systemChat format["handleKilled: %1 ", _object];
|
||||
diag_log format["handleKilled: %1 ", _object];
|
||||
private _ownedDevices = _object getvariable [QGVAR(ownedDevices), []];
|
||||
|
||||
{
|
||||
systemChat format["raising event vehicleDeviceKilled: %1 ", _x];
|
||||
diag_log format["raising event vehicleDeviceKilled: %1 ", _x];
|
||||
["bft_vehicleDeviceKilled", [_x]] call EFUNC(common,globalEvent);
|
||||
} forEach _ownedDevices;
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_add","_newEncryptionKeys"];
|
||||
_newEncryptionKeys = _this select 0;
|
||||
_add = _this select 1;
|
||||
|
||||
// if _add is nil, rebuild list from scratch
|
||||
if (isNil "_add") then {
|
||||
// clear current list
|
||||
GVAR(availableDevices) = [];
|
||||
_add = true;
|
||||
};
|
||||
|
||||
// exit if there is nothing to add / remove
|
||||
if (count _newEncryptionKeys == 0) exitWith {};
|
||||
|
||||
if (_add) then {
|
||||
private ["_deviceModes","_encryptionKeys","_displayData"];
|
||||
|
||||
// Adding a new key isn't nice. Now we got to add new shit and loop through the massive data collection. yay?
|
||||
{
|
||||
if !(isNull D_GET_OWNER(_x)) then {
|
||||
if (!(D_GET_OWNER(_x) isKindOf "CAManBAse") && {D_GET_DEVICE_STATE_VALUE(_x) isEqualTo STATE_NORMAL} && {!(isEngineOn D_GET_OWNER(_x)) && alive D_GET_OWNER(_data)}) exitwith {};
|
||||
if (D_GET_DEVICE_STATE_VALUE(_x) in [STATE_OFFLINE, STATE_DESTROYED]) exitwith {};
|
||||
_encryptionKeys = D_GET_ENCRYPTION(_x);
|
||||
if !([_encryptionKeys, _newEncryptionKeys] call FUNC(encryptionKeyMatch)) exitWith {};
|
||||
|
||||
_deviceModes = D_GET_DEVICEMODES(_x);
|
||||
if !([_deviceModes, GVAR(registeredViewModes)] call FUNC(encryptionKeyMatch)) exitWith {};
|
||||
|
||||
_displayData = _x call FUNC(deviceDataToMapData);
|
||||
if (count _displayData > 0) then {
|
||||
GVAR(availableDevices) pushback _displayData;
|
||||
};
|
||||
};
|
||||
} foreach GVAR(deviceData);
|
||||
} else { // if we remove one, we only have to check the already available devices
|
||||
private ["_device","_i"];
|
||||
|
||||
for "_i" from (count GVAR(availableDevices) - 1) to 0 step -1 do {
|
||||
_device = GVAR(availableDevices) select _i;
|
||||
if !([AD_GET_ENCRYPTION(_device), GVAR(registeredEncyptionKeys)] call FUNC(encryptionKeyMatch)) then {
|
||||
GVAR(availableDevices) deleteAt _i;
|
||||
_i = _i - 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
if (count GVAR(currentOpenedDevice) > 0) then {
|
||||
[GVAR(currentOpenedDevice)] call FUNC(removeDeviceByOwner);
|
||||
};
|
61
addons/bft/functions/fnc_handleRegisteredModeChanged.sqf
Normal file
61
addons/bft/functions/fnc_handleRegisteredModeChanged.sqf
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_add","_viewModes"];
|
||||
_viewModes = _this select 0;
|
||||
_add = _this select 1;
|
||||
|
||||
// if _add is nil, rebuild list from scratch
|
||||
if (isNil "_add") then {
|
||||
// clear current list
|
||||
GVAR(availableDevices) = [];
|
||||
_add = true;
|
||||
};
|
||||
|
||||
// exit if there is nothing to add / remove
|
||||
if (count _viewModes == 0) exitWith {};
|
||||
|
||||
if (_add) then {
|
||||
private ["_deviceModes","_encryptionKeys","_displayData"];
|
||||
|
||||
{
|
||||
if !(isNull D_GET_OWNER(_x)) then {
|
||||
if (!(D_GET_OWNER(_x) isKindOf "CAManBAse") && {D_GET_DEVICE_STATE_VALUE(_x) isEqualTo STATE_NORMAL} && {!(isEngineOn D_GET_OWNER(_x)) && alive D_GET_OWNER(_data)}) exitwith {};
|
||||
if (D_GET_DEVICE_STATE_VALUE(_x) in [STATE_OFFLINE, STATE_DESTROYED]) exitwith {};
|
||||
_deviceModes = D_GET_DEVICEMODES(_x);
|
||||
if !([_deviceModes, _viewModes] call FUNC(encryptionKeyMatch)) exitWith {};
|
||||
|
||||
_encryptionKeys = D_GET_ENCRYPTION(_x);
|
||||
if !([_encryptionKeys, GVAR(registeredEncyptionKeys)] call FUNC(encryptionKeyMatch)) exitWith {};
|
||||
|
||||
_displayData = _x call FUNC(deviceDataToMapData);
|
||||
if (count _displayData > 0) then {
|
||||
GVAR(availableDevices) pushback _displayData;
|
||||
};
|
||||
};
|
||||
} foreach GVAR(deviceData);
|
||||
} else { // if we remove one, we only have to check the already available devices
|
||||
private ["_device","_i"];
|
||||
|
||||
for "_i" from (count GVAR(availableDevices) - 1) to 0 step -1 do {
|
||||
_device = GVAR(availableDevices) select _i;
|
||||
if !([AD_GET_VIEWMOES(_device), GVAR(registeredViewModes)] call FUNC(encryptionKeyMatch)) then {
|
||||
GVAR(availableDevices) deleteAt _i;
|
||||
_i = _i - 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
if (count GVAR(currentOpenedDevice) > 0) then {
|
||||
[GVAR(currentOpenedDevice)] call FUNC(removeDeviceByOwner);
|
||||
};
|
45
addons/bft/functions/fnc_handleRequestAllData.sqf
Normal file
45
addons/bft/functions/fnc_handleRequestAllData.sqf
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* origin <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_origin"];
|
||||
|
||||
diag_log format["handleRequestAllData: Request from Origin: %1", _origin];
|
||||
|
||||
{
|
||||
diag_log format["handleRequestAllData: Add Device Data to origin: %1", _x];
|
||||
["bft_addDeviceData", _origin, _x] call EFUNC(common,targetEvent);
|
||||
} forEach GVAR(deviceData);
|
||||
|
||||
// Alternative:
|
||||
//if (count GVAR(deviceData) > 0) then {
|
||||
// (owner _origin) publicVariableClient QGVAR(deviceData);
|
||||
//};
|
||||
|
||||
{
|
||||
diag_log format["handleRequestAllData: Add synced array variable: %1", _x];
|
||||
private ["_varName", "_variable"];
|
||||
_varName = _x;
|
||||
_variable = missionNamespace getvariable [_varName, []];
|
||||
|
||||
{
|
||||
diag_log format["handleRequestAllData: Add synced array variable (%1) value: %2", _varName, _x];
|
||||
["bft_syncedArrayPushback", _origin, [_varName, _x]] call EFUNC(common,targetEvent);
|
||||
} forEach _variable;
|
||||
|
||||
// Alternative:
|
||||
//if (count _variable > 0) then {
|
||||
// (owner _origin) publicVariableClient _x;
|
||||
//};
|
||||
} forEach GVAR(syncedArrayVariables);
|
35
addons/bft/functions/fnc_handleSyncedArrayDelete.sqf
Normal file
35
addons/bft/functions/fnc_handleSyncedArrayDelete.sqf
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: varName <STRING>
|
||||
* 1: element ID <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_varName", "_elementID"];
|
||||
|
||||
private ["_variable"];
|
||||
_variable = missionNamespace getvariable [_varName, []];
|
||||
|
||||
{
|
||||
if ((_x select 0) isEqualTo _elementID) exitwith {
|
||||
systemChat format["handleSyncedArrayDelete deleting- %1", _x];
|
||||
diag_log format["handleSyncedArrayDelete deleting- %1", _x];
|
||||
private ["_removedElement"];
|
||||
_removedElement = _variable deleteAt _foreachIndex;
|
||||
["bft_syncedArrayChanged", [2, _removedElement]] call EFUNC(common,localEvent);
|
||||
|
||||
};
|
||||
} forEach _variable;
|
||||
|
||||
systemChat format["handleSyncedArrayDelete var- %1", _variable];
|
||||
diag_log format["handleSyncedArrayDelete var- %1", _variable];
|
37
addons/bft/functions/fnc_handleSyncedArrayPushback.sqf
Normal file
37
addons/bft/functions/fnc_handleSyncedArrayPushback.sqf
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: varName <STRING>
|
||||
* 1: data <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_varName", "_data"];
|
||||
|
||||
private ["_variable"];
|
||||
|
||||
systemChat format["handleSyncedArrayPushback: %1", _this];
|
||||
diag_log format["handleSyncedArrayPushback: %1", _this];
|
||||
|
||||
_variable = missionNamespace getvariable [_varName, []];
|
||||
_variable pushback _data;
|
||||
missionNamespace setvariable [_varName, _variable];
|
||||
|
||||
["bft_syncedArrayChanged", [0, _data]] call EFUNC(common,localEvent);
|
||||
|
||||
systemChat format["handleSyncedArrayPushback %1 - %2", _varName, _variable];
|
||||
diag_log format["handleSyncedArrayPushback %1 - %2", _varName, _variable];
|
||||
|
||||
if (isServer) then {
|
||||
if !(_varName in GVAR(syncedArrayVariables)) then {
|
||||
GVAR(syncedArrayVariables) pushback _varName;
|
||||
};
|
||||
};
|
37
addons/bft/functions/fnc_handleSyncedArrayUpdate.sqf
Normal file
37
addons/bft/functions/fnc_handleSyncedArrayUpdate.sqf
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: variableName <STRING>
|
||||
* 1: data. Must contain first element ID <ARRAY>
|
||||
* 2: Indexes of updated data. Either empty or have first element be 0. <ARRAY> <OPTIONAL>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_varName", "_data"];
|
||||
|
||||
private ["_elementID", "_variable", "_compareID"];
|
||||
|
||||
systemChat format["handleSyncedArrayUpdate - %1", _this];
|
||||
diag_log format["handleSyncedArrayUpdate - %1", _this];
|
||||
|
||||
_elementID = if (typeName _data == "ARRAY") then {_data select 0} else {_data};
|
||||
_variable = missionNamespace getvariable [_varName, []];
|
||||
{
|
||||
_compareID = if (typeName _x == "ARRAY") then {_x select 0} else {_x};
|
||||
if (_compareID isEqualTo _elementID) exitwith {
|
||||
_variable set[_forEachIndex, _data];
|
||||
["bft_syncedArrayChanged", [1, _data, _x]] call EFUNC(common,localEvent);
|
||||
};
|
||||
} forEach _variable;
|
||||
|
||||
systemChat format["handleSyncedArrayUpdate var- %1", _variable];
|
||||
diag_log format["handleSyncedArrayUpdate var- %1", _variable];
|
13
addons/bft/functions/fnc_handleUpdateAllEncryptionKeys.sqf
Normal file
13
addons/bft/functions/fnc_handleUpdateAllEncryptionKeys.sqf
Normal file
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
23
addons/bft/functions/fnc_handleUpdateDeviceAppData.sqf
Normal file
23
addons/bft/functions/fnc_handleUpdateDeviceAppData.sqf
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: ID <string>
|
||||
* 1: data <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_deviceID", "_newData"];
|
||||
|
||||
private ["_data"];
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
_data set [3, _newData];
|
||||
|
||||
// ["bft_deviceDataChanged", [_data, false]] call EFUNC(common,localEvent);
|
24
addons/bft/functions/fnc_handleUpdateDeviceCallsign.sqf
Normal file
24
addons/bft/functions/fnc_handleUpdateDeviceCallsign.sqf
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: ID <STRING>
|
||||
* 1: data <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_deviceID", "_callsign"];
|
||||
|
||||
private ["_data", "_deviceAssignableInfo"];
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
_deviceAssignableInfo = _data select 2;
|
||||
_deviceAssignableInfo set [2, _callsign];
|
||||
|
||||
["bft_deviceDataChanged", [_data, false]] call EFUNC(common,localEvent);
|
25
addons/bft/functions/fnc_handleUpdateDeviceElementType.sqf
Normal file
25
addons/bft/functions/fnc_handleUpdateDeviceElementType.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: device ID <STRING>
|
||||
* 1: element type <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_deviceID", "_elementType"];
|
||||
|
||||
private ["_data", "_assignableInformation"];
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
_assignableInformation = _data select 2;
|
||||
_assignableInformation set [0, _elementType select 0];
|
||||
_assignableInformation set [1, _elementType select 1];
|
||||
|
||||
["bft_deviceDataChanged", [_data, false]] call EFUNC(common,localEvent);
|
24
addons/bft/functions/fnc_handleUpdateDeviceGroup.sqf
Normal file
24
addons/bft/functions/fnc_handleUpdateDeviceGroup.sqf
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: device ID <STRING>
|
||||
* 1: group ID <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_deviceID", "_groupID"];
|
||||
|
||||
private ["_data", "_previousGroup"];
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
_previousGroup = _data select 2;
|
||||
_previousGroup set [3, _groupID];
|
||||
|
||||
["bft_deviceDataChanged", [_data, false]] call EFUNC(common,localEvent);
|
24
addons/bft/functions/fnc_handleUpdateDeviceKeys.sqf
Normal file
24
addons/bft/functions/fnc_handleUpdateDeviceKeys.sqf
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: device ID <STRING>
|
||||
* 1: keys <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_deviceID", "_keys"];
|
||||
|
||||
private ["_data", "_encryption"];
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
_encryption = _data select 1;
|
||||
_encryption set [1, _keys];
|
||||
|
||||
["bft_deviceDataChanged", [_data, false]] call EFUNC(common,localEvent);
|
65
addons/bft/functions/fnc_handleUpdateDeviceOwner.sqf
Normal file
65
addons/bft/functions/fnc_handleUpdateDeviceOwner.sqf
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: device ID <STRING>
|
||||
* 1: new owner <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_deviceID", "_newOwner"];
|
||||
|
||||
private ["_data", "_newData", "_previousOwner", "_currentDevices"];
|
||||
|
||||
systemChat format["handleUpdateDeviceOwner: %1", _this];
|
||||
diag_log format["handleUpdateDeviceOwner: %1", _this];
|
||||
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
_previousOwner = _data select 5;
|
||||
_data set [5, _newOwner];
|
||||
|
||||
["bft_deviceDataChanged", [_data, isNull _previousOwner]] call EFUNC(common,localEvent);
|
||||
|
||||
systemChat format["handleUpdateDeviceOwner - setting new owner from %1 to %2", _previousOwner, _newOwner];
|
||||
diag_log format["handleUpdateDeviceOwner - setting new owner from %1 to %2", _previousOwner, _newOwner];
|
||||
|
||||
_newData = [_deviceID] call FUNC(getDeviceData);
|
||||
systemChat format["handleUpdateDeviceOwner - validate new owner - %1", (_newData select 5) == _newOwner];
|
||||
diag_log format["handleUpdateDeviceOwner - validate new owner - %1", (_newData select 5) == _newOwner];
|
||||
|
||||
if (!isNull _newOwner && {local _newOwner}) then {
|
||||
_currentDevices = _newOwner getvariable [QGVAR(ownedDevices), []];
|
||||
if !(_deviceID in _currentDevices) then {
|
||||
_currentDevices pushback _deviceID;
|
||||
_newOwner setvariable [QGVAR(ownedDevices), _currentDevices, true];
|
||||
|
||||
systemChat format["handleUpdateDeviceOwner - new ownedDevices: %1 %2", _newOwner, _currentDevices];
|
||||
diag_log format["handleUpdateDeviceOwner - new ownedDevices: %1 %2", _newOwner, _currentDevices];
|
||||
|
||||
};
|
||||
};
|
||||
if (!isNull _previousOwner && {local _previousOwner}) then {
|
||||
diag_log format["handleUpdateDeviceOwner - removing device (%1) from owner %2 ", _deviceId, _previousOwner];
|
||||
_currentDevices = _previousOwner getvariable [QGVAR(ownedDevices), []];
|
||||
if (_deviceID in _currentDevices) then {
|
||||
_currentDevices = _currentDevices - [_deviceID];
|
||||
_previousOwner setvariable [QGVAR(ownedDevices), _currentDevices, true];
|
||||
|
||||
systemChat format["handleUpdateDeviceOwner - new ownedDevices: %1 %2", _previousOwner, _currentDevices];
|
||||
diag_log format["handleUpdateDeviceOwner - new ownedDevices: %1 %2", _previousOwner, _currentDevices];
|
||||
} else {
|
||||
diag_log format["handleUpdateDeviceOwner - tried removing a deviceId that doesnt exist in our previous owner ids: %1 %2", _previousOwner, _currentDevices];
|
||||
};
|
||||
} else {
|
||||
diag_log format["handleUpdateDeviceOwner - no previous owner to remove stuff from %1 %2", _previousOwner, _deviceId];
|
||||
};
|
||||
|
||||
systemChat format["handleUpdateDeviceOwner - devices: %1", GVAR(deviceData)];
|
||||
diag_log format["handleUpdateDeviceOwner - devices: %1", GVAR(deviceData)];
|
51
addons/bft/functions/fnc_handleVehicleDeviceKilled.sqf
Normal file
51
addons/bft/functions/fnc_handleVehicleDeviceKilled.sqf
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_data"];
|
||||
params ["_deviceId"];
|
||||
|
||||
_data = [_deviceId] call FUNC(getDeviceData);
|
||||
|
||||
systemChat format["handleVehicleDeviceKilled: %1 ", _deviceId];
|
||||
diag_log format["handleVehicleDeviceKilled: %1 DATA: %2", _deviceId, _data];
|
||||
|
||||
private _deviceState = D_GET_DEVICE_STATE(_data);
|
||||
_deviceState set [0, STATE_DESTROYED];
|
||||
_deviceState set [1, getPosASL vehicle D_GET_OWNER(_data)];
|
||||
_deviceState set [2, direction vehicle D_GET_OWNER(_data)];
|
||||
_deviceState set [3, ACE_time];
|
||||
|
||||
if !(isNull D_GET_OWNER(_data)) then {
|
||||
|
||||
systemChat format["handleVehicleDeviceKilled: %1 - owner is not null", _deviceId];
|
||||
diag_log format["handleVehicleDeviceKilled: %1 - owner is not null", _deviceId];
|
||||
|
||||
private _encryptionKeys = D_GET_ENCRYPTION(_data);
|
||||
if !([_encryptionKeys, GVAR(registeredEncyptionKeys)] call FUNC(encryptionKeyMatch)) exitWith {};
|
||||
|
||||
private _deviceModes = D_GET_DEVICEMODES(_data);
|
||||
if !([_deviceModes, GVAR(registeredViewModes)] call FUNC(encryptionKeyMatch)) exitWith {};
|
||||
|
||||
private _displayData = _data call FUNC(deviceDataToMapData);
|
||||
{
|
||||
if (AD_GET_ID(_x) == _deviceId) exitwith {
|
||||
systemChat format["handleVehicleDeviceKilled: %1 - setting new displayData %2", _deviceId, _displayData];
|
||||
diag_log format["handleVehicleDeviceKilled: %1 - setting new displayData %2", _deviceId, _displayData];
|
||||
GVAR(availableDevices) set[_foreachIndex, _displayData];
|
||||
};
|
||||
}foreach GVAR(availableDevices);
|
||||
} else {
|
||||
systemChat format["handleVehicleDeviceKilled: %1 - owner is null", _deviceId];
|
||||
diag_log format["handleVehicleDeviceKilled: %1 - owner is null", _deviceId];
|
||||
};
|
22
addons/bft/functions/fnc_isDeviceOwned.sqf
Normal file
22
addons/bft/functions/fnc_isDeviceOwned.sqf
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: unit <OBJECT>
|
||||
* 1: device ID <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* owned? <BOOLEAN>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit", "_deviceID"];
|
||||
|
||||
private ["_ownedIDs"];
|
||||
_ownedIDs = _unit getvariable [QGVAR(ownedDevices), []];
|
||||
|
||||
(_deviceID in _ownedIDs)
|
27
addons/bft/functions/fnc_removeDeviceByOwner.sqf
Normal file
27
addons/bft/functions/fnc_removeDeviceByOwner.sqf
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Remove all devices of given owner in the available devices collection
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Device Data <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_owner", "_deviceOwner", "_device"];
|
||||
params ["_deviceData"];
|
||||
_owner = D_GET_OWNER(_deviceData);
|
||||
|
||||
for "_i" from (count GVAR(availableDevices) - 1) to 0 step -1 do {
|
||||
_device = GVAR(availableDevices) select _i;
|
||||
_deviceOwner = AD_GET_OWNER(_device);
|
||||
if (_owner == _deviceOwner) then {
|
||||
GVAR(availableDevices) deleteAt _i;
|
||||
_i = _i - 1;
|
||||
};
|
||||
};
|
25
addons/bft/functions/fnc_setDeviceAppData.sqf
Normal file
25
addons/bft/functions/fnc_setDeviceAppData.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: device ID <STRING>
|
||||
* 1: device data <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_deviceID", "_deviceData"];
|
||||
|
||||
private ["_data"];
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
|
||||
if (count _data == 0) exitwith {};
|
||||
if (_deviceData isEqualTo (_data select 3)) exitwith {};
|
||||
|
||||
["bft_updateDeviceData", [_deviceID, _deviceData]] call EFUNC(common,globalEvent);
|
26
addons/bft/functions/fnc_setDeviceCallsign.sqf
Normal file
26
addons/bft/functions/fnc_setDeviceCallsign.sqf
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: device ID <STRING>
|
||||
* 1: callsign <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_deviceID", "_callsign"];
|
||||
|
||||
private ["_data"];
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
|
||||
if (count _data < 3) exitwith {};
|
||||
if (count (_data select 2) < 3) exitwith {};
|
||||
if (_callsign isEqualTo (_data select 2) select 2) exitwith {};
|
||||
|
||||
["bft_updateDeviceCallsign", [_deviceID, _callsign]] call EFUNC(common,globalEvent);
|
27
addons/bft/functions/fnc_setDeviceElementType.sqf
Normal file
27
addons/bft/functions/fnc_setDeviceElementType.sqf
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: device ID <STRING>
|
||||
* 1: elementType <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_deviceID", "_elementType"];
|
||||
|
||||
private ["_data"];
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
|
||||
if (count _data < 3) exitwith {};
|
||||
if (count (_data select 2) < 2) exitwith {};
|
||||
if ((_elementType select 0) isEqualTo (_data select 2) select 0) exitwith {};
|
||||
if ((_elementType select 1) isEqualTo (_data select 2) select 1) exitwith {};
|
||||
|
||||
["bft_updateDeviceElementType", [_deviceID, _elementType]] call EFUNC(common,globalEvent);
|
26
addons/bft/functions/fnc_setDeviceGroup.sqf
Normal file
26
addons/bft/functions/fnc_setDeviceGroup.sqf
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: device ID <STRING>
|
||||
* 1: group ID <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_deviceID", "_groupID"];
|
||||
|
||||
private ["_data"];
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
|
||||
if (count _data < 3) exitwith {};
|
||||
if (count (_data select 2) < 4) exitwith {};
|
||||
if (_groupID isEqualTo (_data select 2) select 3) exitwith {};
|
||||
|
||||
["bft_updateDeviceGroup", [_deviceID, _groupID]] call EFUNC(common,globalEvent);
|
26
addons/bft/functions/fnc_setDeviceKeys.sqf
Normal file
26
addons/bft/functions/fnc_setDeviceKeys.sqf
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: device ID <STRING>
|
||||
* 1: keys <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_deviceID", "_keys"];
|
||||
|
||||
private ["_data"];
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
|
||||
if (count _data < 2) exitwith {};
|
||||
if (count (_data select 1) < 2) exitwith {};
|
||||
if (_keys isEqualTo (_data select 1) select 1) exitwith {};
|
||||
|
||||
["bft_updateDeviceKeys", [_deviceID, _keys]] call EFUNC(common,globalEvent);
|
25
addons/bft/functions/fnc_setDeviceOwner.sqf
Normal file
25
addons/bft/functions/fnc_setDeviceOwner.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: device ID <STRING>
|
||||
* 1: new owner <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_deviceID", "_newOwner"];
|
||||
|
||||
private ["_data"];
|
||||
_data = [_deviceID] call FUNC(getDeviceData);
|
||||
|
||||
if (count _data < 6) exitwith {};
|
||||
if (_newOwner isEqualTo (_data select 5)) exitwith {};
|
||||
|
||||
["bft_updateDeviceOwner", [_deviceID, _newOwner]] call EFUNC(common,globalEvent);
|
19
addons/bft/functions/fnc_syncedArrayDelete.sqf
Normal file
19
addons/bft/functions/fnc_syncedArrayDelete.sqf
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: varName <STRING>
|
||||
* 1: data ID <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_varName", "_dataID"];
|
||||
|
||||
["bft_syncedArrayDelete", [_varName, _dataID]] call EFUNC(common,globalEvent);
|
26
addons/bft/functions/fnc_syncedArrayGetNextID.sqf
Normal file
26
addons/bft/functions/fnc_syncedArrayGetNextID.sqf
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: varName <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_varName"];
|
||||
|
||||
private ["_variable", "_nextID"];
|
||||
_variable = missionNamespace getvariable [_varName, []];
|
||||
_nextID = 0;
|
||||
|
||||
if (count _variable > 0) then {
|
||||
_nextID = ((_variable select (count _variable - 1)) select 0) + 1;
|
||||
};
|
||||
|
||||
_nextID
|
21
addons/bft/functions/fnc_syncedArrayPushback.sqf
Normal file
21
addons/bft/functions/fnc_syncedArrayPushback.sqf
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: varName <STRING>
|
||||
* 1: data <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_varName", "_data"];
|
||||
|
||||
if (typeName _data == "ARRAY" && {(count _data == 0)}) exitwith {};
|
||||
|
||||
["bft_syncedArrayPushback", [_varName, _data]] call EFUNC(common,globalEvent);
|
21
addons/bft/functions/fnc_syncedArrayUpdate.sqf
Normal file
21
addons/bft/functions/fnc_syncedArrayUpdate.sqf
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: varName <STRING>
|
||||
* 1: data <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_varName", "_data"];
|
||||
|
||||
if (typeName _data == "ARRAY" && (count _data == 0)) exitwith {};
|
||||
|
||||
["bft_syncedArrayUpdate", _this] call EFUNC(common,globalEvent);
|
20
addons/bft/functions/fnc_updateAllEncryptionKeys.sqf
Normal file
20
addons/bft/functions/fnc_updateAllEncryptionKeys.sqf
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: side <SIDE>
|
||||
* 1: old key <STRING>
|
||||
* 2: new key <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_side", " _oldKey", " _newKey"];
|
||||
|
||||
// TODO
|
71
addons/bft/functions/fnc_updateAvailableDevicesPosition.sqf
Normal file
71
addons/bft/functions/fnc_updateAvailableDevicesPosition.sqf
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Author: Glowbal, Gundy
|
||||
*
|
||||
* Description:
|
||||
* Start or stop a PFEH to update the position of available devices (icons to draw)
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Start = TRUE, Stop = FALSE <BOOL>
|
||||
* 1: Refresh rate to run the update loop at (equals the device's RX refresh rate), ignored on stop <FLOAT>
|
||||
*
|
||||
* Return Value:
|
||||
* TRUE <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* // start the loop with a 5 second update interval
|
||||
* [true,5] call ace_bft_fnc_updateAvailableDevicesPostion;
|
||||
*
|
||||
* // stop the loop
|
||||
* [false] call ace_bft_fnc_updateAvailableDevicesPostion;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_startNewLoop", "_refreshRateRX"];
|
||||
|
||||
if (_startNewLoop) then {
|
||||
// if there is an ongoing position update loop running, close it down first
|
||||
if (!isNil QGVAR(positionUpdatePFEH)) then {
|
||||
[GVAR(positionUpdatePFEH)] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
// bail if this device does not have a receiver
|
||||
if (_refreshRateRX < 0) exitWith {false};
|
||||
|
||||
// do not let the refresh rate sink below 0.1
|
||||
_refreshRateRX = _refreshRateRX max 0.1;
|
||||
|
||||
// start a new position update loop
|
||||
GVAR(positionUpdatePFEH) = [{
|
||||
{
|
||||
if (ACE_time - (AD_GET_TIME(_x)) >= (AD_GET_REFRESH_RATE(_x))) then {
|
||||
if (AD_GET_DEVICE_STATE_VALUE(_x) isEqualTo STATE_NORMAL) then {
|
||||
private _deviceOwner = AD_GET_OWNER(_x);
|
||||
//if (!(_deviceOwner isKindOf "CAManBAse") && {!(isEngineOn _deviceOwner)}) exitwith {};
|
||||
//systemChat format["updating a device position: %1", _x];
|
||||
_x set [8, ACE_time];
|
||||
_x set [4, getPosASL _deviceOwner];
|
||||
_x set [12, direction _deviceOwner];
|
||||
} else {
|
||||
if (AD_GET_DEVICE_STATE_VALUE(_x) isEqualTo STATE_OFFLINE) then {
|
||||
diag_log format["state of a device was online but ended up in drawing available devices loop!"];
|
||||
};
|
||||
private _deviceState = AD_GET_DEVICE_STATE(_x);
|
||||
(_x select 6) set [1, [0.6, 0.6, 0.6, (1 - ((ACE_time - (_deviceState select 3)) / 100)) max 0.4]];
|
||||
_x set [4, _deviceState select 1];
|
||||
_x set [12, _deviceState select 2];
|
||||
};
|
||||
};
|
||||
} foreach GVAR(availableDevices);
|
||||
}, _refreshRateRX, []] call cba_fnc_addPerFrameHandler;
|
||||
} else {
|
||||
// close down the position update loop
|
||||
if (!isNil QGVAR(positionUpdatePFEH)) then {
|
||||
[GVAR(positionUpdatePFEH)] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
GVAR(positionUpdatePFEH) = nil;
|
||||
};
|
||||
|
||||
true
|
20
addons/bft/functions/fnc_updateGroup.sqf
Normal file
20
addons/bft/functions/fnc_updateGroup.sqf
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: ?
|
||||
* 1: ?
|
||||
* 2: ?
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (count _this < 3) exitwith {};
|
||||
|
||||
[QGVAR(orbatElements), _this] call FUNC(syncedArrayUpdate);
|
51
addons/bft/functions/fnc_updateRegisteredEncryptionKeys.sqf
Normal file
51
addons/bft/functions/fnc_updateRegisteredEncryptionKeys.sqf
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Author: Glowbal, Gundy
|
||||
*
|
||||
* Description: Either set, add or remove the registered encryption keys and trigger "bft_registeredEncryptionKeysChanged" event if a change occurred
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Keys <ARRAY>
|
||||
*
|
||||
* Optional:
|
||||
* 1: add = TRUE, remove = FALSE <BOOLEAN>
|
||||
*
|
||||
* Return Value:
|
||||
* TRUE <BOOLEAN>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_keys", "_add"];
|
||||
|
||||
if (isNil "_add") then {
|
||||
if !(GVAR(registeredEncyptionKeys) isEqualTo _keys) then {
|
||||
GVAR(registeredEncyptionKeys) = _keys;
|
||||
["bft_registeredEncryptionKeysChanged", [_keys,nil]] call EFUNC(common,localEvent);
|
||||
};
|
||||
} else {
|
||||
private ["_changed"];
|
||||
_changed = false;
|
||||
|
||||
if (_add) then {
|
||||
// figure out the real difference
|
||||
_keys = _keys - GVAR(registeredEncyptionKeys);
|
||||
if (count _keys > 0) then {
|
||||
GVAR(registeredEncyptionKeys) = GVAR(registeredEncyptionKeys) + _keys;
|
||||
_changed = true;
|
||||
};
|
||||
} else {
|
||||
// figure out the real difference
|
||||
_keys = GVAR(registeredEncyptionKeys) - (GVAR(registeredEncyptionKeys) - _keys);
|
||||
if (count _keys > 0) then {
|
||||
GVAR(registeredEncyptionKeys) = GVAR(registeredEncyptionKeys) - _keys;
|
||||
_changed = true;
|
||||
};
|
||||
};
|
||||
if (_changed) then {
|
||||
["bft_registeredEncryptionKeysChanged", [_keys,_add]] call EFUNC(common,localEvent);
|
||||
};
|
||||
};
|
||||
|
||||
true
|
51
addons/bft/functions/fnc_updateRegisteredModes.sqf
Normal file
51
addons/bft/functions/fnc_updateRegisteredModes.sqf
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Author: Glowbal, Gundy
|
||||
*
|
||||
* Description: Either set, add or remove the registered modes (reporting modes / channels) and trigger "bft_registeredModeChanged" event if a change occurred
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Modes <ARRAY>
|
||||
*
|
||||
* Optional:
|
||||
* 1: add = TRUE, remove = FALSE <BOOLEAN>
|
||||
*
|
||||
* Return Value:
|
||||
* TRUE <BOOLEAN>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_modes", "_add"];
|
||||
|
||||
if (isNil "_add") then {
|
||||
if !(GVAR(registeredViewModes) isEqualTo _modes) then {
|
||||
GVAR(registeredViewModes) = _modes;
|
||||
["bft_registeredModeChanged", [_modes,nil]] call EFUNC(common,localEvent);
|
||||
};
|
||||
} else {
|
||||
private ["_changed"];
|
||||
_changed = false;
|
||||
|
||||
if (_add) then {
|
||||
// figure out the real difference
|
||||
_modes = _modes - GVAR(registeredViewModes);
|
||||
if (count _modes > 0) then {
|
||||
GVAR(registeredViewModes) = GVAR(registeredViewModes) + _modes;
|
||||
_changed = true;
|
||||
};
|
||||
} else {
|
||||
// figure out the real difference
|
||||
_modes = GVAR(registeredViewModes) - (GVAR(registeredViewModes) - _modes);
|
||||
if (count _modes > 0) then {
|
||||
GVAR(registeredViewModes) = GVAR(registeredViewModes) - _modes;
|
||||
_changed = true;
|
||||
};
|
||||
};
|
||||
if (_changed) then {
|
||||
["bft_registeredModeChanged", [_modes,_add]] call EFUNC(common,localEvent);
|
||||
};
|
||||
};
|
||||
|
||||
true
|
55
addons/bft/functions/fnc_validateInventory.sqf
Normal file
55
addons/bft/functions/fnc_validateInventory.sqf
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
private ["_magazine", "_data", "_magID", "_unMatchedDevices", "_ownedDevices", "_matchedIDs"];
|
||||
|
||||
if !(local _unit) exitwith {};
|
||||
|
||||
{
|
||||
[_unit, _x] call FUNC(checkItem);
|
||||
} forEach items _unit;
|
||||
|
||||
_ownedDevices = _unit getvariable [QGVAR(ownedDevices), []];
|
||||
_matchedIDs = [];
|
||||
{
|
||||
_magID = [_x] call FUNC(getMagazineID);
|
||||
_data = [_magID] call FUNC(getDeviceData);
|
||||
if (count _data > 0) then {
|
||||
if !(_magID in _ownedDevices) then {
|
||||
systemChat format["validate - new picked up ID: %1 %2", _unit, _magID];
|
||||
diag_log format["validate - new picked up ID: %1 %2", _unit, _magID];
|
||||
};
|
||||
[_magID, _unit] call FUNC(setDeviceOwner);
|
||||
_matchedIDs pushback _magID;
|
||||
} else {
|
||||
if (!(_magId in GVAR(pendingIdAssignmentList))) then {
|
||||
_magazine = (magazines _unit) select _forEachIndex;
|
||||
if (getText (configFile >> "CfgMagazines" >> _magazine >> QGVAR(type)) != "") then {
|
||||
["bft_itemCreated", [_unit, getText (configFile >> "CfgMagazines" >> _magazine >> QGVAR(type)), _magazine, _magID]] call EFUNC(common,serverEvent);
|
||||
};
|
||||
};
|
||||
};
|
||||
}foreach (magazinesDetail _unit);
|
||||
|
||||
_unMatchedDevices = _ownedDevices - _matchedIDs;
|
||||
{
|
||||
systemChat format["validate - no longer has ID: %1 %2", _unit, _x];
|
||||
diag_log format["validate - no longer has ID: %1 %2", _unit, _x];
|
||||
["bft_updateDeviceOwner", [_x, objNull]] call EFUNC(common,globalEvent);
|
||||
systemChat format["Dropped a bft device: %1 - %2", _unit, _X];
|
||||
diag_log format["Dropped a bft device: %1 - %2", _unit, _X];
|
||||
} forEach _unMatchedDevices;
|
33
addons/bft/functions/fnc_vehicleInit.sqf
Normal file
33
addons/bft/functions/fnc_vehicleInit.sqf
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* 0: vehicle <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* TRUE <BOOL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_vehicle"];
|
||||
|
||||
systemChat format["VehicleInit: %1",_this];
|
||||
diag_log format["VehicleInit: %1",_this];
|
||||
|
||||
if !(isServer) exitwith {};
|
||||
|
||||
private ["_device"];
|
||||
_device = _vehicle getvariable [QGVAR(vehicleDevice), getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(vehicleDevice))];
|
||||
|
||||
systemChat format["VehicleInit devices: %1",_device];
|
||||
diag_log format["VehicleInit devices: %1",_device];
|
||||
|
||||
if (isClass (configFile >> "ACE_BFT" >> "Devices" >> _device)) then {
|
||||
["bft_itemCreated", [_vehicle, _device, "", format["%1/%2",_vehicle, _device], STATE_OFFLINE]] call EFUNC(common,serverEvent);
|
||||
};
|
||||
|
||||
true
|
1
addons/bft/functions/script_component.hpp
Normal file
1
addons/bft/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
||||
#include "\z\ace\addons\bft\script_component.hpp"
|
20
addons/bft/script_component.hpp
Normal file
20
addons/bft/script_component.hpp
Normal file
@ -0,0 +1,20 @@
|
||||
#define COMPONENT bft
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
// #define DEBUG_MODE_FULL
|
||||
// #define DISABLE_COMPILE_CACHE
|
||||
// #define CBA_DEBUG_SYNCHRONOUS
|
||||
// #define ENABLE_PERFORMANCE_COUNTERS
|
||||
|
||||
#ifdef DEBUG_ENABLED_BFT
|
||||
#define DEBUG_MODE_FULL
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_SETTINGS_BFT
|
||||
#define DEBUG_SETTINGS DEBUG_SETTINGS_BFT
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
||||
|
||||
|
||||
#include "device_getters.hpp"
|
1
addons/bft_device_dk10/$PBOPREFIX$
Normal file
1
addons/bft_device_dk10/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
z\ace\addons\bft_device_dk10
|
76
addons/bft_device_dk10/ACE_BFT.hpp
Normal file
76
addons/bft_device_dk10/ACE_BFT.hpp
Normal file
@ -0,0 +1,76 @@
|
||||
// ACE BFT configuration for devices
|
||||
class ACE_BFT {
|
||||
/*
|
||||
* To add a device to a vehicle reference the device class name on the vehicle
|
||||
* EGVAR(bft,vehicleDevice) = "GroundVehicle_b";
|
||||
*/
|
||||
class Devices {
|
||||
class DK10_b {
|
||||
deviceSide = "WEST";
|
||||
refreshRate[] = {5,2};
|
||||
reportingModes[] = {"FBCB2"};
|
||||
defaultInformation[] = {"Inf", 0, "", 0};
|
||||
interface = "DK10";
|
||||
icon = PATHTOF(UI\icon_bft_DK10.paa);
|
||||
};
|
||||
class DK10_o: DK10_b {
|
||||
deviceSide = "EAST";
|
||||
};
|
||||
class DK10_i: DK10_b {
|
||||
deviceSide = "IND";
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
* To add an interface to a vehicle reference the interface class name on the vehicle
|
||||
* EGVAR(bft,vehicleInterfaces)[] = {"JV5"};
|
||||
* A vehicle can have multiple interfaces available, just add them to the list
|
||||
*
|
||||
* The above will make the interface "JV5" available to all positions within that vehicle.
|
||||
* To limit the positions that the interface will be available for, encapsulate the interface
|
||||
* config name in an array and add a whereAvailable array as the second array item
|
||||
* EGVAR(bft,vehicleInterfaces)[] = {"JV5",{"TAD",{whereAvailable}}}
|
||||
* In the exacmple above, "JV5" will be available everywhere, but "TAD" is limited to certain
|
||||
* positions on that vehicle defined by whereAvailable.
|
||||
*
|
||||
* Here is how whereAvailable works
|
||||
* To define avialability for driver, all turret positions (excluding cargo-turrets) and
|
||||
* cargo positions with cargoIndex 0 and 1:
|
||||
* {"Driver","Turret",{"Cargo",{0,1}}}
|
||||
*
|
||||
* Here are some common settings for whereAvailable
|
||||
* To define pilot and co-pilot for most helicopters:
|
||||
* {"Driver",{"Turret",{0}}}
|
||||
* To define all the crew-members of an APC, but exclude passengers:
|
||||
* {"Driver","Turret"}
|
||||
* To define the driver and and passenger sitting next to him for a truck:
|
||||
* {"Driver",{"Cargo",{0}}}
|
||||
*/
|
||||
class Interfaces {
|
||||
class DK10 {
|
||||
dialogName = QGVAR(DK10_dlg);
|
||||
backgroundDay = QUOTE(PATHTOF(UI\images\DK10_background_ca.paa));
|
||||
backgroundNight = QUOTE(PATHTOF(UI\images\DK10_background_night_ca.paa));
|
||||
|
||||
class InterfaceSettings {
|
||||
dlgIfPosition[] = {};
|
||||
mode = "DESKTOP";
|
||||
showIconText = "true";
|
||||
mapWorldPos[] = {};
|
||||
mapScaleDsp = 2;
|
||||
mapScaleDlg = 2;
|
||||
class mapTypes {
|
||||
SAT = IDC_SCREEN;
|
||||
TOPO = IDC_SCREEN_TOPO;
|
||||
};
|
||||
mapType = "SAT";
|
||||
drawSizeMultiplier = 1;
|
||||
uavCam = "";
|
||||
hCam = "";
|
||||
mapTools = "true";
|
||||
nightMode = 2;
|
||||
brightness = 0.9;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
17
addons/bft_device_dk10/CfgEventHandlers.hpp
Normal file
17
addons/bft_device_dk10/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
class Extended_PreStart_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preStart));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit));
|
||||
};
|
||||
};
|
26
addons/bft_device_dk10/CfgMagazines.hpp
Normal file
26
addons/bft_device_dk10/CfgMagazines.hpp
Normal file
@ -0,0 +1,26 @@
|
||||
class CfgMagazines {
|
||||
class EGVAR(bft_devices,MagazineCore);
|
||||
// DK10 BLUFOR
|
||||
class ACE_DK10Magazine_b: EGVAR(bft_devices,MagazineCore) {
|
||||
descriptionShort = CSTRING(DK10_itemDescription_b);
|
||||
displayName = CSTRING(DK10_itemName_b);
|
||||
model = QUOTE(PATHTOF(data\DK10.p3d));
|
||||
picture = QUOTE(PATHTOF(UI\inventory\DK10_icon.paa));
|
||||
mass = 40;
|
||||
EGVAR(bft,type) = "ACE_DK10_b";
|
||||
};
|
||||
|
||||
// DK10 OPFOR
|
||||
class ACE_DK10Magazine_o: ACE_DK10Magazine_b {
|
||||
descriptionShort = CSTRING(DK10_itemDescription_o);
|
||||
displayName = CSTRING(DK10_itemName_o);
|
||||
EGVAR(bft,type) = "ACE_DK10_o";
|
||||
};
|
||||
|
||||
// DK10 IND
|
||||
class ACE_DK10Magazine_i: ACE_DK10Magazine_b {
|
||||
descriptionShort = CSTRING(DK10_itemDescription_i);
|
||||
displayName = CSTRING(DK10_itemName_i);
|
||||
EGVAR(bft,type) = "ACE_DK10_i";
|
||||
};
|
||||
};
|
21
addons/bft_device_dk10/CfgVehicles.hpp
Normal file
21
addons/bft_device_dk10/CfgVehicles.hpp
Normal file
@ -0,0 +1,21 @@
|
||||
class CfgVehicles {
|
||||
// Boxes
|
||||
class Box_NATO_Support_F;
|
||||
class ACE_Box_BFT_b: Box_NATO_Support_F {
|
||||
class TransportItems {
|
||||
MACRO_ADDITEM(ACE_DK10_b,5);
|
||||
};
|
||||
};
|
||||
class Box_East_Support_F;
|
||||
class ACE_Box_BFT_o: Box_East_Support_F {
|
||||
class TransportItems {
|
||||
MACRO_ADDITEM(ACE_DK10_o,5);
|
||||
};
|
||||
};
|
||||
class Box_IND_Support_F;
|
||||
class ACE_Box_BFT_i: Box_IND_Support_F {
|
||||
class TransportItems {
|
||||
MACRO_ADDITEM(ACE_DK10_i,5);
|
||||
};
|
||||
};
|
||||
};
|
33
addons/bft_device_dk10/CfgWeapons.hpp
Normal file
33
addons/bft_device_dk10/CfgWeapons.hpp
Normal file
@ -0,0 +1,33 @@
|
||||
class CfgWeapons {
|
||||
class InventoryItem_Base_F;
|
||||
class EGVAR(bft_devices,ItemCore);
|
||||
|
||||
// DK10 BLUFOR
|
||||
class ACE_DK10_b: EGVAR(bft_devices,ItemCore) {
|
||||
descriptionShort = CSTRING(DK10_itemDescription_b);
|
||||
displayName = CSTRING(DK10_itemName_b);
|
||||
model = QUOTE(PATHTOF(data\DK10.p3d));
|
||||
picture = QUOTE(PATHTOF(UI\inventory\DK10_icon.paa));
|
||||
class ItemInfo: InventoryItem_Base_F {
|
||||
mass = 40;
|
||||
};
|
||||
EGVAR(bft,deviceType) = "DK10_b";
|
||||
EGVAR(bft,magazineItem) = "ACE_DK10Magazine_b";
|
||||
};
|
||||
|
||||
// DK10 OPFOR
|
||||
class ACE_DK10_o: ACE_DK10_b {
|
||||
descriptionShort = CSTRING(DK10_itemDescription_o);
|
||||
displayName = CSTRING(DK10_itemName_o);
|
||||
EGVAR(bft,deviceType) = "DK10_o";
|
||||
EGVAR(bft,magazineItem) = "ACE_DK10Magazine_o";
|
||||
};
|
||||
|
||||
// DK10 IND
|
||||
class ACE_DK10_i: ACE_DK10_b {
|
||||
descriptionShort = CSTRING(DK10_itemDescription_i);
|
||||
displayName = CSTRING(DK10_itemName_i);
|
||||
EGVAR(bft,deviceType) = "DK10_i";
|
||||
EGVAR(bft,magazineItem) = "ACE_DK10Magazine_i";
|
||||
};
|
||||
};
|
258
addons/bft_device_dk10/UI/defines/DK10_controls.hpp
Normal file
258
addons/bft_device_dk10/UI/defines/DK10_controls.hpp
Normal file
@ -0,0 +1,258 @@
|
||||
// Background definition
|
||||
#define GUI_GRID_PX_W 2048 // width in pixels
|
||||
#define GUI_GRID_PX_H 2048 // hight in pixels
|
||||
|
||||
// Define screen area less header and footer. This defines the outer limits for any control groups.
|
||||
#define SCREEN_CONTENT_X DK10_SCREEN_CONTENT_X
|
||||
#define SCREEN_CONTENT_Y DK10_SCREEN_CONTENT_Y
|
||||
#define SCREEN_CONTENT_W DK10_SCREEN_CONTENT_W
|
||||
#define SCREEN_CONTENT_H DK10_SCREEN_CONTENT_H
|
||||
|
||||
#include "\z\ace\addons\bft_devices\UI\defines\shared_macros.hpp"
|
||||
|
||||
class GVAR(DK10_RscText): EGVAR(bft_devices,RscText) {
|
||||
style = ST_CENTER;
|
||||
w = pxToScreen_W(DK10_OSD_ELEMENT_STD_W);
|
||||
h = pxToScreen_H(DK10_OSD_ELEMENT_STD_H);
|
||||
font = GUI_FONT_MONO;
|
||||
colorText[] = COLOR_WHITE;
|
||||
sizeEx = pxToScreen_H(DK10_OSD_TEXT_STD_SIZE);
|
||||
colorBackground[] = COLOR_TRANSPARENT;
|
||||
shadow = 0;
|
||||
};
|
||||
class GVAR(DK10_RscListbox): EGVAR(bft_devices,RscListbox) {
|
||||
sizeEx = pxToScreen_H(DK10_OSD_TEXT_STD_SIZE * 1.2);
|
||||
};
|
||||
class GVAR(DK10_RscEdit): EGVAR(bft_devices,RscEdit) {
|
||||
sizeEx = pxToScreen_H(DK10_OSD_TEXT_STD_SIZE * 1.2);
|
||||
};
|
||||
class GVAR(DK10_RscButton): EGVAR(bft_devices,RscButton) {
|
||||
font = GUI_FONT_MONO;
|
||||
sizeEx = pxToScreen_H(DK10_OSD_TEXT_STD_SIZE);
|
||||
};
|
||||
class GVAR(DK10_background): EGVAR(bft_devices,RscPicture) {
|
||||
idc = IDC_BACKGROUND;
|
||||
text = "";
|
||||
x = GUI_GRID_X;
|
||||
y = GUI_GRID_Y;
|
||||
w = GUI_GRID_W;
|
||||
h = GUI_GRID_H;
|
||||
};
|
||||
class GVAR(DK10_header): EGVAR(bft_devices,RscPicture) {
|
||||
IDC_COUNTER
|
||||
text = "#(argb,8,8,3)color(0,0,0,1)";
|
||||
x = pxToScreen_X(DK10_MAP_X);
|
||||
y = pxToScreen_Y(DK10_MAP_Y);
|
||||
w = pxToScreen_W(DK10_MAP_W);
|
||||
h = pxToScreen_H(DK10_OSD_HEADER_H);
|
||||
};
|
||||
class GVAR(DK10_OSD_battery): EGVAR(bft_devices,RscPicture) {
|
||||
IDC_COUNTER
|
||||
text = QUOTE(PATHTOEF(bft_devices,UI\icons\battery_ca.paa));
|
||||
x = pxToScreen_X(DK10_OSD_X(1));
|
||||
y = pxToScreen_Y(DK10_MAP_Y + (DK10_OSD_HEADER_H - DK10_OSD_ICON_STD_SIZE) / 2);
|
||||
w = pxToScreen_W(DK10_OSD_ICON_STD_SIZE);
|
||||
h = pxToScreen_H(DK10_OSD_ICON_STD_SIZE);
|
||||
colorText[] = COLOR_WHITE;
|
||||
};
|
||||
class GVAR(DK10_OSD_time): GVAR(DK10_RscText) {
|
||||
idc = IDC_OSD_TIME;
|
||||
style = ST_CENTER;
|
||||
x = pxToScreen_X(DK10_OSD_X(4));
|
||||
y = pxToScreen_Y(DK10_MAP_Y + (DK10_OSD_HEADER_H - DK10_OSD_TEXT_STD_SIZE) / 2);
|
||||
};
|
||||
class GVAR(DK10_OSD_signalStrength): GVAR(DK10_OSD_battery) {
|
||||
IDC_COUNTER
|
||||
text = QUOTE(PATHTOEF(bft_devices,UI\icons\signalStrength_ca.paa));
|
||||
x = pxToScreen_X(DK10_OSD_X(7) + DK10_OSD_ELEMENT_STD_W - DK10_OSD_ICON_STD_SIZE * 2);
|
||||
colorText[] = COLOR_WHITE;
|
||||
};
|
||||
class GVAR(DK10_OSD_satellite): GVAR(DK10_OSD_battery) {
|
||||
IDC_COUNTER
|
||||
text = "\a3\ui_f\data\map\Diary\signal_ca.paa";
|
||||
x = pxToScreen_X(DK10_OSD_X(7) + DK10_OSD_ELEMENT_STD_W - DK10_OSD_ICON_STD_SIZE);
|
||||
colorText[] = COLOR_WHITE;
|
||||
};
|
||||
class GVAR(DK10_OSD_dirDegree): GVAR(DK10_OSD_time) {
|
||||
idc = IDC_OSD_DIR_DEGREE;
|
||||
style = ST_LEFT;
|
||||
x = pxToScreen_X(DK10_OSD_X(2));
|
||||
};
|
||||
class GVAR(DK10_OSD_grid): GVAR(DK10_OSD_dirDegree) {
|
||||
idc = IDC_OSD_GRID;
|
||||
style = ST_RIGHT;
|
||||
x = pxToScreen_X(DK10_OSD_X(6));
|
||||
};
|
||||
class GVAR(DK10_OSD_dirOctant): GVAR(DK10_OSD_dirDegree) {
|
||||
idc = IDC_OSD_DIR_OCTANT;
|
||||
style = ST_RIGHT;
|
||||
x = pxToScreen_X(DK10_OSD_X(1));
|
||||
};
|
||||
class GVAR(DK10_window_back_TL): EGVAR(bft_devices,RscFrame) {
|
||||
x = pxToScreen_X(DK10_WINDOW_BACK_L_X);
|
||||
y = pxToScreen_Y(DK10_WINDOW_BACK_T_Y);
|
||||
w = pxToScreen_W(DK10_WINDOW_BACK_L_W);
|
||||
h = pxToScreen_H(DK10_WINDOW_BACK_H);
|
||||
};
|
||||
class GVAR(DK10_window_back_BL): GVAR(DK10_window_back_TL) {
|
||||
y = pxToScreen_Y(DK10_WINDOW_BACK_B_Y);
|
||||
};
|
||||
class GVAR(DK10_window_back_TR): GVAR(DK10_window_back_TL) {
|
||||
x = pxToScreen_X(DK10_WINDOW_BACK_R_X);
|
||||
w = pxToScreen_W(DK10_WINDOW_BACK_R_W);
|
||||
};
|
||||
class GVAR(DK10_window_back_BR): GVAR(DK10_window_back_TR) {
|
||||
y = pxToScreen_Y(DK10_WINDOW_BACK_B_Y);
|
||||
};
|
||||
class GVAR(DK10_btnF1): EGVAR(bft_devices,RscButtonInv) {
|
||||
x = pxToScreen_X(506);
|
||||
y = pxToScreen_Y(1545);
|
||||
w = pxToScreen_W(52);
|
||||
h = pxToScreen_H(52);
|
||||
};
|
||||
class GVAR(DK10_btnF2): GVAR(DK10_btnF1) {
|
||||
x = pxToScreen_X(569);
|
||||
};
|
||||
class GVAR(DK10_btnF3): GVAR(DK10_btnF1) {
|
||||
x = pxToScreen_X(639);
|
||||
};
|
||||
class GVAR(DK10_btnF4): GVAR(DK10_btnF1) {
|
||||
x = pxToScreen_X(703);
|
||||
};
|
||||
class GVAR(DK10_btnF5): GVAR(DK10_btnF1) {
|
||||
x = pxToScreen_X(768);
|
||||
};
|
||||
class GVAR(DK10_btnF6): GVAR(DK10_btnF1) {
|
||||
x = pxToScreen_X(833);
|
||||
};
|
||||
class GVAR(DK10_btnFn): GVAR(DK10_btnF1) {
|
||||
x = pxToScreen_X(970);
|
||||
};
|
||||
class GVAR(DK10_btnPower): GVAR(DK10_btnFn) {
|
||||
x = pxToScreen_X(1034);
|
||||
};
|
||||
class GVAR(DK10_btnBrtDn): GVAR(DK10_btnFn) {
|
||||
x = pxToScreen_X(1100);
|
||||
};
|
||||
class GVAR(DK10_btnBrtUp): GVAR(DK10_btnFn) {
|
||||
x = pxToScreen_X(1163);
|
||||
};
|
||||
class GVAR(DK10_btnTrackpad): GVAR(DK10_btnFn) {
|
||||
x = pxToScreen_X(1262);
|
||||
y = pxToScreen_Y(1550);
|
||||
w = pxToScreen_W(48);
|
||||
h = pxToScreen_H(43);
|
||||
};
|
||||
class GVAR(DK10_btnMouse): GVAR(DK10_btnFn) {
|
||||
x = pxToScreen_X(1401);
|
||||
w = pxToScreen_W(91);
|
||||
};
|
||||
class GVAR(DK10_btnHome): GVAR(DK10_btnMouse) {
|
||||
x = pxToScreen_X(897);
|
||||
y = pxToScreen_Y(1534);
|
||||
w = pxToScreen_W(61);
|
||||
h = pxToScreen_H(49);
|
||||
};
|
||||
class GVAR(DK10_notificationLight) {
|
||||
x = pxToScreen_X(1353);
|
||||
y = pxToScreen_Y(1557);
|
||||
w = pxToScreen_W(28);
|
||||
h = pxToScreen_H(28);
|
||||
};
|
||||
class GVAR(DK10_OSD_hookGrid): GVAR(DK10_RscText) {
|
||||
idc = IDC_OSD_HOOK_GRID;
|
||||
style = ST_CENTER;
|
||||
x = pxToScreen_X(DK10_OSD_RIGHT_X);
|
||||
y = pxToScreen_Y(DK10_OSD_EDGE_B - DK10_OSD_MARGIN - DK10_OSD_ELEMENT_STD_H * 4);
|
||||
colorText[] = {1,1,1,0.5};
|
||||
colorBackground[] = {0,0,0,0.25};
|
||||
};
|
||||
class GVAR(DK10_OSD_hookElevation): GVAR(DK10_OSD_hookGrid) {
|
||||
idc = IDC_OSD_HOOK_ELEVATION;
|
||||
y = pxToScreen_Y(DK10_OSD_EDGE_B - DK10_OSD_MARGIN - DK10_OSD_ELEMENT_STD_H * 3);
|
||||
};
|
||||
class GVAR(DK10_OSD_hookDst): GVAR(DK10_OSD_hookGrid) {
|
||||
idc = IDC_OSD_HOOK_DST;
|
||||
y = pxToScreen_Y(DK10_OSD_EDGE_B - DK10_OSD_MARGIN - DK10_OSD_ELEMENT_STD_H * 2);
|
||||
};
|
||||
class GVAR(DK10_OSD_hookDir): GVAR(DK10_OSD_hookGrid) {
|
||||
idc = IDC_OSD_HOOK_DIR;
|
||||
y = pxToScreen_Y(DK10_OSD_EDGE_B - DK10_OSD_MARGIN - DK10_OSD_ELEMENT_STD_H);
|
||||
};
|
||||
class GVAR(DK10_loadingtxt): GVAR(DK10_RscText) {
|
||||
idc = IDC_LOADINGTXT;
|
||||
style = ST_CENTER;
|
||||
text = "Loading"; //--- ToDo: Localize;
|
||||
x = pxToScreen_X(SCREEN_CONTENT_X);
|
||||
y = pxToScreen_Y(SCREEN_CONTENT_Y);
|
||||
w = pxToScreen_W(SCREEN_CONTENT_W);
|
||||
h = pxToScreen_H(SCREEN_CONTENT_H);
|
||||
colorBackground[] = COLOR_LIGHT_BLUE;
|
||||
};
|
||||
// Define areas around the screen as interaction areas to allow screen movement
|
||||
class GVAR(DK10_movingHandle_T): GVAR(DK10_RscText) {
|
||||
IDC_COUNTER
|
||||
moving = 1;
|
||||
colorBackground[] = COLOR_TRANSPARENT;
|
||||
x = pxToScreen_X(0);
|
||||
y = pxToScreen_Y(0);
|
||||
w = pxToScreen_W(GUI_GRID_PX_W);
|
||||
h = pxToScreen_H(DK10_MAP_Y);
|
||||
};
|
||||
class GVAR(DK10_movingHandle_B): GVAR(DK10_movingHandle_T) {
|
||||
IDC_COUNTER
|
||||
y = pxToScreen_Y(DK10_MAP_Y + DK10_MAP_H);
|
||||
h = pxToScreen_H(GUI_GRID_PX_H - (DK10_MAP_Y + DK10_MAP_H));
|
||||
};
|
||||
class GVAR(DK10_movingHandle_L): GVAR(DK10_movingHandle_T) {
|
||||
IDC_COUNTER
|
||||
y = pxToScreen_Y(DK10_MAP_Y);
|
||||
w = pxToScreen_W(DK10_MAP_X);
|
||||
h = pxToScreen_H(DK10_MAP_H);
|
||||
};
|
||||
class GVAR(DK10_movingHandle_R): GVAR(DK10_movingHandle_L) {
|
||||
IDC_COUNTER
|
||||
x = pxToScreen_X(DK10_MAP_X + DK10_MAP_W);
|
||||
w = pxToScreen_W(GUI_GRID_PX_W - (DK10_MAP_X + DK10_MAP_W));
|
||||
};
|
||||
|
||||
// transparent control that gets placed on top of the GUI to adjust brightness
|
||||
class GVAR(DK10_brightness): GVAR(DK10_RscText) {
|
||||
idc = IDC_BRIGHTNESS;
|
||||
x = pxToScreen_X(DK10_MAP_X);
|
||||
y = pxToScreen_Y(DK10_MAP_Y);
|
||||
w = pxToScreen_W(DK10_MAP_W);
|
||||
h = pxToScreen_H(DK10_MAP_H);
|
||||
colorBackground[] = COLOR_TRANSPARENT;
|
||||
};
|
||||
class GVAR(DK10_RscMapControl): EGVAR(bft_devices,RscMapControl) {
|
||||
onDraw = onDrawBFT(0);
|
||||
text = "#(argb,8,8,3)color(1,1,1,1)";
|
||||
x = pxToScreen_X(SCREEN_CONTENT_X);
|
||||
y = pxToScreen_Y(SCREEN_CONTENT_Y);
|
||||
w = pxToScreen_W(SCREEN_CONTENT_W);
|
||||
h = pxToScreen_H(SCREEN_CONTENT_H);
|
||||
maxSatelliteAlpha = 10000;
|
||||
alphaFadeStartScale = 10;
|
||||
alphaFadeEndScale = 10;
|
||||
|
||||
// Rendering density coefficients
|
||||
ptsPerSquareSea = 8 / (0.86 / GUI_GRID_H); // seas
|
||||
ptsPerSquareTxt = 8 / (0.86 / GUI_GRID_H); // textures
|
||||
ptsPerSquareCLn = 8 / (0.86 / GUI_GRID_H); // count-lines
|
||||
ptsPerSquareExp = 8 / (0.86 / GUI_GRID_H); // exposure
|
||||
ptsPerSquareCost = 8 / (0.86 / GUI_GRID_H); // cost
|
||||
|
||||
// Rendering thresholds
|
||||
ptsPerSquareFor = 3 / (0.86 / GUI_GRID_H); // forests
|
||||
ptsPerSquareForEdge = 100 / (0.86 / GUI_GRID_H); // forest edges
|
||||
ptsPerSquareRoad = 1.5 / (0.86 / GUI_GRID_H); // roads
|
||||
ptsPerSquareObj = 4 / (0.86 / GUI_GRID_H); // other objects
|
||||
};
|
||||
class GVAR(DK10_notification): GVAR(DK10_RscText) {
|
||||
idc = IDC_NOTIFICATION;
|
||||
x = pxToScreen_X(SCREEN_CONTENT_X + (SCREEN_CONTENT_W * 0.5) / 2);
|
||||
y = pxToScreen_Y(SCREEN_CONTENT_Y + SCREEN_CONTENT_H - 2 * DK10_OSD_TEXT_STD_SIZE);
|
||||
w = pxToScreen_W(SCREEN_CONTENT_W * 0.5);
|
||||
colorBackground[] = COLOR_BLACK;
|
||||
};
|
123
addons/bft_device_dk10/UI/defines/DK10_defines.hpp
Normal file
123
addons/bft_device_dk10/UI/defines/DK10_defines.hpp
Normal file
@ -0,0 +1,123 @@
|
||||
// Map position within background, pixel based
|
||||
#define DK10_MAP_X (257)
|
||||
#define DK10_MAP_Y (491)
|
||||
#define DK10_MAP_W (1341)
|
||||
#define DK10_MAP_H (993)
|
||||
|
||||
// Height of header and footer OSD elements
|
||||
#define DK10_OSD_HEADER_H (42)
|
||||
#define DK10_OSD_FOOTER_H (0)
|
||||
|
||||
// Screen content (the stuff that changes, so map area - header and footer)
|
||||
#define DK10_SCREEN_CONTENT_X (DK10_MAP_X)
|
||||
#define DK10_SCREEN_CONTENT_Y (DK10_MAP_Y + DK10_OSD_HEADER_H)
|
||||
#define DK10_SCREEN_CONTENT_W (DK10_MAP_W)
|
||||
#define DK10_SCREEN_CONTENT_H (DK10_MAP_H - DK10_OSD_HEADER_H - DK10_OSD_FOOTER_H)
|
||||
|
||||
// Window conent offset in % of window background
|
||||
#define DK10_WINDOW_CONENT_OFFSET_FACTOR (0.025)
|
||||
|
||||
// Make for windows 48% in height of available space (so we can fit two)
|
||||
// Background for PiP in 4:3 aspect on the right, the rest will take the available space on the left
|
||||
#define DK10_WINDOW_BACK_MARGIN (DK10_SCREEN_CONTENT_H * 0.01)
|
||||
#define DK10_WINDOW_BACK_H ((DK10_SCREEN_CONTENT_H - 3 * DK10_WINDOW_BACK_MARGIN) / 2)
|
||||
// Make the right window slightly less wide in order to accomodate a 4:3 content ratio as well as the conent offset
|
||||
#define DK10_WINDOW_BACK_R_W (4 / 3 * DK10_WINDOW_BACK_H * (1 - 2 * DK10_WINDOW_CONENT_OFFSET_FACTOR * 3 / 4))
|
||||
#define DK10_WINDOW_BACK_L_W (DK10_SCREEN_CONTENT_W - (DK10_WINDOW_BACK_R_W + 3 * DK10_WINDOW_BACK_MARGIN))
|
||||
|
||||
// Window content (application windows) position within window background, aspect ratio is 4:3
|
||||
// Offset from the left
|
||||
#define DK10_WINDOW_CONTENT_OFFSET_X (DK10_WINDOW_BACK_R_W * DK10_WINDOW_CONENT_OFFSET_FACTOR)
|
||||
// Offset from the bottom
|
||||
#define DK10_WINDOW_CONTENT_OFFSET_Y (DK10_WINDOW_CONTENT_OFFSET_X)
|
||||
#define DK10_WINDOW_CONTENT_R_W (DK10_WINDOW_BACK_R_W - 2 * DK10_WINDOW_CONTENT_OFFSET_X)
|
||||
#define DK10_WINDOW_CONTENT_L_W (DK10_WINDOW_BACK_L_W - 2 * DK10_WINDOW_CONTENT_OFFSET_X)
|
||||
#define DK10_WINDOW_CONTENT_H (3 / 4 * DK10_WINDOW_CONTENT_R_W)
|
||||
|
||||
// Distribute window backgrounds evenly on the available screen space for 2x2 windows
|
||||
#define DK10_WINDOW_BACK_L_X (DK10_SCREEN_CONTENT_X + DK10_WINDOW_BACK_MARGIN)
|
||||
#define DK10_WINDOW_BACK_R_X (DK10_WINDOW_BACK_L_X + DK10_WINDOW_BACK_L_W + DK10_WINDOW_BACK_MARGIN)
|
||||
#define DK10_WINDOW_BACK_T_Y (DK10_SCREEN_CONTENT_Y + DK10_WINDOW_BACK_MARGIN)
|
||||
#define DK10_WINDOW_BACK_B_Y (DK10_WINDOW_BACK_T_Y + DK10_WINDOW_BACK_H + DK10_WINDOW_BACK_MARGIN)
|
||||
|
||||
// Place window content within window background
|
||||
#define DK10_WINDOW_CONTENT_L_X (DK10_WINDOW_BACK_L_X + DK10_WINDOW_CONTENT_OFFSET_X)
|
||||
#define DK10_WINDOW_CONTENT_R_X (DK10_WINDOW_BACK_R_X + DK10_WINDOW_CONTENT_OFFSET_X)
|
||||
#define DK10_WINDOW_CONTENT_T_Y (DK10_WINDOW_BACK_T_Y + DK10_WINDOW_BACK_H - DK10_WINDOW_CONTENT_OFFSET_Y - DK10_WINDOW_CONTENT_H)
|
||||
#define DK10_WINDOW_CONTENT_B_Y (DK10_WINDOW_BACK_B_Y + DK10_WINDOW_BACK_H - DK10_WINDOW_CONTENT_OFFSET_Y - DK10_WINDOW_CONTENT_H)
|
||||
|
||||
// Desktop icon size and offset from tablet screen edge in pixels
|
||||
#define DK10_DESKTOP_ICON_OFFSET_X (25)
|
||||
#define DK10_DESKTOP_ICON_OFFSET_Y (25)
|
||||
#define DK10_DESKTOP_ICON_W (100)
|
||||
#define DK10_DESKTOP_ICON_H (100)
|
||||
|
||||
// Message element positions in pixels
|
||||
#define DK10_MESSAGE_MARGIN_OUTER (20)
|
||||
#define DK10_MESSAGE_MARGIN_INNER (10)
|
||||
|
||||
#define DK10_MESSAGE_BUTTON_W (150)
|
||||
#define DK10_MESSAGE_BUTTON_H (50)
|
||||
|
||||
#define DK10_MESSAGE_MESSAGETEXT_FRAME_X (DK10_SCREEN_CONTENT_X + DK10_MESSAGE_MARGIN_OUTER)
|
||||
#define DK10_MESSAGE_MESSAGETEXT_FRAME_Y (DK10_SCREEN_CONTENT_Y + DK10_MESSAGE_MARGIN_INNER)
|
||||
#define DK10_MESSAGE_MESSAGETEXT_FRAME_W (DK10_SCREEN_CONTENT_W - DK10_MESSAGE_MARGIN_OUTER * 2)
|
||||
#define DK10_MESSAGE_MESSAGETEXT_FRAME_H ((DK10_SCREEN_CONTENT_H - DK10_MESSAGE_MARGIN_INNER * 3) / 2)
|
||||
|
||||
#define DK10_MESSAGE_MESSAGELIST_X (DK10_MESSAGE_MESSAGETEXT_FRAME_X + DK10_MESSAGE_MARGIN_INNER)
|
||||
#define DK10_MESSAGE_MESSAGELIST_Y (DK10_MESSAGE_MESSAGETEXT_FRAME_Y + DK10_MESSAGE_MARGIN_OUTER)
|
||||
#define DK10_MESSAGE_MESSAGELIST_W ((DK10_MESSAGE_MESSAGETEXT_FRAME_W - DK10_MESSAGE_MARGIN_INNER * 3) / 3)
|
||||
#define DK10_MESSAGE_MESSAGELIST_H (DK10_MESSAGE_MESSAGETEXT_FRAME_H - DK10_MESSAGE_MARGIN_INNER - DK10_MESSAGE_MARGIN_OUTER)
|
||||
|
||||
#define DK10_MESSAGE_MESSAGETEXT_X (DK10_MESSAGE_MESSAGELIST_X + DK10_MESSAGE_MESSAGELIST_W + DK10_MESSAGE_MARGIN_INNER)
|
||||
#define DK10_MESSAGE_MESSAGETEXT_Y (DK10_MESSAGE_MESSAGELIST_Y)
|
||||
#define DK10_MESSAGE_MESSAGETEXT_W (DK10_MESSAGE_MESSAGELIST_W * 2)
|
||||
#define DK10_MESSAGE_MESSAGETEXT_H (DK10_MESSAGE_MESSAGELIST_H - DK10_MESSAGE_MARGIN_INNER - DK10_MESSAGE_BUTTON_H)
|
||||
|
||||
#define DK10_MESSAGE_COMPOSE_FRAME_X (DK10_MESSAGE_MESSAGETEXT_FRAME_X)
|
||||
#define DK10_MESSAGE_COMPOSE_FRAME_Y (DK10_MESSAGE_MESSAGETEXT_FRAME_Y + DK10_MESSAGE_MESSAGETEXT_FRAME_H + DK10_MESSAGE_MARGIN_INNER)
|
||||
#define DK10_MESSAGE_COMPOSE_FRAME_W (DK10_MESSAGE_MESSAGETEXT_FRAME_W)
|
||||
#define DK10_MESSAGE_COMPOSE_FRAME_H (DK10_MESSAGE_MESSAGETEXT_FRAME_H)
|
||||
|
||||
#define DK10_MESSAGE_PLAYERLIST_X (DK10_MESSAGE_MESSAGELIST_X)
|
||||
#define DK10_MESSAGE_PLAYERLIST_Y (DK10_MESSAGE_COMPOSE_FRAME_Y + DK10_MESSAGE_MARGIN_OUTER)
|
||||
#define DK10_MESSAGE_PLAYERLIST_W (DK10_MESSAGE_MESSAGELIST_W)
|
||||
#define DK10_MESSAGE_PLAYERLIST_H (DK10_MESSAGE_MESSAGELIST_H)
|
||||
|
||||
#define DK10_MESSAGE_COMPOSE_TEXT_X (DK10_MESSAGE_MESSAGETEXT_X)
|
||||
#define DK10_MESSAGE_COMPOSE_TEXT_Y (DK10_MESSAGE_PLAYERLIST_Y)
|
||||
#define DK10_MESSAGE_COMPOSE_TEXT_W (DK10_MESSAGE_MESSAGETEXT_W)
|
||||
#define DK10_MESSAGE_COMPOSE_TEXT_H (DK10_MESSAGE_MESSAGETEXT_H)
|
||||
|
||||
#define DK10_MESSAGE_BUTTON_SEND_X (DK10_MESSAGE_COMPOSE_FRAME_X + DK10_MESSAGE_COMPOSE_FRAME_W - DK10_MESSAGE_MARGIN_INNER - DK10_MESSAGE_BUTTON_W)
|
||||
#define DK10_MESSAGE_BUTTON_SEND_Y (DK10_MESSAGE_COMPOSE_TEXT_Y + DK10_MESSAGE_COMPOSE_TEXT_H + DK10_MESSAGE_MARGIN_INNER)
|
||||
|
||||
#define DK10_MESSAGE_BUTTON_DELETE_X (DK10_MESSAGE_BUTTON_SEND_X)
|
||||
#define DK10_MESSAGE_BUTTON_DELETE_Y (DK10_MESSAGE_MESSAGETEXT_Y + DK10_MESSAGE_MESSAGETEXT_H + DK10_MESSAGE_MARGIN_INNER)
|
||||
|
||||
// On-screen edge positions (left, right, top, bottom)
|
||||
#define DK10_OSD_MARGIN (10)
|
||||
#define DK10_OSD_EDGE_L (DK10_OSD_MARGIN + DK10_SCREEN_CONTENT_X)
|
||||
#define DK10_OSD_EDGE_R (-DK10_OSD_MARGIN + DK10_SCREEN_CONTENT_X + DK10_SCREEN_CONTENT_W)
|
||||
#define DK10_OSD_EDGE_T (DK10_OSD_MARGIN + DK10_SCREEN_CONTENT_Y)
|
||||
#define DK10_OSD_EDGE_B (-DK10_OSD_FOOTER_H + DK10_MAP_Y + DK10_MAP_H)
|
||||
|
||||
// On-screen element base width and height
|
||||
#define DK10_OSD_ELEMENT_STD_W ((DK10_SCREEN_CONTENT_W - DK10_OSD_MARGIN * 8) / 7)
|
||||
#define DK10_OSD_ELEMENT_STD_H (DK10_OSD_HEADER_H - DK10_OSD_MARGIN)
|
||||
|
||||
// On-screen element X-coord for left, center and right elements
|
||||
#define DK10_OSD_LEFT_X (DK10_OSD_EDGE_L)
|
||||
#define DK10_OSD_CENTER_X (DK10_OSD_EDGE_L + DK10_OSD_MARGIN + DK10_OSD_ELEMENT_STD_W)
|
||||
#define DK10_OSD_RIGHT_X (DK10_OSD_EDGE_R - DK10_OSD_ELEMENT_STD_W)
|
||||
|
||||
// On-screen element X-coord for left, center and right elements
|
||||
#define DK10_OSD_X(ITEM) (DK10_OSD_EDGE_L + (DK10_OSD_MARGIN + DK10_OSD_ELEMENT_STD_W) * (ITEM - 1))
|
||||
|
||||
// On-screen text sizes, hight in pixels
|
||||
// Standard text elements
|
||||
#define DK10_OSD_TEXT_STD_SIZE (27)
|
||||
#define DK10_OSD_ICON_STD_SIZE (35)
|
||||
|
||||
// On-screen map centre cursor
|
||||
#define DK10_CURSOR (32)
|
409
addons/bft_device_dk10/UI/defines/DK10_dialog.hpp
Normal file
409
addons/bft_device_dk10/UI/defines/DK10_dialog.hpp
Normal file
@ -0,0 +1,409 @@
|
||||
#define DISPLAY_NAME DK10_dlg
|
||||
|
||||
#define GUI_GRID_H (safezoneH * 1.2)
|
||||
#define GUI_GRID_W (GUI_GRID_H * 3/4)
|
||||
// since the actual map position is not in the center, we correct for it by shifting it right
|
||||
// (GUI_GRID_PX_W - DK10_MAP_W) / 2 - DK10_MAP_X
|
||||
// is 96.5, that is the pixel amount we have to shift by, devided by GUI_GRID_PX_W
|
||||
// to make it a ratio that we can apply to GUI_GRID_W in order to get a screen value to shift by
|
||||
#define GUI_GRID_X (safezoneX + (safezoneW - GUI_GRID_W) / 2 + (GUI_GRID_W * ((GUI_GRID_PX_W - DK10_MAP_W) / 2 - DK10_MAP_X) / 2048))
|
||||
#define GUI_GRID_Y (safezoneY + (safezoneH - GUI_GRID_H) / 2)
|
||||
|
||||
#include "DK10_controls.hpp"
|
||||
|
||||
//#define MENU_sizeEx pxToScreen_H(DK10_OSD_TEXT_STD_SIZE)
|
||||
//#include "\cTab\shared\cTab_markerMenu_macros.hpp"
|
||||
|
||||
class GVAR(DISPLAY_NAME) {
|
||||
idd = IDD_DK10_DLG;
|
||||
movingEnable = true;
|
||||
onLoad = QUOTE(_this call EFUNC(bft_devices,ifOnLoad));
|
||||
onUnload = QUOTE([] call EFUNC(bft_devices,ifOnUnload));
|
||||
onKeyDown = QUOTE(_this call EFUNC(bft_devices,ifOnKeyDown));
|
||||
objects[] = {};
|
||||
class controlsBackground {
|
||||
class windowsBG: EGVAR(bft_devices,RscPicture) {
|
||||
idc = IDC_WIN_BACK;
|
||||
text = "#(argb,8,8,3)color(0.2,0.431,0.647,1)";
|
||||
x = pxToScreen_X(DK10_MAP_X);
|
||||
y = pxToScreen_Y(DK10_MAP_Y);
|
||||
w = pxToScreen_W(DK10_MAP_W);
|
||||
h = pxToScreen_H(DK10_MAP_H);
|
||||
};
|
||||
class UavMap: GVAR(DK10_RscMapControl) {
|
||||
idc = IDC_UAVMAP;
|
||||
x = pxToScreen_X(DK10_WINDOW_CONTENT_L_X);
|
||||
y = pxToScreen_Y(DK10_WINDOW_CONTENT_B_Y);
|
||||
w = pxToScreen_W(DK10_WINDOW_CONTENT_L_W);
|
||||
h = pxToScreen_H(DK10_WINDOW_CONTENT_H);
|
||||
};
|
||||
class HcamMap: UavMap {
|
||||
idc = IDC_HCAMMAP;
|
||||
};
|
||||
class screen: GVAR(DK10_RscMapControl) {
|
||||
idc = IDC_SCREEN;
|
||||
//onMouseButtonDblClick = "_ok = [3300,_this] execVM '\cTab\shared\cTab_markerMenu_load.sqf';";
|
||||
onMouseMoving = onMM;
|
||||
};
|
||||
class screenTopo: screen {
|
||||
idc = IDC_SCREEN_TOPO;
|
||||
maxSatelliteAlpha = 0;
|
||||
};
|
||||
};
|
||||
class controls {
|
||||
class header: GVAR(DK10_header) {};
|
||||
class battery: GVAR(DK10_OSD_battery) {};
|
||||
class time: GVAR(DK10_OSD_time) {};
|
||||
class signalStrength: GVAR(DK10_OSD_signalStrength) {};
|
||||
class satellite: GVAR(DK10_OSD_satellite) {};
|
||||
class dirDegree: GVAR(DK10_OSD_dirDegree) {};
|
||||
class grid: GVAR(DK10_OSD_grid) {};
|
||||
class dirOctant: GVAR(DK10_OSD_dirOctant) {};
|
||||
class hookGrid: GVAR(DK10_OSD_hookGrid) {};
|
||||
class hookElevation: GVAR(DK10_OSD_hookElevation) {};
|
||||
class hookDst: GVAR(DK10_OSD_hookDst) {};
|
||||
class hookDir: GVAR(DK10_OSD_hookDir) {};
|
||||
// ---------- DESKTOP -----------
|
||||
class Desktop: EGVAR(bft_devices,RscControlsGroup) {
|
||||
idc = IDC_GROUP_DESKTOP;
|
||||
x = pxToScreen_X(SCREEN_CONTENT_X);
|
||||
y = pxToScreen_Y(SCREEN_CONTENT_Y);
|
||||
w = pxToScreen_W(SCREEN_CONTENT_W);
|
||||
h = pxToScreen_H(SCREEN_CONTENT_H);
|
||||
class VScrollbar {};
|
||||
class HScrollbar {};
|
||||
class Scrollbar {};
|
||||
class controls {
|
||||
class appBFT: EGVAR(bft_devices,ActiveText) {
|
||||
style = ST_PICTURE;
|
||||
idc = IDC_ACTBFTTXT;
|
||||
text = QUOTE(PATHTOEF(bft_devices,UI\icons\appBFT.paa));
|
||||
x = pxToGroup_X(SCREEN_CONTENT_X + DK10_DESKTOP_ICON_OFFSET_X);
|
||||
y = pxToGroup_Y(SCREEN_CONTENT_Y + DK10_DESKTOP_ICON_OFFSET_Y);
|
||||
w = pxToScreen_W(DK10_DESKTOP_ICON_W);
|
||||
h = pxToScreen_H(DK10_DESKTOP_ICON_H);
|
||||
onMouseButtonUp = onMBU(modeBFT);
|
||||
toolTip = "FBCB2 - Blue Force Tracker";
|
||||
};
|
||||
class appUAV: appBFT {
|
||||
idc = IDC_ACTUAVTXT;
|
||||
text = QUOTE(PATHTOEF(bft_devices,UI\icons\appUAV.paa));
|
||||
y = pxToGroup_Y(SCREEN_CONTENT_Y + DK10_DESKTOP_ICON_OFFSET_Y * 2 + DK10_DESKTOP_ICON_H);
|
||||
onMouseButtonUp = onMBU(modeUAV);
|
||||
toolTip = "UAV Video Feeds";
|
||||
};
|
||||
class appHCAM: appBFT {
|
||||
idc = IDC_ACTVIDTXT;
|
||||
text = QUOTE(PATHTOEF(bft_devices,UI\icons\appHelmetCam.paa));
|
||||
y = pxToGroup_Y(SCREEN_CONTENT_Y + DK10_DESKTOP_ICON_OFFSET_Y * 3 + DK10_DESKTOP_ICON_H * 2);
|
||||
onMouseButtonUp = onMBU(modeHCAM);
|
||||
toolTip = "Live Helmet Cam Video Feeds";
|
||||
};
|
||||
class appMAIL: appBFT {
|
||||
idc = IDC_ACTMSGTXT;
|
||||
text = QUOTE(PATHTOEF(bft_devices,UI\icons\appMail.paa));
|
||||
y = pxToGroup_Y(SCREEN_CONTENT_Y + DK10_DESKTOP_ICON_OFFSET_Y * 4 + DK10_DESKTOP_ICON_H * 3);
|
||||
onMouseButtonUp = onMBU(modeMESSAGE);
|
||||
toolTip = "Text Messaging System";
|
||||
};
|
||||
};
|
||||
};
|
||||
// ---------- UAV -----------
|
||||
class UAV: EGVAR(bft_devices,RscControlsGroup) {
|
||||
idc = IDC_GROUP_UAV;
|
||||
x = pxToScreen_X(SCREEN_CONTENT_X);
|
||||
y = pxToScreen_Y(SCREEN_CONTENT_Y);
|
||||
w = pxToScreen_W(SCREEN_CONTENT_W);
|
||||
h = pxToScreen_H(SCREEN_CONTENT_H);
|
||||
class VScrollbar {};
|
||||
class HScrollbar {};
|
||||
class Scrollbar {};
|
||||
class controls {
|
||||
class UAVListBG: GVAR(DK10_window_back_TL) {
|
||||
IDC_COUNTER
|
||||
x = pxToGroup_X(DK10_WINDOW_BACK_L_X);
|
||||
y = pxToGroup_Y(DK10_WINDOW_BACK_T_Y);
|
||||
text = "Select UAV";
|
||||
};
|
||||
class MiniMapBG: GVAR(DK10_window_back_BL) {
|
||||
IDC_COUNTER
|
||||
x = pxToGroup_X(DK10_WINDOW_BACK_L_X);
|
||||
y = pxToGroup_Y(DK10_WINDOW_BACK_B_Y);
|
||||
text = "UAV Location";
|
||||
};
|
||||
class UAVVidBG1: GVAR(DK10_window_back_TR) {
|
||||
IDC_COUNTER
|
||||
x = pxToGroup_X(DK10_WINDOW_BACK_R_X);
|
||||
y = pxToGroup_Y(DK10_WINDOW_BACK_T_Y);
|
||||
text = "Pilot view";
|
||||
};
|
||||
class UAVVidBG2: GVAR(DK10_window_back_BR) {
|
||||
IDC_COUNTER
|
||||
x = pxToGroup_X(DK10_WINDOW_BACK_R_X);
|
||||
y = pxToGroup_Y(DK10_WINDOW_BACK_B_Y);
|
||||
text = "Gunner view";
|
||||
};
|
||||
class UAVlist: GVAR(DK10_RscListbox) {
|
||||
idc = IDC_UAVLIST;
|
||||
x = pxToGroup_X(DK10_WINDOW_CONTENT_L_X);
|
||||
y = pxToGroup_Y(DK10_WINDOW_CONTENT_T_Y);
|
||||
w = pxToScreen_W(DK10_WINDOW_CONTENT_L_W);
|
||||
h = pxToScreen_H(DK10_WINDOW_CONTENT_H);
|
||||
onLBSelChanged = onLBSC(UAVlist);
|
||||
};
|
||||
class UAVdisplay: EGVAR(bft_devices,RscPicture) {
|
||||
idc = IDC_UAVDISPLAY;
|
||||
text = "#(argb,512,512,1)r2t(rendertarget8,1.0)";
|
||||
x = pxToGroup_X(DK10_WINDOW_CONTENT_R_X);
|
||||
y = pxToGroup_Y(DK10_WINDOW_CONTENT_T_Y);
|
||||
w = pxToScreen_W(DK10_WINDOW_CONTENT_R_W);
|
||||
h = pxToScreen_H(DK10_WINDOW_CONTENT_H);
|
||||
};
|
||||
class UAV2nddisplay: EGVAR(bft_devices,RscPicture) {
|
||||
idc = IDC_UAV2NDDISPLAY;
|
||||
text = "#(argb,512,512,1)r2t(rendertarget9,1.0)";
|
||||
x = pxToGroup_X(DK10_WINDOW_CONTENT_R_X);
|
||||
y = pxToGroup_Y(DK10_WINDOW_CONTENT_B_Y);
|
||||
w = pxToScreen_W(DK10_WINDOW_CONTENT_R_W);
|
||||
h = pxToScreen_H(DK10_WINDOW_CONTENT_H);
|
||||
};
|
||||
};
|
||||
};
|
||||
// ---------- HELMET CAM -----------
|
||||
class HCAM: EGVAR(bft_devices,RscControlsGroup) {
|
||||
idc = IDC_GROUP_HCAM;
|
||||
x = pxToScreen_X(SCREEN_CONTENT_X);
|
||||
y = pxToScreen_Y(SCREEN_CONTENT_Y);
|
||||
w = pxToScreen_W(SCREEN_CONTENT_W);
|
||||
h = pxToScreen_H(SCREEN_CONTENT_H);
|
||||
class VScrollbar {};
|
||||
class HScrollbar {};
|
||||
class Scrollbar {};
|
||||
class controls {
|
||||
class HcamListBG: GVAR(DK10_window_back_TL) {
|
||||
IDC_COUNTER
|
||||
x = pxToGroup_X(DK10_WINDOW_BACK_L_X);
|
||||
y = pxToGroup_Y(DK10_WINDOW_BACK_T_Y);
|
||||
text = "Select Helmet Cam";
|
||||
};
|
||||
class MiniMapBG: GVAR(DK10_window_back_BL) {
|
||||
IDC_COUNTER
|
||||
x = pxToGroup_X(DK10_WINDOW_BACK_L_X);
|
||||
y = pxToGroup_Y(DK10_WINDOW_BACK_B_Y);
|
||||
text = "Unit Location";
|
||||
};
|
||||
class HcamVidBG: GVAR(DK10_window_back_TR) {
|
||||
IDC_COUNTER
|
||||
x = pxToGroup_X(DK10_WINDOW_BACK_R_X);
|
||||
y = pxToGroup_Y(DK10_WINDOW_BACK_T_Y);
|
||||
text = "Video Stream";
|
||||
};
|
||||
class HcamList: GVAR(DK10_RscListbox) {
|
||||
idc = IDC_HCAMLIST;
|
||||
x = pxToGroup_X(DK10_WINDOW_CONTENT_L_X);
|
||||
y = pxToGroup_Y(DK10_WINDOW_CONTENT_T_Y);
|
||||
w = pxToScreen_W(DK10_WINDOW_CONTENT_L_W);
|
||||
h = pxToScreen_H(DK10_WINDOW_CONTENT_H);
|
||||
onLBSelChanged = onLBSC(HCAMlist);
|
||||
};
|
||||
class HcamDisplay: EGVAR(bft_devices,RscPicture) {
|
||||
idc = IDC_HCAMDISPLAY;
|
||||
text = "#(argb,512,512,1)r2t(rendertarget12,1.0)";
|
||||
x = pxToGroup_X(DK10_WINDOW_CONTENT_R_X);
|
||||
y = pxToGroup_Y(DK10_WINDOW_CONTENT_T_Y);
|
||||
w = pxToScreen_W(DK10_WINDOW_CONTENT_R_W);
|
||||
h = pxToScreen_H(DK10_WINDOW_CONTENT_H);
|
||||
};
|
||||
};
|
||||
};
|
||||
// ---------- MESSAGING -----------
|
||||
class MESSAGE: EGVAR(bft_devices,RscControlsGroup) {
|
||||
idc = IDC_GROUP_MESSAGE;
|
||||
x = pxToScreen_X(SCREEN_CONTENT_X);
|
||||
y = pxToScreen_Y(SCREEN_CONTENT_Y);
|
||||
w = pxToScreen_W(SCREEN_CONTENT_W);
|
||||
h = pxToScreen_H(SCREEN_CONTENT_H);
|
||||
class VScrollbar {};
|
||||
class HScrollbar {};
|
||||
class Scrollbar {};
|
||||
class controls {
|
||||
class msgframe: EGVAR(bft_devices,RscFrame) {
|
||||
IDC_COUNTER
|
||||
text = "Read Message"; //--- ToDo: Localize;
|
||||
x = pxToGroup_X(DK10_MESSAGE_MESSAGETEXT_FRAME_X);
|
||||
y = pxToGroup_Y(DK10_MESSAGE_MESSAGETEXT_FRAME_Y);
|
||||
w = pxToScreen_W(DK10_MESSAGE_MESSAGETEXT_FRAME_W);
|
||||
h = pxToScreen_H(DK10_MESSAGE_MESSAGETEXT_FRAME_H);
|
||||
};
|
||||
class msgListbox: GVAR(DK10_RscListbox) {
|
||||
idc = IDC_MSG_LIST;
|
||||
style = LB_MULTI;
|
||||
x = pxToGroup_X(DK10_MESSAGE_MESSAGELIST_X);
|
||||
y = pxToGroup_Y(DK10_MESSAGE_MESSAGELIST_Y);
|
||||
w = pxToScreen_W(DK10_MESSAGE_MESSAGELIST_W);
|
||||
h = pxToScreen_H(DK10_MESSAGE_MESSAGELIST_H);
|
||||
onLBSelChanged = onLBSC(MSGlist);
|
||||
};
|
||||
class msgTxt: GVAR(DK10_RscEdit) {
|
||||
idc = IDC_MSG_CONTENT;
|
||||
htmlControl = true;
|
||||
style = ST_MULTI;
|
||||
lineSpacing = 0.2;
|
||||
text = "No Message Selected"; //--- ToDo: Localize;
|
||||
x = pxToGroup_X(DK10_MESSAGE_MESSAGETEXT_X);
|
||||
y = pxToGroup_Y(DK10_MESSAGE_MESSAGETEXT_Y);
|
||||
w = pxToScreen_W(DK10_MESSAGE_MESSAGETEXT_W);
|
||||
h = pxToScreen_H(DK10_MESSAGE_MESSAGETEXT_H);
|
||||
canModify = 0;
|
||||
};
|
||||
class composeFrame: EGVAR(bft_devices,RscFrame) {
|
||||
IDC_COUNTER
|
||||
text = "Compose Message"; //--- ToDo: Localize;
|
||||
x = pxToGroup_X(DK10_MESSAGE_COMPOSE_FRAME_X);
|
||||
y = pxToGroup_Y(DK10_MESSAGE_COMPOSE_FRAME_Y);
|
||||
w = pxToScreen_W(DK10_MESSAGE_COMPOSE_FRAME_W);
|
||||
h = pxToScreen_H(DK10_MESSAGE_COMPOSE_FRAME_H);
|
||||
};
|
||||
class playerlistbox: GVAR(DK10_RscListbox) {
|
||||
idc = IDC_MSG_RECIPIENTS;
|
||||
style = LB_MULTI;
|
||||
x = pxToGroup_X(DK10_MESSAGE_PLAYERLIST_X);
|
||||
y = pxToGroup_Y(DK10_MESSAGE_PLAYERLIST_Y);
|
||||
w = pxToScreen_W(DK10_MESSAGE_PLAYERLIST_W);
|
||||
h = pxToScreen_H(DK10_MESSAGE_PLAYERLIST_H);
|
||||
};
|
||||
class deletebtn: GVAR(DK10_RscButton) {
|
||||
idc = IDC_MSG_BTNDELETE;
|
||||
text = "Delete"; //--- ToDo: Localize;
|
||||
tooltip = "Delete Selected Message(s)";
|
||||
x = pxToGroup_X(DK10_MESSAGE_BUTTON_DELETE_X);
|
||||
y = pxToGroup_Y(DK10_MESSAGE_BUTTON_DELETE_Y);
|
||||
w = pxToScreen_W(DK10_MESSAGE_BUTTON_W);
|
||||
h = pxToScreen_H(DK10_MESSAGE_BUTTON_H);
|
||||
onMouseButtonUp = onMBU(msgDelete);
|
||||
};
|
||||
class sendbtn: GVAR(DK10_RscButton) {
|
||||
idc = IDC_MSG_BTNSEND;
|
||||
text = "Send"; //--- ToDo: Localize;
|
||||
x = pxToGroup_X(DK10_MESSAGE_BUTTON_SEND_X);
|
||||
y = pxToGroup_Y(DK10_MESSAGE_BUTTON_SEND_Y);
|
||||
w = pxToScreen_W(DK10_MESSAGE_BUTTON_W);
|
||||
h = pxToScreen_H(DK10_MESSAGE_BUTTON_H);
|
||||
onMouseButtonUp = onMBU(msgSend);
|
||||
};
|
||||
class edittxtbox: GVAR(DK10_RscEdit) {
|
||||
idc = IDC_MSG_COMPOSE;
|
||||
htmlControl = true;
|
||||
style = ST_MULTI;
|
||||
lineSpacing = 0.2;
|
||||
text = ""; //--- ToDo: Localize;
|
||||
x = pxToGroup_X(DK10_MESSAGE_COMPOSE_TEXT_X);
|
||||
y = pxToGroup_Y(DK10_MESSAGE_COMPOSE_TEXT_Y);
|
||||
w = pxToScreen_W(DK10_MESSAGE_COMPOSE_TEXT_W);
|
||||
h = pxToScreen_H(DK10_MESSAGE_COMPOSE_TEXT_H);
|
||||
};
|
||||
};
|
||||
};
|
||||
// ---------- FULLSCREEN HCAM -----------
|
||||
class HcamFull: EGVAR(bft_devices,RscPicture) {
|
||||
idc = IDC_HCAM_FULL;
|
||||
text = "#(argb,512,512,1)r2t(rendertarget13,1.0)";
|
||||
x = pxToScreen_X(SCREEN_CONTENT_X);
|
||||
y = pxToScreen_Y(SCREEN_CONTENT_Y);
|
||||
w = pxToScreen_W(SCREEN_CONTENT_W);
|
||||
h = pxToScreen_H(SCREEN_CONTENT_H);
|
||||
};
|
||||
// ---------- USER MARKER MENU ------------
|
||||
//#define cTab_IS_TABLET
|
||||
//#include "\cTab\shared\cTab_markerMenu_controls.hpp"
|
||||
//#undef cTab_IS_TABLET
|
||||
|
||||
/*
|
||||
### Overlays ###
|
||||
*/
|
||||
// ---------- NOTIFICATION ------------
|
||||
class notification: GVAR(DK10_notification) {};
|
||||
// ---------- LOADING ------------
|
||||
class loadingtxt: GVAR(DK10_loadingtxt) {};
|
||||
// ---------- BRIGHTNESS ------------
|
||||
class brightness: GVAR(DK10_brightness) {};
|
||||
// ---------- BACKGROUND ------------
|
||||
class background: GVAR(DK10_background) {};
|
||||
// ---------- MOVING HANDLEs ------------
|
||||
class movingHandle_T: GVAR(DK10_movingHandle_T) {};
|
||||
class movingHandle_B: GVAR(DK10_movingHandle_B) {};
|
||||
class movingHandle_L: GVAR(DK10_movingHandle_L) {};
|
||||
class movingHandle_R: GVAR(DK10_movingHandle_R) {};
|
||||
|
||||
/*
|
||||
### PHYSICAL BUTTONS ###
|
||||
*/
|
||||
class btnF1: GVAR(DK10_btnF1) {
|
||||
idc = IDC_BTNF1;
|
||||
onMouseButtonUp = onMBU(modeBFT);
|
||||
tooltip = "Blue Force Tracker - (F1)";
|
||||
};
|
||||
class btnF2: GVAR(DK10_btnF2) {
|
||||
idc = IDC_BTNF2;
|
||||
onMouseButtonUp = onMBU(modeUAV);
|
||||
tooltip = "UAV Intel Live Feed - (F2)";
|
||||
};
|
||||
class btnF3: GVAR(DK10_btnF3) {
|
||||
idc = IDC_BTNF3;
|
||||
onMouseButtonUp = onMBU(modeHCAM);
|
||||
tooltip = "Helmet Cam Live Feed - (F3)";
|
||||
};
|
||||
class btnF4: GVAR(DK10_btnF4) {
|
||||
idc = IDC_BTNF4;
|
||||
onMouseButtonUp = onMBU(modeMESSAGE);
|
||||
tooltip = "Text Message Application - (F4)";
|
||||
};
|
||||
class btnF5: GVAR(DK10_btnF5) {
|
||||
idc = IDC_BTNF5;
|
||||
tooltip = "Toggle Map Tools (F5)";
|
||||
onMouseButtonUp = onMBU(toggleMapTools);
|
||||
};
|
||||
class btnF6: GVAR(DK10_btnF6) {
|
||||
idc = IDC_BTNF6;
|
||||
onMouseButtonUp = onMBU(toggleMapType);
|
||||
tooltip = "Toggle Map Textures (F6)";
|
||||
};
|
||||
class btnF7: GVAR(DK10_btnTrackpad) {
|
||||
IDC_COUNTER
|
||||
onMouseButtonUp = onMBU(centerMapOnPlayerPosition);
|
||||
tooltip = "Center Map On Current Position (F7)";
|
||||
};
|
||||
class btnMain: GVAR(DK10_btnHome) {
|
||||
idc = IDC_BTNMAIN;
|
||||
onMouseButtonUp = onMBU(modeDESKTOP);
|
||||
tooltip = "Main Menu";
|
||||
};
|
||||
class btnFN: GVAR(DK10_btnFn) {
|
||||
idc = IDC_BTNFN;
|
||||
onMouseButtonUp = onMBU(toggleIconText);
|
||||
tooltip = "Toggle Text on/off";
|
||||
};
|
||||
class btnOFF: GVAR(DK10_btnPower) {
|
||||
idc = IDC_BTNOFF;
|
||||
onMouseButtonUp = onMBU(close);
|
||||
tooltip = "Close Interface";
|
||||
};
|
||||
class btnUP: GVAR(DK10_btnBrtUp) {
|
||||
idc = IDC_BTNUP;
|
||||
onMouseButtonUp = onMBU(incTextSize);
|
||||
tooltip = "Increase Font";
|
||||
};
|
||||
class btnDWN: GVAR(DK10_btnBrtDn) {
|
||||
idc = IDC_BTNDWN;
|
||||
onMouseButtonUp = onMBU(decTextSize);
|
||||
tooltip = "Decrease Font";
|
||||
};
|
||||
class btnACT: GVAR(DK10_btnMouse) {
|
||||
idc = IDC_BTNACT;
|
||||
onMouseButtonUp = onMBU(btnACT);
|
||||
tooltip = "";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#include "\z\ace\addons\bft_devices\UI\defines\shared_undefines.hpp"
|
BIN
addons/bft_device_dk10/UI/icon_bft_DK10.paa
Normal file
BIN
addons/bft_device_dk10/UI/icon_bft_DK10.paa
Normal file
Binary file not shown.
BIN
addons/bft_device_dk10/UI/images/DK10_background_ca.paa
Normal file
BIN
addons/bft_device_dk10/UI/images/DK10_background_ca.paa
Normal file
Binary file not shown.
BIN
addons/bft_device_dk10/UI/images/DK10_background_night_ca.paa
Normal file
BIN
addons/bft_device_dk10/UI/images/DK10_background_night_ca.paa
Normal file
Binary file not shown.
BIN
addons/bft_device_dk10/UI/inventory/DK10_icon.paa
Normal file
BIN
addons/bft_device_dk10/UI/inventory/DK10_icon.paa
Normal file
Binary file not shown.
0
addons/bft_device_dk10/XEH_PREP.hpp
Normal file
0
addons/bft_device_dk10/XEH_PREP.hpp
Normal file
9
addons/bft_device_dk10/XEH_clientInit.sqf
Normal file
9
addons/bft_device_dk10/XEH_clientInit.sqf
Normal file
@ -0,0 +1,9 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#include "\z\ace\addons\bft_devices\UI\defines\shared_defines.hpp"
|
||||
|
||||
// prevent execution of anything below on headless clients
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
// Initialize all uiNamespace variables
|
||||
SETUVAR(GVAR(DK10_dlg), displayNull);
|
7
addons/bft_device_dk10/XEH_preInit.sqf
Normal file
7
addons/bft_device_dk10/XEH_preInit.sqf
Normal file
@ -0,0 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
ADDON = false;
|
||||
|
||||
#include "XEH_PREP.hpp"
|
||||
|
||||
ADDON = true;
|
3
addons/bft_device_dk10/XEH_preStart.sqf
Normal file
3
addons/bft_device_dk10/XEH_preStart.sqf
Normal file
@ -0,0 +1,3 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
#include "XEH_PREP.hpp"
|
33
addons/bft_device_dk10/config.cpp
Normal file
33
addons/bft_device_dk10/config.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_bft_devices"};
|
||||
author[] = {"Gundy", "Glowbal"};
|
||||
authorUrl = "";
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgWeapons.hpp"
|
||||
#include "CfgMagazines.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
|
||||
// General UI defines and controls from our shared framework for bft devices
|
||||
#include "\z\ace\addons\bft_devices\UI\defines\shared_defines.hpp"
|
||||
#include "\z\ace\addons\bft_devices\UI\defines\shared_controls.hpp"
|
||||
|
||||
#include "ACE_BFT.hpp"
|
||||
|
||||
#include "UI\defines\DK10_defines.hpp"
|
||||
#include "UI\defines\DK10_dialog.hpp"
|
||||
|
||||
// Displays
|
||||
class RscTitles {
|
||||
titles[]={};
|
||||
// include any display defines here
|
||||
};
|
BIN
addons/bft_device_dk10/data/DK10.p3d
Normal file
BIN
addons/bft_device_dk10/data/DK10.p3d
Normal file
Binary file not shown.
93
addons/bft_device_dk10/data/DK10.rvmat
Normal file
93
addons/bft_device_dk10/data/DK10.rvmat
Normal file
@ -0,0 +1,93 @@
|
||||
ambient[]={1,1,1,1};
|
||||
diffuse[]={1,1,1,1};
|
||||
forcedDiffuse[]={0,0,0,1};
|
||||
emmisive[]={0,0,0,1};
|
||||
specular[]={0.67450982,0.67450982,0.67450982,1};
|
||||
specularPower=95;
|
||||
PixelShaderID="Super";
|
||||
VertexShaderID="Super";
|
||||
class Stage1
|
||||
{
|
||||
texture="z\ace\addons\bft_device_dk10\data\DK10_nohq.paa";
|
||||
uvSource="tex";
|
||||
class uvTransform
|
||||
{
|
||||
aside[]={1,0,0};
|
||||
up[]={0,1,0};
|
||||
dir[]={0,0,0};
|
||||
pos[]={0,0,0};
|
||||
};
|
||||
};
|
||||
class Stage2
|
||||
{
|
||||
texture="#(argb,8,8,3)color(0.5,0.5,0.5,1,DT)";
|
||||
uvSource="tex1";
|
||||
class uvTransform
|
||||
{
|
||||
aside[]={0,9,0};
|
||||
up[]={4.5,0,0};
|
||||
dir[]={0,0,0};
|
||||
pos[]={0,0,0};
|
||||
};
|
||||
};
|
||||
class Stage3
|
||||
{
|
||||
texture="#(argb,8,8,3)color(0.5,0.5,0.5,0,MC)";
|
||||
uvSource="tex1";
|
||||
class uvTransform
|
||||
{
|
||||
aside[]={1,0,0};
|
||||
up[]={0,1,0};
|
||||
dir[]={0,0,0};
|
||||
pos[]={0,0,0};
|
||||
};
|
||||
};
|
||||
class Stage4
|
||||
{
|
||||
texture="#(argb,8,8,3)color(1,1,1,1,AS)";
|
||||
uvSource="tex";
|
||||
class uvTransform
|
||||
{
|
||||
aside[]={1,0,0};
|
||||
up[]={0,1,0};
|
||||
dir[]={0,0,0};
|
||||
pos[]={0,0,0};
|
||||
};
|
||||
};
|
||||
class Stage5
|
||||
{
|
||||
texture="z\ace\addons\bft_device_dk10\data\DK10_smdi.paa";
|
||||
uvSource="tex";
|
||||
class uvTransform
|
||||
{
|
||||
aside[]={1,0,0};
|
||||
up[]={0,1,0};
|
||||
dir[]={0,0,0};
|
||||
pos[]={0,0,0};
|
||||
};
|
||||
};
|
||||
class Stage6
|
||||
{
|
||||
texture="#(ai,64,64,1)fresnel(10.4,8.3)";
|
||||
uvSource="tex";
|
||||
class uvTransform
|
||||
{
|
||||
aside[]={1,0,0};
|
||||
up[]={0,1,0};
|
||||
dir[]={0,0,1};
|
||||
pos[]={0,0,0};
|
||||
};
|
||||
};
|
||||
class Stage7
|
||||
{
|
||||
texture="a3\data\env_land_co.paa";
|
||||
uvSource="none";
|
||||
// uvSource="tex";
|
||||
// class uvTransform
|
||||
// {
|
||||
// aside[]={1,0,0};
|
||||
// up[]={0,1,0};
|
||||
// dir[]={0,0,0};
|
||||
// pos[]={0,0,0};
|
||||
// };
|
||||
};
|
BIN
addons/bft_device_dk10/data/DK10_ca.paa
Normal file
BIN
addons/bft_device_dk10/data/DK10_ca.paa
Normal file
Binary file not shown.
BIN
addons/bft_device_dk10/data/DK10_nohq.paa
Normal file
BIN
addons/bft_device_dk10/data/DK10_nohq.paa
Normal file
Binary file not shown.
BIN
addons/bft_device_dk10/data/DK10_smdi.paa
Normal file
BIN
addons/bft_device_dk10/data/DK10_smdi.paa
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user