Merge branch 'master' of git@github.com:KoffeinFlummi/ACE3.git

This commit is contained in:
Nicolás Badano 2015-01-15 23:38:02 -03:00
commit b60dc8999d
27 changed files with 304 additions and 385 deletions

View File

@ -1,73 +0,0 @@
class CfgPatches {
class AGM_Reload {
units[] = {};
weapons[] = {};
requiredVersion = 0.60;
requiredAddons[] = {AGM_Core};
version = "0.95";
versionStr = "0.95";
versionAr[] = {0,95,0};
author[] = {"commy2", "KoffeinFlummi"};
authorUrl = "https://github.com/commy2/";
};
};
class CfgFunctions {
class AGM_Reload {
class AGM_Reload {
file = "\AGM_Reload\functions";
class checkAmmo;
};
};
};
class Extended_Take_EventHandlers {
class CAManBase {
class AGM_AmmoIndicatorReload {
clientTake = "if (_this select 0 == AGM_player && {(_this select 1) in [uniformContainer (_this select 0), vestContainer (_this select 0), backpackContainer (_this select 0)]} && {_this select 2 == currentMagazine (_this select 0)}) then {[_this select 0, vehicle (_this select 0), true] call AGM_Reload_fnc_checkAmmo};";
};
};
};
class AGM_Core_Default_Keys {
class checkAmmo {
displayName = "$STR_AGM_Reload_checkAmmo";
condition = "[_player] call AGM_Core_fnc_canUseWeapon || {_vehicle isKindOf 'StaticWeapon'}";
statement = "[_player, _vehicle, false] call AGM_Reload_fnc_checkAmmo";
key = 19;
shift = 0;
control = 1;
alt = 0;
};
};
class CfgActions {
class LoadMagazine;
class LoadEmptyMagazine : LoadMagazine {
showWindow = 0;
textDefault = "";
};
};
class RscControlsGroup;
class RscText;
class RscInGameUI {
class RscUnitInfo {
// Soldier only
class WeaponInfoControlsGroupLeft: RscControlsGroup {
class controls {
class CA_AmmoCount: RscText {
sizeEx = 0;
};
};
};
// Vehicles only
/*class WeaponInfoControlsGroupRight: RscControlsGroup {
class controls {
class CA_AmmoCount: RscText {
sizeEx = 0;
};
};
};*/
};
};

View File

@ -0,0 +1 @@
z\ace\addons\reload

View File

@ -0,0 +1,8 @@
class CfgActions {
class LoadMagazine;
class LoadEmptyMagazine : LoadMagazine {
showWindow = 0;
textDefault = "";
};
};

View File

@ -0,0 +1,14 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
class Extended_Take_EventHandlers {
class CAManBase {
class ACE_AmmoIndicatorReload {
clientTake = QUOTE(if (_this select 0 == ACE_player && {(_this select 1) in [ARR_3(uniformContainer (_this select 0), vestContainer (_this select 0), backpackContainer (_this select 0))]} && {_this select 2 == currentMagazine (_this select 0)}) then {[ARR_3(_this select 0, vehicle (_this select 0), true)] call FUNC(checkAmmo)};);
};
};
};

View File

@ -0,0 +1,24 @@
class RscControlsGroup;
class RscText;
class RscInGameUI {
class RscUnitInfo {
// Soldiers
class WeaponInfoControlsGroupLeft: RscControlsGroup {
class controls {
class CA_AmmoCount: RscText {
sizeEx = 0;
};
};
};
// Vehicles
/*class WeaponInfoControlsGroupRight: RscControlsGroup {
class controls {
class CA_AmmoCount: RscText {
sizeEx = 0;
};
};
};*/
};
};

View File

@ -0,0 +1,3 @@
#include "script_component.hpp"
PREP(checkAmmo);

30
addons/reload/config.cpp Normal file
View File

@ -0,0 +1,30 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"};
author[] = {"commy2","KoffeinFlummi"};
authorUrl = "https://github.com/commy2/";
VERSION_CONFIG;
};
};
#include "CfgEventHandlers.hpp"
#include "CfgActions.hpp"
class ACE_Default_Keys {
class checkAmmo {
displayName = "$STR_ACE_Reload_checkAmmo";
condition = QUOTE([_player] call EFUNC(common,canUseWeapon) || {_vehicle isKindOf 'StaticWeapon'});
statement = QUOTE([ARR_3(_player, _vehicle, false)] call FUNC(checkAmmo););
key = 19;
shift = 0;
control = 1;
alt = 0;
};
};
#include "RscInGameUI.hpp"

View File

@ -11,10 +11,10 @@
* Return value:
* Nothing
*/
#include "script_component.hpp"
#define COUNT_BARS 12
private ["_unit", "_vehicle"];
_unit = _this select 0;
@ -82,7 +82,7 @@ if (_unit != _vehicle && !(_vehicle isKindOf "StaticWeapon")) then {
for "_a" from 1 to _count do {
_string = _string + "|";
};
_text = [_string, _color] call AGM_Core_fnc_stringToColoredText;
_text = [_string, _color] call EFUNC(common,stringToColoredText);
_string = "";
for "_a" from (_count + 1) to (_maxRounds min COUNT_BARS) do {
@ -91,11 +91,11 @@ if (_unit != _vehicle && !(_vehicle isKindOf "StaticWeapon")) then {
composeText [
_text,
[_string, [0.5, 0.5, 0.5]] call AGM_Core_fnc_stringToColoredText
[_string, [0.5, 0.5, 0.5]] call EFUNC(common,stringToColoredText)
]
};
_picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture");
[_text, _picture] call AGM_Core_fnc_displayTextPicture;
[_text, _picture] call EFUNC(common,displayTextPicture);
};

View File

@ -0,0 +1 @@
#include "\z\ace\addons\reload\script_component.hpp"

View File

@ -0,0 +1,12 @@
#define COMPONENT reload
#include "\z\ace\addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_RELOAD
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_ENABLED_RELOAD
#define DEBUG_SETTINGS DEBUG_ENABLED_RELOAD
#endif
#include "\z\ace\addons\main\script_macros.hpp"

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2014-09-09 -->
<Project name="AGM">
<Project name="ACE">
<Package name="Reload">
<Key ID="STR_AGM_Reload_checkAmmo">
<Key ID="STR_ACE_Reload_checkAmmo">
<English>Check Ammo</English>
<German>Munition prüfen</German>
<Spanish>Verificar munición</Spanish>
@ -14,7 +14,7 @@
<Portuguese>Conferir munições</Portuguese>
<Russian>Kонтроль Боеприпасы</Russian>
</Key>
<Key ID="STR_AGM_Reload_Ammo">
<Key ID="STR_ACE_Reload_Ammo">
<English>Ammo</English>
<German>Munition</German>
<Spanish>Munición</Spanish>

View File

@ -11,24 +11,25 @@ PREP(tabDistanceKey);
PREP(clearDisplay);
PREP(convertToTexturesDegree);
PREP(convertToTexturesDistance);
PREP(showCenter);
PREP(showP1);
PREP(onKeyDown);
PREP(onKeyHold);
PREP(onKeyUp);
PREP(getDirection);
PREP(getDistance);
PREP(getHeightDistance);
PREP(getRelativeAzimuthDistance);
PREP(onKeyDown);
PREP(onKeyHold);
PREP(onKeyUp);
PREP(getRelativeDistance);
PREP(showAzimuth);
PREP(showAzimuthInclination);
PREP(showHeightDistance);
PREP(showDistance);
PREP(showRelativeAzimuthDistance);
PREP(showCenter);
PREP(showP1);
PREP(showRelativeDistance);
GVAR(holdKeyHandler) = -1;
GVAR(isKeyDownAzimuth) = false;

View File

@ -10,7 +10,7 @@ _azimuth = _direction select 0;
_inclination = _direction select 1;
if (_distance < -999) exitWith {
[-1000,-1000] // return
[-1000, -1000] // return
};
[sin _inclination * _distance, cos _inclination * _distance]

View File

@ -1,53 +1,32 @@
// by commy2
#include "script_component.hpp"
_distanceP1 = call AGM_Vector_fnc_getDistance;
_directionP1 = call AGM_Vector_fnc_getDirection;
private ["_distanceP1", "_directionP1", "_azimuthP1", "_inclinationP1", "_distanceP2", "_directionP2", "_azimuthP2", "_inclinationP2"];
_distanceP1 = GVAR(pData) select 0;
_directionP1 = GVAR(pData) select 1;
_azimuthP1 = _directionP1 select 0;
_inclinationP1 = _directionP1 select 1;
_ctrlDigitE1 ctrlSetText "\AGM_Vector\rsc\d1.paa";
_ctrlDigitE2 ctrlSetText "\AGM_Vector\rsc\d-.paa";
_ctrlDigitE3 ctrlSetText "\AGM_Vector\rsc\dP.paa";
waitUntil {!(AGM_vectorKey select 0)};
_distanceP2 = call AGM_Vector_fnc_getDistance;
_directionP2 = call AGM_Vector_fnc_getDirection;
_distanceP2 = call FUNC(getDistance);
_directionP2 = call FUNC(getDirection);
_azimuthP2 = _directionP2 select 0;
_inclinationP2 = _directionP2 select 1;
_relDirection = sqrt ((_azimuthP1 - _azimuthP2)^2 + (_inclinationP1 - _inclinationP2)^2);
_relDistance = sqrt (_distanceP1^2 + _distanceP2^2 - 2 * _distanceP1 * _distanceP2 * cos _relDirection);
private ["_relDirection", "_relDistance", "_relHeight", "_relLength", "_lenghtP1", "_lenghtP2", "_relAzimuth"];
_relDirection = sqrt ((_azimuthP1 - _azimuthP2) ^ 2 + (_inclinationP1 - _inclinationP2) ^ 2);
_relDistance = sqrt (_distanceP1 ^ 2 + _distanceP2 ^ 2 - 2 * _distanceP1 * _distanceP2 * cos _relDirection);
_relHeight = (sin _inclinationP1 * _distanceP1) - (sin _inclinationP2 * _distanceP2);
_relLenght = sqrt (_relDistance^2 - _relHeight^2); if (str(_relLenght) == "-1.#IND") then {_relLenght = 0};
_relLength = sqrt (_relDistance ^ 2 - _relHeight ^ 2); if (str(_relLength) == "-1.#IND") then {_relLength = 0};
_lenghtP1 = cos _inclinationP1 * _distanceP1;
_lenghtP2 = cos _inclinationP2 * _distanceP2;
_relAzimuth = (sin _azimuthP2 * _lenghtP2 - sin _azimuthP1 * _lenghtP1) atan2 (cos _azimuthP2 * _lenghtP2 - cos _azimuthP1 * _lenghtP1);
if (_relAzimuth < 0) then {_relAzimuth = _relAzimuth + 360};
if (_distanceP1 == -9999 || {_distanceP2 == -9999}) then {
_relDistance = -9999;
_relAzimuth = -9999;
if (_distanceP1 < -999 || {_distanceP2 < -999}) exitWith {
[-1000, -1000] // return
};
_digits = _relLenght call AGM_Vector_fnc_convertDistance;
_ctrlDigit1 ctrlSetText (_digits select 0);
_ctrlDigit2 ctrlSetText (_digits select 1);
_ctrlDigit3 ctrlSetText (_digits select 2);
_ctrlDigit4 ctrlSetText (_digits select 3);
_digits = _relAzimuth call AGM_Vector_fnc_convertDegree;
_ctrlDigit5 ctrlSetText (_digits select 0);
_ctrlDigit6 ctrlSetText (_digits select 1);
_ctrlDigit7 ctrlSetText (_digits select 2);
_ctrlDigit8 ctrlSetText (_digits select 3);
_ctrlVectorCenter ctrlShow false;
_ctrlDigitE1 ctrlShow false;
_ctrlDigitE2 ctrlShow false;
_ctrlDigitE3 ctrlShow false;
AGM_isVectorReady = true;
[_relAzimuth, _relLength]

View File

@ -0,0 +1,25 @@
// by commy2
#include "script_component.hpp"
private ["_distanceP1", "_directionP1", "_azimuthP1", "_inclinationP1", "_distanceP2", "_directionP2", "_azimuthP2", "_inclinationP2"];
_distanceP1 = GVAR(pData) select 0;
_directionP1 = GVAR(pData) select 1;
_azimuthP1 = _directionP1 select 0;
_inclinationP1 = _directionP1 select 1;
_distanceP2 = call FUNC(getDistance);
_directionP2 = call FUNC(getDirection);
_azimuthP2 = _directionP2 select 0;
_inclinationP2 = _directionP2 select 1;
private ["_relDirection", "_relDistance"];
_relDirection = sqrt ((_azimuthP1 - _azimuthP2) ^ 2 + (_inclinationP1 - _inclinationP2) ^ 2);
_relDistance = sqrt (_distanceP1 ^ 2 + _distanceP2 ^ 2 - 2 * _distanceP1 * _distanceP2 * cos _relDirection);
if (_distanceP1 < -999 || {_distanceP2 < -999}) exitWith {
-1000 // return
};
_relDistance

View File

@ -1,72 +0,0 @@
// by commy2
#include "script_component.hpp"
private["_dlgVector", "_ctrlVectorCenter", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8", "_ctrlDigitE1", "_ctrlDigitE2", "_ctrlDigitE3", "_distanceP1", "_directionP1", "_azimuthP1", "_inclinationP1", "_directionP2", "_azimuthP2", "_distanceP2", "_inclinationP2", "_digits", "_relDirection", "_relDistance", "_relHeight", "_relLenght", "_digits0", "_digits1", "_digits2", "_lenghtP1", "_lenghtP2", "_relAzimuth"];
disableSerialization;
_dlgVector = uiNamespace getVariable "AGM_dlgVector";
_ctrlVectorCenter = _dlgVector displayCtrl 1;
_ctrlDigit1 = _dlgVector displayCtrl 11;
_ctrlDigit2 = _dlgVector displayCtrl 12;
_ctrlDigit3 = _dlgVector displayCtrl 13;
_ctrlDigit4 = _dlgVector displayCtrl 14;
_ctrlDigit5 = _dlgVector displayCtrl 15;
_ctrlDigit6 = _dlgVector displayCtrl 16;
_ctrlDigit7 = _dlgVector displayCtrl 17;
_ctrlDigit8 = _dlgVector displayCtrl 18;
_ctrlDigitE1 = _dlgVector displayCtrl 21;
_ctrlDigitE2 = _dlgVector displayCtrl 22;
_ctrlDigitE3 = _dlgVector displayCtrl 23;
_ctrlVectorCenter ctrlSetText "\AGM_Vector\rsc\Vector_Center.paa";
_distanceP1 = call AGM_Vector_fnc_getDistance;
_directionP1 = call AGM_Vector_fnc_getDirection;
_azimuthP1 = _directionP1 select 0;
_inclinationP1 = _directionP1 select 1;
_ctrlDigitE1 ctrlSetText "\AGM_Vector\rsc\d1.paa";
_ctrlDigitE2 ctrlSetText "\AGM_Vector\rsc\d-.paa";
_ctrlDigitE3 ctrlSetText "\AGM_Vector\rsc\dP.paa";
waitUntil {!(AGM_vectorKey select 0)};
_distanceP2 = call AGM_Vector_fnc_getDistance;
_directionP2 = call AGM_Vector_fnc_getDirection;
_azimuthP2 = _directionP2 select 0;
_inclinationP2 = _directionP2 select 1;
_relDirection = sqrt ((_azimuthP1 - _azimuthP2)^2 + (_inclinationP1 - _inclinationP2)^2);
_relDistance = sqrt (_distanceP1^2 + _distanceP2^2 - 2 * _distanceP1 * _distanceP2 * cos _relDirection);
_relHeight = (sin _inclinationP1 * _distanceP1) - (sin _inclinationP2 * _distanceP2);
_relLenght = sqrt (_relDistance^2 - _relHeight^2); if (str(_relLenght) == "-1.#IND") then {_relLenght = 0};
_lenghtP1 = cos _inclinationP1 * _distanceP1;
_lenghtP2 = cos _inclinationP2 * _distanceP2;
_relAzimuth = (sin _azimuthP2 * _lenghtP2 - sin _azimuthP1 * _lenghtP1) atan2 (cos _azimuthP2 * _lenghtP2 - cos _azimuthP1 * _lenghtP1);
if (_relAzimuth < 0) then {_relAzimuth = _relAzimuth + 360};
if (_distanceP1 == -9999 || {_distanceP2 == -9999}) then {
_relDistance = -9999;
_relAzimuth = -9999;
};
_digits = _relLenght call AGM_Vector_fnc_convertDistance;
_ctrlDigit1 ctrlSetText (_digits select 0);
_ctrlDigit2 ctrlSetText (_digits select 1);
_ctrlDigit3 ctrlSetText (_digits select 2);
_ctrlDigit4 ctrlSetText (_digits select 3);
_digits = _relAzimuth call AGM_Vector_fnc_convertDegree;
_ctrlDigit5 ctrlSetText (_digits select 0);
_ctrlDigit6 ctrlSetText (_digits select 1);
_ctrlDigit7 ctrlSetText (_digits select 2);
_ctrlDigit8 ctrlSetText (_digits select 3);
_ctrlVectorCenter ctrlShow false;
_ctrlDigitE1 ctrlShow false;
_ctrlDigitE2 ctrlShow false;
_ctrlDigitE3 ctrlShow false;
AGM_isVectorReady = true;

View File

@ -1,58 +0,0 @@
// by commy2
#include "script_component.hpp"
private["_dlgVector", "_ctrlVectorCenter", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8", "_ctrlDigitE1", "_ctrlDigitE2", "_ctrlDigitE3", "_distanceP1", "_directionP1", "_azimuthP1", "_inclinationP1", "_directionP2", "_azimuthP2", "_distanceP2", "_inclinationP2", "_relDirection", "_relDistance", "_distance", "_digits"];
disableSerialization;
_dlgVector = uiNamespace getVariable "AGM_dlgVector";
_ctrlVectorCenter = _dlgVector displayCtrl 1;
_ctrlDigit1 = _dlgVector displayCtrl 11;
_ctrlDigit2 = _dlgVector displayCtrl 12;
_ctrlDigit3 = _dlgVector displayCtrl 13;
_ctrlDigit4 = _dlgVector displayCtrl 14;
_ctrlDigit5 = _dlgVector displayCtrl 15;
_ctrlDigit6 = _dlgVector displayCtrl 16;
_ctrlDigit7 = _dlgVector displayCtrl 17;
_ctrlDigit8 = _dlgVector displayCtrl 18;
_ctrlDigitE1 = _dlgVector displayCtrl 21;
_ctrlDigitE2 = _dlgVector displayCtrl 22;
_ctrlDigitE3 = _dlgVector displayCtrl 23;
_ctrlVectorCenter ctrlSetText "\AGM_Vector\rsc\Vector_Center.paa";
_distanceP1 = call AGM_Vector_fnc_getDistance;
_directionP1 = call AGM_Vector_fnc_getDirection;
_azimuthP1 = _directionP1 select 0;
_inclinationP1 = _directionP1 select 1;
_ctrlDigitE1 ctrlSetText "\AGM_Vector\rsc\d1.paa";
_ctrlDigitE2 ctrlSetText "\AGM_Vector\rsc\d-.paa";
_ctrlDigitE3 ctrlSetText "\AGM_Vector\rsc\dP.paa";
waitUntil {!(AGM_vectorKey select 1)};
_distanceP2 = call AGM_Vector_fnc_getDistance;
_directionP2 = call AGM_Vector_fnc_getDirection;
_azimuthP2 = _directionP2 select 0;
_inclinationP2 = _directionP2 select 1;
_relDirection = sqrt ((_azimuthP1 - _azimuthP2)^2 + (_inclinationP1 - _inclinationP2)^2);
_relDistance = sqrt (_distanceP1^2 + _distanceP2^2 - 2 * _distanceP1 * _distanceP2 * cos _relDirection);
if (_distanceP1 == -9999 || {_distanceP2 == -9999}) then {
_relDistance = -9999;
};
_digits = _relDistance call AGM_Vector_fnc_convertDistance;
_ctrlDigit1 ctrlSetText (_digits select 0);
_ctrlDigit2 ctrlSetText (_digits select 1);
_ctrlDigit3 ctrlSetText (_digits select 2);
_ctrlDigit4 ctrlSetText (_digits select 3);
_ctrlVectorCenter ctrlShow false;
_ctrlDigitE1 ctrlShow false;
_ctrlDigitE2 ctrlShow false;
_ctrlDigitE3 ctrlShow false;
AGM_isVectorReady = true;

View File

@ -14,15 +14,19 @@ _fnc_setPFH = {
GVAR(holdKeyHandler) = -1;
};
GVAR(currentMode) = _this;//
GVAR(holdKeyHandler) = [FUNC(onKeyHold), 0, _this] call CBA_fnc_addPerFrameHandler;
};
switch (_this select 0) do {
case ("azimuth"): {
if (GETGVAR(isKeyDownDistance,false) && {GETGVAR(currentMode,"") in ["relative_distance"]}) exitWith {};
["azimuth"] call FUNC(clearDisplay);
GVAR(isKeyDownAzimuth) = true;
[false] call FUNC(showP1);
if (diag_tickTime < GVAR(keyDownTimeAzimuth) + 0.5) exitWith {
"azimuth+inclination" call _fnc_setPFH;
@ -31,12 +35,10 @@ switch (_this select 0) do {
GVAR(keyDownTimeAzimuth) = diag_tickTime;
if (diag_tickTime > GVAR(keyDownTimeDistance) + 0.5) then {
if (GETGVAR(isKeyDownDistance,false)) exitWith {
hint "P1 relative distance mode";
if !(GETGVAR(isKeyDownDistance,false)) then {
["distance"] call FUNC(clearDisplay);
"azimuth" call _fnc_setPFH;
};
["distance"] call FUNC(clearDisplay);
"azimuth" call _fnc_setPFH;
} else {
"azimuth+distance" call _fnc_setPFH;
};
@ -45,9 +47,12 @@ switch (_this select 0) do {
case ("distance"): {
if (GETGVAR(isKeyDownAzimuth,false) && {GETGVAR(currentMode,"") in ["relative_azimuth+distance"]}) exitWith {};
["distance"] call FUNC(clearDisplay);
GVAR(isKeyDownDistance) = true;
[false] call FUNC(showP1);
if (diag_tickTime < GVAR(keyDownTimeDistance) + 0.5) exitWith {
"height+distance" call _fnc_setPFH;
@ -56,12 +61,10 @@ switch (_this select 0) do {
GVAR(keyDownTimeDistance) = diag_tickTime;
if (diag_tickTime > GVAR(keyDownTimeAzimuth) + 0.5) then {
if (GETGVAR(isKeyDownAzimuth,false)) exitWith {
hint "P1 relative azimuth + non-slope distance mode";
if !(GETGVAR(isKeyDownAzimuth,false)) then {
["azimuth"] call FUNC(clearDisplay);
"distance" call _fnc_setPFH;
};
["azimuth"] call FUNC(clearDisplay);
"distance" call _fnc_setPFH;
} else {
"azimuth+distance" call _fnc_setPFH;
};

View File

@ -56,8 +56,10 @@ switch (_this select 0) do {
[_isReady] call FUNC(showCenter);
if (!GVAR(isKeyDownAzimuth) && {!GVAR(isKeyDownDistance)}) then {
call FUNC(showDistance);
[false] call FUNC(showCenter);
if (_isReady) then {
call FUNC(showDistance);
[false] call FUNC(showCenter);
};
[_this select 1] call CBA_fnc_removePerFrameHandler;
@ -106,6 +108,52 @@ switch (_this select 0) do {
};
case ("relative_distance"): {
private "_isReady";
_isReady = diag_tickTime > GVAR(keyDownTimeAzimuth) + 0.5;
[_isReady] call FUNC(showCenter);
if (!GVAR(isKeyDownAzimuth) && {!GVAR(isKeyDownDistance)}) then {
if (_isReady) then {
call FUNC(showRelativeDistance);
};
[false] call FUNC(showCenter);
[false] call FUNC(showP1);
[_this select 1] call CBA_fnc_removePerFrameHandler;
if (GVAR(holdKeyHandler) > -1) then {
GVAR(holdKeyHandler) = -1;
};
};
};
case ("relative_azimuth+distance"): {
private "_isReady";
_isReady = diag_tickTime > GVAR(keyDownTimeDistance) + 0.5;
[_isReady] call FUNC(showCenter);
if (!GVAR(isKeyDownAzimuth) && {!GVAR(isKeyDownDistance)}) then {
if (_isReady) then {
call FUNC(showRelativeAzimuthDistance);
};
[false] call FUNC(showCenter);
[false] call FUNC(showP1);
[_this select 1] call CBA_fnc_removePerFrameHandler;
if (GVAR(holdKeyHandler) > -1) then {
GVAR(holdKeyHandler) = -1;
};
};
};
};
systemChat str (_this select 0);//

View File

@ -7,16 +7,45 @@ Handles releasing the special vector keys.
*/
#include "script_component.hpp"
private "_fnc_setPFH";
_fnc_setPFH = {
if (GVAR(holdKeyHandler) > -1) then {
[GVAR(holdKeyHandler)] call CBA_fnc_removePerFrameHandler;
GVAR(holdKeyHandler) = -1;
};
GVAR(currentMode) = _this;//
GVAR(holdKeyHandler) = [FUNC(onKeyHold), 0, _this] call CBA_fnc_addPerFrameHandler;
};
switch (_this select 0) do {
case ("azimuth"): {
GVAR(isKeyDownAzimuth) = false;
if (GVAR(isKeyDownDistance)) then {
if (GVAR(currentMode) == "distance") then {
["azimuth"] call FUNC(clearDisplay);
[true] call FUNC(showP1);
GVAR(pData) = [call FUNC(getDistance), call FUNC(getDirection)];
"relative_distance" call _fnc_setPFH;
};
};
};
case ("distance"): {
GVAR(isKeyDownDistance) = false;
if (GVAR(isKeyDownAzimuth)) then {
if (GVAR(currentMode) == "azimuth") then {
["distance"] call FUNC(clearDisplay);
[true] call FUNC(showP1);
GVAR(pData) = [call FUNC(getDistance), call FUNC(getDirection)];
"relative_azimuth+distance" call _fnc_setPFH;
};
};
};
};

View File

@ -1,23 +1,18 @@
// by commy2
#include "script_component.hpp"
private ["_dlgVector", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8"];
private "_dlgVector";
disableSerialization;
_dlgVector = GETUVAR(ACE_dlgVector,displayNull);
_ctrlDigit5 = _dlgVector displayCtrl 1315;
_ctrlDigit6 = _dlgVector displayCtrl 1316;
_ctrlDigit7 = _dlgVector displayCtrl 1317;
_ctrlDigit8 = _dlgVector displayCtrl 1318;
private ["_direction", "_digits"];
_direction = call FUNC(getDirection);
_digits = _direction call FUNC(convertToTexturesDegree);
_ctrlDigit5 ctrlSetText (_digits select 0);
_ctrlDigit6 ctrlSetText (_digits select 1);
_ctrlDigit7 ctrlSetText (_digits select 2);
_ctrlDigit8 ctrlSetText (_digits select 3);
(_dlgVector displayCtrl 1315) ctrlSetText (_digits select 0);
(_dlgVector displayCtrl 1316) ctrlSetText (_digits select 1);
(_dlgVector displayCtrl 1317) ctrlSetText (_digits select 2);
(_dlgVector displayCtrl 1318) ctrlSetText (_digits select 3);

View File

@ -1,20 +1,11 @@
// by commy2
#include "script_component.hpp"
private ["_dlgVector", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8"];
private "_dlgVector";
disableSerialization;
_dlgVector = GETUVAR(ACE_dlgVector,displayNull);
_ctrlDigit1 = _dlgVector displayCtrl 1311;
_ctrlDigit2 = _dlgVector displayCtrl 1312;
_ctrlDigit3 = _dlgVector displayCtrl 1313;
_ctrlDigit4 = _dlgVector displayCtrl 1314;
_ctrlDigit5 = _dlgVector displayCtrl 1315;
_ctrlDigit6 = _dlgVector displayCtrl 1316;
_ctrlDigit7 = _dlgVector displayCtrl 1317;
_ctrlDigit8 = _dlgVector displayCtrl 1318;
private ["_direction", "_digits"];
_direction = call FUNC(getDirection);
@ -22,15 +13,15 @@ _direction = call FUNC(getDirection);
// azimuth
_digits = [_direction select 0] call FUNC(convertToTexturesDegree);
_ctrlDigit5 ctrlSetText (_digits select 0);
_ctrlDigit6 ctrlSetText (_digits select 1);
_ctrlDigit7 ctrlSetText (_digits select 2);
_ctrlDigit8 ctrlSetText (_digits select 3);
(_dlgVector displayCtrl 1315) ctrlSetText (_digits select 0);
(_dlgVector displayCtrl 1316) ctrlSetText (_digits select 1);
(_dlgVector displayCtrl 1317) ctrlSetText (_digits select 2);
(_dlgVector displayCtrl 1318) ctrlSetText (_digits select 3);
// inclination
_digits = [_direction select 1] call FUNC(convertToTexturesDegree);
_ctrlDigit1 ctrlSetText (_digits select 0);
_ctrlDigit2 ctrlSetText (_digits select 1);
_ctrlDigit3 ctrlSetText (_digits select 2);
_ctrlDigit4 ctrlSetText (_digits select 3);
(_dlgVector displayCtrl 1311) ctrlSetText (_digits select 0);
(_dlgVector displayCtrl 1312) ctrlSetText (_digits select 1);
(_dlgVector displayCtrl 1313) ctrlSetText (_digits select 2);
(_dlgVector displayCtrl 1314) ctrlSetText (_digits select 3);

View File

@ -1,23 +1,18 @@
// by commy2
#include "script_component.hpp"
private ["_dlgVector", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4"];
private "_dlgVector";
disableSerialization;
_dlgVector = GETUVAR(ACE_dlgVector,displayNull);
_ctrlDigit1 = _dlgVector displayCtrl 1311;
_ctrlDigit2 = _dlgVector displayCtrl 1312;
_ctrlDigit3 = _dlgVector displayCtrl 1313;
_ctrlDigit4 = _dlgVector displayCtrl 1314;
private ["_distance", "_digits"];
_distance = call FUNC(getDistance);
_digits = [_distance] call FUNC(convertToTexturesDistance);
_ctrlDigit1 ctrlSetText (_digits select 0);
_ctrlDigit2 ctrlSetText (_digits select 1);
_ctrlDigit3 ctrlSetText (_digits select 2);
_ctrlDigit4 ctrlSetText (_digits select 3);
(_dlgVector displayCtrl 1311) ctrlSetText (_digits select 0);
(_dlgVector displayCtrl 1312) ctrlSetText (_digits select 1);
(_dlgVector displayCtrl 1313) ctrlSetText (_digits select 2);
(_dlgVector displayCtrl 1314) ctrlSetText (_digits select 3);

View File

@ -1,20 +1,11 @@
// by commy2
#include "script_component.hpp"
private ["_dlgVector", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8"];
private "_dlgVector";
disableSerialization;
_dlgVector = GETUVAR(ACE_dlgVector,displayNull);
_ctrlDigit1 = _dlgVector displayCtrl 1311;
_ctrlDigit2 = _dlgVector displayCtrl 1312;
_ctrlDigit3 = _dlgVector displayCtrl 1313;
_ctrlDigit4 = _dlgVector displayCtrl 1314;
_ctrlDigit5 = _dlgVector displayCtrl 1315;
_ctrlDigit6 = _dlgVector displayCtrl 1316;
_ctrlDigit7 = _dlgVector displayCtrl 1317;
_ctrlDigit8 = _dlgVector displayCtrl 1318;
private ["_heightDistance", "_digits"];
_heightDistance = call FUNC(getHeightDistance);
@ -22,15 +13,15 @@ _heightDistance = call FUNC(getHeightDistance);
// height
_digits = [_heightDistance select 0] call FUNC(convertToTexturesDistance);
_ctrlDigit1 ctrlSetText (_digits select 0);
_ctrlDigit2 ctrlSetText (_digits select 1);
_ctrlDigit3 ctrlSetText (_digits select 2);
_ctrlDigit4 ctrlSetText (_digits select 3);
(_dlgVector displayCtrl 1311) ctrlSetText (_digits select 0);
(_dlgVector displayCtrl 1312) ctrlSetText (_digits select 1);
(_dlgVector displayCtrl 1313) ctrlSetText (_digits select 2);
(_dlgVector displayCtrl 1314) ctrlSetText (_digits select 3);
// non-slope distance
_digits = [_heightDistance select 1] call FUNC(convertToTexturesDistance);
_ctrlDigit5 ctrlSetText (_digits select 0);
_ctrlDigit6 ctrlSetText (_digits select 1);
_ctrlDigit7 ctrlSetText (_digits select 2);
_ctrlDigit8 ctrlSetText (_digits select 3);
(_dlgVector displayCtrl 1315) ctrlSetText (_digits select 0);
(_dlgVector displayCtrl 1316) ctrlSetText (_digits select 1);
(_dlgVector displayCtrl 1317) ctrlSetText (_digits select 2);
(_dlgVector displayCtrl 1318) ctrlSetText (_digits select 3);

View File

@ -2,7 +2,7 @@
by commy2
Shows or hides the vectors center square thingy.
Shows or hides the 1-P text line.
*/
#include "script_component.hpp"

View File

@ -1,74 +1,27 @@
// by commy2
#include "script_component.hpp"
private["_dlgVector", "_ctrlVectorCenter", "_ctrlDigit1", "_ctrlDigit2", "_ctrlDigit3", "_ctrlDigit4", "_ctrlDigit5", "_ctrlDigit6", "_ctrlDigit7", "_ctrlDigit8", "_ctrlDigitE1", "_ctrlDigitE2", "_ctrlDigitE3", "_distanceP1", "_directionP1", "_azimuthP1", "_inclinationP1", "_directionP2", "_azimuthP2", "_distanceP2", "_inclinationP2", "_digits", "_relDirection", "_relDistance", "_relHeight", "_relLenght", "_digits0", "_digits1", "_digits2", "_lenghtP1", "_lenghtP2", "_relAzimuth"];
private "_dlgVector";
disableSerialization;
_dlgVector = uiNamespace getVariable "AGM_dlgVector";
_ctrlVectorCenter = _dlgVector displayCtrl 1;
_ctrlDigit1 = _dlgVector displayCtrl 11;
_ctrlDigit2 = _dlgVector displayCtrl 12;
_ctrlDigit3 = _dlgVector displayCtrl 13;
_ctrlDigit4 = _dlgVector displayCtrl 14;
_ctrlDigit5 = _dlgVector displayCtrl 15;
_ctrlDigit6 = _dlgVector displayCtrl 16;
_ctrlDigit7 = _dlgVector displayCtrl 17;
_ctrlDigit8 = _dlgVector displayCtrl 18;
_ctrlDigitE1 = _dlgVector displayCtrl 21;
_ctrlDigitE2 = _dlgVector displayCtrl 22;
_ctrlDigitE3 = _dlgVector displayCtrl 23;
_dlgVector = GETUVAR(ACE_dlgVector,displayNull);
_ctrlVectorCenter ctrlSetText "\AGM_Vector\rsc\Vector_Center.paa";
private ["_azimuthDistance", "_digits"];
_distanceP1 = call AGM_Vector_fnc_getDistance;
_directionP1 = call AGM_Vector_fnc_getDirection;
_azimuthP1 = _directionP1 select 0;
_inclinationP1 = _directionP1 select 1;
_azimuthDistance = call FUNC(getRelativeAzimuthDistance);
_ctrlDigitE1 ctrlSetText "\AGM_Vector\rsc\d1.paa";
_ctrlDigitE2 ctrlSetText "\AGM_Vector\rsc\d-.paa";
_ctrlDigitE3 ctrlSetText "\AGM_Vector\rsc\dP.paa";
// relative azimuth
_digits = [_azimuthDistance select 0] call FUNC(convertToTexturesDegree);
waitUntil {!(AGM_vectorKey select 0)};
(_dlgVector displayCtrl 1315) ctrlSetText (_digits select 0);
(_dlgVector displayCtrl 1316) ctrlSetText (_digits select 1);
(_dlgVector displayCtrl 1317) ctrlSetText (_digits select 2);
(_dlgVector displayCtrl 1318) ctrlSetText (_digits select 3);
_distanceP2 = call AGM_Vector_fnc_getDistance;
_directionP2 = call AGM_Vector_fnc_getDirection;
_azimuthP2 = _directionP2 select 0;
_inclinationP2 = _directionP2 select 1;
// relative non-slope distance
_digits = [_azimuthDistance select 1] call FUNC(convertToTexturesDistance);
_relDirection = sqrt ((_azimuthP1 - _azimuthP2)^2 + (_inclinationP1 - _inclinationP2)^2);
_relDistance = sqrt (_distanceP1^2 + _distanceP2^2 - 2 * _distanceP1 * _distanceP2 * cos _relDirection);
_relHeight = (sin _inclinationP1 * _distanceP1) - (sin _inclinationP2 * _distanceP2);
_relLenght = sqrt (_relDistance^2 - _relHeight^2); if (str(_relLenght) == "-1.#IND") then {_relLenght = 0};
_lenghtP1 = cos _inclinationP1 * _distanceP1;
_lenghtP2 = cos _inclinationP2 * _distanceP2;
_relAzimuth = (sin _azimuthP2 * _lenghtP2 - sin _azimuthP1 * _lenghtP1) atan2 (cos _azimuthP2 * _lenghtP2 - cos _azimuthP1 * _lenghtP1);
if (_relAzimuth < 0) then {_relAzimuth = _relAzimuth + 360};
if (_distanceP1 == -9999 || {_distanceP2 == -9999}) then {
_relDistance = -9999;
_relAzimuth = -9999;
};
_digits = _relLenght call AGM_Vector_fnc_convertDistance;
_ctrlDigit1 ctrlSetText (_digits select 0);
_ctrlDigit2 ctrlSetText (_digits select 1);
_ctrlDigit3 ctrlSetText (_digits select 2);
_ctrlDigit4 ctrlSetText (_digits select 3);
_digits = _relAzimuth call AGM_Vector_fnc_convertDegree;
_ctrlDigit5 ctrlSetText (_digits select 0);
_ctrlDigit6 ctrlSetText (_digits select 1);
_ctrlDigit7 ctrlSetText (_digits select 2);
_ctrlDigit8 ctrlSetText (_digits select 3);
_ctrlVectorCenter ctrlShow false;
_ctrlDigitE1 ctrlShow false;
_ctrlDigitE2 ctrlShow false;
_ctrlDigitE3 ctrlShow false;
AGM_isVectorReady = true;
(_dlgVector displayCtrl 1311) ctrlSetText (_digits select 0);
(_dlgVector displayCtrl 1312) ctrlSetText (_digits select 1);
(_dlgVector displayCtrl 1313) ctrlSetText (_digits select 2);
(_dlgVector displayCtrl 1314) ctrlSetText (_digits select 3);

View File

@ -0,0 +1,19 @@
// by commy2
#include "script_component.hpp"
private "_dlgVector";
disableSerialization;
_dlgVector = GETUVAR(ACE_dlgVector,displayNull);
private ["_distance", "_digits"];
_distance = call FUNC(getRelativeDistance);
// relative slope distance
_digits = [_distance] call FUNC(convertToTexturesDistance);
(_dlgVector displayCtrl 1311) ctrlSetText (_digits select 0);
(_dlgVector displayCtrl 1312) ctrlSetText (_digits select 1);
(_dlgVector displayCtrl 1313) ctrlSetText (_digits select 2);
(_dlgVector displayCtrl 1314) ctrlSetText (_digits select 3);