Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add camera slewing via HMD #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
13 changes: 12 additions & 1 deletion XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,15 @@
nil, // "_isGlobal" flag. Set this to true to always have this setting synchronized between all clients in multiplayer
{
} // function that will be executed once on mission start and every time the setting is changed.
] call CBA_Settings_fnc_init;
] call CBA_Settings_fnc_init;

[
"Fat_Lurch_HmdSlew", // Internal setting name, should always contain a tag! This will be the global variable which takes the value of the setting.
"CHECKBOX", // setting type. CHECKBOX, EDITBOX, SLIDER, LIST or COLOR
"Allow Slew via HMD", // Pretty name shown inside the ingame settings menu. Can be stringtable entry.
"Turret Enhanced", // Pretty name of the category where the setting can be found. Can be stringtable entry.
TRUE, // data for this setting: [min, max, default, number of shown trailing decimals]
nil, // "_isGlobal" flag. Set this to true to always have this setting synchronized between all clients in multiplayer
{
} // function that will be executed once on mission start and every time the setting is changed.
] call CBA_Settings_fnc_init;
11 changes: 7 additions & 4 deletions functions/MPaddaction.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ _pri = -1000;

#include "\a3\editor_f\Data\Scripts\dikCodes.h"

// Add keybinds
["Turret Enhanced","add_blk_marker", "Mark Target (Blk)",{_this call fatlurch_fnc_addMarkerBlk}, "", [DIK_1, [true, false, false]]] call CBA_fnc_addKeybind;
["Turret Enhanced","add_blu_marker", "Mark Target (Blu)",{_this call fatlurch_fnc_addMarkerBlu}, "", [DIK_2, [true, false, false]]] call CBA_fnc_addKeybind;
["Turret Enhanced","add_red_marker", "Mark Target (Red)",{_this call fatlurch_fnc_addMarkerRed}, "", [DIK_3, [true, false, false]]] call CBA_fnc_addKeybind;
["Turret Enhanced","hmd_slew", "HMD Slew",{_this call fatlurch_fnc_hmdSlew}, "", [DIK_Y, [true, true, false]]] call CBA_fnc_addKeybind; // Default keybinding (Ctrl + Shift + Y)

_unit addAction ["Mark Target (Blk)", "_this call fatlurch_fnc_addMarkerBlk",nil, _pri,false, true, "","(([_this, _target] call fatlurch_fnc_isViewISR)&&(Fat_Lurch_Markers))"];
_unit addAction ["Mark Target <t color='#0000FF'>(Blu)</t>", "_this call fatlurch_fnc_addMarkerBlu",nil, _pri - 1,false, true, "","(([_this, _target] call fatlurch_fnc_isViewISR)&&(Fat_Lurch_Markers))"];
Expand All @@ -19,11 +21,12 @@ _unit addAction ["Mark Target <t color='#FF0000'>(Red)</t>", "_this call fatlurc
_unit addAction ["Change Altitude", "_this call fatlurch_fnc_changeAltitude",nil, _pri - 3,false, true, "","(([_this, _target] call fatlurch_fnc_isViewISR) && (_target isKindOf 'uav'))"]; //2020_08_24
_unit addAction ["Change Loiter", "_this call fatlurch_fnc_changeLoiter",nil, _pri - 4,false, true, "","(([_this, _target] call fatlurch_fnc_isViewISR) && (_target isKindOf 'uav') && (waypointType [group _target, currentWaypoint group _target] == 'LOITER'))"]; //2020_08_24
_unit addAction ["Map Slew", {params ["_target", "_caller", "_actionId", "_arguments"]; [_target, _caller] call fatlurch_fnc_mapSlew;},nil, _pri - 5,false, true, "","(([_this, _target] call fatlurch_fnc_isViewISR)&&(Fat_Lurch_MapSlew))"];
_unit addAction ["Slew to Grid", {params ["_target", "_caller", "_actionId", "_arguments"]; [_target, _caller] call fatlurch_fnc_inputGrid;},nil, _pri - 6, false, true, "","(([_this, _target] call fatlurch_fnc_isViewISR)&&(Fat_Lurch_Grid))"];
_unit addAction ["Measure Distance", {params ["_target", "_caller", "_actionId", "_arguments"]; [_target] call fatlurch_fnc_measDistance;},nil, _pri - 7,false, true, "","(([_this, _target] call fatlurch_fnc_isViewISR)&&(Fat_Lurch_Measure))"];
_unit addAction ["HMD Slew", {params ["_target", "_caller", "_actionId", "_arguments"]; [_target] call fatlurch_fnc_hmdSlew;},nil, _pri - 6,false, true, "","(!([_this, _target] call fatlurch_fnc_isViewISR)&&(hasPilotCamera vehicle _this)&&(Fat_Lurch_HmdSlew))"];
_unit addAction ["Slew to Grid", {params ["_target", "_caller", "_actionId", "_arguments"]; [_target, _caller] call fatlurch_fnc_inputGrid;},nil, _pri - 7, false, true, "","(([_this, _target] call fatlurch_fnc_isViewISR)&&(Fat_Lurch_Grid))"];
_unit addAction ["Measure Distance", {params ["_target", "_caller", "_actionId", "_arguments"]; [_target] call fatlurch_fnc_measDistance;},nil, _pri - 8,false, true, "","(([_this, _target] call fatlurch_fnc_isViewISR)&&(Fat_Lurch_Measure))"];
//Placeholder for Measure
_unit addAction ["Weapon Status", {params ["_target", "_caller", "_actionId", "_arguments"]; [_target] call fatlurch_fnc_weaponReport;},nil, _pri - 9,false, true, "","(([_this, _target] call fatlurch_fnc_isViewISR)&&(_target isKindOf 'uav'))"];
_unit addAction ["Reset VMS", {params ["_target", "_caller", "_actionId", "_arguments"]; [_target] call fatlurch_fnc_resetUAV;},nil, _pri - 10,false, true, "","(([_this, _target] call fatlurch_fnc_isViewISR)&&(_target isKindOf 'uav'))"];
_unit addAction ["Weapon Status", {params ["_target", "_caller", "_actionId", "_arguments"]; [_target] call fatlurch_fnc_weaponReport;},nil, _pri - 10,false, true, "","(([_this, _target] call fatlurch_fnc_isViewISR)&&(_target isKindOf 'uav'))"];
_unit addAction ["Reset VMS", {params ["_target", "_caller", "_actionId", "_arguments"]; [_target] call fatlurch_fnc_resetUAV;},nil, _pri - 11,false, true, "","(([_this, _target] call fatlurch_fnc_isViewISR)&&(_target isKindOf 'uav'))"];



Expand Down
17 changes: 17 additions & 0 deletions functions/hmdSlew.sqf

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, all those local variables should be declared as private.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// slew the camera to the HMD LOS

if (Fat_Lurch_HmdSlew) then
{
0 spawn {
_HMDLos = screenToWorld [0.5,0.5];
turretPath = player call CBA_fnc_turretPath;
_veh = vehicle player;
_tmpPos = "Land_PenBlack_F" createVehicle _HMDLos;
systemChat format["Turret Slewed to %1", mapgridposition _tmpPos];
sleep 0.1;
_veh lockCameraTo [visiblePositionASL _tmpPos, turretPath];
_veh setPilotCameraTarget (visiblePositionASL _tmpPos);
sleep 0.1;
deleteVehicle _tmpPos;
}
}