Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 49 additions & 2 deletions addons/guidance/CfgAmmo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,58 @@ class CfgAmmo {
class ADDON {
enabled = 1;

defaultSeekerType = "MCLOS";
seekerTypes[] = {"MCLOS"};
defaultSeekerType = "EO";
seekerTypes[] = {"EO"};

defaultSeekerLockMode = "LIN";
seekerLockModes[] = {"LIN"};

// TV Guided projectiles have extra data that is irrelevant to most missiles
class camera {
enabled = 1;
switchOnFire = 1; // switch to the camera view immediately upon firing

class gimbal {
enabled = 1;

gimbalAngleX = 45; // how far left/right can this look in degrees
gimbalAngleY = 45; // how far up/down can this look in degrees
gimbalSpeedX = 10; // how many fast we can look left and right
gimbalSpeedY = 13; // how many fast we can look up and down

gimbalInitOffsetX = 0;
gimbalInitOffsetY = -20;

stabilizeWhenMoving = 1;
trackLockedPosition = 1;
designateWhenStationary = 0; // designate when camera doenst have any inputs
};

fovLevels[] = { 0.2, 0.05 }; // levels of zoom this has
fovGimbalSpeedModifiers[] = { 1, 0.4 }; // the modifier for gimbal speed when at the zoom level
initialFOV = 0.2;
lerpFOV = 0;
fovChangeTime = 1;

alwaysDesignate = 0; // always designate
canStopDesignating = 0;

enabledThermalTypes[] = { "white_hot_black_cold", "black_hot_white_cold" };
initialThermalType = "white_hot_black_cold";

class reticle {
titleRsc = "ACE_guidance_spike";
centerReticle = 242000;
controlsToDisappearOnLock[] = { 241000 };
controlsToAppearOnLock[] = { 243101, 243201, 243301 };
leftGate = 243200;
rightGate = 243300;
topGate = 0;
bottomGate = 243100;
uiNamespaceDialogVariable = "ACE_guidance_camera_reticle";
reticleMovesWithTrack = 1;
};
};

seekerAngle = 90; // Angle in front of the missile which can be searched
seekerAccuracy = 1; // seeker accuracy multiplier
Expand Down
137 changes: 137 additions & 0 deletions addons/guidance/RscTitles.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
class RscOpticsValue;
class RscControlsGroupNoScrollbars;
class RscPicture;
class RscLine;
class RscMapControl;
class RscText;

#define COLOR_WHITE {0.8745,0.8745,0.8745,1}
#define COLOR_BLACK {0,0,0,1}

class RscTitles {
class ACE_guidance_spike {
idd = 1299230000;
controls[] = { "reticle", "manualText" };
duration = 100000;
fadein = 0;
fadeout = 0;
name = "spike_reticle";
onLoad = QUOTE(with uiNamespace do {ACE_guidance_camera_reticle = _this select 0;};);

class manualText: RscText {
idc = 241000;
x = "safeZoneX + safeZoneW * 0.425";
y = "safeZoneY + safeZoneH * 0.2";
w = "safeZoneW * 0.15";
h = "safeZoneH * 0.05";
style = "0 + 2";
text = "MANUAL";
colorBackground[] = {0,0,0,0};
colorText[] = COLOR_WHITE;
font = "LucidaConsoleB";
sizeEx = (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 2.2);
enabled = 1;
show = 1;
};

class reticle: RscControlsGroupNoScrollbars {
idc = 242000;
x = "safeZoneX";
y = "safeZoneY";
w = "safeZoneW-safeZoneX";
h = "safeZoneH-safeZoneY";
enabled = 1;
show = 1;
class controls {
class lineV: RscControlsGroupNoScrollbars {
idc = 243100;
enabled = 1;
show = 1;
class Controls {
class lineBlack: RscText {
x = "safeZoneX + (SafeZoneW * 0.501)";
y = "safeZoneY + (SafeZoneH * 0.53)";
w = "safeZoneW * 0.0025";
h = "safeZoneH * 0.1";
colorBackground[] = COLOR_BLACK;
};
class lineWhite: RscText {
x = "safeZoneX + (SafeZoneW * 0.504)";
y = "safeZoneY + (SafeZoneH * 0.53)";
w = "safeZoneW * 0.0025";
h = "safeZoneH * 0.1";
colorBackground[] = COLOR_WHITE;
};
class squareB: RscText {
idc = 243101;
x = "safeZoneX + safeZoneW * 0.499";
y = "safeZoneY + safeZoneH * 0.52";
w = "safeZoneH * 0.006";
h = "safeZoneW * 0.006";
colorBackground[] = COLOR_BLACK;
};
};
};
class lineHL: RscControlsGroupNoScrollbars {
idc = 243200;
enabled = 1;
show = 1;
class Controls {
class lineBlack: RscText {
x = "safeZoneY + (SafeZoneH * 0.37)";
y = "safeZoneX + (SafeZoneW * 0.5)";
w = "safeZoneH * 0.1";
h = "safeZoneW * 0.003";
colorBackground[] = COLOR_BLACK;
};
class lineWhite: RscText {
x = "safeZoneY + (SafeZoneH * 0.37)";
y = "safeZoneX + (SafeZoneW * 0.504)";
w = "safeZoneH * 0.1";
h = "safeZoneW * 0.0023";
colorBackground[] = COLOR_WHITE;
};
class squareL: RscText {
idc = 243201;
x = "safeZoneX + (SafeZoneW * 0.485)";
y = "safeZoneY + safeZoneH * 0.5";
w = "safeZoneH * 0.006";
h = "safeZoneW * 0.006";
colorBackground[] = COLOR_BLACK;
};
};
};
class lineHR: RscControlsGroupNoScrollbars {
idc = 243300;
enabled = 1;
show = 1;
class Controls {
class lineBlack: RscText {
x = "safeZoneY + (SafeZoneH * 0.53)";
y = "safeZoneX + (SafeZoneW * 0.5)";
w = "safeZoneH * 0.1";
h = "safeZoneW * 0.003";
colorBackground[] = COLOR_BLACK;
};
class lineWhite: RscText {
x = "safeZoneY + (SafeZoneH * 0.53)";
y = "safeZoneX + (SafeZoneW * 0.504)";
w = "safeZoneH * 0.1";
h = "safeZoneW * 0.0023";
colorBackground[] = COLOR_WHITE;
};
class squareR: RscText {
idc = 243301;
x = "safeZoneX + (SafeZoneW * 0.515)";
y = "safeZoneY + safeZoneH * 0.5";
w = "safeZoneH * 0.006";
h = "safeZoneW * 0.006";
colorBackground[] = COLOR_BLACK;
};
};
};
};
};
};
};

14 changes: 14 additions & 0 deletions addons/guidance/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,17 @@ PREP(seekerType_SACLOS);
PREP(seekerType_PLOS);
PREP(seekerType_MCLOS);
PREP(seekerType_SALH);

PREP(camera_init);
PREP(camera_update);
PREP(camera_updateTargetingGate);
PREP(camera_switchTo);
PREP(camera_switchAway);
PREP(camera_destroy);
PREP(camera_cycleViewMode);
PREP(camera_setViewMode);
PREP(camera_changeZoom);
PREP(camera_setZoom);
PREP(camera_handleKeyPress);
PREP(camera_userInCamera);
PREP(camera_getCameraNamespaceFromProjectile);
48 changes: 48 additions & 0 deletions addons/guidance/XEH_post_init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,52 @@
},
[208, [false, false, false]], false] call CBA_fnc_addKeybind; //Down

["ACE3 Weapons", QGVAR(Camera_N), localize LSTRING(Camera_ViewModeCycle),
{
[7, true] call FUNC(keyDown);
},
{
[7, false] call FUNC(keyDown);
},
[49, [false, false, false]], false] call CBA_fnc_addKeybind; //N

["ACE3 Weapons", QGVAR(Camera_NumPlus), localize LSTRING(Camera_ZoomIncrease),
{
[8, true] call FUNC(keyDown);
},
{
[8, false] call FUNC(keyDown);
},
[78, [false, false, false]], false] call CBA_fnc_addKeybind; //Keypad+

["ACE3 Weapons", QGVAR(Camera_NumMinus), localize LSTRING(Camera_ZoomDecrease),
{
[9, true] call FUNC(keyDown);
},
{
[9, false] call FUNC(keyDown);
},
[74, [false, false, false]], false] call CBA_fnc_addKeybind; //Keypad-

GVAR(projectileCameraHash) = [[], objNull] call CBA_fnc_hashCreate;
GVAR(activeCamera) = objNull;

// add camera interactions
private _switchToCameraAction = ["SwitchToCamera", "Switch To Missile Camera", "", {
// statement
params ["_target", "_player", "_params"];
private _camera = _player getVariable [QGVAR(missileCamera), objNull];
[_camera] call FUNC(camera_switchTo);
}, {
// condition
params ["_target", "_player", "_params"];
private _camera = _player getVariable [QGVAR(missileCamera), objNull];
private _projectile = _camera getVariable [QGVAR(missile), objNull];
!([] call FUNC(camera_userInCamera)) && { !(_camera isEqualTo objNull); } && { !(_projectile isEqualTo objNull) }
}/*, {
params ["_target", "_player", "_params"];
// insert children
}*/] call EFUNC(interact_menu,createAction);
["CAManBase", 1, ["ACE_SelfActions"], _switchToCameraAction, true] call EFUNC(interact_menu,addActionToClass);

true
1 change: 1 addition & 0 deletions addons/guidance/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class CfgPatches {

#include "ACE_GuidanceConfig.hpp"

#include "RscTitles.hpp"
#include "CfgEventhandlers.hpp"
#include "CfgAmmo.hpp"
#include "CfgMagazines.hpp"
Expand Down
34 changes: 34 additions & 0 deletions addons/guidance/functions/fnc_camera_changeZoom.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include "script_component.hpp"
/*
* Author: Brandon (TCVM)
* Decreases zoom of current camera
*
* Arguments:
* 0: Guidance Arg Array <ARRAY>
* 1: PFID <NUMBER>
*
* Return Value:
* None
*
* Example:
* [[], 0] call ace_missileguidance_fnc_guidancePFH;
*
* Public: No
*/
params ["_cameraNamespace", "_increase"];

private _zoomIndex = _cameraNamespace getVariable [QGVAR(currentZoomIndex), 0];
private _zoomArray = _cameraNamespace getVariable [QGVAR(fovLevels), []];

if ((count _zoomArray) == 0) exitWith {};
if (_increase) then {
if ((_zoomIndex + 1) < count _zoomArray) then {
_zoomIndex = _zoomIndex + 1;
};
} else {
if (_zoomIndex != 0) then {
_zoomIndex = _zoomIndex - 1;
};
};
[_cameraNamespace, _zoomIndex] call FUNC(camera_setZoom);

32 changes: 32 additions & 0 deletions addons/guidance/functions/fnc_camera_cycleViewMode.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include "script_component.hpp"
/*
* Author: Brandon (TCVM)
* Cycles camera thermal mode (if avaliable)
*
* Arguments:
* 0: Guidance Arg Array <ARRAY>
* 1: PFID <NUMBER>
*
* Return Value:
* None
*
* Example:
* [[], 0] call ace_missileguidance_fnc_guidancePFH;
*
* Public: No
*/
params ["_cameraNamespace"];

private _tiIndex = _cameraNamespace getVariable [QGVAR(currentTIModeIndex), 0];
private _tiArray = _cameraNamespace getVariable [QGVAR(thermalTypes), []];

if ((count _tiArray) == 0) exitWith {};
if ((_tiIndex + 1) >= count _tiArray) then {
_tiIndex = 0;
} else {
_tiIndex = _tiIndex + 1;
};

_cameraNamespace setVariable [QGVAR(currentTIModeIndex), _tiIndex];

[_cameraNamespace, _tiArray select _tiIndex] call FUNC(camera_setViewMode);
37 changes: 37 additions & 0 deletions addons/guidance/functions/fnc_camera_destroy.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include "script_component.hpp"
/*
* Author: Brandon (TCVM)
* Destroys camera attaches to projectile
*
* Arguments:
* 0: Guidance Arg Array <ARRAY>
* 1: PFID <NUMBER>
*
* Return Value:
* None
*
* Example:
* [[], 0] call ace_missileguidance_fnc_guidancePFH;
*
* Public: No
*/
params ["_cameraNamespace", "_projectile"];

private _userInThisCamera = [_cameraNamespace] call FUNC(camera_userInCamera);
private _userCamera = player getVariable [QGVAR(missileCamera), objNull];
if (_userInThisCamera || { _userCamera isEqualTo _cameraNamespace }) then {
player setVariable [QGVAR(missileCamera), objNull];
};

[_cameraNamespace] call FUNC(camera_switchAway);

private _key = _cameraNamespace getVariable [QGVAR(missile), objNull];

private _logic = _cameraNamespace getVariable [QGVAR(logic), objNull];
deleteVehicle _logic;

private _camera = _cameraNamespace getVariable QGVAR(camera);
camDestroy _camera;

_cameraNamespace call CBA_fnc_deleteNamespace;

Loading