Finalize FCS port

This commit is contained in:
KoffeinFlummi 2015-01-13 22:51:02 +01:00
parent 2b54f53ff0
commit c8fd07a5ab
10 changed files with 70 additions and 36 deletions

View File

@ -1,12 +1,12 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE( call compile preprocessFileLineNumbers PATHTOF(XEH_preInit.sqf) );
init = QUOTE(call COMPILE_FILE(XEH_preInit) );
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
clientInit = QUOTE( call compile preprocessFileLineNumbers PATHTOF(XEH_clientInit.sqf) );
clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit) );
};
};

View File

@ -1,12 +1,13 @@
#include "script_component.hpp"
PREPF(adjustRange)
PREPF(canUseFCS)
PREPF(canUseRangefinder)
PREPF(firedEH)
PREPF(getAngle)
PREPF(getRange)
PREPF(keyDown)
PREPF(keyUp)
PREPF(reset)
PREPF(vehicleInit)
PREP(adjustRange);
PREP(canResetFCS);
PREP(canUseFCS);
PREP(canUseRangefinder);
PREP(firedEH);
PREP(getAngle);
PREP(getRange);
PREP(keyDown);
PREP(keyUp);
PREP(reset);
PREP(vehicleInit);

View File

@ -5,7 +5,7 @@ class CfgPatches {
units[] = {};
weapons[] = {};
requiredVersion = 0.60;
requiredAddons[] = {ace_core, ace_interaction};
requiredAddons[] = {ace_common, ace_interaction};
version = QUOTE(VERSION);
versionStr = QUOTE(VERSION);
versionAr[] = {VERSION_AR};
@ -16,22 +16,22 @@ class CfgPatches {
#include "CfgEventHandlers.hpp"
class EGVAR(Core, Default_Keys) {
class ACE_Default_Keys {
class laseTarget {
displayName = $STR_ACE_FireControlSystem_LaseTarget;
displayName = $STR_ACE_FCS_LaseTarget;
condition = QUOTE(call FUNC(canUseRangefinder) || FUNC(canUseFCS));
statement = QUOTE(_range = call FUNC(getRange); if (call FUNC(canUseFCS)) then {[_vehicle, _range] call FUNC(keyDown)};);
statement = QUOTE([_vehicle] call FUNC(keyDown));
conditionUp = QUOTE(GVAR(enabled) && FUNC(canUseFCS));
statementUp = QUOTE(_range = call FUNC(getRange); if (GVAR(enabled) && FUNC(canUseFCS)) then {[_vehicle, _range] call FUNC(keyUp)};);
statementUp = QUOTE([_vehicle] call FUNC(keyUp));
key = 15;
shift = 0;
control = 0;
alt = 0;
};
class adjustRangeUp {
displayName = $STR_ACE_FireControlSystem_AdjustRangeUp;
condition = QUOTE(ACE_player == gunner _vehicle && {getNumber (configFile >> 'CfgVehicles' >> (typeOf _vehicle) >> QGVAR(Enabled)) == 1});
statement = QUOTE([_vehicle, 50] call FUNC(adjustRange));
displayName = $STR_ACE_FCS_AdjustRangeUp;
condition = QUOTE(call FUNC(canUseRangefinder) || FUNC(canUseFCS));
statement = QUOTE([_vehicle, 50] call FUNC(adjustRange));
key = 201;
shift = 0;
control = 0;
@ -39,7 +39,7 @@ class EGVAR(Core, Default_Keys) {
allowHolding = 1;
};
class adjustRangeDown: adjustRangeUp {
displayName = $STR_ACE_FireControlSystem_AdjustRangeDown;
displayName = $STR_ACE_FCS_AdjustRangeDown;
statement = QUOTE([_vehicle, -50] call FUNC(adjustRange));
key = 209;
};
@ -71,9 +71,9 @@ class CfgVehicles {
class Car: LandVehicle {
class ACE_SelfActions {
class ResetFCS {
displayName = $STR_ACE_FireControlSystem_ResetFCS;
displayName = $STR_ACE_FCS_ResetFCS;
enableInside = 1;
condition = QUOTE((count (_vehicle getVariable [QGVAR(Magazines), []]) > 1) and (_player == gunner _vehicle));
condition = QUOTE(call FUNC(canResetFCS));
statement = QUOTE([vehicle _player] call FUNC(reset););
showDisabled = 0;
priority = 1;
@ -125,9 +125,9 @@ class CfgVehicles {
GVAR(Enabled) = 1; // all tracked vehicles get one by default
class ACE_SelfActions {
class ResetFCS {
displayName = $STR_ACE_FireControlSystem_ResetFCS;
displayName = $STR_ACE_FCS_ResetFCS;
enableInside = 1;
condition = QUOTE((count (_vehicle getVariable [QGVAR(Magazines), []]) > 1) and (_player == gunner _vehicle));
condition = QUOTE(call FUNC(canResetFCS));
statement = QUOTE([vehicle _player] call FUNC(reset););
showDisabled = 0;
priority = 1;
@ -243,9 +243,9 @@ class CfgVehicles {
class Helicopter: Air {
class ACE_SelfActions {
class ResetFCS {
displayName = $STR_ACE_FireControlSystem_ResetFCS;
displayName = $STR_ACE_FCS_ResetFCS;
enableInside = 1;
condition = QUOTE((count (_vehicle getVariable [QGVAR(Magazines), []]) > 1) and (_player == gunner _vehicle));
condition = QUOTE(call FUNC(canResetFCS));
statement = QUOTE([vehicle _player] call FUNC(reset););
showDisabled = 0;
priority = 1;

View File

@ -0,0 +1,16 @@
/*
* Author: KoffeinFlummi
*
* Called from config. Can player reset FCS?
*
* Argument:
* Nothing
*
* Return value:
* Boolean (Bool)
*/
#include "script_component.hpp"
_player == gunner _vehicle
&& (count (_vehicle getVariable [QGVAR(Magazines), []]) > 1)

View File

@ -34,7 +34,7 @@ _offset = 0;
};
} forEach _FCSMagazines;
[_round, (_unit getVariable QGVAR(Azimuth)), _offset, 0] call EFUNC(core, changeProjectileDirection);
[_round, (_unit getVariable QGVAR(Azimuth)), _offset, 0] call EFUNC(common,changeProjectileDirection);
// Air burst missile
// may need to get rewritten

View File

@ -4,7 +4,7 @@
* Starts watching the target for sideways correction.
*
* Arguments:
* none
* 0: Vehicle
*
* Return Value:
* none
@ -15,13 +15,15 @@
private ["_vehicle", "_distance", "_weaponDirection"];
_vehicle = _this select 0;
_distance = _this select 1;
_distance = call FUNC(getRange);
if !(call FUNC(canUseFCS)) exitWith {};
GVAR(Enabled) = true;
GVAR(Time) = time;
if (_distance == 0) then {
_distance = [5, 5000, 0] call EFUNC(core, getTargetDistance); // maximum distance: 5000m, 5m precision
_distance = [5, 5000, 0] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision
};
_weaponDirection = _vehicle weaponDirection currentWeapon _vehicle;

View File

@ -5,7 +5,6 @@
*
* Arguments:
* 0: The vehicle
* 1: Range Override (Optional)
*
* Return Value:
* none
@ -16,7 +15,9 @@
private ["_ammoType", "_viewDiff", "_posArrival", "_airFriction", "_timeToLive", "_maxElev", "_vehicle", "_posTarget", "_distance", "_simulationStep", "_posX", "_velocityMagnitude", "_magazines", "_movingAzimuth", "_FCSElevation", "_velocityX", "_velocityY", "_weaponDirection", "_velocityTarget", "_FCSAzimuth", "_FCSMagazines", "_dirArrival", "_i", "_magazineType", "_angleTarget", "_offset", "_timeToTarget", "_initSpeed"];
_vehicle = _this select 0;
_distance = _this select 1;
_distance = call FUNC(getRange);
if !(GVAR(enabled) && FUNC(canUseFCS)) exitWith {};
_magazines = magazines _vehicle;
@ -25,7 +26,7 @@ if (_distance == 0) then {
getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(DistanceInterval)),
getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(MaxDistance)),
getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(MinDistance))
] call EFUNC(core, getTargetDistance); // maximum distance: 5000m, 5m precision
] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision
};
_weaponDirection = _vehicle weaponDirection currentWeapon _vehicle;
@ -159,4 +160,4 @@ GVAR(backgroundCalculation) = [_vehicle, _magazines, _distance, _angleTarget, _F
_vehicle setVariable [QGVAR(Elevation), _FCSElevation, true];
};
[format ["%1: %2", localize "STR_ACE_FireControlSystem_ZeroedTo", _distance]] call EFUNC(core, displayTextStructured);
[format ["%1: %2", localize "STR_ACE_FCS_ZeroedTo", _distance]] call EFUNC(common,displayTextStructured);

View File

@ -21,4 +21,4 @@ _vehicle setVariable [QGVAR(Magazines), [], true];
_vehicle setVariable [QGVAR(Elevation), 0, true];
_vehicle setVariable [QGVAR(Azimuth), 0, true];
[localize "STR_ACE_FireControlSystem_HasBeenReset"] call EFUNC(core, displayTextStructured);
[localize "STR_ACE_FCS_HasBeenReset"] call EFUNC(common,displayTextStructured);

View File

@ -10,6 +10,8 @@
* none
*/
#include "script_component.hpp"
private ["_gunBeg", "_gunnerView", "_gunBegPos", "_gunnerViewPos", "_viewDiff"];
if (getNumber (configFile >> "CfgVehicles" >> (typeOf (_this select 0)) >> QGVAR(Enabled)) == 1) then {

View File

@ -0,0 +1,12 @@
#define COMPONENT fcs
#include "\z\ace\Addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_FCS
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_FCS
#define DEBUG_SETTINGS DEBUG_SETTINGS_FCS
#endif
#include "\z\ace\Addons\main\script_macros.hpp"